From owner-svn-src-all@freebsd.org Sun Jan 22 00:46: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 0320DCB0F04; Sun, 22 Jan 2017 00:46:06 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6703834; Sun, 22 Jan 2017 00:46:05 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M0k5FU024395; Sun, 22 Jan 2017 00:46:05 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M0k43R024393; Sun, 22 Jan 2017 00:46:04 GMT (envelope-from jah@FreeBSD.org) Message-Id: <201701220046.v0M0k43R024393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Sun, 22 Jan 2017 00:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312610 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 00:46:06 -0000 Author: jah Date: Sun Jan 22 00:46:04 2017 New Revision: 312610 URL: https://svnweb.freebsd.org/changeset/base/312610 Log: Like r310481 for i386, move the objects used to create temporary mappings for armv6 pmap zero and copy operations to the MD PCPU region. Change sysmap initialization to only allocate KVA pages for CPUs that are actually present. While here, collapse CMAP3 into CMAP2 (their use was mutually exclusive anyway) and "recover" some space in PCPU padding that has always been available due to 64-byte cacheline padding. Reviewed by: skra MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9172 Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Jan 21 23:35:54 2017 (r312609) +++ head/sys/arm/arm/pmap-v6.c Sun Jan 22 00:46:04 2017 (r312610) @@ -110,11 +110,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SMP -#include -#else -#include -#endif #ifdef DDB #include @@ -296,16 +291,6 @@ vm_paddr_t first_managed_pa; /* * All those kernel PT submaps that BSD is so fond of */ -struct sysmaps { - struct mtx lock; - pt2_entry_t *CMAP1; - pt2_entry_t *CMAP2; - pt2_entry_t *CMAP3; - caddr_t CADDR1; - caddr_t CADDR2; - caddr_t CADDR3; -}; -static struct sysmaps sysmaps_pcpu[MAXCPU]; caddr_t _tmppt = 0; struct msgbuf *msgbufp = NULL; /* XXX move it to machdep.c */ @@ -1134,8 +1119,7 @@ void pmap_bootstrap(vm_offset_t firstaddr) { pt2_entry_t *unused __unused; - struct sysmaps *sysmaps; - u_int i; + struct pcpu *pc; /* * Initialize the kernel pmap (which is statically allocated). @@ -1174,15 +1158,13 @@ pmap_bootstrap(vm_offset_t firstaddr) /* * Local CMAP1/CMAP2 are used for zeroing and copying pages. - * Local CMAP3 is used for data cache cleaning. + * Local CMAP2 is also used for data cache cleaning. */ - for (i = 0; i < MAXCPU; i++) { - sysmaps = &sysmaps_pcpu[i]; - mtx_init(&sysmaps->lock, "SYSMAPS", NULL, MTX_DEF); - SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1); - SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1); - SYSMAP(caddr_t, sysmaps->CMAP3, sysmaps->CADDR3, 1); - } + pc = pcpu_find(curcpu); + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + SYSMAP(caddr_t, pc->pc_cmap1_pte2p, pc->pc_cmap1_addr, 1); + SYSMAP(caddr_t, pc->pc_cmap2_pte2p, pc->pc_cmap2_addr, 1); + SYSMAP(vm_offset_t, unused, pc->pc_qmap_addr, 1); /* * Crashdump maps. @@ -1215,19 +1197,32 @@ pmap_bootstrap(vm_offset_t firstaddr) } static void -pmap_init_qpages(void) +pmap_init_reserved_pages(void) { struct pcpu *pc; + vm_offset_t pages; int i; CPU_FOREACH(i) { pc = pcpu_find(i); - pc->pc_qmap_addr = kva_alloc(PAGE_SIZE); - if (pc->pc_qmap_addr == 0) + /* + * Skip if the mapping has already been initialized, + * i.e. this is the BSP. + */ + if (pc->pc_cmap1_addr != 0) + continue; + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + pages = kva_alloc(PAGE_SIZE * 3); + if (pages == 0) panic("%s: unable to allocate KVA", __func__); + pc->pc_cmap1_pte2p = pt2map_entry(pages); + pc->pc_cmap2_pte2p = pt2map_entry(pages + PAGE_SIZE); + pc->pc_cmap1_addr = (caddr_t)pages; + pc->pc_cmap2_addr = (caddr_t)(pages + PAGE_SIZE); + pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); } } -SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_qpages, NULL); +SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); /* * The function can already be use in second initialization stage. @@ -1578,8 +1573,9 @@ pagezero(void *page) static __inline vm_paddr_t pmap_pt2pg_zero(vm_page_t m) { + pt2_entry_t *cmap2_pte2p; vm_paddr_t pa; - struct sysmaps *sysmaps; + struct pcpu *pc; pa = VM_PAGE_TO_PHYS(m); @@ -1588,20 +1584,27 @@ pmap_pt2pg_zero(vm_page_t m) * to sync it even if the sync is only DSB. */ sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (pte2_load(sysmaps->CMAP2) != 0) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(pa, PTE2_AP_KRW, + pte2_store(cmap2_pte2p, PTE2_KERN_NG(pa, PTE2_AP_KRW, vm_page_pte2_attr(m))); /* Even VM_ALLOC_ZERO request is only advisory. */ if ((m->flags & PG_ZERO) == 0) - pagezero(sysmaps->CADDR2); - pte2_sync_range((pt2_entry_t *)sysmaps->CADDR2, PAGE_SIZE); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + pagezero(pc->pc_cmap2_addr); + pte2_sync_range((pt2_entry_t *)pc->pc_cmap2_addr, PAGE_SIZE); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); + + /* + * Unpin the thread before releasing the lock. Otherwise the thread + * could be rescheduled while still bound to the current CPU, only + * to unpin itself immediately upon resuming execution. + */ sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); return (pa); } @@ -5628,9 +5631,10 @@ small_mappings: void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap2_pte2p; vm_memattr_t oma; vm_paddr_t pa; + struct pcpu *pc; oma = m->md.pat_mode; m->md.pat_mode = ma; @@ -5657,17 +5661,18 @@ pmap_page_set_memattr(vm_page_t m, vm_me if (ma != oma) { pa = VM_PAGE_TO_PHYS(m); sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP2) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(pa, PTE2_AP_KRW, + pte2_store(cmap2_pte2p, PTE2_KERN_NG(pa, PTE2_AP_KRW, vm_memattr_to_pte2(ma))); - dcache_wbinv_poc((vm_offset_t)sysmaps->CADDR2, pa, PAGE_SIZE); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + dcache_wbinv_poc((vm_offset_t)pc->pc_cmap2_addr, pa, PAGE_SIZE); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } } @@ -5745,20 +5750,22 @@ pmap_page_exists_quick(pmap_t pmap, vm_p void pmap_zero_page(vm_page_t m) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap2_pte2p; + struct pcpu *pc; sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (pte2_load(sysmaps->CMAP2) != 0) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, + pte2_store(cmap2_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, vm_page_pte2_attr(m))); - pagezero(sysmaps->CADDR2); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + pagezero(pc->pc_cmap2_addr); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -5770,23 +5777,25 @@ pmap_zero_page(vm_page_t m) void pmap_zero_page_area(vm_page_t m, int off, int size) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap2_pte2p; + struct pcpu *pc; sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (pte2_load(sysmaps->CMAP2) != 0) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, + pte2_store(cmap2_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, vm_page_pte2_attr(m))); if (off == 0 && size == PAGE_SIZE) - pagezero(sysmaps->CADDR2); + pagezero(pc->pc_cmap2_addr); else - bzero(sysmaps->CADDR2 + off, size); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + bzero(pc->pc_cmap2_addr + off, size); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -5798,26 +5807,29 @@ pmap_zero_page_area(vm_page_t m, int off void pmap_copy_page(vm_page_t src, vm_page_t dst) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap1_pte2p, *cmap2_pte2p; + struct pcpu *pc; sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (pte2_load(sysmaps->CMAP1) != 0) + pc = pcpu_find(curcpu); + cmap1_pte2p = pc->pc_cmap1_pte2p; + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap1_pte2p) != 0) panic("%s: CMAP1 busy", __func__); - if (pte2_load(sysmaps->CMAP2) != 0) + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP1, PTE2_KERN_NG(VM_PAGE_TO_PHYS(src), + pte2_store(cmap1_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(src), PTE2_AP_KR | PTE2_NM, vm_page_pte2_attr(src))); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(dst), + pte2_store(cmap2_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(dst), PTE2_AP_KRW, vm_page_pte2_attr(dst))); - bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); - pte2_clear(sysmaps->CMAP1); - tlb_flush((vm_offset_t)sysmaps->CADDR1); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + bcopy(pc->pc_cmap1_addr, pc->pc_cmap2_addr, PAGE_SIZE); + pte2_clear(cmap1_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap1_addr); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } int unmapped_buf_allowed = 1; @@ -5826,18 +5838,21 @@ void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap1_pte2p, *cmap2_pte2p; vm_page_t a_pg, b_pg; char *a_cp, *b_cp; vm_offset_t a_pg_offset, b_pg_offset; + struct pcpu *pc; int cnt; sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP1 != 0) + pc = pcpu_find(curcpu); + cmap1_pte2p = pc->pc_cmap1_pte2p; + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap1_pte2p) != 0) panic("pmap_copy_pages: CMAP1 busy"); - if (*sysmaps->CMAP2 != 0) + if (pte2_load(cmap2_pte2p) != 0) panic("pmap_copy_pages: CMAP2 busy"); while (xfersize > 0) { a_pg = ma[a_offset >> PAGE_SHIFT]; @@ -5846,25 +5861,25 @@ pmap_copy_pages(vm_page_t ma[], vm_offse b_pg = mb[b_offset >> PAGE_SHIFT]; b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); - pte2_store(sysmaps->CMAP1, PTE2_KERN_NG(VM_PAGE_TO_PHYS(a_pg), + pte2_store(cmap1_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(a_pg), PTE2_AP_KR | PTE2_NM, vm_page_pte2_attr(a_pg))); - tlb_flush_local((vm_offset_t)sysmaps->CADDR1); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(b_pg), + tlb_flush_local((vm_offset_t)pc->pc_cmap1_addr); + pte2_store(cmap2_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(b_pg), PTE2_AP_KRW, vm_page_pte2_attr(b_pg))); - tlb_flush_local((vm_offset_t)sysmaps->CADDR2); - a_cp = sysmaps->CADDR1 + a_pg_offset; - b_cp = sysmaps->CADDR2 + b_pg_offset; + tlb_flush_local((vm_offset_t)pc->pc_cmap2_addr); + a_cp = pc->pc_cmap1_addr + a_pg_offset; + b_cp = pc->pc_cmap2_addr + b_pg_offset; bcopy(a_cp, b_cp, cnt); a_offset += cnt; b_offset += cnt; xfersize -= cnt; } - pte2_clear(sysmaps->CMAP1); - tlb_flush((vm_offset_t)sysmaps->CADDR1); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + pte2_clear(cmap1_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap1_addr); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } vm_offset_t @@ -6190,22 +6205,24 @@ pmap_set_pcb_pagedir(pmap_t pmap, struct static void pmap_dcache_wb_pou(vm_paddr_t pa, vm_size_t size, uint32_t attr) { - struct sysmaps *sysmaps; + pt2_entry_t *cmap2_pte2p; + struct pcpu *pc; KASSERT(((pa & PAGE_MASK) + size) <= PAGE_SIZE, ("%s: not on single page", __func__)); sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP3) - panic("%s: CMAP3 busy", __func__); - pte2_store(sysmaps->CMAP3, PTE2_KERN_NG(pa, PTE2_AP_KRW, attr)); - dcache_wb_pou((vm_offset_t)sysmaps->CADDR3 + (pa & PAGE_MASK), size); - pte2_clear(sysmaps->CMAP3); - tlb_flush((vm_offset_t)sysmaps->CADDR3); + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) + panic("%s: CMAP2 busy", __func__); + pte2_store(cmap2_pte2p, PTE2_KERN_NG(pa, PTE2_AP_KRW, attr)); + dcache_wb_pou((vm_offset_t)pc->pc_cmap2_addr + (pa & PAGE_MASK), size); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -6455,25 +6472,27 @@ pmap_fault(pmap_t pmap, vm_offset_t far, static void pmap_zero_page_check(vm_page_t m) { + pt2_entry_t *cmap2_pte2p; uint32_t *p, *end; - struct sysmaps *sysmaps; + struct pcpu *pc; sched_pin(); - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (pte2_load(sysmaps->CMAP2) != 0) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(&pc->pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, + pte2_store(cmap2_pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, vm_page_pte2_attr(m))); - end = (uint32_t*)(sysmaps->CADDR2 + PAGE_SIZE); - for (p = (uint32_t*)sysmaps->CADDR2; p < end; p++) + end = (uint32_t*)(pc->pc_cmap2_addr + PAGE_SIZE); + for (p = (uint32_t*)pc->pc_cmap2_addr; p < end; p++) if (*p != 0) panic("%s: page %p not zero, va: %p", __func__, m, - sysmaps->CADDR2); - pte2_clear(sysmaps->CMAP2); - tlb_flush((vm_offset_t)sysmaps->CADDR2); + pc->pc_cmap2_addr); + pte2_clear(cmap2_pte2p); + tlb_flush((vm_offset_t)pc->pc_cmap2_addr); sched_unpin(); - mtx_unlock(&sysmaps->lock); + mtx_unlock(&pc->pc_cmap_lock); } int Modified: head/sys/arm/include/pcpu.h ============================================================================== --- head/sys/arm/include/pcpu.h Sat Jan 21 23:35:54 2017 (r312609) +++ head/sys/arm/include/pcpu.h Sun Jan 22 00:46:04 2017 (r312610) @@ -32,6 +32,9 @@ #ifdef _KERNEL +#include +#include + #define ALT_STACK_SIZE 128 struct vmspace; @@ -39,16 +42,22 @@ struct vmspace; #endif /* _KERNEL */ #if __ARM_ARCH >= 6 + #define PCPU_MD_FIELDS \ unsigned int pc_vfpsid; \ unsigned int pc_vfpmvfr0; \ unsigned int pc_vfpmvfr1; \ struct pmap *pc_curpmap; \ + struct mtx pc_cmap_lock; \ + void *pc_cmap1_pte2p; \ + void *pc_cmap2_pte2p; \ + caddr_t pc_cmap1_addr; \ + caddr_t pc_cmap2_addr; \ vm_offset_t pc_qmap_addr; \ void *pc_qmap_pte; \ unsigned int pc_dbreg[32]; \ int pc_dbreg_cmd; \ - char __pad[1] + char __pad[27] #else #define PCPU_MD_FIELDS \ vm_offset_t qmap_addr; \ From owner-svn-src-all@freebsd.org Sun Jan 22 01:08: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 95CDECB0461; Sun, 22 Jan 2017 01:08:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 6081D1B9; Sun, 22 Jan 2017 01:08:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id F30B71AAECD; Sun, 22 Jan 2017 12:07:56 +1100 (AEDT) Date: Sun, 22 Jan 2017 12:07:56 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern In-Reply-To: <20170121195114.GA2349@kib.kiev.ua> Message-ID: <20170122115716.T953@besplex.bde.org> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=H7qr+6Qi c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=3uNppCg42bkWnis0B9cA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 01:08:06 -0000 On Sat, 21 Jan 2017, Konstantin Belousov wrote: > On Sat, Jan 21, 2017 at 06:38:17PM +0000, Mateusz Guzik wrote: >> ... >> Log: >> vfs: refactor _vn_lock >> >> Stop testing for LK_RETRY and error multiple times. Also postpone the >> VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. >> >> No functional changes. Many style bugs. >> Modified: head/sys/kern/vfs_vnops.c >> ============================================================================== >> --- head/sys/kern/vfs_vnops.c Sat Jan 21 17:39:10 2017 (r312599) >> +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017 (r312600) >> @@ -1539,27 +1539,24 @@ _vn_lock(struct vnode *vp, int flags, ch >> >> VNASSERT((flags & LK_TYPE_MASK) != 0, vp, >> ("vn_lock called with no locktype.")); >> - do { >> #ifdef DEBUG_VFS_LOCKS >> - KASSERT(vp->v_holdcnt != 0, >> - ("vn_lock %p: zero hold count", vp)); >> + KASSERT(vp->v_holdcnt != 0, >> + ("vn_lock %p: zero hold count", vp)); > This line also has wrong inde seems to not be fixed by later commit. > >> #endif >> - error = VOP_LOCK1(vp, flags, file, line); >> - flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ >> - KASSERT((flags & LK_RETRY) == 0 || error == 0, >> - ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", >> - flags, error)); This was correctly formatted except for the long line. >> - /* >> - * Callers specify LK_RETRY if they wish to get dead vnodes. >> - * If RETRY is not set, we return ENOENT instead. >> - */ >> - if (error == 0 && vp->v_iflag & VI_DOOMED && >> - (flags & LK_RETRY) == 0) { >> +retry: >> + error = VOP_LOCK1(vp, flags, file, line); >> + flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ >> + KASSERT((flags & LK_RETRY) == 0 || error == 0, >> + ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", >> + flags, error)); This is even more grossly misreformatted than the other KASSERT(). The new style bugs are: - random first contuation indent (it happens to be 2 tabs) - long line longer than before (further messed up by the indentation) - random second contuation indent (it actually lines up with the first, except it uses gnu-style lining up parentheses instead of KNF) >> + if (flags & LK_RETRY) { > Stylish test is > if ((flags & LK_RETRY) != 0) { >> + if ((error != 0)) > Too many (). > >> + goto retry; >> + if ((vp->v_iflag & VI_DOOMED)) { > Too many braces again, or missed != 0. >> VOP_UNLOCK(vp, 0); >> error = ENOENT; >> - break; > Also, this does the functional change, it seems to completely break LK_RERY > logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. Later commits further unimproved style by adding __predict_ugly() and long lines from blind substitution of that. __predict_ugly() is almost as useful as 'register', but more invasive. > >> } >> - } while (flags & LK_RETRY && error != 0); >> + } >> return (error); >> } Bruce From owner-svn-src-all@freebsd.org Sun Jan 22 05:28: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 9F7F6CBC516; Sun, 22 Jan 2017 05:28:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A2B8CF; Sun, 22 Jan 2017 05:28:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M5SQjM036718; Sun, 22 Jan 2017 05:28:26 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M5SQDe036714; Sun, 22 Jan 2017 05:28:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701220528.v0M5SQDe036714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 22 Jan 2017 05:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312611 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 05:28:27 -0000 Author: adrian Date: Sun Jan 22 05:28:26 2017 New Revision: 312611 URL: https://svnweb.freebsd.org/changeset/base/312611 Log: [athalq] add debug parsing for the TX FIFO push status. Modified: head/tools/tools/ath/athalq/ar9300_ds.c head/tools/tools/ath/athalq/ar9300_ds.h head/tools/tools/ath/athalq/main.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c ============================================================================== --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 05:28:26 2017 (r312611) @@ -38,6 +38,22 @@ __FBSDID("$FreeBSD$"); #define MS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) #define MF(_v, _f) ( !! ((_v) & (_f))) +void +ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tx_fifo_push p; + + memcpy(&p, &a->payload, sizeof(p)); + printf("[%u.%06u] [%llu] TXPUSH txq=%d, nframes=%d, fifodepth=%d, frmcount=%d\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + be32toh(p.txq), + be32toh(p.nframes), + be32toh(p.fifo_depth), + be32toh(p.frame_cnt)); +} + static void ar9300_decode_txstatus(struct if_ath_alq_payload *a) { @@ -46,10 +62,13 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(&txs, &a->payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%d, DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + txs.status4, + (unsigned int) MS(txs.status1, AR_tx_desc_id), + (unsigned int) MS(txs.ds_info, AR_tx_qcu_num)); printf(" DescId=0x%08x\n", txs.status1); printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", @@ -58,7 +77,7 @@ ar9300_decode_txstatus(struct if_ath_alq MS(txs.ds_info, AR_ctrl_stat), MS(txs.ds_info, AR_desc_id)); - printf(" TxTimestamp=0x%08x\n", txs.status4); + printf(" TxTimestamp: %d\n", txs.status4); printf(" TxDone=%d, SeqNo=%d, TxOpExceed=%d, TXBFStatus=%d\n", MF(txs.status8, AR_tx_done), @@ -130,10 +149,11 @@ ar9300_decode_txdesc(struct if_ath_alq_p /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(&txc, &a->payload, 96); - printf("[%u.%06u] [%llu] TXD\n", + printf("[%u.%06u] [%llu] TXD DescId=0x%04x\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned int) MS(txc.ds_ctl10, AR_tx_desc_id)); printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", txc.ds_info & 0xff, Modified: head/tools/tools/ath/athalq/ar9300_ds.h ============================================================================== --- head/tools/tools/ath/athalq/ar9300_ds.h Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/ar9300_ds.h Sun Jan 22 05:28:26 2017 (r312611) @@ -19,5 +19,6 @@ #define __AR9300_DS_H__ extern void ar9300_alq_payload(struct if_ath_alq_payload *a); +extern void ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a); #endif /* __AR9300_DS_H__ */ Modified: head/tools/tools/ath/athalq/main.c ============================================================================== --- head/tools/tools/ath/athalq/main.c Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/main.c Sun Jan 22 05:28:26 2017 (r312611) @@ -186,6 +186,9 @@ main(int argc, const char *argv[]) case ATH_ALQ_RESUME_BEACON: ath_alq_print_beacon_resume(a); break; + case ATH_ALQ_TX_FIFO_PUSH: + ath_alq_print_edma_tx_fifo_push(a); + break; default: if (be32toh(hdr.sc_hal_magic) == AR5210_MAGIC) ar5210_alq_payload(a); @@ -195,10 +198,8 @@ main(int argc, const char *argv[]) ar5212_alq_payload(a); else if (be32toh(hdr.sc_hal_magic) == AR5416_MAGIC) ar5416_alq_payload(a); -#if 1 else if (be32toh(hdr.sc_hal_magic) == AR9300_MAGIC) ar9300_alq_payload(a); -#endif else printf("[%d.%06d] [%lld] op: %d; len %d\n", be32toh(a->hdr.tstamp_sec), From owner-svn-src-all@freebsd.org Sun Jan 22 05:45: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 D7924CBC82E; Sun, 22 Jan 2017 05:45:43 +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 78A78A5A; Sun, 22 Jan 2017 05:45:43 +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 v0M5jgZw044632; Sun, 22 Jan 2017 05:45:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M5jgch044631; Sun, 22 Jan 2017 05:45:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701220545.v0M5jgch044631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 22 Jan 2017 05:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312612 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 05:45:43 -0000 Author: adrian Date: Sun Jan 22 05:45:42 2017 New Revision: 312612 URL: https://svnweb.freebsd.org/changeset/base/312612 Log: [ath] only apply the AR9300 delimiter workaround for the first sub-frame. This is supposed to only be applied to the first subframe and only if RTS/CTS is being done. I'm still not yet checking RTS/CTS exchange status so it's just happening for all subframes on AR9380 and later. This gets MCS23 throughput up from around 250mbit to 303mbit with RTS/CTS protection enabled, and around 330mbit with no HT protection enabled. Now, MCS23 has a PHY rate of 450mbit and we should be seeing closer to 400mbit for a straight one-way UDP test, but this beats the previous maximum throughput. Tested: * AR9380 (STA) -> AR9580 (AP) - STA with the modifications, doing UDP TX test using iperf. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Sun Jan 22 05:28:26 2017 (r312611) +++ head/sys/dev/ath/if_ath_tx_ht.c Sun Jan 22 05:45:42 2017 (r312612) @@ -402,7 +402,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft */ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf, - uint16_t pktlen) + uint16_t pktlen, int is_first) { #define MS(_v, _f) (((_v) & _f) >> _f##_S) const HAL_RATE_TABLE *rt = sc->sc_currates; @@ -458,11 +458,12 @@ ath_compute_num_delims(struct ath_softc * For AR9380, there's a minimum number of delimeters * required when doing RTS. * - * XXX TODO: this is only needed if (a) RTS/CTS is enabled, and - * XXX (b) this is the first sub-frame in the aggregate. + * XXX TODO: this is only needed if (a) RTS/CTS is enabled for + * this exchange, and (b) (done) this is the first sub-frame + * in the aggregate. */ if (sc->sc_use_ent && (sc->sc_ent_cfg & AH_ENT_RTSCTS_DELIM_WAR) - && ndelim < AH_FIRST_DESC_NDELIMS) + && ndelim < AH_FIRST_DESC_NDELIMS && is_first) ndelim = AH_FIRST_DESC_NDELIMS; /* @@ -975,7 +976,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s */ bf->bf_state.bfs_ndelim = ath_compute_num_delims(sc, bf_first, - bf->bf_state.bfs_pktlen); + bf->bf_state.bfs_pktlen, (bf_first == bf)); /* * Calculate the padding needed from this set of delimiters, From owner-svn-src-all@freebsd.org Sun Jan 22 05:49: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 DE589CBC8E1; Sun, 22 Jan 2017 05:49:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADD5EBEF; Sun, 22 Jan 2017 05:49:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M5nhLR045613; Sun, 22 Jan 2017 05:49:43 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M5nhDf045612; Sun, 22 Jan 2017 05:49:43 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201701220549.v0M5nhDf045612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 22 Jan 2017 05:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312613 - head/sys/powerpc/mpc85xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 05:49:45 -0000 Author: jhibbits Date: Sun Jan 22 05:49:43 2017 New Revision: 312613 URL: https://svnweb.freebsd.org/changeset/base/312613 Log: Fix use of uninitialized variable. I don't know how gcc didn't catch this. This was caught during test building with clang. Modified: head/sys/powerpc/mpc85xx/fsl_diu.c Modified: head/sys/powerpc/mpc85xx/fsl_diu.c ============================================================================== --- head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 05:45:42 2017 (r312612) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 05:49:43 2017 (r312613) @@ -344,7 +344,7 @@ diu_init(struct diu_softc *sc) static int diu_attach(device_t dev) { - struct edid_info *edid; + struct edid_info edid; struct diu_softc *sc; const struct videomode *videomode; void *edid_cells; @@ -384,7 +384,7 @@ diu_attach(device_t dev) } } if (edid_cells != NULL) { - if (edid_parse(edid_cells, edid) != 0) { + if (edid_parse(edid_cells, &edid) != 0) { device_printf(dev, "Error parsing EDID\n"); OF_prop_free(edid_cells); return (ENXIO); From owner-svn-src-all@freebsd.org Sun Jan 22 06:00: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 1DA2DCBCB9C; Sun, 22 Jan 2017 06:00:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E14F31D9; Sun, 22 Jan 2017 06:00:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M606LH049886; Sun, 22 Jan 2017 06:00:06 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M606bR049885; Sun, 22 Jan 2017 06:00:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201701220600.v0M606bR049885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 22 Jan 2017 06:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312614 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 06:00:07 -0000 Author: jhibbits Date: Sun Jan 22 06:00:05 2017 New Revision: 312614 URL: https://svnweb.freebsd.org/changeset/base/312614 Log: Don't pass -Wa,-many through clang, the integrated as doesn't support it. Our base binutils sets -many by default anyway, but external gcc may not do this. PR: kern/215948 Submitted by: Mark Millard Reported by: Mark Millard MFC after: 2 weeks Modified: head/sys/conf/Makefile.powerpc Modified: head/sys/conf/Makefile.powerpc ============================================================================== --- head/sys/conf/Makefile.powerpc Sun Jan 22 05:49:43 2017 (r312613) +++ head/sys/conf/Makefile.powerpc Sun Jan 22 06:00:05 2017 (r312614) @@ -39,7 +39,8 @@ INCLUDES+= -I$S/contrib/libfdt # Force __SPE__, since the builtin will be removed later with -mno-spe CFLAGS+= -mabi=spe -D__SPE__ .endif -CFLAGS+= -msoft-float -Wa,-many +CFLAGS+= -msoft-float +CFLAGS.gcc+= -Wa,-many # Build position-independent kernel CFLAGS+= -fPIC From owner-svn-src-all@freebsd.org Sun Jan 22 06:17: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 0FC12CBCEF3; Sun, 22 Jan 2017 06:17:33 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5944BFE; Sun, 22 Jan 2017 06:17:32 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M6HV3t057974; Sun, 22 Jan 2017 06:17:31 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M6HVvl057973; Sun, 22 Jan 2017 06:17:31 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201701220617.v0M6HVvl057973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 22 Jan 2017 06:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312615 - head/sys/powerpc/mpc85xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 06:17:33 -0000 Author: jhibbits Date: Sun Jan 22 06:17:31 2017 New Revision: 312615 URL: https://svnweb.freebsd.org/changeset/base/312615 Log: Fix r312613. Somehow this slipped through my build testing. Modified: head/sys/powerpc/mpc85xx/fsl_diu.c Modified: head/sys/powerpc/mpc85xx/fsl_diu.c ============================================================================== --- head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 06:00:05 2017 (r312614) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 06:17:31 2017 (r312615) @@ -389,7 +389,7 @@ diu_attach(device_t dev) OF_prop_free(edid_cells); return (ENXIO); } - videomode = edid->edid_preferred_mode; + videomode = edid.edid_preferred_mode; } else { /* Parse video-mode kenv variable. */ if ((err = sscanf(vm_name, "fslfb:%dx%d@%d", &w, &h, &r)) != 3) { From owner-svn-src-all@freebsd.org Sun Jan 22 06:25: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 3137DCBC1A2; Sun, 22 Jan 2017 06:25:43 +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 E90635E4; Sun, 22 Jan 2017 06:25: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 v0M6PgGT061927; Sun, 22 Jan 2017 06:25:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M6PgBX061926; Sun, 22 Jan 2017 06:25:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701220625.v0M6PgBX061926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 22 Jan 2017 06:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312616 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 06:25:43 -0000 Author: adrian Date: Sun Jan 22 06:25:41 2017 New Revision: 312616 URL: https://svnweb.freebsd.org/changeset/base/312616 Log: [athalq] print out unsigned tx timestamps. Modified: head/tools/tools/ath/athalq/ar9300_ds.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c ============================================================================== --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:17:31 2017 (r312615) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:25:41 2017 (r312616) @@ -62,7 +62,7 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(&txs, &a->payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%d, DescId=0x%04x, QCU=%d\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u, DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), (unsigned long long) be64toh(a->hdr.threadid), @@ -77,7 +77,7 @@ ar9300_decode_txstatus(struct if_ath_alq MS(txs.ds_info, AR_ctrl_stat), MS(txs.ds_info, AR_desc_id)); - printf(" TxTimestamp: %d\n", txs.status4); + printf(" TxTimestamp: %u\n", txs.status4); printf(" TxDone=%d, SeqNo=%d, TxOpExceed=%d, TXBFStatus=%d\n", MF(txs.status8, AR_tx_done), From owner-svn-src-all@freebsd.org Sun Jan 22 06:30: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 D3328CBC34A; Sun, 22 Jan 2017 06:30:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18F84B6D; Sun, 22 Jan 2017 06:30:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0M6UuuK062149; Sun, 22 Jan 2017 06:30:56 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M6UtVm062147; Sun, 22 Jan 2017 06:30:55 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201701220630.v0M6UtVm062147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 22 Jan 2017 06:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312617 - in head/sys/powerpc: include powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 06:30:58 -0000 Author: jhibbits Date: Sun Jan 22 06:30:55 2017 New Revision: 312617 URL: https://svnweb.freebsd.org/changeset/base/312617 Log: Hide the 'MOREARGS' macro, it conflicts with contrib code, and is only used in one file. PR: 211818 Reported by: Mark Millard MFC after: 2 weeks Modified: head/sys/powerpc/include/frame.h head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/include/frame.h ============================================================================== --- head/sys/powerpc/include/frame.h Sun Jan 22 06:25:41 2017 (r312616) +++ head/sys/powerpc/include/frame.h Sun Jan 22 06:30:55 2017 (r312617) @@ -109,7 +109,5 @@ struct callframe { /* Definitions for syscalls */ #define FIRSTARG 3 /* first arg in reg 3 */ #define NARGREG 8 /* 8 args in regs */ -#define MOREARGS(sp) ((caddr_t)((uintptr_t)(sp) + \ - sizeof(struct callframe) - 3*sizeof(register_t))) /* more args go here */ #endif /* _MACHINE_FRAME_H_ */ Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Jan 22 06:25:41 2017 (r312616) +++ head/sys/powerpc/powerpc/trap.c Sun Jan 22 06:30:55 2017 (r312617) @@ -80,6 +80,9 @@ __FBSDID("$FreeBSD$"); #define FAULTBUF_CR 22 #define FAULTBUF_R14 3 +#define MOREARGS(sp) ((caddr_t)((uintptr_t)(sp) + \ + sizeof(struct callframe) - 3*sizeof(register_t))) /* more args go here */ + static void trap_fatal(struct trapframe *frame); static void printtrap(u_int vector, struct trapframe *frame, int isfatal, int user); From owner-svn-src-all@freebsd.org Sun Jan 22 07:05: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 217FCCBCAA0; Sun, 22 Jan 2017 07:05:43 +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 CB006AF7; Sun, 22 Jan 2017 07:05: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 v0M75fqT077820; Sun, 22 Jan 2017 07:05:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0M75foW077819; Sun, 22 Jan 2017 07:05:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701220705.v0M75foW077819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 22 Jan 2017 07:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312618 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 07:05:43 -0000 Author: adrian Date: Sun Jan 22 07:05:41 2017 New Revision: 312618 URL: https://svnweb.freebsd.org/changeset/base/312618 Log: [athalq] fix rxtimestamp wrapping; print out per-packet timestamp deltas. The delta here is just between the current TX/RX copmletion and the previous TX/RX completion. The metadata needed to link TX descriptor timestamps to their /completion/ timestamp isn't there yet. Modified: head/tools/tools/ath/athalq/ar9300_ds.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c ============================================================================== --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:30:55 2017 (r312617) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 07:05:41 2017 (r312618) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #define MS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) #define MF(_v, _f) ( !! ((_v) & (_f))) +static uint32_t last_ts = 0; + void ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a) { @@ -62,15 +64,18 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(&txs, &a->payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u, DescId=0x%04x, QCU=%d\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u (%u), DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), (unsigned long long) be64toh(a->hdr.threadid), txs.status4, + txs.status4 - last_ts, (unsigned int) MS(txs.status1, AR_tx_desc_id), (unsigned int) MS(txs.ds_info, AR_tx_qcu_num)); printf(" DescId=0x%08x\n", txs.status1); + last_ts = txs.status4; + printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", txs.ds_info & 0xff, MS(txs.ds_info, AR_tx_qcu_num), @@ -333,10 +338,12 @@ ar9300_decode_rxstatus(struct if_ath_alq /* XXX assumes rxs is smaller than PAYLOAD_LEN! */ memcpy(&rxs, &a->payload, sizeof(struct ar9300_rxs)); - printf("[%u.%06u] [%llu] RXSTATUS\n", + printf("[%u.%06u] [%llu] RXSTATUS RxTimestamp: %u (%d)\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + rxs.status3, + rxs.status3 - last_ts); /* status1 */ /* .. and status5 */ @@ -358,7 +365,8 @@ ar9300_decode_rxstatus(struct if_ath_alq MS(rxs.status2, AR_hw_upload_data)); /* status3 */ - printf(" RX timestamp: %d\n", rxs.status3); + printf(" RX timestamp: %u\n", rxs.status3); + last_ts = rxs.status3; /* status4 */ printf(" GI: %d, 2040: %d, parallel40: %d, stbc=%d\n", From owner-svn-src-all@freebsd.org Sun Jan 22 09:22: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 7CD4BCBC461; Sun, 22 Jan 2017 09:22:34 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1120035E; Sun, 22 Jan 2017 09:22:34 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id d140so18264816wmd.2; Sun, 22 Jan 2017 01:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CDKrYz+R5WqJ8/08Wq9a5MiR5J3mbQyN2KHJQt2bbqw=; b=F2L6QQZf0bmpRi9wBa1dkukvuJa6eEmI56vLPPIV+/HF4go3JNw28APaaRkELptjQL 32idnIHUDd+ESTGdvPsfSivl1mfcPq08p+uAi1tu7E/k1XgXvHPxLnwcU98aEXWinnPY 5T6ksh6F2NurA0kctNtP0RotYwzdr64iVhDZPTMLGlXMhp90lA8OIPaqEB0JpytnBzSf i82B0Qoeu6Id08vTfEIIhLvBp1tx+JHuukboyL/jk8S4AEfZGwpvwtStc2NkXxgsOnpU X1sJAHHOx/E9wlzsLDlwSV0YEOqOS3JZG0556VJBLHCFo7wsVpgJ7MPVxxrW3LB5zslS jcvw== 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=CDKrYz+R5WqJ8/08Wq9a5MiR5J3mbQyN2KHJQt2bbqw=; b=V6YQrH3LPyk/QSm46OB+zSwGs813SHTZm3Q+A5cZT80VtHM6jXbZnUJ1wn6lBPhbt1 qpqPwmTJ4U/cbOqSISKqEIqrZDDWREeYt9x3gczM2BjIsTyHwwGAtau22TXi8wntfmuF yHf9wW6sQ0zdJw7JT4oqf7W5um03tAlh4wiFIwHDoGBZKVqVzwODwuV2YT6WHyPXSfRu UKbjfG4w56wa26X8BfotVlax/rsVFcKWvMUNbaipdwkYrANV3f5rE/Opk9urAwn64TCd ftpPiZqDZR5A5X/aiDPjP3VQKPDU4GC8bW8OsvEuqibZllVDoTey0LomCxquL7Ov1AC3 C2Qg== X-Gm-Message-State: AIkVDXIt/MaEZewY1B6HT+FsHJUh1t1YTNJLssM9h8So6HIc3RUIbWXZBTuSQRiQM2npQg== X-Received: by 10.223.136.197 with SMTP id g5mr18727744wrg.56.1485076952242; Sun, 22 Jan 2017 01:22:32 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id 36sm8446141wrz.8.2017.01.22.01.22.30 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 22 Jan 2017 01:22:31 -0800 (PST) Date: Sun, 22 Jan 2017 10:22:28 +0100 From: Mateusz Guzik To: Bruce Evans Cc: Konstantin Belousov , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern Message-ID: <20170122092228.GC20930@dft-labs.eu> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> <20170122115716.T953@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170122115716.T953@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 09:22:34 -0000 On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: > On Sat, 21 Jan 2017, Konstantin Belousov wrote: > > >On Sat, Jan 21, 2017 at 06:38:17PM +0000, Mateusz Guzik wrote: > >>... > >>Log: > >> vfs: refactor _vn_lock > >> > >> Stop testing for LK_RETRY and error multiple times. Also postpone the > >> VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. > >> > >> No functional changes. > > Many style bugs. > Indeed, the commit was weirdly bad. > >>+ flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > >>+ KASSERT((flags & LK_RETRY) == 0 || error == 0, > >>+ ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", > >>+ flags, error)); > > This is even more grossly misreformatted than the other KASSERT(). The new > style bugs are: > - random first contuation indent (it happens to be 2 tabs) > - long line longer than before (further messed up by the indentation) > - random second contuation indent (it actually lines up with the first, > except it uses gnu-style lining up parentheses instead of KNF) > There was a subsequent commit addressing it, see r312601. > >>+ if (flags & LK_RETRY) { > >Stylish test is > > if ((flags & LK_RETRY) != 0) { > >>+ if ((error != 0)) > >Too many (). > > > >>+ goto retry; > >>+ if ((vp->v_iflag & VI_DOOMED)) { > >Too many braces again, or missed != 0. > >> VOP_UNLOCK(vp, 0); > >> error = ENOENT; > >>- break; > >Also, this does the functional change, it seems to completely break LK_RERY > >logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. > > Later commits further unimproved style by adding __predict_ugly() and > long lines from blind substitution of that. __predict_ugly() is almost > as useful as 'register', but more invasive. > There were no __predict changes to this function. I did add some to vn_closefile in r312602. Indeed, one line is now 82 chars and arguably could be modified to fit the limit. I have to disagree about the usefulness remark. If you check generated assembly for amd64 (included below), you will see the uncommon code is moved out of the way and in particular there are no forward jumps in the common case. With __predict_false: [snip prologue] 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax 0xffffffff8084ecb2 <+34>: test $0x40,%ah 0xffffffff8084ecb5 <+37>: jne 0xffffffff8084ece2 0xffffffff8084ecb7 <+39>: mov 0x24(%rbx),%esi 0xffffffff8084ecba <+42>: mov 0x10(%rbx),%rdx 0xffffffff8084ecbe <+46>: mov %r14,%rdi 0xffffffff8084ecc1 <+49>: mov %r15,%rcx 0xffffffff8084ecc4 <+52>: callq 0xffffffff80850000 0xffffffff8084ecc9 <+57>: mov %eax,%r15d 0xffffffff8084eccc <+60>: mov 0x24(%rbx),%eax 0xffffffff8084eccf <+63>: test $0x40,%ah 0xffffffff8084ecd2 <+66>: jne 0xffffffff8084ecf5 [snip cleanup] 0xffffffff8084ece1 <+81>: retq Without __predict_false: [snip prologue] 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax 0xffffffff8084ecb2 <+34>: test $0x40,%ah 0xffffffff8084ecb5 <+37>: je 0xffffffff8084ecc8 0xffffffff8084ecb7 <+39>: movzwl 0x20(%rbx),%eax 0xffffffff8084ecbb <+43>: cmp $0x1,%eax 0xffffffff8084ecbe <+46>: jne 0xffffffff8084ecc8 0xffffffff8084ecc0 <+48>: mov %r14,%rdi 0xffffffff8084ecc3 <+51>: callq 0xffffffff8083e270 0xffffffff8084ecc8 <+56>: mov 0x24(%rbx),%esi 0xffffffff8084eccb <+59>: mov 0x10(%rbx),%rdx 0xffffffff8084eccf <+63>: mov %r14,%rdi 0xffffffff8084ecd2 <+66>: mov %r15,%rcx 0xffffffff8084ecd5 <+69>: callq 0xffffffff80850000 0xffffffff8084ecda <+74>: mov %eax,%r15d 0xffffffff8084ecdd <+77>: mov 0x24(%rbx),%eax 0xffffffff8084ece0 <+80>: test $0x40,%ah 0xffffffff8084ece3 <+83>: je 0xffffffff8084ed45 0xffffffff8084ece5 <+85>: movzwl 0x20(%rbx),%eax 0xffffffff8084ece9 <+89>: cmp $0x1,%eax 0xffffffff8084ecec <+92>: jne 0xffffffff8084ed45 0xffffffff8084ecee <+94>: movw $0x0,-0x22(%rbp) [skip some parts, +181 marks the beginning of cleanup] 0xffffffff8084ed52 <+194>: retq -- Mateusz Guzik From owner-svn-src-all@freebsd.org Sun Jan 22 11:13: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 2E062CBCE29; Sun, 22 Jan 2017 11:13:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F15BCE5C; Sun, 22 Jan 2017 11:13:54 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MBDsZR080512; Sun, 22 Jan 2017 11:13:54 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MBDs5h080511; Sun, 22 Jan 2017 11:13:54 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701221113.v0MBDs5h080511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 22 Jan 2017 11:13:54 +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: r312619 - stable/11/usr.sbin/pciconf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 11:13:55 -0000 Author: bapt Date: Sun Jan 22 11:13:53 2017 New Revision: 312619 URL: https://svnweb.freebsd.org/changeset/base/312619 Log: MFC r311953 (by cem) pciconf(8): Reallow trailing colon in selectors Reallow device selectors to have a trailing colon, as documented in the manual page. This was broken along with some unrelated cleanups in r295806. PR: 215979 Reported by: David Boyd Sponsored by: Dell EMC Isilon Modified: stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Sun Jan 22 07:05:41 2017 (r312618) +++ stable/11/usr.sbin/pciconf/pciconf.c Sun Jan 22 11:13:53 2017 (r312619) @@ -917,11 +917,8 @@ parsesel(const char *str) while (isdigit(*ep) && i < 4) { selarr[i++] = strtoul(ep, &eppos, 10); ep = eppos; - if (*ep == ':') { + if (*ep == ':') ep++; - if (*ep == '\0') - i = 0; - } } if (i > 0 && *ep == '\0') { sel.pc_func = (i > 2) ? selarr[--i] : 0; From owner-svn-src-all@freebsd.org Sun Jan 22 12:41: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 8A27ECB04CC; Sun, 22 Jan 2017 12:41:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 9E363CC6; Sun, 22 Jan 2017 12:41:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 44AF6D48D75; Sun, 22 Jan 2017 23:41:11 +1100 (AEDT) Date: Sun, 22 Jan 2017 23:41:09 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: Bruce Evans , Konstantin Belousov , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern In-Reply-To: <20170122092228.GC20930@dft-labs.eu> Message-ID: <20170122224849.E897@besplex.bde.org> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> <20170122115716.T953@besplex.bde.org> <20170122092228.GC20930@dft-labs.eu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=H7qr+6Qi c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=HCpYhbqHGTidIVMulywA:9 a=8V4zWRzXokur7vsK:21 a=tqIVVu4pfqI6BqLY:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 12:41:21 -0000 On Sun, 22 Jan 2017, Mateusz Guzik wrote: > On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: > ... >> Later commits further unimproved style by adding __predict_ugly() and >> long lines from blind substitution of that. __predict_ugly() is almost >> as useful as 'register', but more invasive. > > There were no __predict changes to this function. > > I did add some to vn_closefile in r312602. > > Indeed, one line is now 82 chars and arguably could be modified to fit > the limit. > > I have to disagree about the usefulness remark. If you check generated > assembly for amd64 (included below), you will see the uncommon code is > moved out of the way and in particular there are no forward jumps in the > common case. Check benchmarks. A few cycles here and there are in the noise. Kernel code has very few possibilities for useful optimizations since it doesn't have many inner loops. > With __predict_false: > > [snip prologue] > 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax > 0xffffffff8084ecb2 <+34>: test $0x40,%ah > 0xffffffff8084ecb5 <+37>: jne 0xffffffff8084ece2 All that this does is as you say -- invert the condition to jump to the uncommon code. This made more of a difference on old CPUs (possiblly still on low end/non-x86). Now branch predictors are too good for the slow case to be much slower. I think x86 branch predictors initially predict forward branches as not taken and backward branches as taken. So this branch was initially mispredicted, and the change fixes this. But the first branch doesn't really matter. Starting up takes hundreds or thousands of cycles for cache misses. Moving the uncommon code out of the way reduces Icache pressure a bit. I've never been able to measure a significant difference from this. However, I usually compile with -Os to reduce Icache pressure. This is almost as good for speed as -O (typically at most 5% slower than -O2 for kernels). The other day, I tried compiling with -O2 -march=highest-supported and found that on a network microbenchmark which was supposed to benefit from this, it was significantly slower. It was with a very old version of gcc. I think this is because -O2 rearranges the code a lot, and since at least the old version of gcc doesn't understand caches at all, the arrangement accidentally ended up much worse and caused more cache misses. With another compiler and NIC, -O2 gave the expected speeding. > 0xffffffff8084ecb7 <+39>: mov 0x24(%rbx),%esi > 0xffffffff8084ecba <+42>: mov 0x10(%rbx),%rdx > 0xffffffff8084ecbe <+46>: mov %r14,%rdi > 0xffffffff8084ecc1 <+49>: mov %r15,%rcx > 0xffffffff8084ecc4 <+52>: callq 0xffffffff80850000 > 0xffffffff8084ecc9 <+57>: mov %eax,%r15d > 0xffffffff8084eccc <+60>: mov 0x24(%rbx),%eax > 0xffffffff8084eccf <+63>: test $0x40,%ah > 0xffffffff8084ecd2 <+66>: jne 0xffffffff8084ecf5 > [snip cleanup] > 0xffffffff8084ece1 <+81>: retq The code for he uncommon case is now here (not shown). It will be no smaller (actually slightly larger for a branch back) unless it can be shared. > > Without __predict_false: > [snip prologue] > 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax > 0xffffffff8084ecb2 <+34>: test $0x40,%ah > 0xffffffff8084ecb5 <+37>: je 0xffffffff8084ecc8 The branch is not very far away, so perhaps the optimization from the move is null. > 0xffffffff8084ecb7 <+39>: movzwl 0x20(%rbx),%eax > 0xffffffff8084ecbb <+43>: cmp $0x1,%eax > 0xffffffff8084ecbe <+46>: jne 0xffffffff8084ecc8 > 0xffffffff8084ecc0 <+48>: mov %r14,%rdi > 0xffffffff8084ecc3 <+51>: callq 0xffffffff8083e270 The branch was to here <+56>. The function is not very well aligned. It has address 0x90 mod 0x100, so starts 0x10 into a 64-bit cache line (is that still the line size for all modern x86?). So 48 bytes are in a line, but this +56 is in the next line. But aligning functions and branches to cache line boundaries works poorly in general. It wastes Icache in another way. -march affects this a lot, and -march=higher is often worse since the compiler doesn't really understand this and does more or less alignment than is good. Here it didn't bother aligning even 1 of the branch targets. > 0xffffffff8084ecc8 <+56>: mov 0x24(%rbx),%esi > 0xffffffff8084eccb <+59>: mov 0x10(%rbx),%rdx > 0xffffffff8084eccf <+63>: mov %r14,%rdi > 0xffffffff8084ecd2 <+66>: mov %r15,%rcx The main code ends up just +17 later at <+69>. Fitting it all below <+64> would be better but is not necessary if the instructions are slow enough to all the instruction fetch to run ahead. This depends on good prediction to not start too many instructions in paths that won't be followed. > 0xffffffff8084ecd5 <+69>: callq 0xffffffff80850000 > 0xffffffff8084ecda <+74>: mov %eax,%r15d > 0xffffffff8084ecdd <+77>: mov 0x24(%rbx),%eax > 0xffffffff8084ece0 <+80>: test $0x40,%ah > 0xffffffff8084ece3 <+83>: je 0xffffffff8084ed45 > 0xffffffff8084ece5 <+85>: movzwl 0x20(%rbx),%eax > 0xffffffff8084ece9 <+89>: cmp $0x1,%eax > 0xffffffff8084ecec <+92>: jne 0xffffffff8084ed45 > 0xffffffff8084ecee <+94>: movw $0x0,-0x22(%rbp) > [skip some parts, +181 marks the beginning of cleanup] > 0xffffffff8084ed52 <+194>: retq Bruce From owner-svn-src-all@freebsd.org Sun Jan 22 12:57: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 A5863CB0D1B; Sun, 22 Jan 2017 12:57:22 +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 34E22EFB; Sun, 22 Jan 2017 12:57:22 +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 v0MCvGcW031932 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 22 Jan 2017 14:57:17 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0MCvGcW031932 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0MCvGqH031931; Sun, 22 Jan 2017 14:57:16 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 Jan 2017 14:57:16 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Mateusz Guzik , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern Message-ID: <20170122125716.GD2349@kib.kiev.ua> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> <20170122115716.T953@besplex.bde.org> <20170122092228.GC20930@dft-labs.eu> <20170122224849.E897@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170122224849.E897@besplex.bde.org> User-Agent: Mutt/1.7.2 (2016-11-26) 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: Sun, 22 Jan 2017 12:57:22 -0000 On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: > On Sun, 22 Jan 2017, Mateusz Guzik wrote: > > > On Sun, Jan 22, 2017 at 12:07:56PM +1100, Bruce Evans wrote: > > ... > >> Later commits further unimproved style by adding __predict_ugly() and > >> long lines from blind substitution of that. __predict_ugly() is almost > >> as useful as 'register', but more invasive. > > > > There were no __predict changes to this function. > > > > I did add some to vn_closefile in r312602. > > > > Indeed, one line is now 82 chars and arguably could be modified to fit > > the limit. > > > > I have to disagree about the usefulness remark. If you check generated > > assembly for amd64 (included below), you will see the uncommon code is > > moved out of the way and in particular there are no forward jumps in the > > common case. > > Check benchmarks. A few cycles here and there are in the noise. Kernel > code has very few possibilities for useful optimizations since it doesn't > have many inner loops. > > > With __predict_false: > > > > [snip prologue] > > 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax > > 0xffffffff8084ecb2 <+34>: test $0x40,%ah > > 0xffffffff8084ecb5 <+37>: jne 0xffffffff8084ece2 > > All that this does is as you say -- invert the condition to jump to the > uncommon code. This made more of a difference on old CPUs (possiblly > still on low end/non-x86). Now branch predictors are too good for the > slow case to be much slower. > > I think x86 branch predictors initially predict forward branches as not > taken and backward branches as taken. So this branch was initially > mispredicted, and the change fixes this. But the first branch doesn't > really matter. Starting up takes hundreds or thousands of cycles for > cache misses. This is only true if branch predictor memory is large enough to keep the state for the given branch between exercising it. Even if the predictor state could be attached to every byte in the icache, or more likely, every line in the icache or uop cache, it still probably too small to survive between user->kernel transitions for syscalls. Might be there is performance counter which shows branch predictor mis-predictions. In other words, I suspect that there almost all cases might be mis-predictions without manual hint, and mis-predictions together with the full pipeline flush on VFS-intensive load very well might give tens percents of the total cycles on the modern cores. Just speculation. > > Moving the uncommon code out of the way reduces Icache pressure a bit. > I've never been able to measure a significant difference from this. > > However, I usually compile with -Os to reduce Icache pressure. This > is almost as good for speed as -O (typically at most 5% slower than > -O2 for kernels). The other day, I tried compiling with -O2 > -march=highest-supported and found that on a network microbenchmark > which was supposed to benefit from this, it was significantly slower. > It was with a very old version of gcc. I think this is because -O2 > rearranges the code a lot, and since at least the old version of gcc > doesn't understand caches at all, the arrangement accidentally ended > up much worse and caused more cache misses. With another compiler and > NIC, -O2 gave the expected speeding. > > > 0xffffffff8084ecb7 <+39>: mov 0x24(%rbx),%esi > > 0xffffffff8084ecba <+42>: mov 0x10(%rbx),%rdx > > 0xffffffff8084ecbe <+46>: mov %r14,%rdi > > 0xffffffff8084ecc1 <+49>: mov %r15,%rcx > > 0xffffffff8084ecc4 <+52>: callq 0xffffffff80850000 > > 0xffffffff8084ecc9 <+57>: mov %eax,%r15d > > 0xffffffff8084eccc <+60>: mov 0x24(%rbx),%eax > > 0xffffffff8084eccf <+63>: test $0x40,%ah > > 0xffffffff8084ecd2 <+66>: jne 0xffffffff8084ecf5 > > [snip cleanup] > > 0xffffffff8084ece1 <+81>: retq > > The code for he uncommon case is now here (not shown). It will be no > smaller (actually slightly larger for a branch back) unless it can be > shared. > > > > > Without __predict_false: > > [snip prologue] > > 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax > > 0xffffffff8084ecb2 <+34>: test $0x40,%ah > > 0xffffffff8084ecb5 <+37>: je 0xffffffff8084ecc8 > > The branch is not very far away, so perhaps the optimization from the move > is null. > > > 0xffffffff8084ecb7 <+39>: movzwl 0x20(%rbx),%eax > > 0xffffffff8084ecbb <+43>: cmp $0x1,%eax > > 0xffffffff8084ecbe <+46>: jne 0xffffffff8084ecc8 > > 0xffffffff8084ecc0 <+48>: mov %r14,%rdi > > 0xffffffff8084ecc3 <+51>: callq 0xffffffff8083e270 > > The branch was to here <+56>. The function is not very well aligned. It > has address 0x90 mod 0x100, so starts 0x10 into a 64-bit cache line (is that > still the line size for all modern x86?). So 48 bytes are in a line, but > this +56 is in the next line. > > But aligning functions and branches to cache line boundaries works poorly > in general. It wastes Icache in another way. -march affects this a lot, > and -march=higher is often worse since the compiler doesn't really understand > this and does more or less alignment than is good. Here it didn't bother > aligning even 1 of the branch targets. > > > 0xffffffff8084ecc8 <+56>: mov 0x24(%rbx),%esi > > 0xffffffff8084eccb <+59>: mov 0x10(%rbx),%rdx > > 0xffffffff8084eccf <+63>: mov %r14,%rdi > > 0xffffffff8084ecd2 <+66>: mov %r15,%rcx > > The main code ends up just +17 later at <+69>. Fitting it all below <+64> > would be better but is not necessary if the instructions are slow enough > to all the instruction fetch to run ahead. This depends on good prediction > to not start too many instructions in paths that won't be followed. > > > 0xffffffff8084ecd5 <+69>: callq 0xffffffff80850000 > > 0xffffffff8084ecda <+74>: mov %eax,%r15d > > 0xffffffff8084ecdd <+77>: mov 0x24(%rbx),%eax > > 0xffffffff8084ece0 <+80>: test $0x40,%ah > > 0xffffffff8084ece3 <+83>: je 0xffffffff8084ed45 > > 0xffffffff8084ece5 <+85>: movzwl 0x20(%rbx),%eax > > 0xffffffff8084ece9 <+89>: cmp $0x1,%eax > > 0xffffffff8084ecec <+92>: jne 0xffffffff8084ed45 > > 0xffffffff8084ecee <+94>: movw $0x0,-0x22(%rbp) > > [skip some parts, +181 marks the beginning of cleanup] > > 0xffffffff8084ed52 <+194>: retq > > Bruce From owner-svn-src-all@freebsd.org Sun Jan 22 13:21: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 06B62CBC55C; Sun, 22 Jan 2017 13:21:21 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9E0EE42; Sun, 22 Jan 2017 13:21:20 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MDLJdb031665; Sun, 22 Jan 2017 13:21:19 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MDLJst031664; Sun, 22 Jan 2017 13:21:19 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201701221321.v0MDLJst031664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 22 Jan 2017 13:21: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: r312620 - stable/11/sys/boot/fdt/dts/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 13:21:21 -0000 Author: jmcneill Date: Sun Jan 22 13:21:19 2017 New Revision: 312620 URL: https://svnweb.freebsd.org/changeset/base/312620 Log: MFC r310854, r310972 r310854: Add missing reg property to usbphy node. r310972: Fix a typo in the third address of the reg property for the usbphy node. Modified: stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/dts/arm/a83t.dtsi ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Sun Jan 22 11:13:53 2017 (r312619) +++ stable/11/sys/boot/fdt/dts/arm/a83t.dtsi Sun Jan 22 13:21:19 2017 (r312620) @@ -132,6 +132,9 @@ usbphy: phy@01c19400 { compatible = "allwinner,sun8i-a83t-usb-phy"; + reg = <0x01c19400 0x2c>, + <0x01c1a800 0x4>, + <0x01c1b800 0x4>; clocks = <&usb_clk 8>, <&usb_clk 9>, <&usb_clk 10>, From owner-svn-src-all@freebsd.org Sun Jan 22 15:27: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 AC4C4CBCBE6; Sun, 22 Jan 2017 15:27:15 +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 7BE88E41; Sun, 22 Jan 2017 15:27:15 +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 v0MFREmV086255; Sun, 22 Jan 2017 15:27:14 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MFREKg086254; Sun, 22 Jan 2017 15:27:14 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701221527.v0MFREKg086254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Jan 2017 15:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312621 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 15:27:15 -0000 Author: trasz Date: Sun Jan 22 15:27:14 2017 New Revision: 312621 URL: https://svnweb.freebsd.org/changeset/base/312621 Log: Improve debugging printf. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Jan 22 13:21:19 2017 (r312620) +++ head/sys/kern/vfs_subr.c Sun Jan 22 15:27:14 2017 (r312621) @@ -1491,7 +1491,7 @@ alloc: vp->v_bufobj.bo_ops = &buf_ops_bio; #ifdef DIAGNOSTIC if (mp == NULL && vops != &dead_vnodeops) - printf("NULL mp in getnewvnode()\n"); + printf("NULL mp in getnewvnode(9), tag %s\n", tag); #endif #ifdef MAC mac_vnode_init(vp); From owner-svn-src-all@freebsd.org Sun Jan 22 15:32: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 C6950CBCE87; Sun, 22 Jan 2017 15:32:18 +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 88199405; Sun, 22 Jan 2017 15:32:18 +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 v0MFWHOC090181; Sun, 22 Jan 2017 15:32:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MFWHIT090179; Sun, 22 Jan 2017 15:32:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701221532.v0MFWHIT090179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Jan 2017 15:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312622 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 15:32:18 -0000 Author: trasz Date: Sun Jan 22 15:32:17 2017 New Revision: 312622 URL: https://svnweb.freebsd.org/changeset/base/312622 Log: Add SCSI descriptors for USB Mass Storage. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Jan 22 15:27:14 2017 (r312621) +++ head/sys/cam/ctl/ctl.c Sun Jan 22 15:32:17 2017 (r312622) @@ -10103,6 +10103,9 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } else if (port_type == CTL_PORT_SAS) { /* SAS (no version claimed) */ scsi_ulto2b(0x0BE0, inq_ptr->version3); + } else if (port_type == CTL_PORT_UMASS) { + /* USB Mass Storage Class Bulk-Only Transport, Revision 1.0 */ + scsi_ulto2b(0x1730, inq_ptr->version3); } if (lun == NULL) { Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Sun Jan 22 15:27:14 2017 (r312621) +++ head/sys/cam/ctl/ctl.h Sun Jan 22 15:32:17 2017 (r312622) @@ -53,6 +53,7 @@ typedef enum { CTL_PORT_INTERNAL = 0x08, CTL_PORT_ISCSI = 0x10, CTL_PORT_SAS = 0x20, + CTL_PORT_UMASS = 0x40, CTL_PORT_ALL = 0xff, CTL_PORT_ISC = 0x100 // FC port for inter-shelf communication } ctl_port_type; From owner-svn-src-all@freebsd.org Sun Jan 22 15:35: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 946EECBCFCA; Sun, 22 Jan 2017 15:35:52 +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 6436A9A1; Sun, 22 Jan 2017 15:35:52 +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 v0MFZpj0090571; Sun, 22 Jan 2017 15:35:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MFZpDh090570; Sun, 22 Jan 2017 15:35:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701221535.v0MFZpDh090570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Jan 2017 15:35:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312623 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 15:35:52 -0000 Author: trasz Date: Sun Jan 22 15:35:51 2017 New Revision: 312623 URL: https://svnweb.freebsd.org/changeset/base/312623 Log: Remove redundant KASSERT. Modified: head/sys/kern/kern_racct.c Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Sun Jan 22 15:32:17 2017 (r312622) +++ head/sys/kern/kern_racct.c Sun Jan 22 15:35:51 2017 (r312623) @@ -443,12 +443,8 @@ racct_sub_racct(struct racct *dest, cons } if (RACCT_CAN_DROP(i)) { dest->r_resources[i] -= src->r_resources[i]; - if (dest->r_resources[i] < 0) { - KASSERT(RACCT_IS_SLOPPY(i) || - RACCT_IS_DECAYING(i), - ("%s: resource %d usage < 0", __func__, i)); + if (dest->r_resources[i] < 0) dest->r_resources[i] = 0; - } } } } From owner-svn-src-all@freebsd.org Sun Jan 22 16: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 ED471CBD439; Sun, 22 Jan 2017 16:52:33 +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 A3A02F37; Sun, 22 Jan 2017 16:52:33 +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 v0MGqWP4022801; Sun, 22 Jan 2017 16:52:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqURt022768; Sun, 22 Jan 2017 16:52:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqURt022768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312625 - in vendor/llvm/dist: cmake/modules docs include/llvm/Analysis lib/Analysis lib/Bitcode/Reader lib/LTO lib/Target/X86 lib/Transforms/Scalar lib/Transforms/Vectorize test/CodeGe... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:34 -0000 Author: dim Date: Sun Jan 22 16:52:30 2017 New Revision: 312625 URL: https://svnweb.freebsd.org/changeset/base/312625 Log: Vendor import of llvm release_40 branch r292732: https://llvm.org/svn/llvm-project/llvm/branches/release_40@292732 Added: vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll Modified: vendor/llvm/dist/cmake/modules/AddLLVM.cmake vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/docs/index.rst vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Modified: vendor/llvm/dist/cmake/modules/AddLLVM.cmake ============================================================================== --- vendor/llvm/dist/cmake/modules/AddLLVM.cmake Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/cmake/modules/AddLLVM.cmake Sun Jan 22 16:52:30 2017 (r312625) @@ -462,11 +462,9 @@ function(llvm_add_library name) if(UNIX AND NOT APPLE AND NOT ARG_SONAME) set_target_properties(${name} PROPERTIES - # Concatenate the version numbers since ldconfig expects exactly - # one component indicating the ABI version, while LLVM uses - # major+minor for that. - SOVERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR} - VERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}) + # Since 4.0.0, the ABI version is indicated by the major version + SOVERSION ${LLVM_VERSION_MAJOR} + VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}) endif() endif() Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:30 2017 (r312625) @@ -67,13 +67,46 @@ Non-comprehensive list of changes in thi Makes programs 10x faster by doing Special New Thing. + Improvements to ThinLTO (-flto=thin) + ------------------------------------ + * Integration with profile data (PGO). When available, profile data + enables more accurate function importing decisions, as well as + cross-module indirect call promotion. + * Significant build-time and binary-size improvements when compiling with + debug info (-g). + Changes to the LLVM IR ---------------------- -Changes to the ARM Backend +Changes to the ARM Targets -------------------------- - During this release ... +**During this release the AArch64 target has:** + +* Gained support for ILP32 relocations. +* Gained support for XRay. +* Made even more progress on GlobalISel. There is still some work left before + it is production-ready though. +* Refined the support for Qualcomm's Falkor and Samsung's Exynos CPUs. +* Learned a few new tricks for lowering multiplications by constants, folding + spilled/refilled copies etc. + +**During this release the ARM target has:** + +* Gained support for ROPI (read-only position independence) and RWPI + (read-write position independence), which can be used to remove the need for + a dynamic linker. +* Gained support for execute-only code, which is placed in pages without read + permissions. +* Gained a machine scheduler for Cortex-R52. +* Gained support for XRay. +* Gained Thumb1 implementations for several compiler-rt builtins. It also + has some support for building the builtins for HF targets. +* Started using the generic bitreverse intrinsic instead of rbit. +* Gained very basic support for GlobalISel. + +A lot of work has also been done in LLD for ARM, which now supports more +relocations and TLS. Changes to the MIPS Target Modified: vendor/llvm/dist/docs/index.rst ============================================================================== --- vendor/llvm/dist/docs/index.rst Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/docs/index.rst Sun Jan 22 16:52:30 2017 (r312625) @@ -1,11 +1,6 @@ Overview ======== -.. warning:: - - If you are using a released version of LLVM, see `the download page - `_ to find your documentation. - The LLVM compiler infrastructure supports a wide range of projects, from industrial strength compilers to specialized JIT applications to small research projects. Modified: vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h ============================================================================== --- vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h Sun Jan 22 16:52:30 2017 (r312625) @@ -68,7 +68,10 @@ class AssumptionCache { AffectedValuesMap AffectedValues; /// Get the vector of assumptions which affect a value from the cache. - SmallVector &getAffectedValues(Value *V); + SmallVector &getOrInsertAffectedValues(Value *V); + + /// Copy affected values in the cache for OV to be affected values for NV. + void copyAffectedValuesInCache(Value *OV, Value *NV); /// \brief Flag tracking whether we have scanned the function yet. /// Modified: vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -24,7 +24,7 @@ using namespace llvm; using namespace llvm::PatternMatch; -SmallVector &AssumptionCache::getAffectedValues(Value *V) { +SmallVector &AssumptionCache::getOrInsertAffectedValues(Value *V) { // Try using find_as first to avoid creating extra value handles just for the // purpose of doing the lookup. auto AVI = AffectedValues.find_as(V); @@ -98,7 +98,7 @@ void AssumptionCache::updateAffectedValu } for (auto &AV : Affected) { - auto &AVV = getAffectedValues(AV); + auto &AVV = getOrInsertAffectedValues(AV); if (std::find(AVV.begin(), AVV.end(), CI) == AVV.end()) AVV.push_back(CI); } @@ -111,20 +111,27 @@ void AssumptionCache::AffectedValueCallb // 'this' now dangles! } +void AssumptionCache::copyAffectedValuesInCache(Value *OV, Value *NV) { + auto &NAVV = getOrInsertAffectedValues(NV); + auto AVI = AffectedValues.find(OV); + if (AVI == AffectedValues.end()) + return; + + for (auto &A : AVI->second) + if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end()) + NAVV.push_back(A); +} + void AssumptionCache::AffectedValueCallbackVH::allUsesReplacedWith(Value *NV) { if (!isa(NV) && !isa(NV)) return; // Any assumptions that affected this value now affect the new value. - auto &NAVV = AC->getAffectedValues(NV); - auto AVI = AC->AffectedValues.find(getValPtr()); - if (AVI == AC->AffectedValues.end()) - return; - - for (auto &A : AVI->second) - if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end()) - NAVV.push_back(A); + AC->copyAffectedValuesInCache(getValPtr(), NV); + // 'this' now might dangle! If the AffectedValues map was resized to add an + // entry for NV then this object might have been destroyed in favor of some + // copy in the grown map. } void AssumptionCache::scanFunction() { Modified: vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -405,6 +405,7 @@ char ModuleSummaryIndexWrapperPass::ID = INITIALIZE_PASS_BEGIN(ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfoWrapperPass) +INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass) INITIALIZE_PASS_END(ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -768,13 +768,12 @@ void MetadataLoader::MetadataLoaderImpl: unsigned ID, PlaceholderQueue &Placeholders) { assert(ID < (MDStringRef.size()) + GlobalMetadataBitPosIndex.size()); assert(ID >= MDStringRef.size() && "Unexpected lazy-loading of MDString"); -#ifndef NDEBUG // Lookup first if the metadata hasn't already been loaded. if (auto *MD = MetadataList.lookup(ID)) { auto *N = dyn_cast_or_null(MD); - assert(N && N->isTemporary() && "Lazy loading an already loaded metadata"); + if (!N->isTemporary()) + return; } -#endif SmallVector Record; StringRef Blob; IndexCursor.JumpToBit(GlobalMetadataBitPosIndex[ID - MDStringRef.size()]); @@ -827,8 +826,22 @@ Error MetadataLoader::MetadataLoaderImpl auto getMD = [&](unsigned ID) -> Metadata * { if (ID < MDStringRef.size()) return lazyLoadOneMDString(ID); - if (!IsDistinct) + if (!IsDistinct) { + if (auto *MD = MetadataList.lookup(ID)) + return MD; + // If lazy-loading is enabled, we try recursively to load the operand + // instead of creating a temporary. + if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) { + // Create a temporary for the node that is referencing the operand we + // will lazy-load. It is needed before recursing in case there are + // uniquing cycles. + MetadataList.getMetadataFwdRef(NextMetadataNo); + lazyLoadOneMetadata(ID, Placeholders); + return MetadataList.lookup(ID); + } + // Return a temporary. return MetadataList.getMetadataFwdRef(ID); + } if (auto *MD = MetadataList.getMetadataIfResolved(ID)) return MD; return &Placeholders.getPlaceholderOp(ID); Modified: vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp ============================================================================== --- vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -829,11 +829,22 @@ static std::string writeGeneratedObject( // Main entry point for the ThinLTO processing void ThinLTOCodeGenerator::run() { + // Prepare the resulting object vector + assert(ProducedBinaries.empty() && "The generator should not be reused"); + if (SavedObjectsDirectoryPath.empty()) + ProducedBinaries.resize(Modules.size()); + else { + sys::fs::create_directories(SavedObjectsDirectoryPath); + bool IsDir; + sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir); + if (!IsDir) + report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'"); + ProducedBinaryFiles.resize(Modules.size()); + } + if (CodeGenOnly) { // Perform only parallel codegen and return. ThreadPool Pool; - assert(ProducedBinaries.empty() && "The generator should not be reused"); - ProducedBinaries.resize(Modules.size()); int count = 0; for (auto &ModuleBuffer : Modules) { Pool.async([&](int count) { @@ -845,7 +856,12 @@ void ThinLTOCodeGenerator::run() { /*IsImporting*/ false); // CodeGen - ProducedBinaries[count] = codegen(*TheModule); + auto OutputBuffer = codegen(*TheModule); + if (SavedObjectsDirectoryPath.empty()) + ProducedBinaries[count] = std::move(OutputBuffer); + else + ProducedBinaryFiles[count] = writeGeneratedObject( + count, "", SavedObjectsDirectoryPath, *OutputBuffer); }, count++); } @@ -866,18 +882,6 @@ void ThinLTOCodeGenerator::run() { WriteIndexToFile(*Index, OS); } - // Prepare the resulting object vector - assert(ProducedBinaries.empty() && "The generator should not be reused"); - if (SavedObjectsDirectoryPath.empty()) - ProducedBinaries.resize(Modules.size()); - else { - sys::fs::create_directories(SavedObjectsDirectoryPath); - bool IsDir; - sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir); - if (!IsDir) - report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'"); - ProducedBinaryFiles.resize(Modules.size()); - } // Prepare the module map. auto ModuleMap = generateModuleMap(Modules); Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -29455,19 +29455,11 @@ static SDValue combineSelect(SDNode *N, return SDValue(); } -/// Combine brcond/cmov/setcc/.. based on comparing the result of -/// atomic_load_add to use EFLAGS produced by the addition -/// directly if possible. For example: -/// -/// (setcc (cmp (atomic_load_add x, -C) C), COND_E) -/// becomes: -/// (setcc (LADD x, -C), COND_E) -/// -/// and +/// Combine: /// (brcond/cmov/setcc .., (cmp (atomic_load_add x, 1), 0), COND_S) -/// becomes: +/// to: /// (brcond/cmov/setcc .., (LADD x, 1), COND_LE) -/// +/// i.e., reusing the EFLAGS produced by the LOCKed instruction. /// Note that this is only legal for some op/cc combinations. static SDValue combineSetCCAtomicArith(SDValue Cmp, X86::CondCode &CC, SelectionDAG &DAG) { @@ -29482,7 +29474,7 @@ static SDValue combineSetCCAtomicArith(S if (!Cmp.hasOneUse()) return SDValue(); - // This applies to variations of the common case: + // This only applies to variations of the common case: // (icmp slt x, 0) -> (icmp sle (add x, 1), 0) // (icmp sge x, 0) -> (icmp sgt (add x, 1), 0) // (icmp sle x, 0) -> (icmp slt (sub x, 1), 0) @@ -29501,9 +29493,8 @@ static SDValue combineSetCCAtomicArith(S return SDValue(); auto *CmpRHSC = dyn_cast(CmpRHS); - if (!CmpRHSC) + if (!CmpRHSC || CmpRHSC->getZExtValue() != 0) return SDValue(); - APInt Comparand = CmpRHSC->getAPIntValue(); const unsigned Opc = CmpLHS.getOpcode(); @@ -29519,19 +29510,16 @@ static SDValue combineSetCCAtomicArith(S if (Opc == ISD::ATOMIC_LOAD_SUB) Addend = -Addend; - if (Comparand == -Addend) { - // No change to CC. - } else if (CC == X86::COND_S && Comparand == 0 && Addend == 1) { + if (CC == X86::COND_S && Addend == 1) CC = X86::COND_LE; - } else if (CC == X86::COND_NS && Comparand == 0 && Addend == 1) { + else if (CC == X86::COND_NS && Addend == 1) CC = X86::COND_G; - } else if (CC == X86::COND_G && Comparand == 0 && Addend == -1) { + else if (CC == X86::COND_G && Addend == -1) CC = X86::COND_GE; - } else if (CC == X86::COND_LE && Comparand == 0 && Addend == -1) { + else if (CC == X86::COND_LE && Addend == -1) CC = X86::COND_L; - } else { + else return SDValue(); - } SDValue LockOp = lowerAtomicArithWithLOCK(CmpLHS, DAG); DAG.ReplaceAllUsesOfValueWith(CmpLHS.getValue(0), Modified: vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -232,9 +232,6 @@ void X86Subtarget::initSubtargetFeatures else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || isTargetKFreeBSD() || In64BitMode) stackAlignment = 16; - - assert((!isPMULLDSlow() || hasSSE41()) && - "Feature Slow PMULLD can only be set on a subtarget with SSE4.1"); } void X86Subtarget::initializeEnvironment() { Modified: vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -3163,6 +3163,9 @@ LSRInstance::CollectLoopInvariantFixupsA // Don't bother if the instruction is in a BB which ends in an EHPad. if (UseBB->getTerminator()->isEHPad()) continue; + // Don't bother rewriting PHIs in catchswitch blocks. + if (isa(UserInst->getParent()->getTerminator())) + continue; // Ignore uses which are part of other SCEV expressions, to avoid // analyzing them multiple times. if (SE.isSCEVable(UserInst->getType())) { @@ -4672,7 +4675,8 @@ void LSRInstance::RewriteForPHI(PHINode // is the canonical backedge for this loop, which complicates post-inc // users. if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 && - !isa(BB->getTerminator())) { + !isa(BB->getTerminator()) && + !isa(BB->getTerminator())) { BasicBlock *Parent = PN->getParent(); Loop *PNLoop = LI.getLoopFor(Parent); if (!PNLoop || Parent != PNLoop->getHeader()) { Modified: vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -81,6 +81,10 @@ STATISTIC(NumGVNOpsSimplified, "Number o STATISTIC(NumGVNPhisAllSame, "Number of PHIs whos arguments are all the same"); STATISTIC(NumGVNMaxIterations, "Maximum Number of iterations it took to converge GVN"); +STATISTIC(NumGVNLeaderChanges, "Number of leader changes"); +STATISTIC(NumGVNSortedLeaderChanges, "Number of sorted leader changes"); +STATISTIC(NumGVNAvoidedSortedLeaderChanges, + "Number of avoided sorted leader changes"); //===----------------------------------------------------------------------===// // GVN Pass @@ -139,6 +143,10 @@ struct CongruenceClass { // This is used so we can detect store equivalence changes properly. int StoreCount = 0; + // The most dominating leader after our current leader, because the member set + // is not sorted and is expensive to keep sorted all the time. + std::pair NextLeader = {nullptr, ~0U}; + explicit CongruenceClass(unsigned ID) : ID(ID) {} CongruenceClass(unsigned ID, Value *Leader, const Expression *E) : ID(ID), RepLeader(Leader), DefiningExpr(E) {} @@ -320,8 +328,8 @@ private: // Templated to allow them to work both on BB's and BB-edges. template Value *lookupOperandLeader(Value *, const User *, const T &) const; - void performCongruenceFinding(Value *, const Expression *); - void moveValueToNewCongruenceClass(Value *, CongruenceClass *, + void performCongruenceFinding(Instruction *, const Expression *); + void moveValueToNewCongruenceClass(Instruction *, CongruenceClass *, CongruenceClass *); // Reachability handling. void updateReachableEdge(BasicBlock *, BasicBlock *); @@ -1056,20 +1064,43 @@ void NewGVN::markLeaderChangeTouched(Con // Move a value, currently in OldClass, to be part of NewClass // Update OldClass for the move (including changing leaders, etc) -void NewGVN::moveValueToNewCongruenceClass(Value *V, CongruenceClass *OldClass, +void NewGVN::moveValueToNewCongruenceClass(Instruction *I, + CongruenceClass *OldClass, CongruenceClass *NewClass) { - DEBUG(dbgs() << "New congruence class for " << V << " is " << NewClass->ID + DEBUG(dbgs() << "New congruence class for " << I << " is " << NewClass->ID << "\n"); - OldClass->Members.erase(V); - NewClass->Members.insert(V); - if (isa(V)) { + + if (I == OldClass->NextLeader.first) + OldClass->NextLeader = {nullptr, ~0U}; + + // The new instruction and new class leader may either be siblings in the + // dominator tree, or the new class leader should dominate the new member + // instruction. We simply check that the member instruction does not properly + // dominate the new class leader. + assert( + !isa(NewClass->RepLeader) || !NewClass->RepLeader || + I == NewClass->RepLeader || + !DT->properlyDominates( + I->getParent(), + cast(NewClass->RepLeader)->getParent()) && + "New class for instruction should not be dominated by instruction"); + + if (NewClass->RepLeader != I) { + auto DFSNum = InstrDFS.lookup(I); + if (DFSNum < NewClass->NextLeader.second) + NewClass->NextLeader = {I, DFSNum}; + } + + OldClass->Members.erase(I); + NewClass->Members.insert(I); + if (isa(I)) { --OldClass->StoreCount; assert(OldClass->StoreCount >= 0); ++NewClass->StoreCount; assert(NewClass->StoreCount > 0); } - ValueToClass[V] = NewClass; + ValueToClass[I] = NewClass; // See if we destroyed the class or need to swap leaders. if (OldClass->Members.empty() && OldClass != InitialClass) { if (OldClass->DefiningExpr) { @@ -1078,25 +1109,48 @@ void NewGVN::moveValueToNewCongruenceCla << " from table\n"); ExpressionToClass.erase(OldClass->DefiningExpr); } - } else if (OldClass->RepLeader == V) { + } else if (OldClass->RepLeader == I) { // When the leader changes, the value numbering of // everything may change due to symbolization changes, so we need to // reprocess. - OldClass->RepLeader = *(OldClass->Members.begin()); + DEBUG(dbgs() << "Leader change!\n"); + ++NumGVNLeaderChanges; + // We don't need to sort members if there is only 1, and we don't care about + // sorting the initial class because everything either gets out of it or is + // unreachable. + if (OldClass->Members.size() == 1 || OldClass == InitialClass) { + OldClass->RepLeader = *(OldClass->Members.begin()); + } else if (OldClass->NextLeader.first) { + ++NumGVNAvoidedSortedLeaderChanges; + OldClass->RepLeader = OldClass->NextLeader.first; + OldClass->NextLeader = {nullptr, ~0U}; + } else { + ++NumGVNSortedLeaderChanges; + // TODO: If this ends up to slow, we can maintain a dual structure for + // member testing/insertion, or keep things mostly sorted, and sort only + // here, or .... + std::pair MinDFS = {nullptr, ~0U}; + for (const auto X : OldClass->Members) { + auto DFSNum = InstrDFS.lookup(X); + if (DFSNum < MinDFS.second) + MinDFS = {X, DFSNum}; + } + OldClass->RepLeader = MinDFS.first; + } markLeaderChangeTouched(OldClass); } } // Perform congruence finding on a given value numbering expression. -void NewGVN::performCongruenceFinding(Value *V, const Expression *E) { - ValueToExpression[V] = E; +void NewGVN::performCongruenceFinding(Instruction *I, const Expression *E) { + ValueToExpression[I] = E; // This is guaranteed to return something, since it will at least find // INITIAL. - CongruenceClass *VClass = ValueToClass[V]; - assert(VClass && "Should have found a vclass"); + CongruenceClass *IClass = ValueToClass[I]; + assert(IClass && "Should have found a IClass"); // Dead classes should have been eliminated from the mapping. - assert(!VClass->Dead && "Found a dead class"); + assert(!IClass->Dead && "Found a dead class"); CongruenceClass *EClass; if (const auto *VE = dyn_cast(E)) { @@ -1118,13 +1172,13 @@ void NewGVN::performCongruenceFinding(Va NewClass->RepLeader = lookupOperandLeader(SI->getValueOperand(), SI, SI->getParent()); } else { - NewClass->RepLeader = V; + NewClass->RepLeader = I; } assert(!isa(E) && "VariableExpression should have been handled already"); EClass = NewClass; - DEBUG(dbgs() << "Created new congruence class for " << *V + DEBUG(dbgs() << "Created new congruence class for " << *I << " using expression " << *E << " at " << NewClass->ID << " and leader " << *(NewClass->RepLeader) << "\n"); DEBUG(dbgs() << "Hash value was " << E->getHashValue() << "\n"); @@ -1140,36 +1194,31 @@ void NewGVN::performCongruenceFinding(Va assert(!EClass->Dead && "We accidentally looked up a dead class"); } } - bool ClassChanged = VClass != EClass; - bool LeaderChanged = LeaderChanges.erase(V); + bool ClassChanged = IClass != EClass; + bool LeaderChanged = LeaderChanges.erase(I); if (ClassChanged || LeaderChanged) { DEBUG(dbgs() << "Found class " << EClass->ID << " for expression " << E << "\n"); if (ClassChanged) - - moveValueToNewCongruenceClass(V, VClass, EClass); - - - markUsersTouched(V); - if (auto *I = dyn_cast(V)) { - if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) { - // If this is a MemoryDef, we need to update the equivalence table. If - // we determined the expression is congruent to a different memory - // state, use that different memory state. If we determined it didn't, - // we update that as well. Right now, we only support store - // expressions. - if (!isa(MA) && isa(E) && - EClass->Members.size() != 1) { - auto *DefAccess = cast(E)->getDefiningAccess(); - setMemoryAccessEquivTo(MA, DefAccess != MA ? DefAccess : nullptr); - } else { - setMemoryAccessEquivTo(MA, nullptr); - } - markMemoryUsersTouched(MA); + moveValueToNewCongruenceClass(I, IClass, EClass); + markUsersTouched(I); + if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) { + // If this is a MemoryDef, we need to update the equivalence table. If + // we determined the expression is congruent to a different memory + // state, use that different memory state. If we determined it didn't, + // we update that as well. Right now, we only support store + // expressions. + if (!isa(MA) && isa(E) && + EClass->Members.size() != 1) { + auto *DefAccess = cast(E)->getDefiningAccess(); + setMemoryAccessEquivTo(MA, DefAccess != MA ? DefAccess : nullptr); + } else { + setMemoryAccessEquivTo(MA, nullptr); } + markMemoryUsersTouched(MA); } - } else if (StoreInst *SI = dyn_cast(V)) { + } else if (auto *SI = dyn_cast(I)) { // There is, sadly, one complicating thing for stores. Stores do not // produce values, only consume them. However, in order to make loads and // stores value number the same, we ignore the value operand of the store. Modified: vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -5602,6 +5602,13 @@ void LoopVectorizationLegality::collectL // is consecutive-like, the pointer operand should remain uniform. else if (hasConsecutiveLikePtrOperand(&I)) ConsecutiveLikePtrs.insert(Ptr); + + // Otherwise, if the memory instruction will be vectorized and its + // pointer operand is non-consecutive-like, the memory instruction should + // be a gather or scatter operation. Its pointer operand will be + // non-uniform. + else + PossibleNonUniformPtrs.insert(Ptr); } // Add to the Worklist all consecutive and consecutive-like pointers that Modified: vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -192,68 +192,4 @@ entry: ret i8 %s2 } -define i8 @test_sub_1_setcc_eq(i64* %p) #0 { -; CHECK-LABEL: test_sub_1_setcc_eq: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: lock decq (%rdi) -; CHECK-NEXT: sete %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw sub i64* %p, i64 1 seq_cst - %tmp1 = icmp eq i64 %tmp0, 1 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -define i8 @test_add_5_setcc_ne(i64* %p) #0 { -; CHECK-LABEL: test_add_5_setcc_ne: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: lock addq $5, (%rdi) -; CHECK-NEXT: setne %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw add i64* %p, i64 5 seq_cst - %tmp1 = icmp ne i64 %tmp0, -5 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -define i8 @test_add_5_setcc_ne_comparand_mismatch(i64* %p) #0 { -; CHECK-LABEL: test_add_5_setcc_ne_comparand_mismatch: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: movl $5, %eax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: testq %rax, %rax -; CHECK-NEXT: setne %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw add i64* %p, i64 5 seq_cst - %tmp1 = icmp ne i64 %tmp0, 0 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -declare void @g() -define zeroext i1 @test_sub_1_setcc_jcc(i64* %p) local_unnamed_addr #0 { -; TODO: It's possible to use "lock dec" here, but both uses of the cmp need to -; be updated. -; CHECK-LABEL: test_sub_1_setcc_jcc: -; CHECK: # BB#0: # %entry -; CHECK: movq $-1, %rax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: cmpq $1, %rax -; CHECK-NEXT: sete %bl -; CHECK-NEXT: jne -entry: - %add = atomicrmw volatile add i64* %p, i64 -1 seq_cst - %cmp = icmp ne i64 %add, 1 - %not = xor i1 %cmp, true - br i1 %cmp, label %else, label %then -then: - tail call void @g() - br label %else -else: - ret i1 %not -} - attributes #0 = { nounwind } Modified: vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -4,6 +4,9 @@ ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE4-32 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE4-64 +; Make sure that the slow-pmulld feature can be used without SSE4.1. +; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=silvermont -mattr=-sse4.1 + define <4 x i32> @foo(<4 x i8> %A) { ; CHECK32-LABEL: foo: ; CHECK32: # BB#0: Modified: vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll ============================================================================== --- vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -17,7 +17,7 @@ ; RUN: -o /dev/null -disable-ondemand-mds-loading -stats \ ; RUN: 2>&1 | FileCheck %s -check-prefix=NOTLAZY ; NOTLAZY: 58 bitcode-reader - Number of Metadata records loaded -; NOTLAZY: 8 bitcode-reader - Number of MDStrings loaded +; NOTLAZY: 6 bitcode-reader - Number of MDStrings loaded target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" @@ -48,7 +48,7 @@ define void @globalfunc3(i32 %arg) { !3 = !{!"3"} !4 = !{!"4"} !5 = !{!"5"} -!6 = !{!"6"} +!6 = !{!9} !7 = !{!"7"} !8 = !{!"8"} -!9 = !{!"9"} +!9 = !{!6} Added: vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,58 @@ +; RUN: opt -S -loop-reduce < %s | FileCheck %s +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc19.0.24215" + +define void @fn3() personality i32 (...)* @__CxxFrameHandler3 { +entry: + %call = invoke i32 @fn2() + to label %for.cond.preheader unwind label %catch.dispatch2 + +for.cond.preheader: ; preds = %entry + br label %for.cond + +for.cond: ; preds = %for.cond.preheader, %for.cond + %b.0 = phi i32 [ %inc, %for.cond ], [ %call, %for.cond.preheader ] + %inc = add nsw i32 %b.0, 1 + invoke void @fn1(i32 %inc) + to label %for.cond unwind label %catch.dispatch + +; CHECK: %[[add:.*]] = add i32 %call, 1 +; CHECK: br label %for.cond + +; CHECK: for.cond: ; preds = %for.cond, %for.cond.preheader +; CHECK: %[[lsr_iv:.*]] = phi i32 [ %lsr.iv.next, %for.cond ], [ %[[add]], %for.cond.preheader ] +; CHECK: %[[lsr_iv_next:.*]] = add i32 %lsr.iv, 1 +; CHECK: invoke void @fn1(i32 %[[lsr_iv]]) + + +catch.dispatch: ; preds = %for.cond + %0 = catchswitch within none [label %catch] unwind label %catch.dispatch2 + +catch: ; preds = %catch.dispatch + %1 = catchpad within %0 [i8* null, i32 64, i8* null] + invoke void @_CxxThrowException(i8* null, i8* null) #2 [ "funclet"(token %1) ] + to label %unreachable unwind label %catch.dispatch2 + +catch.dispatch2: ; preds = %catch.dispatch, %catch, %entry + %a.0 = phi i32 [ undef, %entry ], [ %call, %catch ], [ %call, %catch.dispatch ] + %2 = catchswitch within none [label %catch3] unwind to caller + +catch3: ; preds = %catch.dispatch2 + %3 = catchpad within %2 [i8* null, i32 64, i8* null] + call void @fn1(i32 %a.0) [ "funclet"(token %3) ] + catchret from %3 to label %try.cont4 + +try.cont4: ; preds = %catch3 + ret void + +unreachable: ; preds = %catch + unreachable +} + +declare i32 @fn2() + +declare i32 @__CxxFrameHandler3(...) + +declare void @fn1(i32) + +declare void @_CxxThrowException(i8*, i8*) Added: vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,56 @@ +; REQUIRES: asserts +; RUN: opt < %s -loop-vectorize -instcombine -S -debug-only=loop-vectorize -disable-output -print-after=instcombine 2>&1 | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: PR31671 +; +; Check a pointer in which one of its uses is consecutive-like and another of +; its uses is non-consecutive-like. In the test case below, %tmp3 is the +; pointer operand of an interleaved load, making it consecutive-like. However, +; it is also the pointer operand of a non-interleaved store that will become a +; scatter operation. %tmp3 (and the induction variable) should not be marked +; uniform-after-vectorization. +; +; CHECK: LV: Found uniform instruction: %tmp0 = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %i +; CHECK-NOT: LV: Found uniform instruction: %tmp3 = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %i +; CHECK-NOT: LV: Found uniform instruction: %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] +; CHECK-NOT: LV: Found uniform instruction: %i.next = add nuw nsw i64 %i, 5 +; CHECK: vector.body: +; CHECK: %vec.ind = phi <16 x i64> +; CHECK: %[[T0:.+]] = extractelement <16 x i64> %vec.ind, i32 0 +; CHECK: %[[T1:.+]] = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %[[T0]] +; CHECK: %[[T2:.+]] = bitcast float* %[[T1]] to <80 x float>* +; CHECK: load <80 x float>, <80 x float>* %[[T2]], align 4 +; CHECK: %[[T3:.+]] = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %[[T0]] +; CHECK: %[[T4:.+]] = bitcast float* %[[T3]] to <80 x float>* +; CHECK: load <80 x float>, <80 x float>* %[[T4]], align 4 +; CHECK: %VectorGep = getelementptr inbounds %data, %data* %d, i64 0, i32 0, <16 x i64> %vec.ind +; CHECK: call void @llvm.masked.scatter.v16f32({{.*}}, <16 x float*> %VectorGep, {{.*}}) +; CHECK: br i1 {{.*}}, label %middle.block, label %vector.body + +%data = type { [32000 x float], [3 x i32], [4 x i8], [32000 x float] } + +define void @PR31671(float %x, %data* %d) #0 { +entry: + br label %for.body + +for.body: + %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] + %tmp0 = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %i + %tmp1 = load float, float* %tmp0, align 4 + %tmp2 = fmul float %x, %tmp1 + %tmp3 = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %i + %tmp4 = load float, float* %tmp3, align 4 + %tmp5 = fadd float %tmp4, %tmp2 + store float %tmp5, float* %tmp3, align 4 + %i.next = add nuw nsw i64 %i, 5 + %cond = icmp slt i64 %i.next, 32000 + br i1 %cond, label %for.body, label %for.end + +for.end: + ret void +} + +attributes #0 = { "target-cpu"="knl" } Added: vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,135 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" + +;; Both of these tests are tests of phi nodes that end up all equivalent to each other +;; Without proper leader ordering, we will end up cycling the leader between all of them and never converge. + +define void @foo() { +; CHECK-LABEL: @foo( +; CHECK-NEXT: bb: +; CHECK-NEXT: br label [[BB1:%.*]] +; CHECK: bb1: +; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ 0, [[BB:%.*]] ], [ 1, [[BB18:%.*]] ] +; CHECK-NEXT: br label [[BB2:%.*]] +; CHECK: bb2: +; CHECK-NEXT: br label [[BB4:%.*]] +; CHECK: bb4: +; CHECK-NEXT: br i1 undef, label [[BB18]], label [[BB7:%.*]] +; CHECK: bb7: +; CHECK-NEXT: br label [[BB9:%.*]] +; CHECK: bb9: +; CHECK-NEXT: br i1 undef, label [[BB2]], label [[BB11:%.*]] +; CHECK: bb11: +; CHECK-NEXT: br i1 undef, label [[BB16:%.*]], label [[BB14:%.*]] +; CHECK: bb14: +; CHECK-NEXT: br label [[BB4]] +; CHECK: bb16: +; CHECK-NEXT: br label [[BB7]] +; CHECK: bb18: +; CHECK-NEXT: br label [[BB1]] +; +bb: + br label %bb1 + +bb1: ; preds = %bb18, %bb + %tmp = phi i32 [ 0, %bb ], [ 1, %bb18 ] + br label %bb2 + +bb2: ; preds = %bb9, %bb1 + %tmp3 = phi i32 [ %tmp, %bb1 ], [ %tmp8, %bb9 ] + br label %bb4 + +bb4: ; preds = %bb14, %bb2 + %tmp5 = phi i32 [ %tmp3, %bb2 ], [ %tmp15, %bb14 ] + br i1 undef, label %bb18, label %bb7 + +bb7: ; preds = %bb16, %bb4 + %tmp8 = phi i32 [ %tmp17, %bb16 ], [ %tmp5, %bb4 ] + br label %bb9 + +bb9: ; preds = %bb7 + br i1 undef, label %bb2, label %bb11 + +bb11: ; preds = %bb9 + br i1 undef, label %bb16, label %bb14 + +bb14: ; preds = %bb11 + %tmp15 = phi i32 [ %tmp8, %bb11 ] + br label %bb4 + +bb16: ; preds = %bb11 + %tmp17 = phi i32 [ %tmp8, %bb11 ] + br label %bb7 + +bb18: ; preds = %bb4 + br label %bb1 +} + +%struct.a = type {} +%struct.b = type {} + +declare void @c.d.p(i64, i8*) + +define void @e() { +; CHECK-LABEL: @e( +; CHECK-NEXT: [[F:%.*]] = alloca i32 +; CHECK-NEXT: store i32 undef, i32* [[F]], !g !0 +; CHECK-NEXT: br label [[H:%.*]] +; CHECK: h: +; CHECK-NEXT: call void @c.d.p(i64 8, i8* undef) +; CHECK-NEXT: [[I:%.*]] = load i32, i32* [[F]] +; CHECK-NEXT: [[J:%.*]] = load i32, i32* null +; CHECK-NEXT: [[K:%.*]] = icmp eq i32 [[I]], [[J]] +; CHECK-NEXT: br i1 [[K]], label [[L:%.*]], label [[Q:%.*]] +; CHECK: l: +; CHECK-NEXT: br label [[R:%.*]] +; CHECK: q: +; CHECK-NEXT: [[M:%.*]] = load %struct.a*, %struct.a** null +; CHECK-NEXT: br label [[R]] +; CHECK: r: +; CHECK-NEXT: switch i32 undef, label [[N:%.*]] [ +; CHECK-NEXT: i32 0, label [[S:%.*]] +; CHECK-NEXT: ] +; CHECK: s: +; CHECK-NEXT: store i32 undef, i32* [[F]], !g !0 +; CHECK-NEXT: br label [[H]] +; CHECK: n: +; CHECK-NEXT: [[O:%.*]] = load %struct.a*, %struct.a** null +; CHECK-NEXT: ret void +; + %f = alloca i32 + store i32 undef, i32* %f, !g !0 + br label %h + +h: ; preds = %s, %0 + call void @c.d.p(i64 8, i8* undef) + %i = load i32, i32* %f + %j = load i32, i32* null + %k = icmp eq i32 %i, %j + br i1 %k, label %l, label %q + +l: ; preds = %h + br label %r + +q: ; preds = %h + %m = load %struct.a*, %struct.a** null + %1 = bitcast %struct.a* %m to %struct.b* + br label %r + +r: ; preds = %q, %l + switch i32 undef, label %n [ + i32 0, label %s + ] + +s: ; preds = %r + store i32 undef, i32* %f, !g !0 + br label %h + +n: ; preds = %r + %o = load %struct.a*, %struct.a** null + %2 = bitcast %struct.a* %o to %struct.b* + ret void +} + +!0 = !{} From owner-svn-src-all@freebsd.org Sun Jan 22 16:52: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 BC967CBD440; Sun, 22 Jan 2017 16:52:36 +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 73709F3C; Sun, 22 Jan 2017 16:52:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MGqZ4R022848; Sun, 22 Jan 2017 16:52:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqZaU022847; Sun, 22 Jan 2017 16:52:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqZaU022847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312626 - vendor/llvm/llvm-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:36 -0000 Author: dim Date: Sun Jan 22 16:52:35 2017 New Revision: 312626 URL: https://svnweb.freebsd.org/changeset/base/312626 Log: Tag llvm release_40 branch r292732. Added: vendor/llvm/llvm-release_40-r292732/ - copied from r312625, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 16: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 F0A81CBD49A; Sun, 22 Jan 2017 16:52:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7230103A; Sun, 22 Jan 2017 16:52:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MGqkDQ022971; Sun, 22 Jan 2017 16:52:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqkkI022970; Sun, 22 Jan 2017 16:52:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqkkI022970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312628 - vendor/clang/clang-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:48 -0000 Author: dim Date: Sun Jan 22 16:52:46 2017 New Revision: 312628 URL: https://svnweb.freebsd.org/changeset/base/312628 Log: Tag clang release_40 branch r292732. Added: vendor/clang/clang-release_40-r292732/ - copied from r312627, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 16:52: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 23907CBD48D; Sun, 22 Jan 2017 16:52:45 +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 E0422FDF; Sun, 22 Jan 2017 16:52:44 +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 v0MGqij2022923; Sun, 22 Jan 2017 16:52:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqf6N022896; Sun, 22 Jan 2017 16:52:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqf6N022896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312627 - in vendor/clang/dist: bindings/python/clang docs include/clang/Basic lib/Basic lib/Frontend lib/Parse lib/Sema test/CXX/dcl.dcl/basic.namespace/namespace.udecl test/CXX/dcl.de... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:45 -0000 Author: dim Date: Sun Jan 22 16:52:41 2017 New Revision: 312627 URL: https://svnweb.freebsd.org/changeset/base/312627 Log: Vendor import of clang release_40 branch r292732: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292732 Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp (contents, props changed) Modified: vendor/clang/dist/bindings/python/clang/__init__.py vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/docs/AttributeReference.rst vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/docs/UsersManual.rst vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/Frontend/DependencyFile.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp vendor/clang/dist/test/CXX/drs/dr16xx.cpp vendor/clang/dist/test/CXX/drs/dr19xx.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp vendor/clang/dist/test/CodeCompletion/member-access.cpp vendor/clang/dist/test/Driver/netbsd.c vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Modified: vendor/clang/dist/bindings/python/clang/__init__.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:41 2017 (r312627) @@ -20,5 +20,13 @@ The available modules are: Bindings for the Clang indexing library. """ + +# Python 3 uses unicode for strings. The bindings, in particular the interaction +# with ctypes, need modifying to handle conversions between unicode and +# c-strings. +import sys +if sys.version_info[0] != 2: + raise Exception("Only Python 2 is supported.") + __all__ = ['cindex'] Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:41 2017 (r312627) @@ -554,8 +554,8 @@ class BaseEnumeration(object): if value >= len(self.__class__._kinds): self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1) if self.__class__._kinds[value] is not None: - raise ValueError,'{0} value {1} already loaded'.format( - str(self.__class__), value) + raise ValueError('{0} value {1} already loaded'.format( + str(self.__class__), value)) self.value = value self.__class__._kinds[value] = self self.__class__._name_map = None @@ -577,7 +577,7 @@ class BaseEnumeration(object): @classmethod def from_id(cls, id): if id >= len(cls._kinds) or cls._kinds[id] is None: - raise ValueError,'Unknown template argument kind %d' % id + raise ValueError('Unknown template argument kind %d' % id) return cls._kinds[id] def __repr__(self): @@ -1777,7 +1777,7 @@ class StorageClass(object): if value >= len(StorageClass._kinds): StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1) if StorageClass._kinds[value] is not None: - raise ValueError,'StorageClass already loaded' + raise ValueError('StorageClass already loaded') self.value = value StorageClass._kinds[value] = self StorageClass._name_map = None @@ -1798,7 +1798,7 @@ class StorageClass(object): @staticmethod def from_id(id): if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]: - raise ValueError,'Unknown storage class %d' % id + raise ValueError('Unknown storage class %d' % id) return StorageClass._kinds[id] def __repr__(self): @@ -2729,9 +2729,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) @@ -2793,9 +2793,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) Modified: vendor/clang/dist/docs/AttributeReference.rst ============================================================================== --- vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -456,6 +456,7 @@ warnings or errors at compile-time if ca 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) Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -46,8 +46,35 @@ Major New Features clang to emit a warning or error if a function call meets one or more user-specified conditions. +- Enhanced devirtualization with + `-fstrict-vtable-pointers `_. + Clang devirtualizes across different basic blocks, like loops: + + .. code-block:: c++ + + struct A { + virtual void foo(); + }; + void indirect(A &a, int n) { + for (int i = 0 ; i < n; i++) + a.foo(); + } + void test(int n) { + A a; + indirect(a, n); + } + + - ... +Improvements to ThinLTO (-flto=thin) +------------------------------------ +- Integration with profile data (PGO). When available, profile data enables + more accurate function importing decisions, as well as cross-module indirect + call promotion. +- Significant build-time and binary-size improvements when compiling with debug + info (-g). + Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Modified: vendor/clang/dist/docs/UsersManual.rst ============================================================================== --- vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -1097,6 +1097,14 @@ are listed below. the behavior of sanitizers in the ``cfi`` group to allow checking of cross-DSO virtual and indirect calls. + +.. option:: -fstrict-vtable-pointers + + Enable optimizations based on the strict rules for overwriting polymorphic + C++ objects, i.e. the vptr is invariant during an object's lifetime. + This enables better devirtualization. Turned off by default, because it is + still experimental. + .. option:: -ffast-math Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor @@ -2645,7 +2653,7 @@ Execute ``clang-cl /?`` to see a list of (overridden by LLVM_PROFILE_FILE env var) -fprofile-instr-generate Generate instrumented code to collect execution counts into default.profraw file - (overriden by '=' form of option or LLVM_PROFILE_FILE env var) + (overridden by '=' form of option or LLVM_PROFILE_FILE env var) -fprofile-instr-use= Use instrumentation data for profile-guided optimization -fsanitize-blacklist= Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:41 2017 (r312627) @@ -3337,8 +3337,8 @@ def note_ovl_candidate : Note<"candidate def note_ovl_candidate_inherited_constructor : Note< "constructor from base class %0 inherited here">; def note_ovl_candidate_inherited_constructor_slice : Note< - "constructor inherited from base class cannot be used to initialize from " - "an argument of the derived class type">; + "candidate %select{constructor|template}0 ignored: " + "inherited constructor cannot be used to %select{copy|move}1 object">; def note_ovl_candidate_illegal_constructor : Note< "candidate %select{constructor|template}0 ignored: " "instantiation %select{takes|would take}0 its own class type by value">; Modified: vendor/clang/dist/lib/Basic/Targets.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -512,7 +512,7 @@ protected: Builder.defineMacro("__unix__"); Builder.defineMacro("__ELF__"); if (Opts.POSIXThreads) - Builder.defineMacro("_POSIX_THREADS"); + Builder.defineMacro("_REENTRANT"); switch (Triple.getArch()) { default: Modified: vendor/clang/dist/lib/Frontend/DependencyFile.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -447,9 +447,9 @@ void DFGImpl::OutputDependencyFile() { // Create phony targets if requested. if (PhonyTarget && !Files.empty()) { // Skip the first entry, this is always the input file itself. - for (StringRef File : Files) { + for (auto I = Files.begin() + 1, E = Files.end(); I != E; ++I) { OS << '\n'; - PrintFilename(OS, File, OutputFormat); + PrintFilename(OS, *I, OutputFormat); OS << ":\n"; } } Modified: vendor/clang/dist/lib/Parse/ParseExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1652,9 +1652,10 @@ Parser::ParsePostfixExpressionSuffix(Exp if (Tok.is(tok::code_completion)) { // Code completion for a member access expression. - Actions.CodeCompleteMemberReferenceExpr( - getCurScope(), LHS.get(), OpLoc, OpKind == tok::arrow, - ExprStatementTokLoc == LHS.get()->getLocStart()); + if (Expr *Base = LHS.get()) + Actions.CodeCompleteMemberReferenceExpr( + getCurScope(), Base, OpLoc, OpKind == tok::arrow, + ExprStatementTokLoc == Base->getLocStart()); cutOffParsing(); return ExprError(); Modified: vendor/clang/dist/lib/Sema/SemaOverload.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5944,6 +5944,28 @@ Sema::AddOverloadCandidate(FunctionDecl Candidate.FailureKind = ovl_fail_illegal_constructor; return; } + + // C++ [over.match.funcs]p8: (proposed DR resolution) + // A constructor inherited from class type C that has a first parameter + // of type "reference to P" (including such a constructor instantiated + // from a template) is excluded from the set of candidate functions when + // constructing an object of type cv D if the argument list has exactly + // one argument and D is reference-related to P and P is reference-related + // to C. + auto *Shadow = dyn_cast(FoundDecl.getDecl()); + if (Shadow && Args.size() == 1 && Constructor->getNumParams() >= 1 && + Constructor->getParamDecl(0)->getType()->isReferenceType()) { + QualType P = Constructor->getParamDecl(0)->getType()->getPointeeType(); + QualType C = Context.getRecordType(Constructor->getParent()); + QualType D = Context.getRecordType(Shadow->getParent()); + SourceLocation Loc = Args.front()->getExprLoc(); + if ((Context.hasSameUnqualifiedType(P, C) || IsDerivedFrom(Loc, P, C)) && + (Context.hasSameUnqualifiedType(D, P) || IsDerivedFrom(Loc, D, P))) { + Candidate.Viable = false; + Candidate.FailureKind = ovl_fail_inhctor_slice; + return; + } + } } unsigned NumParams = Proto->getNumParams(); @@ -6016,31 +6038,6 @@ Sema::AddOverloadCandidate(FunctionDecl } } - // C++ [over.best.ics]p4+: (proposed DR resolution) - // If the target is the first parameter of an inherited constructor when - // constructing an object of type C with an argument list that has exactly - // one expression, an implicit conversion sequence cannot be formed if C is - // reference-related to the type that the argument would have after the - // application of the user-defined conversion (if any) and before the final - // standard conversion sequence. - auto *Shadow = dyn_cast(FoundDecl.getDecl()); - if (Shadow && Args.size() == 1 && !isa(Args.front())) { - bool DerivedToBase, ObjCConversion, ObjCLifetimeConversion; - QualType ConvertedArgumentType = Args.front()->getType(); - if (Candidate.Conversions[0].isUserDefined()) - ConvertedArgumentType = - Candidate.Conversions[0].UserDefined.After.getFromType(); - if (CompareReferenceRelationship(Args.front()->getLocStart(), - Context.getRecordType(Shadow->getParent()), - ConvertedArgumentType, DerivedToBase, - ObjCConversion, - ObjCLifetimeConversion) >= Ref_Related) { - Candidate.Viable = false; - Candidate.FailureKind = ovl_fail_inhctor_slice; - return; - } - } - if (EnableIfAttr *FailedAttr = CheckEnableIf(Function, Args)) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_enable_if; @@ -10222,8 +10219,13 @@ static void NoteFunctionCandidate(Sema & return DiagnoseOpenCLExtensionDisabled(S, Cand); case ovl_fail_inhctor_slice: + // It's generally not interesting to note copy/move constructors here. + if (cast(Fn)->isCopyOrMoveConstructor()) + return; S.Diag(Fn->getLocation(), - diag::note_ovl_candidate_inherited_constructor_slice); + diag::note_ovl_candidate_inherited_constructor_slice) + << (Fn->getPrimaryTemplate() ? 1 : 0) + << Fn->getParamDecl(0)->getType()->isRValueReferenceType(); MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl); return; Modified: vendor/clang/dist/lib/Sema/SemaTemplate.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5127,18 +5127,22 @@ ExprResult Sema::CheckTemplateArgument(N if (CTAK == CTAK_Deduced && !Context.hasSameType(ParamType.getNonLValueExprType(Context), Arg->getType())) { - // C++ [temp.deduct.type]p17: (DR1770) - // If P has a form that contains , and if the type of i differs from - // the type of the corresponding template parameter of the template named - // by the enclosing simple-template-id, deduction fails. - // - // Note that CTAK will be CTAK_DeducedFromArrayBound if the form was [i] - // rather than . - // - // FIXME: We interpret the 'i' here as referring to the expression - // denoting the non-type template parameter rather than the parameter - // itself, and so strip off references before comparing types. It's - // not clear how this is supposed to work for references. + // FIXME: If either type is dependent, we skip the check. This isn't + // correct, since during deduction we're supposed to have replaced each + // template parameter with some unique (non-dependent) placeholder. + // FIXME: If the argument type contains 'auto', we carry on and fail the + // type check in order to force specific types to be more specialized than + // 'auto'. It's not clear how partial ordering with 'auto' is supposed to + // work. + if ((ParamType->isDependentType() || Arg->isTypeDependent()) && + !Arg->getType()->getContainedAutoType()) { + Converted = TemplateArgument(Arg); + return Arg; + } + // FIXME: This attempts to implement C++ [temp.deduct.type]p17. Per DR1770, + // we should actually be checking the type of the template argument in P, + // not the type of the template argument deduced from A, against the + // template parameter type. Diag(StartLoc, diag::err_deduced_non_type_template_arg_type_mismatch) << Arg->getType() << ParamType.getUnqualifiedType(); Modified: vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1,16 +1,16 @@ // RUN: %clang_cc1 -std=c++11 -verify %s -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; D1 d1(0); // expected-error {{ambiguous}} @@ -35,7 +35,7 @@ namespace default_ctor { operator D&&(); }; - struct A { // expected-note 4{{candidate}} + struct A { // expected-note 2{{candidate}} A(); // expected-note {{candidate}} A(C &&); // expected-note {{candidate}} @@ -47,7 +47,7 @@ namespace default_ctor { A(convert_to_D2); // expected-note {{candidate}} }; - struct B { // expected-note 4{{candidate}} + struct B { // expected-note 2{{candidate}} B(); // expected-note {{candidate}} B(C &&); // expected-note {{candidate}} @@ -66,9 +66,9 @@ namespace default_ctor { using B::operator=; }; struct D : A, B { - using A::A; // expected-note 5{{inherited here}} + using A::A; // expected-note 3{{inherited here}} using A::operator=; - using B::B; // expected-note 5{{inherited here}} + using B::B; // expected-note 3{{inherited here}} using B::operator=; D(int); @@ -93,13 +93,13 @@ namespace default_ctor { } struct Y; - struct X { // expected-note 2{{candidate}} + struct X { X(); - X(volatile Y &); // expected-note {{constructor inherited from base class cannot be used to initialize from an argument of the derived class type}} + X(volatile Y &); // expected-note 3{{inherited constructor cannot be used to copy object}} } x; - struct Y : X { using X::X; } volatile y; // expected-note 2{{candidate}} - struct Z : Y { using Y::Y; } volatile z; // expected-note 3{{candidate}} expected-note 5{{inherited here}} - Z z1(x); // ok - Z z2(y); // ok, Z is not reference-related to type of y + struct Y : X { using X::X; } volatile y; + struct Z : Y { using Y::Y; } volatile z; // expected-note 4{{no known conversion}} expected-note 2{{would lose volatile}} expected-note 3{{requires 0}} expected-note 3{{inherited here}} + Z z1(x); // expected-error {{no match}} + Z z2(y); // expected-error {{no match}} Z z3(z); // expected-error {{no match}} } Modified: vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -134,13 +134,13 @@ ExplicitDefaultedAggr eda2{}; struct DefaultedBase { int n; - DefaultedBase() = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase const&) = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase &&) = default; // expected-note 0+ {{candidate}} + DefaultedBase() = default; + DefaultedBase(DefaultedBase const&) = default; + DefaultedBase(DefaultedBase &&) = default; }; struct InheritingConstructors : DefaultedBase { // expected-note 3 {{candidate}} - using DefaultedBase::DefaultedBase; // expected-note 2 {{inherited here}} + using DefaultedBase::DefaultedBase; }; InheritingConstructors ic = { 42 }; // expected-error {{no matching constructor}} Modified: vendor/clang/dist/test/CXX/drs/dr16xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -71,14 +71,14 @@ namespace dr1638 { // dr1638: yes namespace dr1645 { // dr1645: 3.9 #if __cplusplus >= 201103L - struct A { // expected-note 2{{candidate}} + struct A { constexpr A(int, float = 0); // expected-note 2{{candidate}} explicit A(int, int = 0); // expected-note 2{{candidate}} A(int, int, int = 0) = delete; // expected-note {{candidate}} }; struct B : A { // expected-note 2{{candidate}} - using A::A; // expected-note 7{{inherited here}} + using A::A; // expected-note 5{{inherited here}} }; constexpr B a(0); // expected-error {{ambiguous}} Modified: vendor/clang/dist/test/CXX/drs/dr19xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -138,18 +138,21 @@ namespace dr1959 { // dr1959: 3.9 struct c; struct a { a() = default; - a(const a &) = delete; // expected-note 2{{deleted}} + a(const a &) = delete; // expected-note {{deleted}} a(const b &) = delete; // not inherited - a(c &&) = delete; - template a(T) = delete; + a(c &&) = delete; // expected-note {{not viable}} + template a(T) = delete; // expected-note {{would take its own class type by value}} }; - struct b : a { // expected-note {{copy constructor of 'b' is implicitly deleted because base class 'dr1959::a' has a deleted copy constructor}} - using a::a; + struct b : a { // expected-note {{cannot bind}} expected-note {{deleted because}} + using a::a; // expected-note 2{{inherited here}} }; a x; - b y = x; // expected-error {{deleted}} + // FIXME: As a resolution to an open DR against P0136R0, we disallow + // use of inherited constructors to construct from a single argument + // where the base class is reference-related to the argument type. + b y = x; // expected-error {{no viable conversion}} b z = z; // expected-error {{deleted}} struct c : a { @@ -158,7 +161,7 @@ namespace dr1959 { // dr1959: 3.9 }; // FIXME: As a resolution to an open DR against P0136R0, we disallow // use of inherited constructors to construct from a single argument - // where the derived class is reference-related to its type. + // where the base class is reference-related to the argument type. c q(static_cast(q)); #endif } Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,7 +3,7 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct A { // expected-note 8{{candidate is the implicit}} +struct A { // expected-note 4{{candidate is the implicit}} A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}} A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} @@ -15,7 +15,7 @@ struct A { // expected-note 8{{candidate }; struct B : A { // expected-note 4{{candidate is the implicit}} - using A::A; // expected-note 19{{inherited here}} + using A::A; // expected-note 15{{inherited here}} B(void*); }; Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -14,21 +14,21 @@ D1 d1a(1), d1b(1, 1); D1 fd1() { return 1; } -struct B2 { // expected-note 2{{candidate}} +struct B2 { explicit B2(int, int = 0, int = 0); }; struct D2 : B2 { // expected-note 2{{candidate constructor}} - using B2::B2; // expected-note 2{{inherited here}} + using B2::B2; }; D2 d2a(1), d2b(1, 1), d2c(1, 1, 1); D2 fd2() { return 1; } // expected-error {{no viable conversion}} -struct B3 { // expected-note 2{{candidate}} +struct B3 { B3(void*); // expected-note {{candidate}} }; struct D3 : B3 { // expected-note 2{{candidate constructor}} - using B3::B3; // expected-note 3{{inherited here}} + using B3::B3; // expected-note {{inherited here}} }; D3 fd3() { return 1; } // expected-error {{no viable conversion}} Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,15 +3,15 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; struct D2 : B1, B2 { using B1::B1; Modified: vendor/clang/dist/test/CodeCompletion/member-access.cpp ============================================================================== --- vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -27,6 +27,16 @@ public: void test(const Proxy &p) { p-> +} + +struct Test1 { + Base1 b; + + static void sfunc() { + b. // expected-error {{invalid use of member 'b' in static member function}} + } +}; + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: Base1 : Base1:: // CHECK-CC1: member1 : [#int#][#Base1::#]member1 @@ -39,4 +49,6 @@ void test(const Proxy &p) { // CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>) // CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>) // CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>) - + +// Make sure this doesn't crash +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:7 %s -verify Modified: vendor/clang/dist/test/Driver/netbsd.c ============================================================================== --- vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:41 2017 (r312627) @@ -126,6 +126,8 @@ // RUN: %clang -no-canonical-prefixes -target powerpc64--netbsd -static \ // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=S-POWERPC64 %s +// RUN: %clang -target x86_64--netbsd -pthread -dM -E %s \ +// RUN: | FileCheck -check-prefix=PTHREAD %s // STATIC: ld{{.*}}" "--eh-frame-hdr" // STATIC-NOT: "-pie" @@ -427,3 +429,7 @@ // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" + +// PTHREAD-NOT: _POSIX_THREADS +// PTHREAD: _REENTRANT +// PTHREAD-NOT: _POSIX_THREADS Modified: vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c ============================================================================== --- vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:41 2017 (r312627) @@ -32,5 +32,12 @@ // RUN: FileCheck -check-prefix=TEST5 %s < %t.d // TEST5: foo $$(bar) b az qu\ ux \ space: +// Test self dependency, PR31644 + +// RUN: %clang -E -MD -MP -MF %t.d %s +// RUN: FileCheck -check-prefix=TEST6 %s < %t.d +// TEST6: dependencies-and-pp.c +// TEST6-NOT: dependencies-and-pp.c: + // TODO: Test default target without quoting // TODO: Test default target with quoting Modified: vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -56,9 +56,9 @@ namespace InvalidConstruction { } namespace ExplicitConv { - struct B {}; // expected-note 2{{candidate}} + struct B {}; struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + using B::B; }; struct X { explicit operator B(); } x; struct Y { explicit operator D(); } y; @@ -68,19 +68,40 @@ namespace ExplicitConv { } namespace NestedListInit { - struct B { B(); } b; // expected-note 5{{candidate}} - struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + struct B { B(); } b; // expected-note 3{{candidate}} + struct D : B { // expected-note 14{{not viable}} + using B::B; }; // This is a bit weird. We're allowed one pair of braces for overload // resolution, and one more pair of braces due to [over.ics.list]/2. B b1 = {b}; B b2 = {{b}}; B b3 = {{{b}}}; // expected-error {{no match}} - // This is the same, but we get one call to D's version of B::B(const B&) - // before the two permitted calls to D::D(D&&). - D d1 = {b}; - D d2 = {{b}}; - D d3 = {{{b}}}; + // Per a proposed defect resolution, we don't get to call + // D's version of B::B(const B&) here. + D d0 = b; // expected-error {{no viable conversion}} + D d1 = {b}; // expected-error {{no match}} + D d2 = {{b}}; // expected-error {{no match}} + D d3 = {{{b}}}; // expected-error {{no match}} D d4 = {{{{b}}}}; // expected-error {{no match}} } + +namespace PR31606 { + // PR31606: as part of a proposed defect resolution, do not consider + // inherited constructors that would be copy constructors for any class + // between the declaring class and the constructed class (inclusive). + struct Base {}; + + struct A : Base { + using Base::Base; + bool operator==(A const &) const; // expected-note {{no known conversion from 'PR31606::B' to 'const PR31606::A' for 1st argument}} + }; + + struct B : Base { + using Base::Base; + }; + + bool a = A{} == A{}; + // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}. + bool b = A{} == B{}; // expected-error {{invalid operands}} +} Modified: vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -207,19 +207,19 @@ namespace NTTPTypeVsPartialOrder { struct X { typedef int value_type; }; template struct Y { typedef T value_type; }; - template struct A; // expected-note {{template}} + template struct A; template struct A {}; - template struct A, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} + template struct A, N> {}; A ax; A, 0> ay; - template struct B; // expected-note {{template}} - template struct B<0, T, N>; // expected-note {{matches}} + template struct B; + template struct B<0, T, N>; template struct B<0, X, N> {}; - template struct B<0, Y, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} expected-note {{matches}} + template struct B<0, Y, N> {}; B<0, X, 0> bx; - B<0, Y, 0> by; // expected-error {{ambiguous}} + B<0, Y, 0> by; } namespace DefaultArgVsPartialSpec { Modified: vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -17,7 +17,7 @@ void test_Unexpanded() { // Test using non-type members from pack of base classes. template struct A : T... { // expected-note 2{{candidate}} - using T::T ...; // expected-note 6{{inherited here}} + using T::T ...; // expected-note 2{{inherited here}} using T::operator() ...; using T::operator T* ...; using T::h ...; @@ -29,7 +29,7 @@ template struct A : T... }; namespace test_A { - struct X { // expected-note 2{{candidate}} + struct X { X(); X(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} @@ -43,7 +43,7 @@ namespace test_A { operator Y *(); void h(int, int); // expected-note {{not viable}} }; - struct Z { // expected-note 2{{candidate}} + struct Z { Z(); Z(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/SemaTemplate/partial-order.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify + +// expected-no-diagnostics + +namespace hana_enable_if_idiom { + template struct A {}; + template> struct B; + template struct B> {}; + template struct B> {}; + struct C { + static const bool value = true; + }; + B b; +} Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -370,13 +370,13 @@ namespace PR17696 { } namespace partial_order_different_types { - // These are unordered because the type of the final argument doesn't match. - template struct A; // expected-note {{here}} - template struct A<0, N, T, U, V> {}; // expected-note {{matches}} - template struct A<0, 0, T, U, V> {}; // expected-note {{matches}} - // expected-error@-1 {{not more specialized than the primary}} - // expected-note@-2 {{deduced non-type template argument does not have the same type as the corresponding template parameter ('U' vs 'type-parameter-0-0')}} - A<0, 0, int, int, 0> a; // expected-error {{ambiguous partial specializations}} + template struct A; + template struct A<0, N, T, U, V>; // expected-note {{matches}} + // FIXME: It appears that this partial specialization should be ill-formed as + // it is not more specialized than the primary template. V is not deducible + // because it does not have the same type as the corresponding parameter. + template struct A<0, N, T, U, V> {}; // expected-note {{matches}} + A<0, 0, int, int, 0> a; // expected-error {{ambiguous}} } namespace partial_order_references { @@ -434,7 +434,7 @@ namespace dependent_nested_partial_speci template struct E { template struct F; // expected-note {{template}} - template struct F {}; // expected-error {{not more specialized than the primary}} expected-note {{does not have the same type}} + template struct F {}; // expected-error {{not more specialized than the primary}} }; E::F e1; // expected-note {{instantiation of}} } Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -79,13 +79,13 @@ namespace Auto { TInt ia; TInt iap; // expected-error {{different template parameters}} - TInt ida; // FIXME expected-error {{different template parameters}} + TInt ida; TInt ii; TInt iip; // expected-error {{different template parameters}} TIntPtr ipa; TIntPtr ipap; - TIntPtr ipda; // FIXME expected-error {{different template parameters}} + TIntPtr ipda; TIntPtr ipi; // expected-error {{different template parameters}} TIntPtr ipip; @@ -114,6 +114,6 @@ namespace Auto { int n; template struct SubstFailure; - TInt isf; // expected-error {{different template parameters}} - TIntPtr ipsf; // expected-error {{different template parameters}} + TInt isf; // FIXME: this should be ill-formed + TIntPtr ipsf; } From owner-svn-src-all@freebsd.org Sun Jan 22 16:52: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 CC728CBD4B6; Sun, 22 Jan 2017 16:52:50 +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 8377E107E; Sun, 22 Jan 2017 16:52:50 +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 v0MGqnae023018; Sun, 22 Jan 2017 16:52:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqnmD023017; Sun, 22 Jan 2017 16:52:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqnmD023017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312629 - vendor/compiler-rt/compiler-rt-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:50 -0000 Author: dim Date: Sun Jan 22 16:52:49 2017 New Revision: 312629 URL: https://svnweb.freebsd.org/changeset/base/312629 Log: Tag compiler-rt release_40 branch r292732. Added: vendor/compiler-rt/compiler-rt-release_40-r292732/ - copied from r312628, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 16:52: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 1012DCBD4FC; Sun, 22 Jan 2017 16:52: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 CEA601125; Sun, 22 Jan 2017 16:52: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 v0MGqtLa023080; Sun, 22 Jan 2017 16:52:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqrcr023065; Sun, 22 Jan 2017 16:52:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqrcr023065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312630 - in vendor/libc++/dist: include src test/std/containers/sequences/array test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time test/std/language.support/support.rtt... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:56 -0000 Author: dim Date: Sun Jan 22 16:52:53 2017 New Revision: 312630 URL: https://svnweb.freebsd.org/changeset/base/312630 Log: Vendor import of libc++ release_40 branch r292732: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@292732 Added: vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp (contents, props changed) Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/array vendor/libc++/dist/include/new vendor/libc++/dist/include/string vendor/libc++/dist/include/typeinfo vendor/libc++/dist/src/new.cpp vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/__config Sun Jan 22 16:52:53 2017 (r312630) @@ -835,6 +835,18 @@ template struct __static_asse #define _DECLARE_C99_LDBL_MATH 1 #endif +#if defined(__APPLE__) +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# endif +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif +# endif +#endif // defined(__APPLE__) + #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE #endif Modified: vendor/libc++/dist/include/array ============================================================================== --- vendor/libc++/dist/include/array Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/array Sun Jan 22 16:52:53 2017 (r312630) @@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: - _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];} - reference at(size_type __n); + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator[](size_type __n) {return __elems_[__n];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const_reference operator[](size_type __n) const {return __elems_[__n];} + + _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n); _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const; - _LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];} - _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 @@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array }; template +_LIBCPP_CONSTEXPR_AFTER_CXX14 typename array<_Tp, _Size>::reference array<_Tp, _Size>::at(size_type __n) { Modified: vendor/libc++/dist/include/new ============================================================================== --- vendor/libc++/dist/include/new Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/new Sun Jan 22 16:52:53 2017 (r312630) @@ -101,8 +101,9 @@ void operator delete[](void* ptr, void* # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION #endif -#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \ - (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)) +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ + (!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \ + (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))) # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif @@ -144,7 +145,7 @@ public: #endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) -#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; #else Modified: vendor/libc++/dist/include/string ============================================================================== --- vendor/libc++/dist/include/string Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/string Sun Jan 22 16:52:53 2017 (r312630) @@ -818,6 +818,7 @@ public: operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); + template _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES Modified: vendor/libc++/dist/include/typeinfo ============================================================================== --- vendor/libc++/dist/include/typeinfo Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/typeinfo Sun Jan 22 16:52:53 2017 (r312630) @@ -95,12 +95,13 @@ protected: uintptr_t __type_name; _LIBCPP_INLINE_VISIBILITY - type_info(const char* __n) : __type_name(reinterpret_cast(__n)) {} + explicit type_info(const char* __n) + : __type_name(reinterpret_cast(__n)) {} #else const char *__type_name; _LIBCPP_INLINE_VISIBILITY - type_info(const char* __n) : __type_name(__n) {} + explicit type_info(const char* __n) : __type_name(__n) {} #endif public: Modified: vendor/libc++/dist/src/new.cpp ============================================================================== --- vendor/libc++/dist/src/new.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/src/new.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA } _LIBCPP_WEAK -void * -operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC -{ - if (size == 0) - size = 1; - if (static_cast(alignment) < sizeof(void*)) - alignment = std::align_val_t(sizeof(void*)); - void* p; -#if defined(_LIBCPP_MSVCRT) - while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) -#else - while (::posix_memalign(&p, static_cast(alignment), size) != 0) -#endif - { - // If posix_memalign fails and there is a new_handler, - // call it to try free up memory. - std::new_handler nh = std::get_new_handler(); - if (nh) - nh(); - else { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw std::bad_alloc(); -#else - p = nullptr; // posix_memalign doesn't initialize 'p' on failure - break; -#endif - } - } - return p; -} - -_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { @@ -116,14 +84,21 @@ operator new(size_t size, const std::not _LIBCPP_WEAK void* -operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT +operator new[](size_t size) _THROW_BAD_ALLOC +{ + return ::operator new(size); +} + +_LIBCPP_WEAK +void* +operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { void* p = 0; #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif // _LIBCPP_NO_EXCEPTIONS - p = ::operator new(size, alignment); + p = ::operator new[](size); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -134,29 +109,92 @@ operator new(size_t size, std::align_val } _LIBCPP_WEAK -void* -operator new[](size_t size) _THROW_BAD_ALLOC +void +operator delete(void* ptr) _NOEXCEPT { - return ::operator new(size); + if (ptr) + ::free(ptr); } _LIBCPP_WEAK -void* -operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +void +operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT { - return ::operator new(size, alignment); + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete(void* ptr, size_t) _NOEXCEPT +{ + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr) _NOEXCEPT +{ + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT +{ + ::operator delete[](ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr, size_t) _NOEXCEPT +{ + ::operator delete[](ptr); +} + +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) + +_LIBCPP_WEAK +void * +operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +{ + if (size == 0) + size = 1; + if (static_cast(alignment) < sizeof(void*)) + alignment = std::align_val_t(sizeof(void*)); + void* p; +#if defined(_LIBCPP_MSVCRT) + while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) +#else + while (::posix_memalign(&p, static_cast(alignment), size) != 0) +#endif + { + // If posix_memalign fails and there is a new_handler, + // call it to try free up memory. + std::new_handler nh = std::get_new_handler(); + if (nh) + nh(); + else { +#ifndef _LIBCPP_NO_EXCEPTIONS + throw std::bad_alloc(); +#else + p = nullptr; // posix_memalign doesn't initialize 'p' on failure + break; +#endif + } + } + return p; } _LIBCPP_WEAK void* -operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT +operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { void* p = 0; #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif // _LIBCPP_NO_EXCEPTIONS - p = ::operator new[](size); + p = ::operator new(size, alignment); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -168,6 +206,13 @@ operator new[](size_t size, const std::n _LIBCPP_WEAK void* +operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +{ + return ::operator new(size, alignment); +} + +_LIBCPP_WEAK +void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { void* p = 0; @@ -187,14 +232,6 @@ operator new[](size_t size, std::align_v _LIBCPP_WEAK void -operator delete(void* ptr) _NOEXCEPT -{ - if (ptr) - ::free(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) @@ -207,13 +244,6 @@ operator delete(void* ptr, std::align_va _LIBCPP_WEAK void -operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -221,13 +251,6 @@ operator delete(void* ptr, std::align_va _LIBCPP_WEAK void -operator delete(void* ptr, size_t) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -235,13 +258,6 @@ operator delete(void* ptr, size_t, std:: _LIBCPP_WEAK void -operator delete[] (void* ptr) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, std::align_val_t alignment) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -249,13 +265,6 @@ operator delete[] (void* ptr, std::align _LIBCPP_WEAK void -operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - ::operator delete[](ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { ::operator delete[](ptr, alignment); @@ -263,18 +272,13 @@ operator delete[] (void* ptr, std::align _LIBCPP_WEAK void -operator delete[] (void* ptr, size_t) _NOEXCEPT -{ - ::operator delete[](ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT { ::operator delete[](ptr, alignment); } +#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) + #endif // !__GLIBCXX__ namespace std Modified: vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -23,6 +23,14 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_idx( size_t idx, double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.at(idx) == val; +} +#endif + int main() { { @@ -82,4 +90,11 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_idx(0, 1), ""); + static_assert (check_idx(1, 2), ""); + static_assert (check_idx(2, 3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -9,10 +9,10 @@ // -// reference front(); -// reference back(); +// reference front(); // constexpr in C++17 +// reference back(); // constexpr in C++17 // const_reference front(); // constexpr in C++14 -// const_reference back(); // constexpr in C++14 +// const_reference back(); // constexpr in C++14 #include #include @@ -23,6 +23,20 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_front( double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.front() == val; +} + +constexpr bool check_back( double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.back() == val; +} +#endif + int main() { { @@ -65,4 +79,10 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_front(1), ""); + static_assert (check_back (3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -23,6 +23,14 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_idx( size_t idx, double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr[idx] == val; +} +#endif + int main() { { @@ -63,4 +71,11 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_idx(0, 1), ""); + static_assert (check_idx(1, 2), ""); + static_assert (check_idx(2, 3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -72,13 +72,60 @@ std::pair GetS return {st.st_atime, st.st_mtime}; } -inline bool TimeIsRepresentableAsTimeT(file_time_type tp) { +namespace { +bool TestSupportsNegativeTimes() { + using namespace std::chrono; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp(seconds(-5)); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time <= -5; +} + +bool TestSupportsMaxTime() { using namespace std::chrono; using Lim = std::numeric_limits; - auto sec = duration_cast(tp.time_since_epoch()).count(); - return (sec >= Lim::min() && sec <= Lim::max()); + auto max_sec = duration_cast(file_time_type::max().time_since_epoch()).count(); + if (max_sec > Lim::max()) return false; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp = file_time_type::max(); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time > max_sec - 1; } +static const bool SupportsNegativeTimes = TestSupportsNegativeTimes(); +static const bool SupportsMaxTime = TestSupportsMaxTime(); + +} // end namespace + +// Check if a time point is representable on a given filesystem. Check that: +// (A) 'tp' is representable as a time_t +// (B) 'tp' is non-negative or the filesystem supports negative times. +// (C) 'tp' is not 'file_time_type::max()' or the filesystem supports the max +// value. +inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { + using namespace std::chrono; + using Lim = std::numeric_limits; + auto sec = duration_cast(tp.time_since_epoch()).count(); + auto microsec = duration_cast(tp.time_since_epoch()).count(); + if (sec < Lim::min() || sec > Lim::max()) return false; + else if (microsec < 0 && !SupportsNegativeTimes) return false; + else if (tp == file_time_type::max() && !SupportsMaxTime) return false; + return true; +} TEST_SUITE(exists_test_suite) @@ -214,15 +261,17 @@ TEST_CASE(set_last_write_time_dynamic_en file_time_type got_time = last_write_time(TC.p); - TEST_CHECK(got_time != old_time); - if (TC.new_time < epoch_time) { - TEST_CHECK(got_time <= TC.new_time); - TEST_CHECK(got_time > TC.new_time - Sec(1)); - } else { - TEST_CHECK(got_time <= TC.new_time + Sec(1)); - TEST_CHECK(got_time >= TC.new_time - Sec(1)); + if (TimeIsRepresentableByFilesystem(TC.new_time)) { + TEST_CHECK(got_time != old_time); + if (TC.new_time < epoch_time) { + TEST_CHECK(got_time <= TC.new_time); + TEST_CHECK(got_time > TC.new_time - Sec(1)); + } else { + TEST_CHECK(got_time <= TC.new_time + Sec(1)); + TEST_CHECK(got_time >= TC.new_time - Sec(1)); + } + TEST_CHECK(LastAccessTime(TC.p) == old_times.first); } - TEST_CHECK(LastAccessTime(TC.p) == old_times.first); } } @@ -269,17 +318,12 @@ TEST_CASE(test_write_min_time) const path p = env.create_file("file", 42); std::error_code ec = GetTestEC(); - file_time_type last_time = last_write_time(p); file_time_type new_time = file_time_type::min(); last_write_time(p, new_time, ec); file_time_type tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); @@ -287,18 +331,13 @@ TEST_CASE(test_write_min_time) ec = GetTestEC(); last_write_time(p, Clock::now()); - last_time = last_write_time(p); new_time = file_time_type::min() + MicroSec(1); last_write_time(p, new_time, ec); tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); @@ -317,18 +356,13 @@ TEST_CASE(test_write_min_max_time) const path p = env.create_file("file", 42); std::error_code ec = GetTestEC(); - file_time_type last_time = last_write_time(p); file_time_type new_time = file_time_type::max(); ec = GetTestEC(); last_write_time(p, new_time, ec); file_time_type tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt > new_time - Sec(1)); TEST_CHECK(tt <= new_time); Modified: vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -10,11 +10,16 @@ // test type_info #include +#include #include #include +bool test_constructor_explicit(std::type_info const&) { return false; } +bool test_constructor_explicit(std::string const&) { return true; } + int main() { + { const std::type_info& t1 = typeid(int); const std::type_info& t2 = typeid(int); assert(t1 == t2); @@ -23,4 +28,13 @@ int main() assert(!t1.before(t2)); assert(strcmp(t1.name(), t2.name()) == 0); assert(strcmp(t1.name(), t3.name()) != 0); + } + { + // type_info has a protected constructor taking a string literal. This + // constructor is not intended for users. However it still participates + // in overload resolution, so we need to ensure that it is marked explicit + // to avoid ambiguous conversions. + // See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216201 + assert(test_constructor_explicit("abc")); + } } Added: vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// basic_string& +// operator=(basic_string&& str); + +#include +#include + +#include "test_macros.h" + +int main() +{ + // Test that assignment from {} and {ptr, len} are allowed and are not + // ambiguous. + { + std::string s = "hello world"; + s = {}; + assert(s.empty()); + } + { + std::string s = "hello world"; + s = {"abc", 2}; + assert(s == "ab"); + } +} Modified: vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -28,12 +28,23 @@ test(std::basic_string_view sv) typedef std::basic_string, test_allocator > S; typedef typename S::traits_type T; typedef typename S::allocator_type A; + { S s2(sv); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == sv.size()); assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); assert(s2.get_allocator() == A()); assert(s2.capacity() >= s2.size()); + } + { + S s2; + s2 = sv; + LIBCPP_ASSERT(s2.__invariants()); + assert(s2.size() == sv.size()); + assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); + assert(s2.get_allocator() == A()); + assert(s2.capacity() >= s2.size()); + } } template @@ -42,12 +53,23 @@ test(std::basic_string_view sv, c { typedef std::basic_string, A> S; typedef typename S::traits_type T; + { S s2(sv, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == sv.size()); assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); assert(s2.get_allocator() == a); assert(s2.capacity() >= s2.size()); + } + { + S s2(a); + s2 = sv; + LIBCPP_ASSERT(s2.__invariants()); + assert(s2.size() == sv.size()); + assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); + assert(s2.get_allocator() == a); + assert(s2.capacity() >= s2.size()); + } } int main() From owner-svn-src-all@freebsd.org Sun Jan 22 16: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 E8DC4CBD529; Sun, 22 Jan 2017 16:52:58 +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 978C21164; Sun, 22 Jan 2017 16:52:58 +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 v0MGqvZS023126; Sun, 22 Jan 2017 16:52:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqvnL023125; Sun, 22 Jan 2017 16:52:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqvnL023125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312631 - vendor/libc++/libc++-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:52:59 -0000 Author: dim Date: Sun Jan 22 16:52:57 2017 New Revision: 312631 URL: https://svnweb.freebsd.org/changeset/base/312631 Log: Tag libc++ release_40 branch r292732. Added: vendor/libc++/libc++-release_40-r292732/ - copied from r312630, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 16:53: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 D6BE2CBD58D; Sun, 22 Jan 2017 16:53:06 +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 8A0451262; Sun, 22 Jan 2017 16:53:06 +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 v0MGr50F023236; Sun, 22 Jan 2017 16:53:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr5VU023235; Sun, 22 Jan 2017 16:53:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr5VU023235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312633 - vendor/lld/lld-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:53:07 -0000 Author: dim Date: Sun Jan 22 16:53:05 2017 New Revision: 312633 URL: https://svnweb.freebsd.org/changeset/base/312633 Log: Tag lld release_40 branch r292732. Added: vendor/lld/lld-release_40-r292732/ - copied from r312632, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 16:53: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 08BA2CBD578; Sun, 22 Jan 2017 16:53:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF227121A; Sun, 22 Jan 2017 16:53:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MGr2cI023190; Sun, 22 Jan 2017 16:53:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr1ec023177; Sun, 22 Jan 2017 16:53:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr1ec023177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312632 - in vendor/lld/dist: ELF test/ELF test/ELF/Inputs X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:53:04 -0000 Author: dim Date: Sun Jan 22 16:53:01 2017 New Revision: 312632 URL: https://svnweb.freebsd.org/changeset/base/312632 Log: Vendor import of lld release_40 branch r292732: https://llvm.org/svn/llvm-project/lld/branches/release_40@292732 Added: vendor/lld/dist/test/ELF/Inputs/resolution-end.s (contents, props changed) vendor/lld/dist/test/ELF/resolution-end.s (contents, props changed) vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s (contents, props changed) Modified: vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/Symbols.h vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/test/ELF/gc-sections-shared.s vendor/lld/dist/test/ELF/init-fini.s Modified: vendor/lld/dist/ELF/SymbolTable.cpp ============================================================================== --- vendor/lld/dist/ELF/SymbolTable.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SymbolTable.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -140,7 +140,7 @@ template DefinedRegular *SymbolTable::addIgnored(StringRef Name, uint8_t Visibility) { SymbolBody *S = find(Name); - if (!S || !S->isUndefined()) + if (!S || S->isInCurrentDSO()) return nullptr; return addAbsolute(Name, Visibility); } @@ -283,7 +283,7 @@ static int compareDefined(Symbol *S, boo if (WasInserted) return 1; SymbolBody *Body = S->body(); - if (Body->isLazy() || Body->isUndefined() || Body->isShared()) + if (Body->isLazy() || !Body->isInCurrentDSO()) return 1; if (Binding == STB_WEAK) return -1; @@ -426,12 +426,8 @@ void SymbolTable::addShared(Shared std::tie(S, WasInserted) = insert(Name, Sym.getType(), STV_DEFAULT, /*CanOmitFromDynSym*/ true, F); // Make sure we preempt DSO symbols with default visibility. - if (Sym.getVisibility() == STV_DEFAULT) { + if (Sym.getVisibility() == STV_DEFAULT) S->ExportDynamic = true; - // Exporting preempting symbols takes precedence over linker scripts. - if (S->VersionId == VER_NDX_LOCAL) - S->VersionId = VER_NDX_GLOBAL; - } if (WasInserted || isa>(S->body())) { replaceBody>(S, F, Name, Sym, Verdef); if (!S->isWeak()) @@ -468,6 +464,14 @@ template SymbolBody *Symbol } template +SymbolBody *SymbolTable::findInCurrentDSO(StringRef Name) { + if (SymbolBody *S = find(Name)) + if (S->isInCurrentDSO()) + return S; + return nullptr; +} + +template void SymbolTable::addLazyArchive(ArchiveFile *F, const object::Archive::Symbol Sym) { Symbol *S; Modified: vendor/lld/dist/ELF/SymbolTable.h ============================================================================== --- vendor/lld/dist/ELF/SymbolTable.h Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SymbolTable.h Sun Jan 22 16:53:01 2017 (r312632) @@ -82,6 +82,7 @@ public: void scanVersionScript(); SymbolBody *find(StringRef Name); + SymbolBody *findInCurrentDSO(StringRef Name); void trace(StringRef Name); void wrap(StringRef Name); Modified: vendor/lld/dist/ELF/Symbols.cpp ============================================================================== --- vendor/lld/dist/ELF/Symbols.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Symbols.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -203,8 +203,8 @@ void SymbolBody::parseSymbolVersion() { // Truncate the symbol name so that it doesn't include the version string. Name = {S.data(), Pos}; - // If this is an undefined or shared symbol it is not a definition. - if (isUndefined() || isShared()) + // If this is not in this DSO, it is not a definition. + if (!isInCurrentDSO()) return; // '@@' in a symbol name means the default version. @@ -299,7 +299,8 @@ uint8_t Symbol::computeBinding() const { return Binding; if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) return STB_LOCAL; - if (VersionId == VER_NDX_LOCAL && !body()->isUndefined()) + const SymbolBody *Body = body(); + if (VersionId == VER_NDX_LOCAL && Body->isInCurrentDSO()) return STB_LOCAL; if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE) return STB_GLOBAL; Modified: vendor/lld/dist/ELF/Symbols.h ============================================================================== --- vendor/lld/dist/ELF/Symbols.h Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Symbols.h Sun Jan 22 16:53:01 2017 (r312632) @@ -67,6 +67,7 @@ public: return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind; } bool isShared() const { return SymbolKind == SharedKind; } + bool isInCurrentDSO() const { return !isUndefined() && !isShared(); } bool isLocal() const { return IsLocal; } bool isPreemptible() const; StringRef getName() const { return Name; } Modified: vendor/lld/dist/ELF/SyntheticSections.cpp ============================================================================== --- vendor/lld/dist/ELF/SyntheticSections.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SyntheticSections.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -883,9 +883,9 @@ template void DynamicSectio add({DT_FINI_ARRAYSZ, Out::FiniArray, Entry::SecSize}); } - if (SymbolBody *B = Symtab::X->find(Config->Init)) + if (SymbolBody *B = Symtab::X->findInCurrentDSO(Config->Init)) add({DT_INIT, B}); - if (SymbolBody *B = Symtab::X->find(Config->Fini)) + if (SymbolBody *B = Symtab::X->findInCurrentDSO(Config->Fini)) add({DT_FINI, B}); bool HasVerNeed = In::VerNeed->getNeedNum() != 0; Modified: vendor/lld/dist/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist/ELF/Writer.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Writer.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -641,7 +641,7 @@ static void addOptionalSynthetic(StringR typename ELFT::uint Val, uint8_t StOther = STV_HIDDEN) { if (SymbolBody *S = Symtab::X->find(Name)) - if (S->isUndefined() || S->isShared()) + if (!S->isInCurrentDSO()) Symtab::X->addSynthetic(Name, Sec, Val, StOther); } @@ -661,7 +661,7 @@ static Symbol *addOptionalRegular(String SymbolBody *S = Symtab::X->find(Name); if (!S) return nullptr; - if (!S->isUndefined() && !S->isShared()) + if (S->isInCurrentDSO()) return S->symbol(); return addRegular(Name, IS, Value); } Added: vendor/lld/dist/test/ELF/Inputs/resolution-end.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/Inputs/resolution-end.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,2 @@ +.data + .quad _end Modified: vendor/lld/dist/test/ELF/gc-sections-shared.s ============================================================================== --- vendor/lld/dist/test/ELF/gc-sections-shared.s Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/test/ELF/gc-sections-shared.s Sun Jan 22 16:53:01 2017 (r312632) @@ -19,15 +19,6 @@ # CHECK-NEXT: Section: Undefined (0x0) # CHECK-NEXT: } # CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: bar -# CHECK-NEXT: Value: -# CHECK-NEXT: Size: -# CHECK-NEXT: Binding: Global -# CHECK-NEXT: Type: -# CHECK-NEXT: Other: -# CHECK-NEXT: Section: .text -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { # CHECK-NEXT: Name: bar2 # CHECK-NEXT: Value: # CHECK-NEXT: Size: Modified: vendor/lld/dist/test/ELF/init-fini.s ============================================================================== --- vendor/lld/dist/test/ELF/init-fini.s Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/test/ELF/init-fini.s Sun Jan 22 16:53:01 2017 (r312632) @@ -17,11 +17,22 @@ // RUN: ld.lld -shared %t -o %t2 -init=_foo -fini=_bar // RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=OVR %s -// Should add a dynamic table entry even if a given symbol stay undefined +// Don't add an entry for undef. The freebsd dynamic linker doesn't +// check if the value is null. If it is, it will just call the +// load address. // RUN: ld.lld -shared %t -o %t2 -init=_undef -fini=_undef // RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=UNDEF %s -// UNDEF: INIT 0x0 -// UNDEF: FINI 0x0 +// UNDEF-NOT: INIT +// UNDEF-NOT: FINI + +// Don't add an entry for shared. For the same reason as undef. +// RUN: ld.lld -shared %t -o %t.so +// RUN: echo > %t.s +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t2.o +// RUN: ld.lld -shared %t2.o %t.so -o %t2 +// RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=SHARED %s +// SHARED-NOT: INIT +// SHARED-NOT: FINI // Should not add new entries to the symbol table // and should not require given symbols to be resolved Added: vendor/lld/dist/test/ELF/resolution-end.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/resolution-end.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,39 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/resolution-end.s -o %t2.o +# RUN: ld.lld -shared -o %t2.so %t2.o +# RUN: ld.lld %t1.o %t2.so -o %t +# RUN: llvm-readobj -t -s -section-data %t | FileCheck %s +# REQUIRES: x86 + +# Test that we resolve _end to the this executable. + +# CHECK: Name: .text +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_EXECINSTR +# CHECK-NEXT: ] +# CHECK-NEXT: Address: +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: SectionData ( +# CHECK-NEXT: 0000: 80202000 00000000 +# CHECK-NEXT: ) + +# CHECK: Symbol { +# CHECK: Name: _end +# CHECK-NEXT: Value: 0x202080 +# CHECK-NEXT: Size: +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: +# CHECK-NEXT: Other: +# CHECK-NEXT: Section: +# CHECK-NEXT: } + +.global _start +_start: +.quad _end Added: vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,28 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t2.so +# RUN: echo "{ local: *; };" > %t.script +# RUN: ld.lld --version-script %t.script -shared %t.o %t2.so -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + +# The symbol foo must be hidden. This matches bfd and gold and is +# required to make it possible for a c++ library to hide its own +# operator delete. + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .global foo +foo: + nop + From owner-svn-src-all@freebsd.org Sun Jan 22 16:53: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 1B901CBD5CC; Sun, 22 Jan 2017 16:53:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6C7F12E3; Sun, 22 Jan 2017 16:53:10 +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 v0MGr9AK023283; Sun, 22 Jan 2017 16:53:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr9sm023282; Sun, 22 Jan 2017 16:53:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr9sm023282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312634 - vendor/lldb/lldb-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 16:53:11 -0000 Author: dim Date: Sun Jan 22 16:53:09 2017 New Revision: 312634 URL: https://svnweb.freebsd.org/changeset/base/312634 Log: Tag lldb release_40 branch r292732. Added: vendor/lldb/lldb-release_40-r292732/ - copied from r312633, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Sun Jan 22 17:00: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 62BA2CBD8BD; Sun, 22 Jan 2017 17:00:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id D54511DD7; Sun, 22 Jan 2017 17:00:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 6CF96105590; Mon, 23 Jan 2017 04:00:20 +1100 (AEDT) Date: Mon, 23 Jan 2017 04:00:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Mateusz Guzik , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern In-Reply-To: <20170122125716.GD2349@kib.kiev.ua> Message-ID: <20170123015806.E1391@besplex.bde.org> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> <20170122115716.T953@besplex.bde.org> <20170122092228.GC20930@dft-labs.eu> <20170122224849.E897@besplex.bde.org> <20170122125716.GD2349@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=c+HbeV1l c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=KFjhAxRdrjCR4X8GKyMA:9 a=saPsQCn3M3ld-qYC:21 a=h35VYZtXcDGq4LUF:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 17:00:28 -0000 On Sun, 22 Jan 2017, Konstantin Belousov wrote: > On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: >> On Sun, 22 Jan 2017, Mateusz Guzik wrote: >>> ... >>> I have to disagree about the usefulness remark. If you check generated >>> assembly for amd64 (included below), you will see the uncommon code is >>> moved out of the way and in particular there are no forward jumps in the >>> common case. >> >> Check benchmarks. A few cycles here and there are in the noise. Kernel >> code has very few possibilities for useful optimizations since it doesn't >> have many inner loops. >> >>> With __predict_false: >>> >>> [snip prologue] >>> 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax >>> 0xffffffff8084ecb2 <+34>: test $0x40,%ah >>> 0xffffffff8084ecb5 <+37>: jne 0xffffffff8084ece2 >> >> All that this does is as you say -- invert the condition to jump to the >> uncommon code. This made more of a difference on old CPUs (possiblly >> still on low end/non-x86). Now branch predictors are too good for the >> slow case to be much slower. >> >> I think x86 branch predictors initially predict forward branches as not >> taken and backward branches as taken. So this branch was initially >> mispredicted, and the change fixes this. But the first branch doesn't >> really matter. Starting up takes hundreds or thousands of cycles for >> cache misses. > This is only true if branch predictor memory is large enough to keep the > state for the given branch between exercising it. Even if the predictor > state could be attached to every byte in the icache, or more likely, > every line in the icache or uop cache, it still probably too small to > survive between user->kernel transitions for syscalls. Might be there is > performance counter which shows branch predictor mis-predictions. > > In other words, I suspect that there almost all cases might be > mis-predictions without manual hint, and mis-predictions together with > the full pipeline flush on VFS-intensive load very well might give tens > percents of the total cycles on the modern cores. > > Just speculation. Check benchmarks. I looked at the mis-prediction counts mainly for a networking micro-benchmark alsmost 10 years ago. They seemed to be among the least of the performance problems (the main ones were general bloat and cache misses). I think the branch-predictor caches on even 10-year old x86 are quite large, enough to hold tens or hundreds of syscalls. Otherwise performance would be lower than it is. Testing shows that the cache size is about 2048 on Athlon-XP. I might be measuring just the size of the L1 Icache interacting with the branch predictor: The program is for i386 and needs some editing: X int X main(void) X { X asm(" \n\ X pushal \n\ X movl $192105,%edi \n\ Set this to $(sysctl -n machdep.tsc_freq) / 10000 to count cycles easily. X 1: \n\ X # beware of clobbering in padding \n\ X pushal \n\ X xorl %eax,%eax \n\ X # repeat next many times, e.g., 2047 times on Athlon-xp \n\ X jz 2f; .p2align 3; 2: \n\ With up to 2048 branches, each branch takes 2 cycles on Athlon-XP. After that, each branch takes 10.8 cycles. I don't understand why the alignment is needed, but without it each branch takes 9 cycles instead of 2 starting with just 2 jz's. "jmp" branches are not predicted any better than the always-taken "jz" braches. Alignment is needed similarly. Change "jz" to "jnz" to see the speed with branches never taken. This takes 2 cycles for any number of branches up to 8K when the L1 Icache runs out. Now the default prediction of not-taken is correct, so there are no mispredictions. The alignment costs 0.5 cycles with a small number of jnz's and 0.03 cycles with a large number of jz's or jmp's. It helps with a large number of jnz's. X popal \n\ X decl %edi \n\ X jne 1b \n\ X popal \n\ X "); X return (0); X } Timing on Haswell: - Haswell only benefits slightly from the alignment and reaches full speed with ".p2align 2" - 1 cycle instead of 2 for branch-not-taken - 2.1 cycles instead of 2 minimum for branch-taken - predictor cache size 4K instead of 2K - 12 cycles instead of 10.8 for branches mispredicted by the default for more than 4K jz's. Bruce From owner-svn-src-all@freebsd.org Sun Jan 22 17:05: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 7A6FDCBDB52; Sun, 22 Jan 2017 17:05:34 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49FA2381; Sun, 22 Jan 2017 17:05:34 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MH5X4O027647; Sun, 22 Jan 2017 17:05:33 GMT (envelope-from matthew@FreeBSD.org) Received: (from matthew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MH5X5g027646; Sun, 22 Jan 2017 17:05:33 GMT (envelope-from matthew@FreeBSD.org) Message-Id: <201701221705.v0MH5X5g027646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: matthew set sender to matthew@FreeBSD.org using -f From: Matthew Seaman Date: Sun, 22 Jan 2017 17:05:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r312635 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 17:05:34 -0000 Author: matthew (ports committer) Date: Sun Jan 22 17:05:33 2017 New Revision: 312635 URL: https://svnweb.freebsd.org/changeset/base/312635 Log: Stephen McKay has approved having his commit bit taken in. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Sun Jan 22 16:53:09 2017 (r312634) +++ svnadmin/conf/access Sun Jan 22 17:05:33 2017 (r312635) @@ -151,7 +151,6 @@ markj markm mav maxim -mckay mckusick melifaro mizhka From owner-svn-src-all@freebsd.org Sun Jan 22 17:07: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 0640CCBDCA7; Sun, 22 Jan 2017 17:07:39 +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 BC32092B; Sun, 22 Jan 2017 17:07:38 +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 v0MH7bDa027771; Sun, 22 Jan 2017 17:07:37 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MH7bAF027769; Sun, 22 Jan 2017 17:07:37 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701221707.v0MH7bAF027769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 22 Jan 2017 17:07:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312636 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 17:07:39 -0000 Author: loos Date: Sun Jan 22 17:07:37 2017 New Revision: 312636 URL: https://svnweb.freebsd.org/changeset/base/312636 Log: Properly assemble an mbuf chain out of received fragments. Remove the rx_batch hack, it makes no difference now that most of bugs have been sorted out. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/cpsw/if_cpswvar.h Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:05:33 2017 (r312635) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:07:37 2017 (r312636) @@ -1582,14 +1582,19 @@ cpsw_intr_rx(void *arg) static struct mbuf * cpsw_rx_dequeue(struct cpsw_softc *sc) { + int nsegs, port, removed; struct cpsw_cpdma_bd bd; struct cpsw_slot *last, *slot; struct cpswp_softc *psc; - struct mbuf *mb_head, *mb_tail; - int port, removed = 0; + struct mbuf *m, *m0, *mb_head, *mb_tail; + uint16_t m0_flags; + nsegs = 0; + m0 = NULL; last = NULL; - mb_head = mb_tail = NULL; + mb_head = NULL; + mb_tail = NULL; + removed = 0; /* Pull completed packets off hardware RX queue. */ while ((slot = STAILQ_FIRST(&sc->rx.active)) != NULL) { @@ -1612,10 +1617,12 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); + m = slot->mbuf; + slot->mbuf = NULL; + if (bd.flags & CPDMA_BD_TDOWNCMPLT) { CPSW_DEBUGF(sc, ("RX teardown is complete")); - m_freem(slot->mbuf); - slot->mbuf = NULL; + m_freem(m); sc->rx.running = 0; sc->rx.teardown = 0; break; @@ -1627,28 +1634,36 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) psc = device_get_softc(sc->port[port].dev); /* Set up mbuf */ - /* TODO: track SOP/EOP bits to assemble a full mbuf - out of received fragments. */ - slot->mbuf->m_data += bd.bufoff; - slot->mbuf->m_len = bd.buflen; + m->m_data += bd.bufoff; + m->m_len = bd.buflen; if (bd.flags & CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.len = bd.pktlen; - slot->mbuf->m_pkthdr.rcvif = psc->ifp; - slot->mbuf->m_flags |= M_PKTHDR; - } - slot->mbuf->m_next = NULL; - slot->mbuf->m_nextpkt = NULL; - if (bd.flags & CPDMA_BD_PASS_CRC) - m_adj(slot->mbuf, -ETHER_CRC_LEN); + m->m_pkthdr.len = bd.pktlen; + m->m_pkthdr.rcvif = psc->ifp; + m->m_flags |= M_PKTHDR; + m0_flags = bd.flags; + m0 = m; + } + nsegs++; + m->m_next = NULL; + m->m_nextpkt = NULL; + if (bd.flags & CPDMA_BD_EOP && m0 != NULL) { + if (m0_flags & CPDMA_BD_PASS_CRC) + m_adj(m0, -ETHER_CRC_LEN); + m0_flags = 0; + m0 = NULL; + if (nsegs > sc->rx.longest_chain) + sc->rx.longest_chain = nsegs; + nsegs = 0; + } if ((psc->ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ if ((bd.flags & (CPDMA_BD_SOP | CPDMA_BD_PKT_ERR_MASK)) == CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; - slot->mbuf->m_pkthdr.csum_data = 0xffff; + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + m->m_pkthdr.csum_data = 0xffff; } } @@ -1661,15 +1676,21 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) } /* Add mbuf to packet list to be returned. */ - if (mb_tail) { - mb_tail->m_nextpkt = slot->mbuf; + if (mb_tail != NULL && (bd.flags & CPDMA_BD_SOP)) { + mb_tail->m_nextpkt = m; + } else if (mb_tail != NULL) { + mb_tail->m_next = m; + } else if (mb_tail == NULL && (bd.flags & CPDMA_BD_SOP) == 0) { + if (bootverbose) + printf( + "%s: %s: discanding fragment packet w/o header\n", + __func__, psc->ifp->if_xname); + m_freem(m); + continue; } else { - mb_head = slot->mbuf; + mb_head = m; } - mb_tail = slot->mbuf; - slot->mbuf = NULL; - if (sc->rx_batch > 0 && sc->rx_batch == removed) - break; + mb_tail = m; } if (removed != 0) { @@ -2686,9 +2707,6 @@ cpsw_add_sysctls(struct cpsw_softc *sc) SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "Enable switch debug messages"); - SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "rx_batch", - CTLFLAG_RW, &sc->rx_batch, 0, "Set the rx batch size"); - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, "attachedSecs", CTLTYPE_UINT | CTLFLAG_RD, sc, 0, cpsw_stat_attached, "IU", "Time since driver attach"); Modified: head/sys/arm/ti/cpsw/if_cpswvar.h ============================================================================== --- head/sys/arm/ti/cpsw/if_cpswvar.h Sun Jan 22 17:05:33 2017 (r312635) +++ head/sys/arm/ti/cpsw/if_cpswvar.h Sun Jan 22 17:07:37 2017 (r312636) @@ -89,7 +89,6 @@ struct cpsw_softc { int active_slave; int debug; int dualemac; - int rx_batch; phandle_t node; struct bintime attach_uptime; /* system uptime when attach happened. */ struct cpsw_port port[2]; From owner-svn-src-all@freebsd.org Sun Jan 22 17:10: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 7C966CBDFC2; Sun, 22 Jan 2017 17:10:33 +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 18DF9DEA; Sun, 22 Jan 2017 17:10:32 +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 v0MHAQ6U094157 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 22 Jan 2017 19:10:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0MHAQ6U094157 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0MHAQI6094156; Sun, 22 Jan 2017 19:10:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 22 Jan 2017 19:10:26 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Mateusz Guzik , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312600 - head/sys/kern Message-ID: <20170122171026.GH2349@kib.kiev.ua> References: <201701211838.v0LIcHIv072626@repo.freebsd.org> <20170121195114.GA2349@kib.kiev.ua> <20170122115716.T953@besplex.bde.org> <20170122092228.GC20930@dft-labs.eu> <20170122224849.E897@besplex.bde.org> <20170122125716.GD2349@kib.kiev.ua> <20170123015806.E1391@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170123015806.E1391@besplex.bde.org> User-Agent: Mutt/1.7.2 (2016-11-26) 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: Sun, 22 Jan 2017 17:10:33 -0000 On Mon, Jan 23, 2017 at 04:00:19AM +1100, Bruce Evans wrote: > On Sun, 22 Jan 2017, Konstantin Belousov wrote: > > > On Sun, Jan 22, 2017 at 11:41:09PM +1100, Bruce Evans wrote: > >> On Sun, 22 Jan 2017, Mateusz Guzik wrote: > >>> ... > >>> I have to disagree about the usefulness remark. If you check generated > >>> assembly for amd64 (included below), you will see the uncommon code is > >>> moved out of the way and in particular there are no forward jumps in the > >>> common case. > >> > >> Check benchmarks. A few cycles here and there are in the noise. Kernel > >> code has very few possibilities for useful optimizations since it doesn't > >> have many inner loops. > >> > >>> With __predict_false: > >>> > >>> [snip prologue] > >>> 0xffffffff8084ecaf <+31>: mov 0x24(%rbx),%eax > >>> 0xffffffff8084ecb2 <+34>: test $0x40,%ah > >>> 0xffffffff8084ecb5 <+37>: jne 0xffffffff8084ece2 > >> > >> All that this does is as you say -- invert the condition to jump to the > >> uncommon code. This made more of a difference on old CPUs (possiblly > >> still on low end/non-x86). Now branch predictors are too good for the > >> slow case to be much slower. > >> > >> I think x86 branch predictors initially predict forward branches as not > >> taken and backward branches as taken. So this branch was initially > >> mispredicted, and the change fixes this. But the first branch doesn't > >> really matter. Starting up takes hundreds or thousands of cycles for > >> cache misses. > > This is only true if branch predictor memory is large enough to keep the > > state for the given branch between exercising it. Even if the predictor > > state could be attached to every byte in the icache, or more likely, > > every line in the icache or uop cache, it still probably too small to > > survive between user->kernel transitions for syscalls. Might be there is > > performance counter which shows branch predictor mis-predictions. > > > > In other words, I suspect that there almost all cases might be > > mis-predictions without manual hint, and mis-predictions together with > > the full pipeline flush on VFS-intensive load very well might give tens > > percents of the total cycles on the modern cores. > > > > Just speculation. > > Check benchmarks. > > I looked at the mis-prediction counts mainly for a networking micro-benchmark > alsmost 10 years ago. They seemed to be among the least of the performance > problems (the main ones were general bloat and cache misses). I think the > branch-predictor caches on even 10-year old x86 are quite large, enough to > hold tens or hundreds of syscalls. Otherwise performance would be lower > than it is. > > Testing shows that the cache size is about 2048 on Athlon-XP. I might be > measuring just the size of the L1 Icache interacting with the branch > predictor: > > The program is for i386 and needs some editing: > > X int > X main(void) > X { > X asm(" \n\ > X pushal \n\ > X movl $192105,%edi \n\ > > Set this to $(sysctl -n machdep.tsc_freq) / 10000 to count cycles easily. > > X 1: \n\ > X # beware of clobbering in padding \n\ > X pushal \n\ > X xorl %eax,%eax \n\ > X # repeat next many times, e.g., 2047 times on Athlon-xp \n\ > X jz 2f; .p2align 3; 2: \n\ > > With up to 2048 branches, each branch takes 2 cycles on Athlon-XP. > After that, each branch takes 10.8 cycles. > > I don't understand why the alignment is needed, but without it each branch > takes 9 cycles instead of 2 starting with just 2 jz's. My guess this is the predictor graining issue I alluded to earlier. E.g. Agner Fog' manuals state that for K8/K10, ============================== The branch prediction mechanism allows no more than three taken branches for every aligned 16-byte block of code. ============================== The benchmark does not check the cost of misprediction, since the test consists only of the thread of branches, there is no speculative state to unwind. > > "jmp" branches are not predicted any better than the always-taken "jz" > braches. Alignment is needed similarly. > > Change "jz" to "jnz" to see the speed with branches never taken. This > takes 2 cycles for any number of branches up to 8K when the L1 Icache > runs out. Now the default prediction of not-taken is correct, so there > are no mispredictions. > > The alignment costs 0.5 cycles with a small number of jnz's and 0.03 > cycles with a large number of jz's or jmp's. It helps with a large > number of jnz's. > > X popal \n\ > X decl %edi \n\ > X jne 1b \n\ > X popal \n\ > X "); > X return (0); > X } > > Timing on Haswell: > - Haswell only benefits slightly from the alignment and reaches full > speed with ".p2align 2" > - 1 cycle instead of 2 for branch-not-taken > - 2.1 cycles instead of 2 minimum for branch-taken > - predictor cache size 4K instead of 2K > - 12 cycles instead of 10.8 for branches mispredicted by the default for > more than 4K jz's. > > Bruce From owner-svn-src-all@freebsd.org Sun Jan 22 17:24: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 E4069CBB4F3; Sun, 22 Jan 2017 17:24:01 +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 B39F199A; Sun, 22 Jan 2017 17:24:01 +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 v0MHO0kp035794; Sun, 22 Jan 2017 17:24:00 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MHO0HX035792; Sun, 22 Jan 2017 17:24:00 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701221724.v0MHO0HX035792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 22 Jan 2017 17:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312637 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 17:24:02 -0000 Author: loos Date: Sun Jan 22 17:24:00 2017 New Revision: 312637 URL: https://svnweb.freebsd.org/changeset/base/312637 Log: Be a little more pedantic here, the TRM says the hardware is supposed to only clean the OWNER bit on SOP descriptors. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:07:37 2017 (r312636) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Jan 22 17:24:00 2017 (r312637) @@ -1981,7 +1981,8 @@ cpsw_tx_dequeue(struct cpsw_softc *sc) sc->tx.teardown = 1; } - if ((flags & CPDMA_BD_OWNER) != 0 && sc->tx.teardown == 0) + if ((flags & (CPDMA_BD_SOP | CPDMA_BD_OWNER)) == + (CPDMA_BD_SOP | CPDMA_BD_OWNER) && sc->tx.teardown == 0) break; /* Hardware is still using this packet. */ bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTWRITE); From owner-svn-src-all@freebsd.org Sun Jan 22 17:49: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 B49EFCBBD3D; Sun, 22 Jan 2017 17:49:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ACC382E; Sun, 22 Jan 2017 17:49:15 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MHnE1t044456; Sun, 22 Jan 2017 17:49:14 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MHnETA044455; Sun, 22 Jan 2017 17:49:14 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201701221749.v0MHnETA044455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 22 Jan 2017 17:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312638 - head/sbin/restore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 17:49:15 -0000 Author: mckusick Date: Sun Jan 22 17:49:14 2017 New Revision: 312638 URL: https://svnweb.freebsd.org/changeset/base/312638 Log: By default, when doing incremental restores the restore program overwrites an existing file rather than removing it and creating a new file. If the old and new version of the file both have extended attributes and the extended attributes of the two versions of the file are different, the result is that the new file ends up with the union of the extended attributes of the old and new files. To get the behavior of replacing the extended attributes rather than augmenting them requires explicitly removing the old attributes and then adding the new ones. To get this behavior, the old file must be unlinked (which clears out the old extended attributes). Then the new file of the same name must be created and the new extended attributes added to it. This behavior can be obtained by specifying the -u flag when running restore. Rather than defaulting the -u option to on and possibly breaking existing scripts using restore, this change simply notes in the restore.8 manual page that the -u flag is recommended when using restore on filesystems that contain extended attributes. PR: 216127 Reported by: dewayne at heuristicsystems.com.au Differential Revision: https://reviews.freebsd.org/D9208 Modified: head/sbin/restore/restore.8 Modified: head/sbin/restore/restore.8 ============================================================================== --- head/sbin/restore/restore.8 Sun Jan 22 17:24:00 2017 (r312637) +++ head/sbin/restore/restore.8 Sun Jan 22 17:49:14 2017 (r312638) @@ -349,6 +349,8 @@ To prevent this, the .Fl u (unlink) flag causes restore to remove old entries before attempting to create new ones. +This flag is recommended when using extended attributes +to avoid improperly accumulating attributes on pre-existing files. .It Fl v Normally .Nm From owner-svn-src-all@freebsd.org Sun Jan 22 18:04: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 8D0C0CBC319; Sun, 22 Jan 2017 18:04:58 +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 67DA13BB; Sun, 22 Jan 2017 18:04:58 +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 v0MI4vRE052603; Sun, 22 Jan 2017 18:04:57 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MI4vjF052602; Sun, 22 Jan 2017 18:04:57 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701221804.v0MI4vjF052602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sun, 22 Jan 2017 18:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312641 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 18:04:58 -0000 Author: sbruno Date: Sun Jan 22 18:04:57 2017 New Revision: 312641 URL: https://svnweb.freebsd.org/changeset/base/312641 Log: igb(4) enable WOL features for this class of devices. PR: 208343 Submitted by: Kaho Tashikazu Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:41 2017 (r312640) +++ head/sys/dev/e1000/if_em.c Sun Jan 22 18:04:57 2017 (r312641) @@ -1738,7 +1738,7 @@ em_if_stop(if_ctx_t ctx) e1000_reset_hw(&adapter->hw); if (adapter->hw.mac.type >= e1000_82544) - E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0); e1000_led_off(&adapter->hw); e1000_cleanup_led(&adapter->hw); @@ -2313,7 +2313,7 @@ em_reset(if_ctx_t ctx) /* Issue a global reset */ e1000_reset_hw(hw); - E1000_WRITE_REG(hw, E1000_WUC, 0); + E1000_WRITE_REG(hw, E1000_WUFC, 0); em_disable_aspm(adapter); /* and a re-init */ if (e1000_init_hw(hw) < 0) { @@ -2514,9 +2514,12 @@ em_setup_interface(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ if (adapter->wol) { - if_setcapabilitiesbit(ifp, IFCAP_WOL, 0); - if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, 0); - } + if_setcapenablebit(ifp, IFCAP_WOL_MAGIC, + IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } else { + if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC | + IFCAP_WOL_MCAST| IFCAP_WOL_UCAST); + } /* * Specify the media types supported by this adapter and register @@ -3314,6 +3317,15 @@ em_get_wakeup(if_ctx_t ctx) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_82575: /* listing all igb devices */ + case e1000_82576: + case e1000_82580: + case e1000_i350: + case e1000_i354: + case e1000_i210: + case e1000_i211: + case e1000_vfadapt: + case e1000_vfadapt_i350: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -3393,7 +3405,7 @@ em_enable_wakeup(if_ctx_t ctx) ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); - wuc |= E1000_WUC_PME_EN ; + wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || @@ -3417,6 +3429,9 @@ em_enable_wakeup(if_ctx_t ctx) if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) == 0) adapter->wol &= ~E1000_WUFC_MAG; + if ((if_getcapenable(ifp) & IFCAP_WOL_UCAST) == 0) + adapter->wol &= ~E1000_WUFC_EX; + if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) == 0) adapter->wol &= ~E1000_WUFC_MC; else { @@ -3425,10 +3440,7 @@ em_enable_wakeup(if_ctx_t ctx) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } - if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan) || - (adapter->hw.mac.type == e1000_pch_lpt) || - (adapter->hw.mac.type == e1000_pch_spt)) { + if ( adapter->hw.mac.type >= e1000_pchlan) { if (em_enable_phy_wakeup(adapter)) return; } else { @@ -3493,7 +3505,7 @@ em_enable_phy_wakeup(struct adapter *ada /* enable PHY wakeup in MAC register */ E1000_WRITE_REG(hw, E1000_WUC, - E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); + E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN | E1000_WUC_APME); E1000_WRITE_REG(hw, E1000_WUFC, adapter->wol); /* configure and enable PHY wakeup in PHY registers */ From owner-svn-src-all@freebsd.org Sun Jan 22 18:30: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 81D83CBCE26; Sun, 22 Jan 2017 18:30:57 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 5759E2EC; Sun, 22 Jan 2017 18:30:57 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 673A15649D; Sun, 22 Jan 2017 12:30:56 -0600 (CST) Subject: Re: svn commit: r312426 - head/sys/kern To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201701191846.v0JIkfMI078267@repo.freebsd.org> From: Eric van Gyzen Message-ID: <174532d3-e959-db1c-9363-ee8ff0c6d21d@FreeBSD.org> Date: Sun, 22 Jan 2017 12:30:52 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <201701191846.v0JIkfMI078267@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 18:30:57 -0000 On 01/19/2017 12:46, Andriy Gapon wrote: > Author: avg > Date: Thu Jan 19 18:46:41 2017 > New Revision: 312426 > URL: https://svnweb.freebsd.org/changeset/base/312426 > > Log: > fix a thread preemption regression in schedulers introduced in r270423 > > Commit r270423 fixed a regression in sched_yield() that was introduced > in earlier changes. Unfortunately, at the same time it introduced an > new regression. Pointy hat to: vangyzen, 2.5 years later... Eric From owner-svn-src-all@freebsd.org Sun Jan 22 18:55: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 C5CD0CBD288; Sun, 22 Jan 2017 18:55:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9587C139; Sun, 22 Jan 2017 18:55:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MIt16o072892; Sun, 22 Jan 2017 18:55:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MIt1fk072891; Sun, 22 Jan 2017 18:55:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701221855.v0MIt1fk072891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 22 Jan 2017 18:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312644 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 18:55:02 -0000 Author: bapt Date: Sun Jan 22 18:55:01 2017 New Revision: 312644 URL: https://svnweb.freebsd.org/changeset/base/312644 Log: Readd a feature lost in pw(8) refactoring pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after: 3 days Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sun Jan 22 18:31:49 2017 (r312643) +++ head/usr.sbin/pw/pw_user.c Sun Jan 22 18:55:01 2017 (r312644) @@ -1697,6 +1697,10 @@ pw_user_mod(int argc, char **argv, char edited = true; } + if (createhome && fstatat(conf.rootfd, pwd->pw_dir, &st, 0) == -1) { + docreatehome = true; + } + if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; edited = true; From owner-svn-src-all@freebsd.org Sun Jan 22 19:36: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 BEAC7CBDF4F; Sun, 22 Jan 2017 19:36: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 8E2B9C6F; Sun, 22 Jan 2017 19:36:03 +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 v0MJa2u6088830; Sun, 22 Jan 2017 19:36:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJa2An088829; Sun, 22 Jan 2017 19:36:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221936.v0MJa2An088829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312645 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 19:36:03 -0000 Author: kib Date: Sun Jan 22 19:36:02 2017 New Revision: 312645 URL: https://svnweb.freebsd.org/changeset/base/312645 Log: Provide fallback VOP methods for crossmp vnode. In particular, crossmp vnode might leak into rename code. PR: 216380 Reported by: fnacl@protonmail.com Sponsored by: The FreeBSD Foundation X-MFC with: r309425 Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sun Jan 22 18:55:01 2017 (r312644) +++ head/sys/kern/vfs_lookup.c Sun Jan 22 19:36:02 2017 (r312645) @@ -132,6 +132,7 @@ crossmp_vop_unlock(struct vop_unlock_arg } static struct vop_vector crossmp_vnodeops = { + .vop_default = &default_vnodeops, .vop_islocked = crossmp_vop_islocked, .vop_lock1 = crossmp_vop_lock1, .vop_unlock = crossmp_vop_unlock, From owner-svn-src-all@freebsd.org Sun Jan 22 19:38: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 C8B0BCBC0C1; Sun, 22 Jan 2017 19:38:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E89DED9; Sun, 22 Jan 2017 19:38:46 +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 v0MJcjLK089023; Sun, 22 Jan 2017 19:38:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJcjcB089022; Sun, 22 Jan 2017 19:38:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221938.v0MJcjcB089022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312646 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 19:38:46 -0000 Author: kib Date: Sun Jan 22 19:38:45 2017 New Revision: 312646 URL: https://svnweb.freebsd.org/changeset/base/312646 Log: More style cleanup. Use ANSI C definition for vn_closefile(). Switch to VNASSERT in _vn_lock(), simplify messages. Sponsored by: The FreeBSD Foundation X-MFC with: r312600, r312601, r312602, r312606 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Jan 22 19:36:02 2017 (r312645) +++ head/sys/kern/vfs_vnops.c Sun Jan 22 19:38:45 2017 (r312646) @@ -1538,27 +1538,21 @@ _vn_lock(struct vnode *vp, int flags, ch int error; VNASSERT((flags & LK_TYPE_MASK) != 0, vp, - ("vn_lock called with no locktype.")); -#ifdef DEBUG_VFS_LOCKS - KASSERT(vp->v_holdcnt != 0, - ("vn_lock %p: zero hold count", vp)); -#endif + ("vn_lock: no locktype")); + VNASSERT(vp->v_holdcnt != 0, vp, ("vn_lock: zero hold count")); retry: error = VOP_LOCK1(vp, flags, file, line); flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or " - " an error occurred (%d)", flags, error)); + ("vn_lock: error %d incompatible with flags %#x", error, flags)); if ((flags & LK_RETRY) == 0) { - if (error == 0 && vp->v_iflag & VI_DOOMED) { + if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) { VOP_UNLOCK(vp, 0); error = ENOENT; } - } else { - if (error != 0) - goto retry; - } + } else if (error != 0) + goto retry; return (error); } @@ -1566,9 +1560,7 @@ retry: * File table vnode close routine. */ static int -vn_closefile(fp, td) - struct file *fp; - struct thread *td; +vn_closefile(struct file *fp, struct thread *td) { struct vnode *vp; struct flock lf; @@ -1577,12 +1569,14 @@ vn_closefile(fp, td) vp = fp->f_vnode; fp->f_ops = &badfileops; - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) vrefact(vp); error = vn_close(vp, fp->f_flag, fp->f_cred, td); - if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) { + if (__predict_false((fp->f_flag & FHASLOCK) != 0) && + fp->f_type == DTYPE_VNODE) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; From owner-svn-src-all@freebsd.org Sun Jan 22 19:41: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 8B0B2CBC33A; Sun, 22 Jan 2017 19:41:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ABE2371; Sun, 22 Jan 2017 19:41:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MJfgUM092046; Sun, 22 Jan 2017 19:41:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJfgHJ092045; Sun, 22 Jan 2017 19:41:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221941.v0MJfgHJ092045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312647 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 19:41:43 -0000 Author: kib Date: Sun Jan 22 19:41:42 2017 New Revision: 312647 URL: https://svnweb.freebsd.org/changeset/base/312647 Log: Add comments explaining unobvious td_critnest adjustments in critical_exit(). Based on the discussion with: jhb Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential revision: D9276 MFC after: 1 week Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c ============================================================================== --- head/sys/kern/kern_switch.c Sun Jan 22 19:38:45 2017 (r312646) +++ head/sys/kern/kern_switch.c Sun Jan 22 19:41:42 2017 (r312647) @@ -206,7 +206,22 @@ critical_exit(void) if (td->td_critnest == 1) { td->td_critnest = 0; + + /* + * Interrupt handlers execute critical_exit() on + * leave, and td_owepreempt may be left set by an + * interrupt handler only when td_critnest > 0. If we + * are decrementing td_critnest from 1 to 0, read + * td_owepreempt after decrementing, to not miss the + * preempt. Disallow compiler to reorder operations. + */ + __compiler_membar(); if (td->td_owepreempt && !kdb_active) { + /* + * Microoptimization: we committed to switch, + * disable preemption in interrupt handlers + * while spinning for the thread lock. + */ td->td_critnest = 1; thread_lock(td); td->td_critnest--; From owner-svn-src-all@freebsd.org Sun Jan 22 19:46: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 4095ECBC43D; Sun, 22 Jan 2017 19:46: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 EA827A08; Sun, 22 Jan 2017 19:46: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 v0MJkF8B092987; Sun, 22 Jan 2017 19:46:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJkFHH092986; Sun, 22 Jan 2017 19:46:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221946.v0MJkFHH092986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312648 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 19:46:16 -0000 Author: kib Date: Sun Jan 22 19:46:14 2017 New Revision: 312648 URL: https://svnweb.freebsd.org/changeset/base/312648 Log: Editing and clarifications for tmpfs(5). Submitted by: wblock Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D9211 Modified: head/share/man/man5/tmpfs.5 Modified: head/share/man/man5/tmpfs.5 ============================================================================== --- head/share/man/man5/tmpfs.5 Sun Jan 22 19:41:42 2017 (r312647) +++ head/share/man/man5/tmpfs.5 Sun Jan 22 19:46:14 2017 (r312648) @@ -77,7 +77,7 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver implements in-memory, or +driver implements an in-memory, or .Tn tmpfs file system. The filesystem stores both file metadata and data in main memory. @@ -85,22 +85,22 @@ This allows very fast and low latency ac The data is volatile. An umount or system reboot invalidates it. These properties make the filesystem's mounts suitable for fast -scratch storage, e.g. +scratch storage, like .Pa /tmp . .Pp If the system becomes low on memory and swap is configured (see .Xr swapon 8 ), -file data may be written to the swap space, freeing memory +the system can transfer file data to swap space, freeing memory for other needs. -The current implementation never swaps out metadata, including -the directory content. +Metadata, including the directory content, is never swapped out by the +current implementation. Keep this in mind when planning the mount limits, especially when expecting to place many small files on a tmpfs mount. .Pp -When a file from a tmpfs mount is mmaped (see -.Xr mmap 2 ) -into the process address space, the swap VM object which manages the file -pages is used to implement mapping and to avoid double-copying of +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of the file data. This quirk causes process inspection tools, like .Xr procstat 1 , From owner-svn-src-all@freebsd.org Sun Jan 22 19:50: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 3D65FCBC4C9; Sun, 22 Jan 2017 19:50:25 +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 0CC5CBC4; Sun, 22 Jan 2017 19:50:24 +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 v0MJoODY093262; Sun, 22 Jan 2017 19:50:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MJoO02093261; Sun, 22 Jan 2017 19:50:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701221950.v0MJoO02093261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Jan 2017 19:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312649 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 19:50:25 -0000 Author: kib Date: Sun Jan 22 19:50:23 2017 New Revision: 312649 URL: https://svnweb.freebsd.org/changeset/base/312649 Log: Document mount option "nonc" for tmpfs. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D9258 Modified: head/share/man/man5/tmpfs.5 Modified: head/share/man/man5/tmpfs.5 ============================================================================== --- head/share/man/man5/tmpfs.5 Sun Jan 22 19:46:14 2017 (r312648) +++ head/share/man/man5/tmpfs.5 Sun Jan 22 19:50:23 2017 (r312649) @@ -54,7 +54,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2017 +.Dd January 20, 2017 .Dt TMPFS 5 .Os .Sh NAME @@ -120,6 +120,10 @@ Defaults to the mount point's UID. .It Cm mode Specifies the mode (in octal notation) of the root inode of the file system. Defaults to the mount point's mode. +.It Cm nonc +Do not use namecache to resolve names to files for the created mount. +This saves memory, but currently might impair scalability for highly +used mounts on large machines. .It Cm inodes Specifies the maximum number of nodes available to the file system. If not specified, the file system chooses a reasonable maximum based on From owner-svn-src-all@freebsd.org Sun Jan 22 20:03: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 830DBCBC912; Sun, 22 Jan 2017 20:03:20 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C0B81480; Sun, 22 Jan 2017 20:03:20 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MK3J57001623; Sun, 22 Jan 2017 20:03:19 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MK3JmF001620; Sun, 22 Jan 2017 20:03:19 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701222003.v0MK3JmF001620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 22 Jan 2017 20:03:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312650 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 20:03:20 -0000 Author: bapt Date: Sun Jan 22 20:03:18 2017 New Revision: 312650 URL: https://svnweb.freebsd.org/changeset/base/312650 Log: Really restore the old behaviour for pw usermod -m It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days Modified: head/usr.sbin/pw/psdate.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_usermod.sh Modified: head/usr.sbin/pw/psdate.c ============================================================================== --- head/usr.sbin/pw/psdate.c Sun Jan 22 19:50:23 2017 (r312649) +++ head/usr.sbin/pw/psdate.c Sun Jan 22 20:03:18 2017 (r312650) @@ -41,12 +41,8 @@ static const char rcsid[] = static int numerics(char const * str) { - int rc = isdigit((unsigned char)*str); - if (rc) - while (isdigit((unsigned char)*str) || *str == 'x') - ++str; - return rc && !*str; + return (str[strspn(str, "0123456789x")] == '\0'); } static int Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sun Jan 22 19:50:23 2017 (r312649) +++ head/usr.sbin/pw/pw_user.c Sun Jan 22 20:03:18 2017 (r312650) @@ -1493,7 +1493,7 @@ pw_user_mod(int argc, char **argv, char intmax_t id = -1; int ch, fd = -1; size_t i, j; - bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome; + bool quiet, createhome, pretty, dryrun, nis, edited; bool precrypted; mode_t homemode = 0; time_t expire_days, password_days, now; @@ -1503,7 +1503,7 @@ pw_user_mod(int argc, char **argv, char passwd = NULL; class = nispasswd = NULL; quiet = createhome = pretty = dryrun = nis = precrypted = false; - edited = docreatehome = false; + edited = false; if (arg1 != NULL) { if (arg1[strspn(arg1, "0123456789")] == '\0') @@ -1697,10 +1697,6 @@ pw_user_mod(int argc, char **argv, char edited = true; } - if (createhome && fstatat(conf.rootfd, pwd->pw_dir, &st, 0) == -1) { - docreatehome = true; - } - if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; edited = true; @@ -1708,8 +1704,6 @@ pw_user_mod(int argc, char **argv, char if (!createhome) warnx("WARNING: home `%s' does not exist", pwd->pw_dir); - else - docreatehome = true; } else if (!S_ISDIR(st.st_mode)) { warnx("WARNING: home `%s' is not a directory", pwd->pw_dir); @@ -1801,7 +1795,7 @@ pw_user_mod(int argc, char **argv, char * that this also `works' for editing users if -m is used, but * existing files will *not* be overwritten. */ - if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir && + if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { if (!skel) skel = cnf->dotdir; Modified: head/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_usermod.sh Sun Jan 22 19:50:23 2017 (r312649) +++ head/usr.sbin/pw/tests/pw_usermod.sh Sun Jan 22 20:03:18 2017 (r312650) @@ -253,6 +253,26 @@ user_mod_w_yes_body() { $(atf_get_srcdir)/crypt $passhash "foo" } +atf_test_case user_mod_m +user_mod_m_body() { + populate_root_etc_skel + + mkdir -p ${HOME}/home + mkdir -p ${HOME}/skel + echo "entry" > ${HOME}/skel/.file + atf_check -s exit:0 ${RPW} useradd foo + ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been created" + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -d ${HOME}/home/foo || atf_fail "Directory should have been created" + test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added" + echo "entry" > ${HOME}/skel/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added" + echo > ${HOME}/home/foo/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2 +} + atf_init_test_cases() { atf_add_test_case user_mod @@ -275,4 +295,5 @@ atf_init_test_cases() { atf_add_test_case user_mod_w_none atf_add_test_case user_mod_w_random atf_add_test_case user_mod_w_yes + atf_add_test_case user_mod_m } From owner-svn-src-all@freebsd.org Sun Jan 22 20:06: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 28453CBCA2A; Sun, 22 Jan 2017 20:06:17 +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 DD86B1676; Sun, 22 Jan 2017 20:06:16 +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 v0MK6G1Q001772; Sun, 22 Jan 2017 20:06:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MK6Fmd001766; Sun, 22 Jan 2017 20:06:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701222006.v0MK6Fmd001766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Jan 2017 20:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312651 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 20:06:17 -0000 Author: trasz Date: Sun Jan 22 20:06:15 2017 New Revision: 312651 URL: https://svnweb.freebsd.org/changeset/base/312651 Log: Remove max_targets and max_target_id CTL port variables; they were unused. This changes the CTL frontend ABI and thus shouldn't be MFC-ed. Reviewed by: mav@ Modified: head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_ioctl.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl_frontend.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend.h Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend.h Sun Jan 22 20:06:15 2017 (r312651) @@ -120,7 +120,6 @@ struct ctl_wwpn_iid { * port_name: A string describing the FETD. e.g. "LSI 1030T U320" * or whatever you want to use to describe the driver. * - * * physical_port: This is the physical port number of this * particular port within the driver/hardware. This * number is hardware/driver specific. @@ -179,11 +178,6 @@ struct ctl_wwpn_iid { * to request a dump of any debugging information or * state to the console. * - * max_targets: The maximum number of targets that we can create - * per-port. - * - * max_target_id: The highest target ID that we can use. - * * targ_port: The CTL layer assigns a "port number" to every * FETD. This port number should be passed back in * in the header of every ctl_io that is queued to @@ -234,8 +228,6 @@ struct ctl_port { void *targ_lun_arg; /* passed to CTL */ void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ void (*fe_done)(union ctl_io *io); /* passed to CTL */ - int max_targets; /* passed to CTL */ - int max_target_id; /* passed to CTL */ int32_t targ_port; /* passed back to FETD */ void *ctl_pool_ref; /* passed back to FETD */ uint32_t max_initiators; /* passed back to FETD */ Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 22 20:06:15 2017 (r312651) @@ -147,11 +147,6 @@ cfcs_init(void) port->onoff_arg = softc; port->fe_datamove = cfcs_datamove; port->fe_done = cfcs_done; - - /* XXX KDM what should we report here? */ - /* XXX These should probably be fetched from CTL. */ - port->max_targets = 1; - port->max_target_id = 15; port->targ_port = -1; retval = ctl_port_register(port); Modified: head/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_ioctl.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_ioctl.c Sun Jan 22 20:06:15 2017 (r312651) @@ -104,8 +104,6 @@ cfi_init(void) port->port_name = "ioctl"; port->fe_datamove = cfi_datamove; port->fe_done = cfi_done; - port->max_targets = 1; - port->max_target_id = 0; port->targ_port = -1; port->max_initiators = 1; Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Sun Jan 22 20:06:15 2017 (r312651) @@ -2127,11 +2127,6 @@ cfiscsi_ioctl_port_create(struct ctl_req port->onoff_arg = ct; port->fe_datamove = cfiscsi_datamove; port->fe_done = cfiscsi_done; - - /* XXX KDM what should we report here? */ - /* XXX These should probably be fetched from CTL. */ - port->max_targets = 1; - port->max_target_id = 15; port->targ_port = -1; port->options = opts; Modified: head/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc_local.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/ctl_tpc_local.c Sun Jan 22 20:06:15 2017 (r312651) @@ -95,8 +95,6 @@ tpcl_init(void) port->port_name = "tpc"; port->fe_datamove = tpcl_datamove; port->fe_done = tpcl_done; - port->max_targets = 1; - port->max_target_id = 0; port->targ_port = -1; port->max_initiators = 1; Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sun Jan 22 20:03:18 2017 (r312650) +++ head/sys/cam/ctl/scsi_ctl.c Sun Jan 22 20:06:15 2017 (r312651) @@ -402,12 +402,6 @@ ctlfeasync(void *callback_arg, uint32_t port->targ_lun_arg = softc; port->fe_datamove = ctlfe_datamove; port->fe_done = ctlfe_done; - /* - * XXX KDM the path inquiry doesn't give us the maximum - * number of targets supported. - */ - port->max_targets = cpi->max_target; - port->max_target_id = cpi->max_target; port->targ_port = -1; /* From owner-svn-src-all@freebsd.org Sun Jan 22 20:08: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 E88C2CBCB20; Sun, 22 Jan 2017 20:08:09 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::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 8471C1821; Sun, 22 Jan 2017 20:08:09 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id d140so21378375wmd.2; Sun, 22 Jan 2017 12:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+4emPAaaCGVvkBzTS4NEiYCanDjW+QyerW5pGLUWQu8=; b=KKsyShFYgsfWBl9AGEdXzqiD2QBWcQnSl1oE9udCoixnCOQQZVdXR2I35xfnd1f7rz +GR7T/8bQU5lGrNd1tX56QfRDZGwiVezc/grbAmOmISPQqVl3b6OuDH7o0jvEqZz5fPY av5K5U1Tu7zjx9b4B6cbF/nVNfDYJkDqTepiQIiGU0zoIVfa0ZMVW258lYoP0sGHi0Un KQhoYEYjRav6+IfzHQMlfpcM9/YSyvabQRRv+R9+lDstEZJ7hLeD8h9Df5BMShD8CNa3 ja90gNr+KSjYpilFfGjMw/eLlpLJUiaC9dNsNYajBO1IauiC7Mn0ih+JCuBGeVWkP5Tv wWsQ== 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:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=+4emPAaaCGVvkBzTS4NEiYCanDjW+QyerW5pGLUWQu8=; b=ERQ+3UILazc89ZGAPgW3LrJK1ABjvDMr2TvxSFC4scIpqdS7v0LQ0qGL3ii3QPRyZU G9LDmmqnAn1KwlCZcD3HLttl3jZdhOkpYhgPJj88uXzKwWzjXarVag5EVL7trYw/L04c pVYri6j1SGw6ObNUeY9p2zZIJJOv4WXUleDqtnCF4WLkkN+YZMvTAukT3e0qm0agtLVS TLh5spFYuj8gR7N7GGhegEPVHlOM/q+DmaZND8YJD42c81iADl8c+Xz56pnAErfx7E00 EgAoUu+UzBTRNRFOapOW2iHi+wLTX4/wLOaGB7MnsV2VChGj+vcqs4igTdrmomNOif4d wW4w== X-Gm-Message-State: AIkVDXJq4MdhCJQxLT/LEcwZeyYebSzlWwhYZ1qtx0PEIn97rh8MUD1/+zuFFqm2MySqbQ== X-Received: by 10.28.19.78 with SMTP id 75mr12157285wmt.108.1485115687745; Sun, 22 Jan 2017 12:08:07 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id z134sm17354152wmc.20.2017.01.22.12.08.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jan 2017 12:08:06 -0800 (PST) Sender: Baptiste Daroussin Date: Sun, 22 Jan 2017 21:08:05 +0100 From: Baptiste Daroussin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312650 - in head/usr.sbin/pw: . tests Message-ID: <20170122200805.l5vmo3nhodfl2m6q@ivaldir.etoilebsd.net> References: <201701222003.v0MK3JmF001620@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c5uszr3xaanb3aag" Content-Disposition: inline In-Reply-To: <201701222003.v0MK3JmF001620@repo.freebsd.org> User-Agent: NeoMutt/20170113 (1.7.2) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 20:08:10 -0000 --c5uszr3xaanb3aag Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 22, 2017 at 08:03:19PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Sun Jan 22 20:03:18 2017 > New Revision: 312650 > URL: https://svnweb.freebsd.org/changeset/base/312650 >=20 > Log: > Really restore the old behaviour for pw usermod -m > =20 > It again reinstall missing skel files without overwriting changed one > Add a regression test about it > =20 > Reported by: ae > MFC after: 3 days >=20 > Modified: > head/usr.sbin/pw/psdate.c > head/usr.sbin/pw/pw_user.c > head/usr.sbin/pw/tests/pw_usermod.sh >=20 > Modified: head/usr.sbin/pw/psdate.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/usr.sbin/pw/psdate.c Sun Jan 22 19:50:23 2017 (r312649) > +++ head/usr.sbin/pw/psdate.c Sun Jan 22 20:03:18 2017 (r312650) > @@ -41,12 +41,8 @@ static const char rcsid[] =3D > static int > numerics(char const * str) > { > - int rc =3D isdigit((unsigned char)*str); > =20 > - if (rc) > - while (isdigit((unsigned char)*str) || *str =3D=3D 'x') > - ++str; > - return rc && !*str; > + return (str[strspn(str, "0123456789x")] =3D=3D '\0'); > } Oups that wasn't supposed to be there but anyway it is in now Bapt --c5uszr3xaanb3aag Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAliFESEACgkQY4mL3PG3 Plp5lxAAuezpGgmXLAynp5s9yUen99I4MNoElWgTHAWbjO1xHlGzjgNRKM6NpU3n 5vT5xsd/t2lKkdamBDbuK7P5paJMDQ9CtFywG4yujPpHmjTZnlDNHVyu1ToHi6jX FJS4u1JUk6jbOGh0VppLl7PnuwQuWaX7o6rwdybv4GMXd27FU6yJD2utI8p1jZFR PD/Wa/hYrr61QFAnGGTvn8ssKBHMa+YBrfF9LeWf9KbjU0JKlBO4WRHqhDK3BHFZ 8u6u3YDqO6ADJkOcFdSSqTuZ1awEh46peQVCqa4wqc8rxIRr1kWb8mQPBUjTaINJ mgzC3w1SWg7W2amcVCwH0LU6mGH/yLm1zbjL4ihCnsz+PyVVYSO3KccNBEjnZK93 6nfKIzB6aYl/vZXn/Jbhdrg9K3NFmmDab69NrcZxo9s5i3uTqtPCi8zfdGxSWTJ1 OJlM4gxdCn7BmrC5eeLe0V4KKNzeoBiHuQ64LX4kenvRWw/gVPx1tEzDZxdcIkkL RHI2lhbMJRYs9CPqEK72EWoX2xM5TrYBfNWuKU21T89tdpVIXRMmtAJWKnt0vNF4 ZgHKbMwrhXNPqBxKu99HbSvWFlLBRly+MQBYDbSTi2CKlpgEaDLmjclc/Tc6Ug7J MwTNTmkWHISY5Upx14XwGY2ju1yg3A/MFBLMDk3E6F1G7GX1sZA= =7n6b -----END PGP SIGNATURE----- --c5uszr3xaanb3aag-- From owner-svn-src-all@freebsd.org Sun Jan 22 20:11: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 3AEC9CBCCDB; Sun, 22 Jan 2017 20:11:26 +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 15AFA1CFC; Sun, 22 Jan 2017 20:11:26 +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 v0MKBPHk004111; Sun, 22 Jan 2017 20:11:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MKBPHE004110; Sun, 22 Jan 2017 20:11:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701222011.v0MKBPHE004110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Jan 2017 20:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312652 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 20:11:26 -0000 Author: trasz Date: Sun Jan 22 20:11:24 2017 New Revision: 312652 URL: https://svnweb.freebsd.org/changeset/base/312652 Log: Move values displayed by "iscsictl -v" one character to the right, to line up output from "iscsictl -v" with "ctladm islist -v". MFC after: 2 weeks Modified: head/usr.bin/iscsictl/iscsictl.c Modified: head/usr.bin/iscsictl/iscsictl.c ============================================================================== --- head/usr.bin/iscsictl/iscsictl.c Sun Jan 22 20:06:15 2017 (r312651) +++ head/usr.bin/iscsictl/iscsictl.c Sun Jan 22 20:11:24 2017 (r312652) @@ -514,74 +514,74 @@ kernel_list(int iscsi_fd, const struct t * Display-only modifier as this information * is also present within the 'session' container */ - xo_emit("{L:/%-25s}{V:sessionId/%u}\n", + xo_emit("{L:/%-26s}{V:sessionId/%u}\n", "Session ID:", state->iss_id); xo_open_container("initiator"); - xo_emit("{L:/%-25s}{V:name/%s}\n", + xo_emit("{L:/%-26s}{V:name/%s}\n", "Initiator name:", conf->isc_initiator); - xo_emit("{L:/%-25s}{V:portal/%s}\n", + xo_emit("{L:/%-26s}{V:portal/%s}\n", "Initiator portal:", conf->isc_initiator_addr); - xo_emit("{L:/%-25s}{V:alias/%s}\n", + xo_emit("{L:/%-26s}{V:alias/%s}\n", "Initiator alias:", conf->isc_initiator_alias); xo_close_container("initiator"); xo_open_container("target"); - xo_emit("{L:/%-25s}{V:name/%s}\n", + xo_emit("{L:/%-26s}{V:name/%s}\n", "Target name:", conf->isc_target); - xo_emit("{L:/%-25s}{V:portal/%s}\n", + xo_emit("{L:/%-26s}{V:portal/%s}\n", "Target portal:", conf->isc_target_addr); - xo_emit("{L:/%-25s}{V:alias/%s}\n", + xo_emit("{L:/%-26s}{V:alias/%s}\n", "Target alias:", state->iss_target_alias); xo_close_container("target"); xo_open_container("auth"); - xo_emit("{L:/%-25s}{V:user/%s}\n", + xo_emit("{L:/%-26s}{V:user/%s}\n", "User:", conf->isc_user); - xo_emit("{L:/%-25s}{V:secret/%s}\n", + xo_emit("{L:/%-26s}{V:secret/%s}\n", "Secret:", conf->isc_secret); - xo_emit("{L:/%-25s}{V:mutualUser/%s}\n", + xo_emit("{L:/%-26s}{V:mutualUser/%s}\n", "Mutual user:", conf->isc_mutual_user); - xo_emit("{L:/%-25s}{V:mutualSecret/%s}\n", + xo_emit("{L:/%-26s}{V:mutualSecret/%s}\n", "Mutual secret:", conf->isc_mutual_secret); xo_close_container("auth"); - xo_emit("{L:/%-25s}{V:type/%s}\n", + xo_emit("{L:/%-26s}{V:type/%s}\n", "Session type:", conf->isc_discovery ? "Discovery" : "Normal"); - xo_emit("{L:/%-25s}{V:enable/%s}\n", + xo_emit("{L:/%-26s}{V:enable/%s}\n", "Enable:", conf->isc_enable ? "Yes" : "No"); - xo_emit("{L:/%-25s}{V:state/%s}\n", + xo_emit("{L:/%-26s}{V:state/%s}\n", "Session state:", state->iss_connected ? "Connected" : "Disconnected"); - xo_emit("{L:/%-25s}{V:failureReason/%s}\n", + xo_emit("{L:/%-26s}{V:failureReason/%s}\n", "Failure reason:", state->iss_reason); - xo_emit("{L:/%-25s}{V:headerDigest/%s}\n", + xo_emit("{L:/%-26s}{V:headerDigest/%s}\n", "Header digest:", state->iss_header_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - xo_emit("{L:/%-25s}{V:dataDigest/%s}\n", + xo_emit("{L:/%-26s}{V:dataDigest/%s}\n", "Data digest:", state->iss_data_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - xo_emit("{L:/%-25s}{V:recvDataSegmentLen/%d}\n", + xo_emit("{L:/%-26s}{V:recvDataSegmentLen/%d}\n", "MaxRecvDataSegmentLength:", state->iss_max_recv_data_segment_length); - xo_emit("{L:/%-25s}{V:sendDataSegmentLen/%d}\n", + xo_emit("{L:/%-26s}{V:sendDataSegmentLen/%d}\n", "MaxSendDataSegmentLength:", state->iss_max_send_data_segment_length); - xo_emit("{L:/%-25s}{V:maxBurstLen/%d}\n", + xo_emit("{L:/%-26s}{V:maxBurstLen/%d}\n", "MaxBurstLen:", state->iss_max_burst_length); - xo_emit("{L:/%-25s}{V:firstBurstLen/%d}\n", + xo_emit("{L:/%-26s}{V:firstBurstLen/%d}\n", "FirstBurstLen:", state->iss_first_burst_length); - xo_emit("{L:/%-25s}{V:immediateData/%s}\n", + xo_emit("{L:/%-26s}{V:immediateData/%s}\n", "ImmediateData:", state->iss_immediate_data ? "Yes" : "No"); - xo_emit("{L:/%-25s}{V:iSER/%s}\n", + xo_emit("{L:/%-26s}{V:iSER/%s}\n", "iSER (RDMA):", conf->isc_iser ? "Yes" : "No"); - xo_emit("{L:/%-25s}{V:offloadDriver/%s}\n", + xo_emit("{L:/%-26s}{V:offloadDriver/%s}\n", "Offload driver:", state->iss_offload); - xo_emit("{L:/%-25s}", + xo_emit("{L:/%-26s}", "Device nodes:"); print_periphs(state->iss_id); xo_emit("\n\n"); From owner-svn-src-all@freebsd.org Sun Jan 22 21:31: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 C4672CBCF07; Sun, 22 Jan 2017 21:31:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92D4A8EA; Sun, 22 Jan 2017 21:31:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MLVW3F037265; Sun, 22 Jan 2017 21:31:32 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MLVWjg037264; Sun, 22 Jan 2017 21:31:32 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201701222131.v0MLVWjg037264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 22 Jan 2017 21:31: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: r312653 - stable/11/share/skel X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 21:31:33 -0000 Author: jilles Date: Sun Jan 22 21:31:32 2017 New Revision: 312653 URL: https://svnweb.freebsd.org/changeset/base/312653 Log: MFC r312230: skel: Do not set -o emacs in .shrc. sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set this again in .shrc, since that only serves to prevent invocations like 'sh -o vi' and 'sh +o emacs' to have the intended effect. PR: 215958 Submitted by: Andras Farkas Modified: stable/11/share/skel/dot.shrc Directory Properties: stable/11/ (props changed) Modified: stable/11/share/skel/dot.shrc ============================================================================== --- stable/11/share/skel/dot.shrc Sun Jan 22 20:11:24 2017 (r312652) +++ stable/11/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) @@ -13,10 +13,6 @@ # # umask 022 -# Enable the builtin emacs(1) command line editor in sh(1), -# e.g. C-a -> beginning-of-line. -set -o emacs - # Uncomment this and comment the above to enable the builtin vi(1) command # line editor in sh(1), e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-all@freebsd.org Sun Jan 22 21:34: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 9024ECBCFD8; Sun, 22 Jan 2017 21:34:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F543B2A; Sun, 22 Jan 2017 21:34:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MLYQVb038101; Sun, 22 Jan 2017 21:34:26 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MLYQpG038100; Sun, 22 Jan 2017 21:34:26 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201701222134.v0MLYQpG038100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 22 Jan 2017 21:34: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: r312654 - stable/10/share/skel X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 21:34:27 -0000 Author: jilles Date: Sun Jan 22 21:34:26 2017 New Revision: 312654 URL: https://svnweb.freebsd.org/changeset/base/312654 Log: MFC r312230: skel: Do not set -o emacs in .shrc. sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set this again in .shrc, since that only serves to prevent invocations like 'sh -o vi' and 'sh +o emacs' to have the intended effect. PR: 215958 Submitted by: Andras Farkas Modified: stable/10/share/skel/dot.shrc Directory Properties: stable/10/ (props changed) Modified: stable/10/share/skel/dot.shrc ============================================================================== --- stable/10/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) +++ stable/10/share/skel/dot.shrc Sun Jan 22 21:34:26 2017 (r312654) @@ -13,10 +13,6 @@ # # umask 022 -# Enable the builtin emacs(1) command line editor in sh(1), -# e.g. C-a -> beginning-of-line. -set -o emacs - # Uncomment this and comment the above to enable the builtin vi(1) command # line editor in sh(1), e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-all@freebsd.org Sun Jan 22 23:30: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 5C4DFCBD37E; Sun, 22 Jan 2017 23:30:28 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (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 0241FC12; Sun, 22 Jan 2017 23:30:27 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v0MNUOQb000256; Sun, 22 Jan 2017 15:30:24 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v0MNUJMp000255; Sun, 22 Jan 2017 15:30:19 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r312653 - stable/11/share/skel In-Reply-To: <201701222131.v0MLVWjg037264@repo.freebsd.org> To: Jilles Tjoelker Date: Sun, 22 Jan 2017 15:30:19 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 23:30:28 -0000 > Author: jilles > Date: Sun Jan 22 21:31:32 2017 > New Revision: 312653 > URL: https://svnweb.freebsd.org/changeset/base/312653 > > Log: > MFC r312230: skel: Do not set -o emacs in .shrc. > > sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set > this again in .shrc, since that only serves to prevent invocations like > 'sh -o vi' and 'sh +o emacs' to have the intended effect. > > PR: 215958 > Submitted by: Andras Farkas > > Modified: > stable/11/share/skel/dot.shrc > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/skel/dot.shrc > ============================================================================== > --- stable/11/share/skel/dot.shrc Sun Jan 22 20:11:24 2017 (r312652) > +++ stable/11/share/skel/dot.shrc Sun Jan 22 21:31:32 2017 (r312653) > @@ -13,10 +13,6 @@ > # > # umask 022 > > -# Enable the builtin emacs(1) command line editor in sh(1), > -# e.g. C-a -> beginning-of-line. > -set -o emacs > - > # Uncomment this and comment the above to enable the builtin vi(1) command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ documentation error.... please correct that too. > # line editor in sh(1), e.g. ESC to go into visual mode. > # set -o vi > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Jan 22 23:46: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 E2747CBD7BB; Sun, 22 Jan 2017 23:46:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B205E966; Sun, 22 Jan 2017 23:46:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0MNjxFU093476; Sun, 22 Jan 2017 23:45:59 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MNjxEM093475; Sun, 22 Jan 2017 23:45:59 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201701222345.v0MNjxEM093475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 22 Jan 2017 23:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312655 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 22 Jan 2017 23:46:01 -0000 Author: avos Date: Sun Jan 22 23:45:59 2017 New Revision: 312655 URL: https://svnweb.freebsd.org/changeset/base/312655 Log: net80211: fix flags setup for HT40 5GHz channels. Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sun Jan 22 21:34:26 2017 (r312654) +++ head/sys/net80211/ieee80211.c Sun Jan 22 23:45:59 2017 (r312655) @@ -1317,6 +1317,7 @@ getflags_5ghz(const uint8_t bands[], uin if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; + } /* 40MHz */ if (ht40) { @@ -1340,7 +1341,6 @@ getflags_5ghz(const uint8_t bands[], uin IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; - } } /* XXX VHT80+80 */ From owner-svn-src-all@freebsd.org Mon Jan 23 01: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 BB595CBCB6D; Mon, 23 Jan 2017 01:20:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 954993ED; Mon, 23 Jan 2017 01:20:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N1Kwkk031477; Mon, 23 Jan 2017 01:20:58 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N1KwtK031474; Mon, 23 Jan 2017 01:20:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701230120.v0N1KwtK031474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 23 Jan 2017 01:20: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: r312656 - in stable/11/sys: conf netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 01:20:59 -0000 Author: pfg Date: Mon Jan 23 01:20:58 2017 New Revision: 312656 URL: https://svnweb.freebsd.org/changeset/base/312656 Log: MFC r312443: mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. There were several places where reference to compression were left unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID which is not defined in the tree and therefore were sure to break with INVARIANTS: comment them out. Reported by: Eugene Grosbein PR: 216265 Modified: stable/11/sys/conf/NOTES stable/11/sys/conf/options stable/11/sys/netgraph/ng_mppc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/conf/NOTES Mon Jan 23 01:20:58 2017 (r312656) @@ -769,8 +769,7 @@ options NETGRAPH_IPFW options NETGRAPH_KSOCKET options NETGRAPH_L2TP options NETGRAPH_LMI -# MPPC compression requires proprietary files (not included) -#options NETGRAPH_MPPC_COMPRESSION +options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/conf/options Mon Jan 23 01:20:58 2017 (r312656) @@ -510,7 +510,6 @@ NETGRAPH_IPFW opt_netgraph.h NETGRAPH_KSOCKET opt_netgraph.h NETGRAPH_L2TP opt_netgraph.h NETGRAPH_LMI opt_netgraph.h -# MPPC compression requires proprietary files (not included) NETGRAPH_MPPC_COMPRESSION opt_netgraph.h NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h Modified: stable/11/sys/netgraph/ng_mppc.c ============================================================================== --- stable/11/sys/netgraph/ng_mppc.c Sun Jan 22 23:45:59 2017 (r312655) +++ stable/11/sys/netgraph/ng_mppc.c Mon Jan 23 01:20:58 2017 (r312656) @@ -66,7 +66,7 @@ #if !defined(NETGRAPH_MPPC_COMPRESSION) && !defined(NETGRAPH_MPPC_ENCRYPTION) #ifdef KLD_MODULE -/* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ +#define NETGRAPH_MPPC_COMPRESSION #define NETGRAPH_MPPC_ENCRYPTION #else /* This case is indicative of an error in sys/conf files */ @@ -81,7 +81,6 @@ static MALLOC_DEFINE(M_NETGRAPH_MPPC, "n #endif #ifdef NETGRAPH_MPPC_COMPRESSION -/* XXX this file doesn't exist yet, but hopefully someday it will... */ #include #endif #ifdef NETGRAPH_MPPC_ENCRYPTION @@ -543,7 +542,7 @@ err1: &destCnt, d->history, flags, 0); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_EXPANDED) == 0 && (rtn & MPPC_COMP_OK) == MPPC_COMP_OK) { outlen -= destCnt; @@ -805,7 +804,7 @@ failed: &sourceCnt, &destCnt, d->history, flags); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_DEST_EXHAUSTED) != 0 || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", From owner-svn-src-all@freebsd.org Mon Jan 23 01:21: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 8C5FECBCD38; Mon, 23 Jan 2017 01:21:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 672E7817; Mon, 23 Jan 2017 01:21:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N1LdmS032929; Mon, 23 Jan 2017 01:21:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N1Ldgp032467; Mon, 23 Jan 2017 01:21:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701230121.v0N1Ldgp032467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 23 Jan 2017 01:21:39 +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: r312657 - in stable/10/sys: conf netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 01:21:40 -0000 Author: pfg Date: Mon Jan 23 01:21:39 2017 New Revision: 312657 URL: https://svnweb.freebsd.org/changeset/base/312657 Log: MFC r312443: mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. There were several places where reference to compression were left unfinished. Furthermore, KASSERTs contained references to MPPC_INVALID which is not defined in the tree and therefore were sure to break with INVARIANTS: comment them out. Reported by: Eugene Grosbein PR: 216265 Modified: stable/10/sys/conf/NOTES stable/10/sys/conf/options stable/10/sys/netgraph/ng_mppc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/conf/NOTES Mon Jan 23 01:21:39 2017 (r312657) @@ -747,8 +747,7 @@ options NETGRAPH_IPFW options NETGRAPH_KSOCKET options NETGRAPH_L2TP options NETGRAPH_LMI -# MPPC compression requires proprietary files (not included) -#options NETGRAPH_MPPC_COMPRESSION +options NETGRAPH_MPPC_COMPRESSION options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/conf/options Mon Jan 23 01:21:39 2017 (r312657) @@ -512,7 +512,6 @@ NETGRAPH_IPFW opt_netgraph.h NETGRAPH_KSOCKET opt_netgraph.h NETGRAPH_L2TP opt_netgraph.h NETGRAPH_LMI opt_netgraph.h -# MPPC compression requires proprietary files (not included) NETGRAPH_MPPC_COMPRESSION opt_netgraph.h NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h Modified: stable/10/sys/netgraph/ng_mppc.c ============================================================================== --- stable/10/sys/netgraph/ng_mppc.c Mon Jan 23 01:20:58 2017 (r312656) +++ stable/10/sys/netgraph/ng_mppc.c Mon Jan 23 01:21:39 2017 (r312657) @@ -66,7 +66,7 @@ #if !defined(NETGRAPH_MPPC_COMPRESSION) && !defined(NETGRAPH_MPPC_ENCRYPTION) #ifdef KLD_MODULE -/* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ +#define NETGRAPH_MPPC_COMPRESSION #define NETGRAPH_MPPC_ENCRYPTION #else /* This case is indicative of an error in sys/conf files */ @@ -81,7 +81,6 @@ static MALLOC_DEFINE(M_NETGRAPH_MPPC, "n #endif #ifdef NETGRAPH_MPPC_COMPRESSION -/* XXX this file doesn't exist yet, but hopefully someday it will... */ #include #endif #ifdef NETGRAPH_MPPC_ENCRYPTION @@ -546,7 +545,7 @@ err1: &destCnt, d->history, flags, 0); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_EXPANDED) == 0 && (rtn & MPPC_COMP_OK) == MPPC_COMP_OK) { outlen -= destCnt; @@ -808,7 +807,7 @@ failed: &sourceCnt, &destCnt, d->history, flags); /* Check return value */ - KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); + /* KASSERT(rtn != MPPC_INVALID, ("%s: invalid", __func__)); */ if ((rtn & MPPC_DEST_EXHAUSTED) != 0 || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", From owner-svn-src-all@freebsd.org Mon Jan 23 02:21: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 B9F3BCBD8B0; Mon, 23 Jan 2017 02:21:07 +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 7BDDD183; Mon, 23 Jan 2017 02:21:07 +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 v0N2L6wD055526; Mon, 23 Jan 2017 02:21:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N2L6Ds055523; Mon, 23 Jan 2017 02:21:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201701230221.v0N2L6Ds055523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 23 Jan 2017 02:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312658 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 02:21:07 -0000 Author: markj Date: Mon Jan 23 02:21:06 2017 New Revision: 312658 URL: https://svnweb.freebsd.org/changeset/base/312658 Log: Remove the DTRACEHIOC_ADD ioctl. This ioctl has been considered legacy by upstream since the DTrace code was first imported, and is unused. The removal also allows some simplification of dtrace_helper_slurp(). Also remove a bogus copyout in the DTRACEHIOC_ADDDOF handler. Due to a bug, it would overwrite an in-memory copy of the DOF header rather than the passed-in DOF helper. Moreover, DTRACEHIOC_ADDDOF already copies the helper back out automatically since its argument has the IOC_OUT attribute. Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/dtrace/dtrace_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Jan 23 01:21:39 2017 (r312657) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Jan 23 02:21:06 2017 (r312658) @@ -16255,18 +16255,11 @@ dtrace_helper_provider_validate(dof_hdr_ } static int -#ifdef __FreeBSD__ dtrace_helper_slurp(dof_hdr_t *dof, dof_helper_t *dhp, struct proc *p) -#else -dtrace_helper_slurp(dof_hdr_t *dof, dof_helper_t *dhp) -#endif { dtrace_helpers_t *help; dtrace_vstate_t *vstate; dtrace_enabling_t *enab = NULL; -#ifndef __FreeBSD__ - proc_t *p = curproc; -#endif int i, gen, rv, nhelpers = 0, nprovs = 0, destroy = 1; uintptr_t daddr = (uintptr_t)dof; @@ -16277,8 +16270,8 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ vstate = &help->dthps_vstate; - if ((rv = dtrace_dof_slurp(dof, vstate, NULL, &enab, - dhp != NULL ? dhp->dofhp_addr : 0, B_FALSE)) != 0) { + if ((rv = dtrace_dof_slurp(dof, vstate, NULL, &enab, dhp->dofhp_addr, + B_FALSE)) != 0) { dtrace_dof_destroy(dof); return (rv); } @@ -16286,22 +16279,20 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ /* * Look for helper providers and validate their descriptions. */ - if (dhp != NULL) { - for (i = 0; i < dof->dofh_secnum; i++) { - dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr + - dof->dofh_secoff + i * dof->dofh_secsize); - - if (sec->dofs_type != DOF_SECT_PROVIDER) - continue; + for (i = 0; i < dof->dofh_secnum; i++) { + dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr + + dof->dofh_secoff + i * dof->dofh_secsize); - if (dtrace_helper_provider_validate(dof, sec) != 0) { - dtrace_enabling_destroy(enab); - dtrace_dof_destroy(dof); - return (-1); - } + if (sec->dofs_type != DOF_SECT_PROVIDER) + continue; - nprovs++; + if (dtrace_helper_provider_validate(dof, sec) != 0) { + dtrace_enabling_destroy(enab); + dtrace_dof_destroy(dof); + return (-1); } + + nprovs++; } /* @@ -16342,7 +16333,7 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_ gen = help->dthps_generation++; dtrace_enabling_destroy(enab); - if (dhp != NULL && nprovs > 0) { + if (nprovs > 0) { /* * Now that this is in-kernel, we change the sense of the * members: dofhp_dof denotes the in-kernel copy of the DOF Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Jan 23 01:21:39 2017 (r312657) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Jan 23 02:21:06 2017 (r312658) @@ -1410,7 +1410,6 @@ typedef struct { #define DTRACEHIOC_REMOVE (DTRACEHIOC | 2) /* remove helper */ #define DTRACEHIOC_ADDDOF (DTRACEHIOC | 3) /* add helper DOF */ #else -#define DTRACEHIOC_ADD _IOWR('z', 1, dof_hdr_t)/* add helper */ #define DTRACEHIOC_REMOVE _IOW('z', 2, int) /* remove helper */ #define DTRACEHIOC_ADDDOF _IOWR('z', 3, dof_helper_t)/* add helper DOF */ #endif Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_ioctl.c Mon Jan 23 01:21:39 2017 (r312657) +++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c Mon Jan 23 02:21:06 2017 (r312658) @@ -44,10 +44,8 @@ dtrace_ioctl_helper(struct cdev *dev, u_ case DTRACEHIOC_ADDDOF: dhp = (dof_helper_t *)addr; addr = (caddr_t)(uintptr_t)dhp->dofhp_dof; - /* FALLTHROUGH */ - case DTRACEHIOC_ADD: - p = curproc; - if (dhp == NULL || p->p_pid == dhp->dofhp_pid) { + if (p->p_pid == dhp->dofhp_pid) { + p = curproc; dof = dtrace_dof_copyin((uintptr_t)addr, &rval); } else { p = pfind(dhp->dofhp_pid); @@ -72,10 +70,7 @@ dtrace_ioctl_helper(struct cdev *dev, u_ mutex_enter(&dtrace_lock); if ((rval = dtrace_helper_slurp(dof, dhp, p)) != -1) { - if (dhp != NULL) { - dhp->dofhp_gen = rval; - copyout(dhp, addr, sizeof(*dhp)); - } + dhp->dofhp_gen = rval; rval = 0; } else { rval = EINVAL; From owner-svn-src-all@freebsd.org Mon Jan 23 04:03: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 6F5A4CBD783; Mon, 23 Jan 2017 04:03:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3678267E; Mon, 23 Jan 2017 04:03:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N43CCA001653; Mon, 23 Jan 2017 04:03:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N43Cmw001652; Mon, 23 Jan 2017 04:03:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201701230403.v0N43Cmw001652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 23 Jan 2017 04:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312659 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 04:03:13 -0000 Author: jhibbits Date: Mon Jan 23 04:03:12 2017 New Revision: 312659 URL: https://svnweb.freebsd.org/changeset/base/312659 Log: Avoid using non-zero argument for __builtin_frame_address(). Building kernel with devel/powerpc64-gcc (6.2.0) yields the following error: /usr/src/sys/powerpc/powerpc/db_trace.c:299:20: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address] Work around this by dereferencing the frame address manually instead. PR: 215600 Reported by: Mark Millard MFC after: 2 weeks Modified: head/sys/powerpc/powerpc/db_trace.c Modified: head/sys/powerpc/powerpc/db_trace.c ============================================================================== --- head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 02:21:06 2017 (r312658) +++ head/sys/powerpc/powerpc/db_trace.c Mon Jan 23 04:03:12 2017 (r312659) @@ -296,8 +296,12 @@ db_trace_self(void) { db_addr_t addr; - addr = (db_addr_t)__builtin_frame_address(1); - db_backtrace(curthread, addr, -1); + addr = (db_addr_t)__builtin_frame_address(0); + if (addr == 0) { + db_printf("Null frame address\n"); + return; + } + db_backtrace(curthread, *(db_addr_t *)addr, -1); } int From owner-svn-src-all@freebsd.org Mon Jan 23 04:20: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 343A4CBDA50; Mon, 23 Jan 2017 04:20: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 0F0D0BCB; Mon, 23 Jan 2017 04:20: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 v0N4KcRJ006063; Mon, 23 Jan 2017 04:20:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N4KcDK006062; Mon, 23 Jan 2017 04:20:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701230420.v0N4KcDK006062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 23 Jan 2017 04:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312660 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 04:20:39 -0000 Author: adrian Date: Mon Jan 23 04:20:37 2017 New Revision: 312660 URL: https://svnweb.freebsd.org/changeset/base/312660 Log: [ath] [ar9300] ensure the software scheduler is called to form more aggregates for EDMA chips When investigating performance on UDP TX on the AR9380 I found that the following sequence was occuring: * INTR * EINPROGRESS - nothing yet * INTR * TXSTATUS - process a TX completion for an aggregate * INTR, INTR * TXSTATUS - process a TX completion for an aggregate * TXD, TXD ... populate frames from the hardware queue and submit What should be happening is a completed TXSTATUS fires off more packets that are queued on active TIDs. What /was/ happening was after that first TXSTATUS the TX queue hardware queue was still empty, so it didn't push anything into the FIFO. Only after the second TXSTATUS did any progress get made. This is one of two commits - it ensures that the software TX queue scheduler is called /after/ TX completion, otherwise no frames from the software staging queues will be processed into the hardware queues. The second commit will fix it so it populates aggregate frames correctly when the above occurs - right now ath_txq_sched() is called, but it doesn't populate anything because its pre-check conditions are wrong. Whilst here, add/tweak debugging. Tested: * AR9380 STA (testing device) -> AR9580 hostap Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Mon Jan 23 04:03:12 2017 (r312659) +++ head/sys/dev/ath/if_ath_tx_edma.c Mon Jan 23 04:20:37 2017 (r312660) @@ -178,6 +178,13 @@ ath_tx_edma_push_staging_list(struct ath ATH_TXQ_LOCK_ASSERT(txq); + DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_TX_PROC, + "%s: called; TXQ=%d, fifo.depth=%d, axq_q empty=%d\n", + __func__, + txq->axq_qnum, + txq->axq_fifo_depth, + !! (TAILQ_EMPTY(&txq->axq_q))); + /* * Don't bother doing any work if it's full. */ @@ -802,6 +809,8 @@ ath_edma_tx_processq(struct ath_softc *s uint32_t txstatus[32]; #endif + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called\n", __func__); + for (idx = 0; ; idx++) { bzero(&ts, sizeof(ts)); @@ -812,8 +821,12 @@ ath_edma_tx_processq(struct ath_softc *s status = ath_hal_txprocdesc(ah, NULL, (void *) &ts); ATH_TXSTATUS_UNLOCK(sc); - if (status == HAL_EINPROGRESS) + if (status == HAL_EINPROGRESS) { + DPRINTF(sc, ATH_DEBUG_TX_PROC, + "%s: (%d): EINPROGRESS\n", + __func__, idx); break; + } #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_TX_PROC) @@ -1016,6 +1029,10 @@ ath_edma_tx_processq(struct ath_softc *s /* Attempt to schedule more hardware frames to the TX FIFO */ for (i = 0; i < HAL_NUM_TX_QUEUES; i++) { if (ATH_TXQ_SETUP(sc, i)) { + ATH_TX_LOCK(sc); + ath_txq_sched(sc, &sc->sc_txq[i]); + ATH_TX_UNLOCK(sc); + ATH_TXQ_LOCK(&sc->sc_txq[i]); ath_edma_tx_fifo_fill(sc, &sc->sc_txq[i]); ATH_TXQ_UNLOCK(&sc->sc_txq[i]); @@ -1024,6 +1041,8 @@ ath_edma_tx_processq(struct ath_softc *s /* Kick software scheduler */ ath_tx_swq_kick(sc); } + + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: end\n", __func__); } static void From owner-svn-src-all@freebsd.org Mon Jan 23 04:30: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 911BACBDD85; Mon, 23 Jan 2017 04:30: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 522C785; Mon, 23 Jan 2017 04:30: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 v0N4U849010119; Mon, 23 Jan 2017 04:30:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N4U8Ep010118; Mon, 23 Jan 2017 04:30:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701230430.v0N4U8Ep010118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 23 Jan 2017 04:30:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312661 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 04:30:09 -0000 Author: adrian Date: Mon Jan 23 04:30:08 2017 New Revision: 312661 URL: https://svnweb.freebsd.org/changeset/base/312661 Log: [ath] fix thresholds for deciding to queue to the software queue and populate hardware frames This is two fixes, which establishes what I /think/ is pretty close to the theoretical PHY maximum speed on the AR9380 devices. * When doing A-MPDU on a TID, don't queue to the hardware directly if the hardware queue is busy. This gives us time to get more packets queued up (and the hardware is busy, so there's no point in queuing more to the hardware right now) to potentially form an A-MPDU. This fixes up the throughput issue I was seeing where a couple hundred single frames were being sent a second interspersed between A-MPDU frames. It just happened that the software queue had exactly one frame in it at that point. Queuing it until the hardware finishes transmitting isn't exactly costly. * When determining whether to dequeue from a software node/TID queue into the hardware queue, fix up the checks to work right for EDMA chips (ar9380 and later.) Before it was not dispatching anything until the FIFO was empty. Now we allow it to dispatch another aggregate up to the hardware aggregate limit, like I intended with the earlier work. This allows a 5GHz HT40, short-GI, "htprotmode off" test at MCS23 to achieve 357 Mbit/sec in a one-way UDP test. The stars have to be aligned /just right/ so there are no retries but it can happen. Just don't expect it to work in an OTA test if your 2yo is running around the room - MCS23 is very very sensitive to channel conditions. Tested: * AR9380 STA (test) -> AR9580 hostap TODO: * More thorough testing on pre-AR9380 chips (AR5416, AR9160, AR9280) * (Finally) teach ath_rate_sample about throughput/latency rather than air time, so I can get good transmit rates with a 2yo running around. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jan 23 04:20:37 2017 (r312660) +++ head/sys/dev/ath/if_ath_tx.c Mon Jan 23 04:30:08 2017 (r312661) @@ -3129,7 +3129,21 @@ ath_tx_swq(struct ath_softc *sc, struct ATH_TID_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { - /* AMPDU running, attempt direct dispatch if possible */ + /* + * AMPDU running, queue single-frame if the hardware queue + * isn't busy. + * + * If the hardware queue is busy, sending an aggregate frame + * then just hold off so we can queue more aggregate frames. + * + * Otherwise we may end up with single frames leaking through + * because we are dispatching them too quickly. + * + * TODO: maybe we should treat this as two policies - minimise + * latency, or maximise throughput. Then for BE/BK we can + * maximise throughput, and VO/VI (if AMPDU is enabled!) + * minimise latency. + */ /* * Always queue the frame to the tail of the list. @@ -3138,18 +3152,18 @@ ath_tx_swq(struct ath_softc *sc, struct /* * If the hardware queue isn't busy, direct dispatch - * the head frame in the list. Don't schedule the - * TID - let it build some more frames first? + * the head frame in the list. * - * When running A-MPDU, always just check the hardware - * queue depth against the aggregate frame limit. - * We don't want to burst a large number of single frames - * out to the hardware; we want to aggressively hold back. + * Note: if we're say, configured to do ADDBA but not A-MPDU + * then maybe we want to still queue two non-aggregate frames + * to the hardware. Again with the per-TID policy + * configuration..) * * Otherwise, schedule the TID. */ /* XXX TXQ locking */ - if (txq->axq_depth + txq->fifo.axq_depth < sc->sc_hwq_limit_aggr) { + if (txq->axq_depth + txq->fifo.axq_depth == 0) { + bf = ATH_TID_FIRST(atid); ATH_TID_REMOVE(atid, bf, bf_list); @@ -5615,19 +5629,40 @@ ath_txq_sched(struct ath_softc *sc, stru ATH_TX_LOCK_ASSERT(sc); /* - * Don't schedule if the hardware queue is busy. - * This (hopefully) gives some more time to aggregate - * some packets in the aggregation queue. - * - * XXX It doesn't stop a parallel sender from sneaking - * in transmitting a frame! + * For non-EDMA chips, aggr frames that have been built are + * in axq_aggr_depth, whether they've been scheduled or not. + * There's no FIFO, so txq->axq_depth is what's been scheduled + * to the hardware. + * + * For EDMA chips, we do it in two stages. The existing code + * builds a list of frames to go to the hardware and the EDMA + * code turns it into a single entry to push into the FIFO. + * That way we don't take up one packet per FIFO slot. + * We do push one aggregate per FIFO slot though, just to keep + * things simple. + * + * The FIFO depth is what's in the hardware; the txq->axq_depth + * is what's been scheduled to the FIFO. + * + * fifo.axq_depth is the number of frames (or aggregates) pushed + * into the EDMA FIFO. For multi-frame lists, this is the number + * of frames pushed in. + * axq_fifo_depth is the number of FIFO slots currently busy. */ - /* XXX TXQ locking */ - if (txq->axq_aggr_depth + txq->fifo.axq_depth >= sc->sc_hwq_limit_aggr) { + + /* For EDMA and non-EDMA, check built/scheduled against aggr limit */ + if (txq->axq_aggr_depth >= sc->sc_hwq_limit_aggr) { sc->sc_aggr_stats.aggr_sched_nopkt++; return; } - if (txq->axq_depth >= sc->sc_hwq_limit_nonaggr) { + + /* + * For non-EDMA chips, axq_depth is the "what's scheduled to + * the hardware list". For EDMA it's "What's built for the hardware" + * and fifo.axq_depth is how many frames have been dispatched + * already to the hardware. + */ + if (txq->axq_depth + txq->fifo.axq_depth >= sc->sc_hwq_limit_nonaggr) { sc->sc_aggr_stats.aggr_sched_nopkt++; return; } From owner-svn-src-all@freebsd.org Mon Jan 23 04:42: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 58836CBD135 for ; Mon, 23 Jan 2017 04:42:16 +0000 (UTC) (envelope-from lakshmi.n@msystechnologies.com) Received: from mail-qt0-x22f.google.com (mail-qt0-x22f.google.com [IPv6:2607:f8b0:400d:c0d::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 252B9B3E for ; Mon, 23 Jan 2017 04:42:16 +0000 (UTC) (envelope-from lakshmi.n@msystechnologies.com) Received: by mail-qt0-x22f.google.com with SMTP id x49so104163938qtc.2 for ; Sun, 22 Jan 2017 20:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=msystechnologies.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oIznQRp0r/6dJBwsee1ZjOtl0tyYKoHQiRQz5eIhYlA=; b=jHyr+BYxC2v5jBsjkN0Jgcb/aaghQjdvOa8v9PZbpSRG37X/MnnBuEhRq45WbSc+9N T7Pcc2aTtfqzJ3IARg53yyj+SojPKDAFPtKbXph8FqPbAySmEIGsRe5Ry7SA7z9rfoGY tfCrCcoz3tXf/isZUdGMgvjxY5WLknrhPPxd4= 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=oIznQRp0r/6dJBwsee1ZjOtl0tyYKoHQiRQz5eIhYlA=; b=uZ5in2WigTCf+QNG3LsHoJa5vKc33MJzCmrTZq3fYPNCaLIM5dDviITBsRiUAd895m xXmc/lt73VBqRF8yLc8xz3oZ0866eRLdE6/0qlMySE+/GIEVMxQh8QHbKiWTO6q5ock8 aLmO/vfa7ZTpPxFip44dmZJ/SbOvPAbLr+Vj0+5hdNxFOFHl19rTBRtwAp2iI014jDAl NMkosgwzn5KhjE5+j2VzJ6OnDQCjaZJB7l4avxj4v2VILdO8tvA/lZ81nrdFtFXASFhT Ho1+paY57zxs2SkO8+Bshxhk2eOhAUEmbcNi0o3mzu/d4AQVmVLHKUACNeZHMSykmDlW PwMQ== X-Gm-Message-State: AIkVDXLKzuEQwZlgdmppbsRguqPh0zhoggfNJT40w38EDHK5AbSCATJ48nAW0bf0uYmrBKR//AuO/6g+g5tvviqGoCI8oma5QUrolQ9CjrN8oSM+8G3Yfd/S8sxbH7PoZ+a7ryfx8EbIiYPR3OWY6A== X-Received: by 10.237.59.28 with SMTP id p28mr21844739qte.222.1485146535094; Sun, 22 Jan 2017 20:42:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.89.244 with HTTP; Sun, 22 Jan 2017 20:42:14 -0800 (PST) In-Reply-To: References: <201508122021.t7CKL5wk016750@repo.freebsd.org> <20170118223827.GJ86256@strugglingcoder.info> From: Lakshmi Narasimhan Sundararajan Date: Mon, 23 Jan 2017 10:12:14 +0530 Message-ID: Subject: Re: svn commit: r286700 - in head: sbin/ifconfig sys/net To: Ravi Pokala Cc: Hiren Panchasara , Alan Somers , smh@freebsd.org, "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: Mon, 23 Jan 2017 04:42:16 -0000 It's been a long while since we looked at this. We have moved along to other projects. I am sorry, I cannot be of much help now. Regards LN On Sat, Jan 21, 2017 at 8:07 AM, Ravi Pokala wrote: > -----Original Message----- > > From: on behalf of Hiren Panchasara < > hiren@freebsd.org> > > Date: 2017-01-18, Wednesday at 14:38 > > To: Alan Somers , , > , > > Cc: "src-committers@freebsd.org" , " > svn-src-all@freebsd.org" , " > svn-src-head@freebsd.org" > > Subject: Re: svn commit: r286700 - in head: sbin/ifconfig sys/net > > > > Adding the submitter and other reviewers for their comments. > > > > On 01/18/17 at 03:03P, Alan Somers wrote: > >> Is the change to lacp_port_create correct? The comment indicates that > >> fast is configurable, but it's actually constant. Later on, there's > >> some dead code that depends on the value of fast (it was dead before > >> this commit, too). > >> > >> CID: 1305734 > >> CID: 1305692 > > You're right that in lacp_port_create(), "fast" (and "active") are both > constant. I think the comment intended to indicate that "fast" could be > changed via ioctl *after create*. > > It seems to me that the right thing to do would be to remove both "fast" > and "active" from lacp_port_create(), and have it unconditionally set > "lp->lp_state" to LACP_STATE_ACTIVITY. That would eliminate the unclear > comments and fix both Coverity issues, without changing any behavior. > > -Ravi (rpokala@) > > >> -Alan > >> > >> On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara > wrote: > >>> Author: hiren > >>> Date: Wed Aug 12 20:21:04 2015 > >>> New Revision: 286700 > >>> URL: https://svnweb.freebsd.org/changeset/base/286700 > >>> > >>> Log: > >>> Make LAG LACP fast timeout tunable through IOCTL. > >>> > >>> Differential Revision: D3300 > >>> Submitted by: LN Sundararajan > >>> Reviewed by: wblock, smh, gnn, hiren, rpokala at panasas > >>> MFC after: 2 weeks > >>> Sponsored by: Panasas > >>> > >>> Modified: > >>> head/sbin/ifconfig/ifconfig.8 > >>> head/sbin/ifconfig/iflagg.c > >>> head/sys/net/ieee8023ad_lacp.c > >>> head/sys/net/ieee8023ad_lacp.h > >>> head/sys/net/if_lagg.c > >>> head/sys/net/if_lagg.h > >>> > >>> Modified: head/sbin/ifconfig/ifconfig.8 > >>> ============================================================ > ================== > >>> --- head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sbin/ifconfig/ifconfig.8 Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -28,7 +28,7 @@ > >>> .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > >>> .\" $FreeBSD$ > >>> .\" > >>> -.Dd May 15, 2015 > >>> +.Dd Aug 12, 2015 > >>> .Dt IFCONFIG 8 > >>> .Os > >>> .Sh NAME > >>> @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h > >>> Set a shift parameter for RSS local hash computation. > >>> Hash is calculated by using flowid bits in a packet header mbuf > >>> which are shifted by the number of this parameter. > >>> +.It Cm lacp_fast_timeout > >>> +Enable lacp fast-timeout on the interface. > >>> +.It Cm -lacp_fast_timeout > >>> +Disable lacp fast-timeout on the interface. > >>> .El > >>> .Pp > >>> The following parameters are specific to IP tunnel interfaces, > >>> > >>> Modified: head/sbin/ifconfig/iflagg.c > >>> ============================================================ > ================== > >>> --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in > >>> case -LAGG_OPT_LACP_TXTEST: > >>> case LAGG_OPT_LACP_RXTEST: > >>> case -LAGG_OPT_LACP_RXTEST: > >>> + case LAGG_OPT_LACP_TIMEOUT: > >>> + case -LAGG_OPT_LACP_TIMEOUT: > >>> break; > >>> default: > >>> err(1, "Invalid lagg option"); > >>> @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = { > >>> DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), > >>> DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), > >>> DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), > >>> + DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > >>> + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, > setlaggsetopt), > >>> DEF_CMD_ARG("flowid_shift", setlaggflowidshift), > >>> }; > >>> static struct afswtch af_lagg = { > >>> > >>> Modified: head/sys/net/ieee8023ad_lacp.c > >>> ============================================================ > ================== > >>> --- head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sys/net/ieee8023ad_lacp.c Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp) > >>> int error; > >>> > >>> boolean_t active = TRUE; /* XXX should be configurable */ > >>> - boolean_t fast = FALSE; /* XXX should be configurable */ > >>> + boolean_t fast = FALSE; /* Configurable via ioctl */ > >>> > >>> link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); > >>> sdl.sdl_alen = ETHER_ADDR_LEN; > >>> > >>> Modified: head/sys/net/ieee8023ad_lacp.h > >>> ============================================================ > ================== > >>> --- head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sys/net/ieee8023ad_lacp.h Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -251,6 +251,7 @@ struct lacp_softc { > >>> u_int32_t lsc_tx_test; > >>> } lsc_debug; > >>> u_int32_t lsc_strict_mode; > >>> + boolean_t lsc_fast_timeout; /* if set, fast > timeout */ > >>> }; > >>> > >>> #define LACP_TYPE_ACTORINFO 1 > >>> > >>> Modified: head/sys/net/if_lagg.c > >>> ============================================================ > ================== > >>> --- head/sys/net/if_lagg.c Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sys/net/if_lagg.c Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -1257,6 +1257,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > >>> ro->ro_opts |= LAGG_OPT_LACP_RXTEST; > >>> if (lsc->lsc_strict_mode != 0) > >>> ro->ro_opts |= LAGG_OPT_LACP_STRICT; > >>> + if (lsc->lsc_fast_timeout != 0) > >>> + ro->ro_opts |= LAGG_OPT_LACP_TIMEOUT; > >>> > >>> ro->ro_active = sc->sc_active; > >>> } else { > >>> @@ -1292,6 +1294,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > >>> case -LAGG_OPT_LACP_RXTEST: > >>> case LAGG_OPT_LACP_STRICT: > >>> case -LAGG_OPT_LACP_STRICT: > >>> + case LAGG_OPT_LACP_TIMEOUT: > >>> + case -LAGG_OPT_LACP_TIMEOUT: > >>> valid = lacp = 1; > >>> break; > >>> default: > >>> @@ -1320,6 +1324,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > >>> sc->sc_opts &= ~ro->ro_opts; > >>> } else { > >>> struct lacp_softc *lsc; > >>> + struct lacp_port *lp; > >>> > >>> lsc = (struct lacp_softc *)sc->sc_psc; > >>> > >>> @@ -1342,6 +1347,20 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > >>> case -LAGG_OPT_LACP_STRICT: > >>> lsc->lsc_strict_mode = 0; > >>> break; > >>> + case LAGG_OPT_LACP_TIMEOUT: > >>> + LACP_LOCK(lsc); > >>> + LIST_FOREACH(lp, &lsc->lsc_ports, > lp_next) > >>> + lp->lp_state |= > LACP_STATE_TIMEOUT; > >>> + LACP_UNLOCK(lsc); > >>> + lsc->lsc_fast_timeout = 1; > >>> + break; > >>> + case -LAGG_OPT_LACP_TIMEOUT: > >>> + LACP_LOCK(lsc); > >>> + LIST_FOREACH(lp, &lsc->lsc_ports, > lp_next) > >>> + lp->lp_state &= > ~LACP_STATE_TIMEOUT; > >>> + LACP_UNLOCK(lsc); > >>> + lsc->lsc_fast_timeout = 0; > >>> + break; > >>> } > >>> } > >>> LAGG_WUNLOCK(sc); > >>> > >>> Modified: head/sys/net/if_lagg.h > >>> ============================================================ > ================== > >>> --- head/sys/net/if_lagg.h Wed Aug 12 20:16:13 2015 > (r286699) > >>> +++ head/sys/net/if_lagg.h Wed Aug 12 20:21:04 2015 > (r286700) > >>> @@ -150,6 +150,7 @@ struct lagg_reqopts { > >>> #define LAGG_OPT_LACP_STRICT 0x10 /* > LACP strict mode */ > >>> #define LAGG_OPT_LACP_TXTEST 0x20 /* > LACP debug: txtest */ > >>> #define LAGG_OPT_LACP_RXTEST 0x40 /* > LACP debug: rxtest */ > >>> +#define LAGG_OPT_LACP_TIMEOUT 0x80 /* > LACP timeout */ > >>> u_int ro_count; /* number of > ports */ > >>> u_int ro_active; /* active port > count */ > >>> u_int ro_flapping; /* number of > flapping */ > >>> > > > > -- DISCLAIMER The information in this e-mail is confidential and may be subject to legal privilege. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorized. If you have received this communication in error, please address with the subject heading "Received in error," send to it@msystechnologies.com, then delete the e-mail and destroy any copies of it. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. The views, opinions, conclusions and other information expressed in this electronic mail and any attachments are not given or endorsed by the company unless otherwise indicated by an authorized representative independent of this message. MSys cannot guarantee that e-mail communications are secure or error-free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses, though all reasonable precautions have been taken to ensure no viruses are present in this e-mail. As our company cannot accept responsibility for any loss or damage arising from the use of this e-mail or attachments we recommend that you subject these to your virus checking procedures prior to use From owner-svn-src-all@freebsd.org Mon Jan 23 04:47: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 12B0ECBD349; Mon, 23 Jan 2017 04:47: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 C7E78D25; Mon, 23 Jan 2017 04:47: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 v0N4lc4h017917; Mon, 23 Jan 2017 04:47:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N4lcKj017916; Mon, 23 Jan 2017 04:47:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701230447.v0N4lcKj017916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 23 Jan 2017 04:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312662 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 04:47:40 -0000 Author: adrian Date: Mon Jan 23 04:47:38 2017 New Revision: 312662 URL: https://svnweb.freebsd.org/changeset/base/312662 Log: [ath] modify cabq and per-node packet usage limits. * limit cabq to 64 - in practice if this stays at ath_txbuf then all buffers can be tied up by a very busy broadcast domain (eg ARP storm, way too much MDNS/NETBIOS). It's been like this in the freebsd-wifi-build AP project for the longest time. * Now that I figured out the hilarity inherent in aggregate forming and AR9380 EDMA work, change the per-node to 64 frames by default. I'll do some more work to shorten the queue latency introduced when doing data so TCP isn't so terrible, but it's now no longer /always/ tens of milliseconds of extra latency when doing active iperf tests. Notes: The reason for the extra latency is partly tx/rx taskqueue handling and scheduling, and partly due to a lack of airtime/QoS awareness of per-node traffic. Ideally we'd have different limits/priorities on the QoS/TID levels per node so say, voice/video data got a better share of buffer allocations over best effort/bulk data, but we currently don't implement that. It's not /hard/ to do, I just need to do it. Tested: * AR9380 (STA), AR9580 (hostap) - both with the relevant changes. TCP is now at around 180mbit with rate control and RTS protection enabled. UDP stays at 355mbit at MCS23, no HT protection. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Jan 23 04:30:08 2017 (r312661) +++ head/sys/dev/ath/if_ath.c Mon Jan 23 04:47:38 2017 (r312662) @@ -1028,12 +1028,16 @@ ath_attach(u_int16_t devid, struct ath_s * otherwise) to be transmitted. */ sc->sc_txq_data_minfree = 10; + /* - * Leave this as default to maintain legacy behaviour. - * Shortening the cabq/mcastq may end up causing some - * undesirable behaviour. + * Shorten this to 64 packets, or 1/4 ath_txbuf, whichever + * is smaller. + * + * Anything bigger can potentially see the cabq consume + * almost all buffers, starving everything else, only to + * see most fail to transmit in the given beacon interval. */ - sc->sc_txq_mcastq_maxdepth = ath_txbuf; + sc->sc_txq_mcastq_maxdepth = MIN(64, ath_txbuf / 4); /* * How deep can the node software TX queue get whilst it's asleep. @@ -1041,11 +1045,10 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_txq_node_psq_maxdepth = 16; /* - * Default the maximum queue depth for a given node - * to 1/4'th the TX buffers, or 64, whichever - * is larger. + * Default the maximum queue to to 1/4'th the TX buffers, or + * 64, whichever is smaller. */ - sc->sc_txq_node_maxdepth = MAX(64, ath_txbuf / 4); + sc->sc_txq_node_maxdepth = MIN(64, ath_txbuf / 4); /* Enable CABQ by default */ sc->sc_cabq_enable = 1; From owner-svn-src-all@freebsd.org Mon Jan 23 06:04: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 C7D4ECBD47C; Mon, 23 Jan 2017 06:04:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 977DC1E51; Mon, 23 Jan 2017 06:04:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N64h8C049769; Mon, 23 Jan 2017 06:04:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N64hvL049768; Mon, 23 Jan 2017 06:04:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201701230604.v0N64hvL049768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 23 Jan 2017 06:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312663 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 06:04:44 -0000 Author: delphij Date: Mon Jan 23 06:04:43 2017 New Revision: 312663 URL: https://svnweb.freebsd.org/changeset/base/312663 Log: When creating record file, use umask 077 instead of the default. MFC after: 2 weeks Modified: head/usr.bin/mail/send.c Modified: head/usr.bin/mail/send.c ============================================================================== --- head/usr.bin/mail/send.c Mon Jan 23 04:47:38 2017 (r312662) +++ head/usr.bin/mail/send.c Mon Jan 23 06:04:43 2017 (r312663) @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } From owner-svn-src-all@freebsd.org Mon Jan 23 07: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 4B428CBDCED; Mon, 23 Jan 2017 07:32:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACEE1FA6; Mon, 23 Jan 2017 07:32:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N7Wlj3086357; Mon, 23 Jan 2017 07:32:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N7WlkZ086356; Mon, 23 Jan 2017 07:32:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201701230732.v0N7WlkZ086356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 23 Jan 2017 07:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312664 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 07:32:48 -0000 Author: delphij Date: Mon Jan 23 07:32:47 2017 New Revision: 312664 URL: https://svnweb.freebsd.org/changeset/base/312664 Log: Always initialize 'c'. MFC after: 2 weeks Modified: head/usr.bin/mail/send.c Modified: head/usr.bin/mail/send.c ============================================================================== --- head/usr.bin/mail/send.c Mon Jan 23 06:04:43 2017 (r312663) +++ head/usr.bin/mail/send.c Mon Jan 23 07:32:47 2017 (r312664) @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *ob FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace From owner-svn-src-all@freebsd.org Mon Jan 23 08:32: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 4663ACBD58E; Mon, 23 Jan 2017 08:32:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id EE14F7C4; Mon, 23 Jan 2017 08:32:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA20011; Mon, 23 Jan 2017 10:32:02 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cVa2k-0007MH-55; Mon, 23 Jan 2017 10:32:02 +0200 Subject: Re: svn commit: r312426 - head/sys/kern To: Eric van Gyzen , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201701191846.v0JIkfMI078267@repo.freebsd.org> <174532d3-e959-db1c-9363-ee8ff0c6d21d@FreeBSD.org> From: Andriy Gapon Message-ID: <28326b7f-f590-fbf2-2054-d17e41fe1382@FreeBSD.org> Date: Mon, 23 Jan 2017 10:30:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <174532d3-e959-db1c-9363-ee8ff0c6d21d@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 08:32:11 -0000 On 22/01/2017 20:30, Eric van Gyzen wrote: > On 01/19/2017 12:46, Andriy Gapon wrote: >> Author: avg >> Date: Thu Jan 19 18:46:41 2017 >> New Revision: 312426 >> URL: https://svnweb.freebsd.org/changeset/base/312426 >> >> Log: >> fix a thread preemption regression in schedulers introduced in r270423 >> >> Commit r270423 fixed a regression in sched_yield() that was introduced >> in earlier changes. Unfortunately, at the same time it introduced an >> new regression. > > Pointy hat to: vangyzen, 2.5 years later... Eric, sorry I didn't realize you are a committer. Otherwise I'd add you as a reviewer and would also make sure to add that pointy hat line :-) -- Andriy Gapon From owner-svn-src-all@freebsd.org Mon Jan 23 08:34: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 3BBF5CBD607; Mon, 23 Jan 2017 08:34:43 +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 0B212A9B; Mon, 23 Jan 2017 08:34:42 +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 v0N8Yggx010992; Mon, 23 Jan 2017 08:34:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N8Yg8H010990; Mon, 23 Jan 2017 08:34:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701230834.v0N8Yg8H010990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 Jan 2017 08:34:42 +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: r312665 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 08:34:43 -0000 Author: avg Date: Mon Jan 23 08:34:41 2017 New Revision: 312665 URL: https://svnweb.freebsd.org/changeset/base/312665 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/11/sys/kern/sched_4bsd.c stable/11/sys/kern/sched_ule.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sched_4bsd.c ============================================================================== --- stable/11/sys/kern/sched_4bsd.c Mon Jan 23 07:32:47 2017 (r312664) +++ stable/11/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) @@ -968,8 +968,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/11/sys/kern/sched_ule.c ============================================================================== --- stable/11/sys/kern/sched_ule.c Mon Jan 23 07:32:47 2017 (r312664) +++ stable/11/sys/kern/sched_ule.c Mon Jan 23 08:34:41 2017 (r312665) @@ -1898,8 +1898,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-all@freebsd.org Mon Jan 23 08:34: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 961F8CBD64B; Mon, 23 Jan 2017 08:34:52 +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 65ABDB01; Mon, 23 Jan 2017 08:34:52 +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 v0N8YpSN011044; Mon, 23 Jan 2017 08:34:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N8Ypnu011042; Mon, 23 Jan 2017 08:34:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701230834.v0N8Ypnu011042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 23 Jan 2017 08:34: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: r312666 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 08:34:52 -0000 Author: avg Date: Mon Jan 23 08:34:51 2017 New Revision: 312666 URL: https://svnweb.freebsd.org/changeset/base/312666 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/10/sys/kern/sched_4bsd.c stable/10/sys/kern/sched_ule.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sched_4bsd.c ============================================================================== --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/10/sys/kern/sched_ule.c ============================================================================== --- stable/10/sys/kern/sched_ule.c Mon Jan 23 08:34:41 2017 (r312665) +++ stable/10/sys/kern/sched_ule.c Mon Jan 23 08:34:51 2017 (r312666) @@ -1870,8 +1870,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-all@freebsd.org Mon Jan 23 13:34: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 3A755CBCF0B; Mon, 23 Jan 2017 13:34:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 0507CA86; Mon, 23 Jan 2017 13:34:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id BDED0D65BE7; Tue, 24 Jan 2017 00:34:41 +1100 (AEDT) Date: Tue, 24 Jan 2017 00:34:41 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r312666 - stable/10/sys/kern In-Reply-To: <201701230834.v0N8Ypnu011042@repo.freebsd.org> Message-ID: <20170124002712.Q903@besplex.bde.org> References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=BKLDlBYG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=RN40QYc7CpQC_wqHqSMA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 13:34:51 -0000 On Mon, 23 Jan 2017, Andriy Gapon wrote: > ============================================================================== > --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) > +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) > @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t > sched_load_rem(); > > td->td_lastcpu = td->td_oncpu; > - preempted = !((td->td_flags & TDF_SLICEEND) || > - (flags & SWT_RELINQUISH)); > + preempted = (td->td_flags & TDF_SLICEEND) == 0 && > + (flags & SW_PREEMPT) != 0; > td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); > td->td_owepreempt = 0; > td->td_oncpu = NOCPU; Please also merge to FreeBSD-9. FreeBSD-9 has best performance for a makeworld benchmark. What is a good benchmark for showing that the fix helps? Involuntary context switches increased by almost a factor of 2 for the makeworld benchmark (over nfs) recently, but that was just caused by pessimizations in the NIC driver. Bruce From owner-svn-src-all@freebsd.org Mon Jan 23 14:18: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 099B8CBD015; Mon, 23 Jan 2017 14:18:52 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id DD521B9B; Mon, 23 Jan 2017 14:18:51 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 231AF5649D; Mon, 23 Jan 2017 08:18:51 -0600 (CST) Subject: Re: svn commit: r312426 - head/sys/kern To: Andriy Gapon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201701191846.v0JIkfMI078267@repo.freebsd.org> <174532d3-e959-db1c-9363-ee8ff0c6d21d@FreeBSD.org> <28326b7f-f590-fbf2-2054-d17e41fe1382@FreeBSD.org> From: Eric van Gyzen Message-ID: <5e929e2e-2c64-db93-c75f-b28806241bbc@FreeBSD.org> Date: Mon, 23 Jan 2017 08:18:45 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <28326b7f-f590-fbf2-2054-d17e41fe1382@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 14:18:52 -0000 On 01/23/2017 02:30, Andriy Gapon wrote: > On 22/01/2017 20:30, Eric van Gyzen wrote: >> On 01/19/2017 12:46, Andriy Gapon wrote: >>> Author: avg >>> Date: Thu Jan 19 18:46:41 2017 >>> New Revision: 312426 >>> URL: https://svnweb.freebsd.org/changeset/base/312426 >>> >>> Log: >>> fix a thread preemption regression in schedulers introduced in r270423 >>> >>> Commit r270423 fixed a regression in sched_yield() that was introduced >>> in earlier changes. Unfortunately, at the same time it introduced an >>> new regression. >> >> Pointy hat to: vangyzen, 2.5 years later... > > Eric, > > sorry I didn't realize you are a committer. > Otherwise I'd add you as a reviewer and would also make sure to add that pointy > hat line :-) LOL. No worries. Thanks for the fix! Eric From owner-svn-src-all@freebsd.org Mon Jan 23 15:39: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 B1625CBEBCC; Mon, 23 Jan 2017 15:39:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C143A89; Mon, 23 Jan 2017 15:39:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0NFdpdX082463; Mon, 23 Jan 2017 15:39:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NFdpE0082462; Mon, 23 Jan 2017 15:39:51 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701231539.v0NFdpE0082462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 23 Jan 2017 15:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312667 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 15:39:52 -0000 Author: pfg Date: Mon Jan 23 15:39:51 2017 New Revision: 312667 URL: https://svnweb.freebsd.org/changeset/base/312667 Log: sort - Don't live-loop threads. Worker threads now use a pthread_cond_t to wait for work instead of burning the cpu up. Obtained from: DragonflyBSD (07774aea0ccf64a48fcfad8899e3bf7c8f18277a) MFC after: 2 weeks Modified: head/usr.bin/sort/radixsort.c Modified: head/usr.bin/sort/radixsort.c ============================================================================== --- head/usr.bin/sort/radixsort.c Mon Jan 23 08:34:51 2017 (r312666) +++ head/usr.bin/sort/radixsort.c Mon Jan 23 15:39:51 2017 (r312667) @@ -83,12 +83,12 @@ static struct level_stack *g_ls; #if defined(SORT_THREADS) /* stack guarding mutex */ +static pthread_cond_t g_ls_cond; static pthread_mutex_t g_ls_mutex; /* counter: how many items are left */ static size_t sort_left; /* guarding mutex */ -static pthread_mutex_t sort_left_mutex; /* semaphore to count threads */ static sem_t mtsem; @@ -99,23 +99,25 @@ static sem_t mtsem; static inline void sort_left_dec(size_t n) { - - pthread_mutex_lock(&sort_left_mutex); + pthread_mutex_lock(&g_ls_mutex); sort_left -= n; - pthread_mutex_unlock(&sort_left_mutex); + if (sort_left == 0 && nthreads > 1) + pthread_cond_broadcast(&g_ls_cond); + pthread_mutex_unlock(&g_ls_mutex); } /* * Do we have something to sort ? + * + * This routine does not need to be locked. */ static inline bool have_sort_left(void) { bool ret; - pthread_mutex_lock(&sort_left_mutex); ret = (sort_left > 0); - pthread_mutex_unlock(&sort_left_mutex); + return (ret); } @@ -146,6 +148,11 @@ push_ls(struct sort_level *sl) #if defined(SORT_THREADS) if (nthreads > 1) + pthread_cond_signal(&g_ls_cond); +#endif + +#if defined(SORT_THREADS) + if (nthreads > 1) pthread_mutex_unlock(&g_ls_mutex); #endif } @@ -184,13 +191,19 @@ pop_ls_mt(void) pthread_mutex_lock(&g_ls_mutex); - if (g_ls) { - sl = g_ls->sl; - saved_ls = g_ls; - g_ls = g_ls->next; - } else { + for (;;) { + if (g_ls) { + sl = g_ls->sl; + saved_ls = g_ls; + g_ls = g_ls->next; + break; + } sl = NULL; saved_ls = NULL; + + if (have_sort_left() == 0) + break; + pthread_cond_wait(&g_ls_cond, &g_ls_mutex); } pthread_mutex_unlock(&g_ls_mutex); @@ -495,13 +508,8 @@ run_sort_cycle_mt(void) for (;;) { slc = pop_ls_mt(); - if (slc == NULL) { - if (have_sort_left()) { - pthread_yield(); - continue; - } + if (slc == NULL) break; - } run_sort_level_next(slc); } } @@ -512,9 +520,7 @@ run_sort_cycle_mt(void) static void* sort_thread(void* arg) { - run_sort_cycle_mt(); - sem_post(&mtsem); return (arg); @@ -610,8 +616,7 @@ run_top_sort_level(struct sort_level *sl pthread_t pth; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, - PTHREAD_DETACHED); + pthread_attr_setdetachstate(&attr, PTHREAD_DETACHED); for (;;) { int res = pthread_create(&pth, &attr, @@ -628,7 +633,7 @@ run_top_sort_level(struct sort_level *sl pthread_attr_destroy(&attr); } - for(i = 0; i < nthreads; ++i) + for (i = 0; i < nthreads; ++i) sem_wait(&mtsem); } #endif /* defined(SORT_THREADS) */ @@ -651,7 +656,7 @@ run_sort(struct sort_list_item **base, s pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_ADAPTIVE_NP); pthread_mutex_init(&g_ls_mutex, &mattr); - pthread_mutex_init(&sort_left_mutex, &mattr); + pthread_cond_init(&g_ls_cond, NULL); pthread_mutexattr_destroy(&mattr); @@ -679,7 +684,6 @@ run_sort(struct sort_list_item **base, s if (nthreads > 1) { sem_destroy(&mtsem); pthread_mutex_destroy(&g_ls_mutex); - pthread_mutex_destroy(&sort_left_mutex); } nthreads = nthreads_save; #endif From owner-svn-src-all@freebsd.org Mon Jan 23 16:04: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 75EDACBE5E6; Mon, 23 Jan 2017 16:04:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2F16E3BC; Mon, 23 Jan 2017 16:04:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA20869; Mon, 23 Jan 2017 18:04:47 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cVh6t-0007iT-0P; Mon, 23 Jan 2017 18:04:47 +0200 Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Andriy Gapon Message-ID: <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Date: Mon, 23 Jan 2017 18:03:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170124002712.Q903@besplex.bde.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 16:04:51 -0000 On 23/01/2017 15:34, Bruce Evans wrote: > On Mon, 23 Jan 2017, Andriy Gapon wrote: > >> ============================================================================== >> --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) >> +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) >> @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t >> sched_load_rem(); >> >> td->td_lastcpu = td->td_oncpu; >> - preempted = !((td->td_flags & TDF_SLICEEND) || >> - (flags & SWT_RELINQUISH)); >> + preempted = (td->td_flags & TDF_SLICEEND) == 0 && >> + (flags & SW_PREEMPT) != 0; >> td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); >> td->td_owepreempt = 0; >> td->td_oncpu = NOCPU; > > Please also merge to FreeBSD-9. FreeBSD-9 has best performance for a > makeworld benchmark. Will do. > What is a good benchmark for showing that the fix helps? Honestly, I do not know. We ran into a pathology where a thread was not getting scheduled for a long time after being preempted while in a critical section (so the actual preemption was a voluntary switch when exiting the critical section). I am not sure what kind of a synthetic benchmark or a test case would readily demonstrate the problem. > Involuntary context switches increased by almost a factor of 2 for the > makeworld benchmark (over nfs) recently, but that was just caused by > pessimizations in the NIC driver. -- Andriy Gapon From owner-svn-src-all@freebsd.org Mon Jan 23 16:40: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 D9EB0CBD2F8; Mon, 23 Jan 2017 16:40:21 +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 A9B5388; Mon, 23 Jan 2017 16:40:21 +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 v0NGeKdY008155; Mon, 23 Jan 2017 16:40:20 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NGeKH7008154; Mon, 23 Jan 2017 16:40:20 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201701231640.v0NGeKH7008154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 23 Jan 2017 16:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312668 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 16:40:22 -0000 Author: bz Date: Mon Jan 23 16:40:20 2017 New Revision: 312668 URL: https://svnweb.freebsd.org/changeset/base/312668 Log: Remove a static function declaration for a function not implemented. Makes head code compile on 10.3 and cleanup is never wrong. MFC after: 3 days Modified: head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Mon Jan 23 15:39:51 2017 (r312667) +++ head/sys/arm64/arm64/mp_machdep.c Mon Jan 23 16:40:20 2017 (r312668) @@ -105,8 +105,6 @@ static void ipi_preempt(void *); static void ipi_rendezvous(void *); static void ipi_stop(void *); -static int ipi_handler(void *arg); - struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; From owner-svn-src-all@freebsd.org Mon Jan 23 17:44: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 0EAEECBEAAB; Mon, 23 Jan 2017 17:44: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 D2A0CB0; Mon, 23 Jan 2017 17:44: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 v0NHiXhS037149; Mon, 23 Jan 2017 17:44:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NHiXU1037148; Mon, 23 Jan 2017 17:44:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701231744.v0NHiXU1037148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 23 Jan 2017 17:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312669 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 17:44:35 -0000 Author: mav Date: Mon Jan 23 17:44:33 2017 New Revision: 312669 URL: https://svnweb.freebsd.org/changeset/base/312669 Log: Fix overrun handling issue in r312291. MFC after: 1 week Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jan 23 16:40:20 2017 (r312668) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jan 23 17:44:33 2017 (r312669) @@ -2638,7 +2638,7 @@ cfiscsi_datamove_out(union ctl_io *io) * Complete write underflow. Not a single byte to read. Return. */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); - if (io->scsiio.kern_rel_offset > expected_len) { + if (io->scsiio.kern_rel_offset >= expected_len) { io->scsiio.be_move_done(io); return; } From owner-svn-src-all@freebsd.org Mon Jan 23 18:12: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 87E7FCBE43D; Mon, 23 Jan 2017 18:12:22 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 6ACA3C5F; Mon, 23 Jan 2017 18:12:21 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 992655649D; Mon, 23 Jan 2017 12:12:15 -0600 (CST) Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Andriy Gapon , Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Eric van Gyzen Message-ID: Date: Mon, 23 Jan 2017 12:12:14 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 18:12:22 -0000 On 01/23/2017 10:03, Andriy Gapon wrote: > On 23/01/2017 15:34, Bruce Evans wrote: >> What is a good benchmark for showing that the fix helps? > > Honestly, I do not know. We ran into a pathology where a thread was not getting > scheduled for a long time after being preempted while in a critical section (so > the actual preemption was a voluntary switch when exiting the critical section). > I am not sure what kind of a synthetic benchmark or a test case would readily > demonstrate the problem. I submitted r270423, which introduced the bug Andriy just fixed. I'm already setting up the performance test that I used for that change. It's a macro-benchmark of a commercial product, so I can't elaborate on details, but at least I can give a thumb indication in the style of a Roman Dictator. Eric From owner-svn-src-all@freebsd.org Mon Jan 23 19:20: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 D4BBCCBEF31; Mon, 23 Jan 2017 19:20:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3C51132E; Mon, 23 Jan 2017 19:20:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0NJKtgG078405; Mon, 23 Jan 2017 19:20:55 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NJKtYY078404; Mon, 23 Jan 2017 19:20:55 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201701231920.v0NJKtYY078404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 23 Jan 2017 19:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312670 - head/sys/boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 19:20:56 -0000 Author: gonzo Date: Mon Jan 23 19:20:55 2017 New Revision: 312670 URL: https://svnweb.freebsd.org/changeset/base/312670 Log: [am335x] Use upstream tda19988 framer node from upstream DTS Remove custom DTS duplicate of tda19988 node and use upstream-provided one introduced by r295436. This duplication created two tdaX devices which confused fb driver into using only 640x480 area while setting display to native resolution. Reported by: Michael Smith MFC after: 3 days Modified: head/sys/boot/fdt/dts/arm/beaglebone-black.dts Modified: head/sys/boot/fdt/dts/arm/beaglebone-black.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/beaglebone-black.dts Mon Jan 23 17:44:33 2017 (r312669) +++ head/sys/boot/fdt/dts/arm/beaglebone-black.dts Mon Jan 23 19:20:55 2017 (r312670) @@ -50,13 +50,7 @@ }; &i2c0 { - tda998x: hdmi-encoder { - compatible = "nxp,tda998x"; - reg = <0x70>; - - pinctrl-names = "default", "off"; - pinctrl-0 = <&nxp_hdmi_bonelt_pins>; - pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>; + tda998x: tda19988 { status = "okay"; }; }; From owner-svn-src-all@freebsd.org Mon Jan 23 20:51: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 29723CBE830; Mon, 23 Jan 2017 20:51:31 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB96DD91; Mon, 23 Jan 2017 20:51:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0NKpUwd017932; Mon, 23 Jan 2017 20:51:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NKpTVL017928; Mon, 23 Jan 2017 20:51:29 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201701232051.v0NKpTVL017928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 23 Jan 2017 20:51: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: r312671 - in stable/11/sys: conf dev/sdhci modules modules/sdhci_acpi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 20:51:31 -0000 Author: gonzo Date: Mon Jan 23 20:51:29 2017 New Revision: 312671 URL: https://svnweb.freebsd.org/changeset/base/312671 Log: MFC r311911, r311923 r311911: [sdhci] Add ACPI platform support for SDHCI driver - Create ACPI version of SDHCI attach/detach/accessors logic. Some platforms (e.g. BayTrail-based Minnowboard) expose SDHCI devices via ACPI, not PCI - Add sdchi_acpi kernel module Reviewed by: ian, imp Differential Revision: https://reviews.freebsd.org/D9112 r311923: Add acpi_if.h and opt_acpi.h to Makefile to unbreak "make depend" with sys/modules/sdhci_acpi X-MFC with: r311911 Reported by: Jenkins Added: stable/11/sys/dev/sdhci/sdhci_acpi.c - copied unchanged from r311911, head/sys/dev/sdhci/sdhci_acpi.c stable/11/sys/modules/sdhci_acpi/ - copied from r311911, head/sys/modules/sdhci_acpi/ Modified: stable/11/sys/conf/files stable/11/sys/modules/Makefile stable/11/sys/modules/sdhci_acpi/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Jan 23 19:20:55 2017 (r312670) +++ stable/11/sys/conf/files Mon Jan 23 20:51:29 2017 (r312671) @@ -2557,6 +2557,7 @@ dev/scd/scd.c optional scd isa dev/scd/scd_isa.c optional scd isa dev/sdhci/sdhci.c optional sdhci dev/sdhci/sdhci_if.m optional sdhci +dev/sdhci/sdhci_acpi.c optional sdhci acpi dev/sdhci/sdhci_pci.c optional sdhci pci dev/sf/if_sf.c optional sf pci dev/sge/if_sge.c optional sge pci Copied: stable/11/sys/dev/sdhci/sdhci_acpi.c (from r311911, head/sys/dev/sdhci/sdhci_acpi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/sdhci/sdhci_acpi.c Mon Jan 23 20:51:29 2017 (r312671, copy of r311911, head/sys/dev/sdhci/sdhci_acpi.c) @@ -0,0 +1,370 @@ +/*- + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "sdhci.h" +#include "mmcbr_if.h" +#include "sdhci_if.h" + +static const struct sdhci_acpi_device { + const char* hid; + int uid; + const char *desc; + u_int quirks; +} sdhci_acpi_devices[] = { + { "80860F14", 1, "Intel Bay Trail eMMC 4.5 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, + { "80860F16", 0, "Intel Bay Trail SD Host Controller", + 0 }, + { NULL, 0, NULL, 0} +}; + +static char *sdhci_ids[] = { + "80860F14", + "80860F16", + NULL +}; + +struct sdhci_acpi_softc { + u_int quirks; /* Chip specific quirks */ + struct resource *irq_res; /* IRQ resource */ + void *intrhand; /* Interrupt handle */ + + struct sdhci_slot slot; + struct resource *mem_res; /* Memory resource */ +}; + +static void sdhci_acpi_intr(void *arg); +static int sdhci_acpi_detach(device_t dev); + +static uint8_t +sdhci_acpi_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_1(sc->mem_res, off); +} + +static void +sdhci_acpi_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_1(sc->mem_res, off, val); +} + +static uint16_t +sdhci_acpi_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_2(sc->mem_res, off); +} + +static void +sdhci_acpi_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_2(sc->mem_res, off, val); +} + +static uint32_t +sdhci_acpi_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return bus_read_4(sc->mem_res, off); +} + +static void +sdhci_acpi_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_barrier(sc->mem_res, 0, 0xFF, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + bus_write_4(sc->mem_res, off, val); +} + +static void +sdhci_acpi_read_multi_4(device_t dev, struct sdhci_slot *slot, + bus_size_t off, uint32_t *data, bus_size_t count) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_read_multi_stream_4(sc->mem_res, off, data, count); +} + +static void +sdhci_acpi_write_multi_4(device_t dev, struct sdhci_slot *slot, + bus_size_t off, uint32_t *data, bus_size_t count) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + bus_write_multi_stream_4(sc->mem_res, off, data, count); +} + +static const struct sdhci_acpi_device * +sdhci_acpi_find_device(device_t dev) +{ + const char *hid; + int i, uid; + ACPI_HANDLE handle; + ACPI_STATUS status; + + hid = ACPI_ID_PROBE(device_get_parent(dev), dev, sdhci_ids); + if (hid == NULL) + return (NULL); + + handle = acpi_get_handle(dev); + status = acpi_GetInteger(handle, "_UID", &uid); + if (ACPI_FAILURE(status)) + uid = 0; + + for (i = 0; sdhci_acpi_devices[i].hid != NULL; i++) { + if (strcmp(sdhci_acpi_devices[i].hid, hid) != 0) + continue; + if ((sdhci_acpi_devices[i].uid != 0) && + (sdhci_acpi_devices[i].uid != uid)) + continue; + return &sdhci_acpi_devices[i]; + } + + return (NULL); +} + +static int +sdhci_acpi_probe(device_t dev) +{ + const struct sdhci_acpi_device *acpi_dev; + + acpi_dev = sdhci_acpi_find_device(dev); + if (acpi_dev == NULL) + return (ENXIO); + + device_set_desc(dev, acpi_dev->desc); + + return (BUS_PROBE_DEFAULT); +} + +static int +sdhci_acpi_attach(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int rid, err; + const struct sdhci_acpi_device *acpi_dev; + + acpi_dev = sdhci_acpi_find_device(dev); + if (acpi_dev == NULL) + return (ENXIO); + + sc->quirks = acpi_dev->quirks; + + /* Allocate IRQ. */ + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "can't allocate IRQ\n"); + return (ENOMEM); + } + + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "can't allocate memory resource for slot\n"); + sdhci_acpi_detach(dev); + return (ENOMEM); + } + + sc->slot.quirks = sc->quirks; + + err = sdhci_init_slot(dev, &sc->slot, 0); + if (err) { + device_printf(dev, "failed to init slot\n"); + sdhci_acpi_detach(dev); + return (err); + } + + /* Activate the interrupt */ + err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, sdhci_acpi_intr, sc, &sc->intrhand); + if (err) { + device_printf(dev, "can't setup IRQ\n"); + sdhci_acpi_detach(dev); + return (err); + } + + /* Process cards detection. */ + sdhci_start_slot(&sc->slot); + + return (0); +} + +static int +sdhci_acpi_detach(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + + if (sc->intrhand) + bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + if (sc->irq_res) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->irq_res), sc->irq_res); + + if (sc->mem_res) { + sdhci_cleanup_slot(&sc->slot); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + } + + return (0); +} + +static int +sdhci_acpi_shutdown(device_t dev) +{ + + return (0); +} + +static int +sdhci_acpi_suspend(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int err; + + err = bus_generic_suspend(dev); + if (err) + return (err); + sdhci_generic_suspend(&sc->slot); + return (0); +} + +static int +sdhci_acpi_resume(device_t dev) +{ + struct sdhci_acpi_softc *sc = device_get_softc(dev); + int err; + + sdhci_generic_resume(&sc->slot); + err = bus_generic_resume(dev); + if (err) + return (err); + return (0); +} + +static void +sdhci_acpi_intr(void *arg) +{ + struct sdhci_acpi_softc *sc = (struct sdhci_acpi_softc *)arg; + + sdhci_generic_intr(&sc->slot); +} + +static device_method_t sdhci_methods[] = { + /* device_if */ + DEVMETHOD(device_probe, sdhci_acpi_probe), + DEVMETHOD(device_attach, sdhci_acpi_attach), + DEVMETHOD(device_detach, sdhci_acpi_detach), + DEVMETHOD(device_shutdown, sdhci_acpi_shutdown), + DEVMETHOD(device_suspend, sdhci_acpi_suspend), + DEVMETHOD(device_resume, sdhci_acpi_resume), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), + DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), + + /* mmcbr_if */ + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), + DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + + /* SDHCI registers accessors */ + DEVMETHOD(sdhci_read_1, sdhci_acpi_read_1), + DEVMETHOD(sdhci_read_2, sdhci_acpi_read_2), + DEVMETHOD(sdhci_read_4, sdhci_acpi_read_4), + DEVMETHOD(sdhci_read_multi_4, sdhci_acpi_read_multi_4), + DEVMETHOD(sdhci_write_1, sdhci_acpi_write_1), + DEVMETHOD(sdhci_write_2, sdhci_acpi_write_2), + DEVMETHOD(sdhci_write_4, sdhci_acpi_write_4), + DEVMETHOD(sdhci_write_multi_4, sdhci_acpi_write_multi_4), + + DEVMETHOD_END +}; + +static driver_t sdhci_acpi_driver = { + "sdhci_acpi", + sdhci_methods, + sizeof(struct sdhci_acpi_softc), +}; +static devclass_t sdhci_acpi_devclass; + +DRIVER_MODULE(sdhci_acpi, acpi, sdhci_acpi_driver, sdhci_acpi_devclass, NULL, + NULL); +MODULE_DEPEND(sdhci_acpi, sdhci, 1, 1, 1); +DRIVER_MODULE(mmc, sdhci_acpi, mmc_driver, mmc_devclass, NULL, NULL); +MODULE_DEPEND(sdhci_acpi, mmc, 1, 1, 1); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Mon Jan 23 19:20:55 2017 (r312670) +++ stable/11/sys/modules/Makefile Mon Jan 23 20:51:29 2017 (r312671) @@ -330,6 +330,7 @@ SUBDIR= \ scd \ ${_scsi_low} \ sdhci \ + ${_sdhci_acpi} \ sdhci_pci \ sem \ send \ @@ -662,6 +663,7 @@ _padlock_rng= padlock_rng _rdrand_rng= rdrand_rng .endif _s3= s3 +_sdhci_acpi= sdhci_acpi _tpm= tpm _twa= twa _vesa= vesa Modified: stable/11/sys/modules/sdhci_acpi/Makefile ============================================================================== --- head/sys/modules/sdhci_acpi/Makefile Wed Jan 11 01:53:54 2017 (r311911) +++ stable/11/sys/modules/sdhci_acpi/Makefile Mon Jan 23 20:51:29 2017 (r312671) @@ -3,6 +3,7 @@ .PATH: ${.CURDIR}/../../dev/sdhci KMOD= sdhci_acpi -SRCS= sdhci_acpi.c sdhci.h sdhci_if.h device_if.h bus_if.h pci_if.h mmcbr_if.h +SRCS= sdhci_acpi.c sdhci.h sdhci_if.h +SRCS+= acpi_if.h device_if.h bus_if.h opt_acpi.h pci_if.h mmcbr_if.h .include From owner-svn-src-all@freebsd.org Mon Jan 23 21:09: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 9FABDCBECB6; Mon, 23 Jan 2017 21:09:28 +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 64522A30; Mon, 23 Jan 2017 21:09:28 +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 v0NL9R07023052; Mon, 23 Jan 2017 21:09:27 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NL9REv023051; Mon, 23 Jan 2017 21:09:27 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701232109.v0NL9REv023051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 23 Jan 2017 21:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312672 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 21:09:28 -0000 Author: jkim Date: Mon Jan 23 21:09:27 2017 New Revision: 312672 URL: https://svnweb.freebsd.org/changeset/base/312672 Log: Fix a typo introduced in r306024. Modified: head/sys/dev/mrsas/mrsas_linux.c Modified: head/sys/dev/mrsas/mrsas_linux.c ============================================================================== --- head/sys/dev/mrsas/mrsas_linux.c Mon Jan 23 20:51:29 2017 (r312671) +++ head/sys/dev/mrsas/mrsas_linux.c Mon Jan 23 21:09:27 2017 (r312672) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #if (__FreeBSD_version >= 1001511) #include #elif (__FreeBSD_version > 900000) -#include +#include #endif #include From owner-svn-src-all@freebsd.org Mon Jan 23 23:14: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 84BB6CBEA10; Mon, 23 Jan 2017 23:14: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 49C32DDF; Mon, 23 Jan 2017 23:14: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 v0NNEf7M078523; Mon, 23 Jan 2017 23:14:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0NNEfqY078522; Mon, 23 Jan 2017 23:14:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701232314.v0NNEfqY078522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 23 Jan 2017 23:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r312674 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 23 Jan 2017 23:14:42 -0000 Author: adrian Date: Mon Jan 23 23:14:41 2017 New Revision: 312674 URL: https://svnweb.freebsd.org/changeset/base/312674 Log: Release Michael from mentorship. He's proven to be responsible and deliver good stuff! Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Jan 23 22:10:57 2017 (r312673) +++ svnadmin/conf/mentors Mon Jan 23 23:14:41 2017 (r312674) @@ -29,7 +29,6 @@ kadesai ken Co-mentor: scottl, ambrisk karels gnn mahrens mckusick miwi rwatson -mizhka adrian Co-mentor: cognet monthadar adrian peterj jhb Co-mentor: grog phil theraven Co-mentor: sjg From owner-svn-src-all@freebsd.org Tue Jan 24 00:36: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 D35F0CBD4FF; Tue, 24 Jan 2017 00:36:47 +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 ADFB8DC; Tue, 24 Jan 2017 00:36:47 +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 v0O0akG6011502; Tue, 24 Jan 2017 00:36:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O0akT2011501; Tue, 24 Jan 2017 00:36:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201701240036.v0O0akT2011501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 24 Jan 2017 00:36:46 +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: r312676 - stable/11/sys/netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 00:36:47 -0000 Author: ae Date: Tue Jan 24 00:36:46 2017 New Revision: 312676 URL: https://svnweb.freebsd.org/changeset/base/312676 Log: MFC r309888: Modify IPv6 statistic accounting in ip6_input(). Add rcvif local variable to keep inbound interface pointer. Count ifs6_in_discard errors in all "goto bad" cases. Now it will count errors even if mbuf was freed. Modify all places where m->m_pkthdr.rcvif is used to use local rcvif variable. Modified: stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Mon Jan 23 23:20:00 2017 (r312675) +++ stable/11/sys/netinet6/ip6_input.c Tue Jan 24 00:36:46 2017 (r312676) @@ -549,6 +549,7 @@ ip6_input(struct mbuf *m) struct in6_addr odst; struct ip6_hdr *ip6; struct in6_ifaddr *ia; + struct ifnet *rcvif; u_int32_t plen; u_int32_t rtalert = ~0; int off = sizeof(struct ip6_hdr), nest; @@ -558,7 +559,8 @@ ip6_input(struct mbuf *m) /* * Drop the packet if IPv6 operation is disabled on the interface. */ - if ((ND_IFINFO(m->m_pkthdr.rcvif)->flags & ND6_IFF_IFDISABLED)) + rcvif = m->m_pkthdr.rcvif; + if ((ND_IFINFO(rcvif)->flags & ND6_IFF_IFDISABLED)) goto bad; #ifdef IPSEC @@ -595,16 +597,15 @@ ip6_input(struct mbuf *m) if (m->m_next) { if (m->m_flags & M_LOOP) { IP6STAT_INC(ip6s_m2m[V_loif->if_index]); - } else if (m->m_pkthdr.rcvif->if_index < IP6S_M2MMAX) - IP6STAT_INC( - ip6s_m2m[m->m_pkthdr.rcvif->if_index]); + } else if (rcvif->if_index < IP6S_M2MMAX) + IP6STAT_INC(ip6s_m2m[rcvif->if_index]); else IP6STAT_INC(ip6s_m2m[0]); } else IP6STAT_INC(ip6s_m1); } - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); + in6_ifstat_inc(rcvif, ifs6_in_receive); IP6STAT_INC(ip6s_total); #ifndef PULLDOWN_TEST @@ -620,10 +621,8 @@ ip6_input(struct mbuf *m) n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); else n = m_gethdr(M_NOWAIT, MT_DATA); - if (n == NULL) { - m_freem(m); - return; /* ENOBUFS */ - } + if (n == NULL) + goto bad; m_move_pkthdr(n, m); m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); @@ -635,26 +634,22 @@ ip6_input(struct mbuf *m) #endif if (m->m_len < sizeof(struct ip6_hdr)) { - struct ifnet *inifp; - inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { IP6STAT_INC(ip6s_toosmall); - in6_ifstat_inc(inifp, ifs6_in_hdrerr); - return; + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); + goto bad; } } ip6 = mtod(m, struct ip6_hdr *); - if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { IP6STAT_INC(ip6s_badvers); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); goto bad; } IP6STAT_INC(ip6s_nxthist[ip6->ip6_nxt]); - - IP_PROBE(receive, NULL, NULL, ip6, m->m_pkthdr.rcvif, NULL, ip6); + IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6); /* * Check against address spoofing/corruption. @@ -665,7 +660,7 @@ ip6_input(struct mbuf *m) * XXX: "badscope" is not very suitable for a multicast source. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MC_INTFACELOCAL(&ip6->ip6_dst) && @@ -677,7 +672,7 @@ ip6_input(struct mbuf *m) * as the outgoing/incoming interface. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && @@ -689,7 +684,7 @@ ip6_input(struct mbuf *m) * a packet is received, it must be silently dropped. */ IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #ifdef ALTQ @@ -713,7 +708,7 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #if 0 @@ -813,8 +808,8 @@ passin: IP6STAT_INC(ip6s_badscope); /* XXX */ goto bad; } - if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || - in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { + if (in6_setscope(&ip6->ip6_src, rcvif, NULL) || + in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6STAT_INC(ip6s_badscope); goto bad; } @@ -824,7 +819,7 @@ passin: */ if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { ours = 1; - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); + in6_ifstat_inc(rcvif, ifs6_in_mcast); goto hbhcheck; } /* @@ -859,7 +854,6 @@ passin: */ if (!V_ip6_forwarding) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } @@ -891,7 +885,7 @@ passin: */ if (m->m_pkthdr.len - sizeof(struct ip6_hdr) < plen) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } if (m->m_pkthdr.len > sizeof(struct ip6_hdr) + plen) { @@ -918,10 +912,8 @@ passin: * XXX TODO: Check hlim and multicast scope here to avoid * unnecessarily calling into ip6_mforward(). */ - if (ip6_mforward && - ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) { + if (ip6_mforward && ip6_mforward(ip6, rcvif, m)) { IP6STAT_INC(ip6s_cantforward); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); goto bad; } } else if (!ours) { @@ -943,7 +935,7 @@ passin: if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } @@ -951,7 +943,7 @@ passin: * Tell launch routine the next header */ IP6STAT_INC(ip6s_delivered); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_deliver); + in6_ifstat_inc(rcvif, ifs6_in_deliver); nest = 0; while (nxt != IPPROTO_DONE) { @@ -966,7 +958,7 @@ passin: */ if (m->m_pkthdr.len < off) { IP6STAT_INC(ip6s_tooshort); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); + in6_ifstat_inc(rcvif, ifs6_in_truncated); goto bad; } @@ -984,7 +976,9 @@ passin: } return; bad: - m_freem(m); + in6_ifstat_inc(rcvif, ifs6_in_discard); + if (m != NULL) + m_freem(m); } /* From owner-svn-src-all@freebsd.org Tue Jan 24 00:38: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 9AB1DCBD5B8; Tue, 24 Jan 2017 00:38:36 +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 6A0632A1; Tue, 24 Jan 2017 00:38:36 +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 v0O0cZs6011621; Tue, 24 Jan 2017 00:38:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O0cZtB011620; Tue, 24 Jan 2017 00:38:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201701240038.v0O0cZtB011620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 24 Jan 2017 00:38:35 +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: r312677 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 00:38:36 -0000 Author: ae Date: Tue Jan 24 00:38:35 2017 New Revision: 312677 URL: https://svnweb.freebsd.org/changeset/base/312677 Log: MFC r312341: Initialize IPFW static rules rmlock with RM_RECURSE flag. This lock was replaced from rwlock in r272840. But unlike rwlock, rmlock doesn't allow recursion on rm_rlock(), so at this time fix this with RM_RECURSE flag. Later we need to change ipfw to avoid such recursions. PR: 216171 Modified: stable/11/sys/netpfil/ipfw/ip_fw_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_private.h Tue Jan 24 00:36:46 2017 (r312676) +++ stable/11/sys/netpfil/ipfw/ip_fw_private.h Tue Jan 24 00:38:35 2017 (r312677) @@ -412,7 +412,7 @@ struct ipfw_ifc { #define IPFW_PF_RUNLOCK(p) IPFW_RUNLOCK(p) #else /* FreeBSD */ #define IPFW_LOCK_INIT(_chain) do { \ - rm_init(&(_chain)->rwmtx, "IPFW static rules"); \ + rm_init_flags(&(_chain)->rwmtx, "IPFW static rules", RM_RECURSE); \ rw_init(&(_chain)->uh_lock, "IPFW UH lock"); \ } while (0) From owner-svn-src-all@freebsd.org Tue Jan 24 01:39: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 2B24DCBE332; Tue, 24 Jan 2017 01:39:42 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEDD69BF; Tue, 24 Jan 2017 01:39:41 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O1dfxL035627; Tue, 24 Jan 2017 01:39:41 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O1dfVP035626; Tue, 24 Jan 2017 01:39:41 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201701240139.v0O1dfVP035626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 24 Jan 2017 01:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312678 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 01:39:42 -0000 Author: rpokala Date: Tue Jan 24 01:39:40 2017 New Revision: 312678 URL: https://svnweb.freebsd.org/changeset/base/312678 Log: Eliminate misleading comments and dead code in lacp_port_create() Variables "fast" and "active" are both constant in lacp_port_create(), but comments mispleadingly suggest that "fast" can be changed via ioctl. The constant values control the value of "lp->lp_state", so it too is constant, and the code for assigning different value to it is essentially dead. Remove both "fast" and "active", and set "lp->lp_state" unconditionally; that gets rid of the dead code and misleading comments. CID: 1305692 CID: 1305734 Reported by: asomers Reviewed by: asomers MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D9302 Modified: head/sys/net/ieee8023ad_lacp.c Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Tue Jan 24 00:38:35 2017 (r312677) +++ head/sys/net/ieee8023ad_lacp.c Tue Jan 24 01:39:40 2017 (r312678) @@ -528,9 +528,6 @@ lacp_port_create(struct lagg_port *lgp) struct ifmultiaddr *rifma = NULL; int error; - boolean_t active = TRUE; /* XXX should be configurable */ - boolean_t fast = FALSE; /* Configurable via ioctl */ - link_init_sdl(ifp, (struct sockaddr *)&sdl, IFT_ETHER); sdl.sdl_alen = ETHER_ADDR_LEN; @@ -559,9 +556,7 @@ lacp_port_create(struct lagg_port *lgp) lacp_fill_actorinfo(lp, &lp->lp_actor); lacp_fill_markerinfo(lp, &lp->lp_marker); - lp->lp_state = - (active ? LACP_STATE_ACTIVITY : 0) | - (fast ? LACP_STATE_TIMEOUT : 0); + lp->lp_state = LACP_STATE_ACTIVITY; lp->lp_aggregator = NULL; lacp_sm_rx_set_expired(lp); LACP_UNLOCK(lsc); From owner-svn-src-all@freebsd.org Tue Jan 24 02:09: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 DA773CBEE63; Tue, 24 Jan 2017 02:09:31 +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 AA293BC9; Tue, 24 Jan 2017 02:09:31 +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 v0O29Uk8047839; Tue, 24 Jan 2017 02:09:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O29UDD047838; Tue, 24 Jan 2017 02:09:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201701240209.v0O29UDD047838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 24 Jan 2017 02:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312679 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 02:09:32 -0000 Author: ian Date: Tue Jan 24 02:09:30 2017 New Revision: 312679 URL: https://svnweb.freebsd.org/changeset/base/312679 Log: Handle imx6 erratum ERR004346... to reboot, clear the SRS bit twice within the same cycle of the 32khz clock. I've never actually noticed this error happening, but it's an easy fix. Modified: head/sys/arm/freescale/imx/imx_machdep.c Modified: head/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx_machdep.c Tue Jan 24 01:39:40 2017 (r312678) +++ head/sys/arm/freescale/imx/imx_machdep.c Tue Jan 24 02:09:30 2017 (r312679) @@ -69,11 +69,18 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_phys * Trigger an immediate reset by clearing the SRS bit in the watchdog * control register. The reset happens on the next cycle of the wdog * 32KHz clock, so hang out in a spin loop until the reset takes effect. + * + * Imx6 erratum ERR004346 says the SRS bit has to be cleared twice + * within the same cycle of the 32khz clock to reliably trigger the + * reset. Writing it 3 times in a row ensures at least 2 of the writes + * happen in the same 32k clock cycle. */ if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { printf("cpu_reset() can't find its control register... locking up now."); } else { *pcr &= ~WDOG_CR_SRS; + *pcr &= ~WDOG_CR_SRS; + *pcr &= ~WDOG_CR_SRS; } for (;;) continue; From owner-svn-src-all@freebsd.org Tue Jan 24 02:35: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 26C29CBEB8C; Tue, 24 Jan 2017 02:35:41 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7830C9A; Tue, 24 Jan 2017 02:35:40 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O2Zd9a059871; Tue, 24 Jan 2017 02:35:39 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O2Zdn3059863; Tue, 24 Jan 2017 02:35:39 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201701240235.v0O2Zdn3059863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 24 Jan 2017 02:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312680 - in head: etc/devd share/man/man4 sys/conf sys/contrib/dev/rtwn sys/dev/rtwn sys/dev/rtwn/rtl8188e/usb sys/dev/rtwn/rtl8192c sys/dev/rtwn/rtl8192c/pci sys/dev/rtwn/rtl8192c/usb... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 02:35:41 -0000 Author: kevlo Date: Tue Jan 24 02:35:38 2017 New Revision: 312680 URL: https://svnweb.freebsd.org/changeset/base/312680 Log: Add support for the Realtek RTL8192EU chipset. Committed over the D-Link DWA-131 rev E1 on amd64 with WPA. Reviewed by: avos Added: head/sys/contrib/dev/rtwn/rtwn-rtl8192eufw.fw.uu head/sys/dev/rtwn/rtl8192c/r92c_llt.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/ head/sys/dev/rtwn/rtl8192e/r92e.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_chan.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_init.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_led.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_rf.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_rom.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_rom_defs.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_rom_image.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/r92e_var.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/usb/ head/sys/dev/rtwn/rtl8192e/usb/r92eu.h (contents, props changed) head/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/usb/r92eu_init.c (contents, props changed) head/sys/dev/rtwn/rtl8192e/usb/r92eu_reg.h (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192eu/ head/sys/modules/rtwnfw/rtwnrtl8192eu/Makefile (contents, props changed) Modified: head/etc/devd/usb.conf head/share/man/man4/rtwn.4 head/share/man/man4/rtwn_usb.4 head/share/man/man4/rtwnfw.4 head/sys/conf/files head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c head/sys/dev/rtwn/rtl8192c/r92c.h head/sys/dev/rtwn/rtl8192c/r92c_init.c head/sys/dev/rtwn/rtl8192c/r92c_reg.h head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c head/sys/dev/rtwn/rtl8812a/r12a_beacon.c head/sys/dev/rtwn/rtl8812a/r12a_fw.c head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c head/sys/dev/rtwn/rtl8821a/r21a_init.c head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c head/sys/dev/rtwn/usb/rtwn_usb_attach.h head/sys/dev/usb/usbdevs head/sys/modules/rtwn/Makefile head/sys/modules/rtwn_usb/Makefile head/sys/modules/rtwnfw/Makefile Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Tue Jan 24 02:09:30 2017 (r312679) +++ head/etc/devd/usb.conf Tue Jan 24 02:35:38 2017 (r312680) @@ -2737,7 +2737,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0bda"; - match "product" "(0x8176|0x8177|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)"; + match "product" "(0x8176|0x8177|0x8178|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)"; action "kldload -n if_rtwn_usb"; }; @@ -2753,7 +2753,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0bda"; - match "product" "(0x818a|0x8191)"; + match "product" "(0x818a|0x818b|0x8191)"; action "kldload -n if_rtwn_usb"; }; @@ -3793,7 +3793,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1199"; - match "product" "(0x68aa|0x68c0|0x9041)"; + match "product" "(0x68aa|0x68c0|0x9041|0x9071)"; action "kldload -n u3g"; }; @@ -3905,7 +3905,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1573|0x1803|0x1c05|0x1c0b)"; + match "product" "(0x1573|0x15c1|0x1803|0x1c05|0x1c0b)"; action "kldload -n u3g"; }; @@ -5025,7 +5025,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310|0x3314|0x3315|0x3316|0x3318)"; + match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310|0x3314|0x3315|0x3316|0x3318|0x3319)"; action "kldload -n if_rtwn_usb"; }; @@ -5297,7 +5297,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2357"; - match "product" "0x0101"; + match "product" "(0x0101|0x0108|0x0109)"; action "kldload -n if_rtwn_usb"; }; @@ -5889,5 +5889,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2743 USB entries processed +# 2751 USB entries processed Modified: head/share/man/man4/rtwn.4 ============================================================================== --- head/share/man/man4/rtwn.4 Tue Jan 24 02:09:30 2017 (r312679) +++ head/share/man/man4/rtwn.4 Tue Jan 24 02:35:38 2017 (r312680) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd January 24, 2017 .Dt RTWN 4 .Os .Sh NAME @@ -52,9 +52,9 @@ if_rtwn_usb_load="YES" The .Nm driver provides support for wireless network devices based on -the Realtek RTL8192C, RTL8188E, RTL8812A and RTL8821A programming APIs. -These APIs are used by a wide variety of chips; most chips with USB -and some with PCI interface are supported. +the Realtek RTL8192C, RTL8188E, RTL8192E, RTL8812A and RTL8821A +programming APIs. These APIs are used by a wide variety of chips; +most chips with USB and some with PCI interface are supported. .Pp To enable use for PCI/PCIe systems, see the rtwn_pci(4) driver; for USB devices, use the rtwn_usb(4) driver. @@ -98,6 +98,7 @@ when an interface is brought up: .It Pa /boot/kernel/rtwn-rtl8192cfwE.ko .It Pa /boot/kernel/rtwn-rtl8192cfwT.ko .It Pa /boot/kernel/rtwn-rtl8192cfwU.ko +.It Pa /boot/kernel/rtwn-rtl8192eufw.ko .It Pa /boot/kernel/rtwn-rtl8812aufw.ko .It Pa /boot/kernel/rtwn-rtl8821aufw.ko .El Modified: head/share/man/man4/rtwn_usb.4 ============================================================================== --- head/share/man/man4/rtwn_usb.4 Tue Jan 24 02:09:30 2017 (r312679) +++ head/share/man/man4/rtwn_usb.4 Tue Jan 24 02:35:38 2017 (r312680) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 6, 2017 +.Dd January 24, 2017 .Dt RTWN_USB 4 .Os .Sh NAME @@ -56,7 +56,7 @@ driver. .Sh HARDWARE The .Nm -driver supports Realtek RTL8188CU/RTL8188RU/RTL8188EU/RTL8192CU/RTL8812AU/RTL8821AU +driver supports Realtek RTL8188CU/RTL8188RU/RTL8188EU/RTL8192CU/RTL8192EU/RTL8812AU/RTL8821AU based USB wireless network adapters, including: .Pp .Bl -column -compact "Belkin F7D1102 Surf Wireless Micro" "Bus" @@ -70,6 +70,7 @@ based USB wireless network adapters, inc .It "D-Link DWA-123 rev D1" Ta USB 2.0 .It "D-Link DWA-125 rev D1" Ta USB 2.0 .It "D-Link DWA-131" Ta USB 2.0 +.It "D-Link DWA-131 rev E1" Ta USB 2.0 .It "D-Link DWA-171 rev A1" Ta USB 2.0 .It "D-Link DWA-172 rev A1" Ta USB 2.0 .It "D-Link DWA-180 rev A1" Ta USB 2.0 @@ -94,7 +95,10 @@ based USB wireless network adapters, inc .It "TP-LINK TL-WN723N v3" Ta USB 2.0 .It "TP-LINK TL-WN725N v2" Ta USB 2.0 .It "TP-LINK TL-WN821N v4" Ta USB 2.0 +.It "TP-LINK TL-WN821N v5" Ta USB 2.0 +.It "TP-LINK TL-WN822N v4" Ta USB 2.0 .It "TP-LINK TL-WN823N v1" Ta USB 2.0 +.It "TP-LINK TL-WN823N v2" Ta USB 2.0 .It "TRENDnet TEW-805UB" Ta USB 3.0 .It "ZyXEL NWD6605" Ta USB 3.0 .El Modified: head/share/man/man4/rtwnfw.4 ============================================================================== --- head/share/man/man4/rtwnfw.4 Tue Jan 24 02:09:30 2017 (r312679) +++ head/share/man/man4/rtwnfw.4 Tue Jan 24 02:35:38 2017 (r312680) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2015 +.Dd January 24, 2017 .Dt RTWNFW 4 .Os .Sh NAME @@ -46,6 +46,7 @@ of the following: .Cd "device rtwn-rtl8192cfwE" .Cd "device rtwn-rtl8192cfwT" .Cd "device rtwn-rtl8192cfwU" +.Cd "device rtwn-rtl8192eufw" .Cd "device rtwn-rtl8812aufw" .Cd "device rtwn-rtl8821aufw" .Ed @@ -59,6 +60,7 @@ rtwn-rtl8192cfwE_B_load="YES" rtwn-rtl8192cfwE_load="YES" rtwn-rtl8192cfwT_load="YES" rtwn-rtl8192cfwU_load="YES" +rtwn-rtl8192eufw_load="YES" rtwn-rtl8812aufw_load="YES" rtwn-rtl8821aufw_load="YES" .Ed @@ -66,8 +68,8 @@ rtwn-rtl8821aufw_load="YES" rtwn-rtl8192cfwE and rtl8192cfwE_B modules provide access to firmware sets for the Realtek RTL8188CE chip based PCIe adapters. Other modules provide access to firmware sets for the Realtek RTL8188CUS, -RTL8188CE-VAU, RTL8188EUS, RTL8188RU, RTL8192CU, RTL8812AU and RTL8821AU -chip based USB WiFi adapters. +RTL8188CE-VAU, RTL8188EUS, RTL8188RU, RTL8192CU, RTL8192EU, RTL8812AU and +RTL8821AU chip based USB WiFi adapters. They may be statically linked into the kernel, or loaded as a modules. .Pp Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jan 24 02:09:30 2017 (r312679) +++ head/sys/conf/files Tue Jan 24 02:35:38 2017 (r312680) @@ -2674,6 +2674,7 @@ dev/rtwn/rtl8192c/r92c_calib.c optional dev/rtwn/rtl8192c/r92c_chan.c optional rtwn dev/rtwn/rtl8192c/r92c_fw.c optional rtwn dev/rtwn/rtl8192c/r92c_init.c optional rtwn +dev/rtwn/rtl8192c/r92c_llt.c optional rtwn dev/rtwn/rtl8192c/r92c_rf.c optional rtwn dev/rtwn/rtl8192c/r92c_rom.c optional rtwn dev/rtwn/rtl8192c/r92c_rx.c optional rtwn @@ -2690,6 +2691,16 @@ dev/rtwn/rtl8192c/usb/r92cu_init.c optio dev/rtwn/rtl8192c/usb/r92cu_led.c optional rtwn_usb dev/rtwn/rtl8192c/usb/r92cu_rx.c optional rtwn_usb dev/rtwn/rtl8192c/usb/r92cu_tx.c optional rtwn_usb +# RTL8192E +dev/rtwn/rtl8192e/r92e_chan.c optional rtwn +dev/rtwn/rtl8192e/r92e_fw.c optional rtwn +dev/rtwn/rtl8192e/r92e_init.c optional rtwn +dev/rtwn/rtl8192e/r92e_led.c optional rtwn +dev/rtwn/rtl8192e/r92e_rf.c optional rtwn +dev/rtwn/rtl8192e/r92e_rom.c optional rtwn +dev/rtwn/rtl8192e/r92e_rx.c optional rtwn +dev/rtwn/rtl8192e/usb/r92eu_attach.c optional rtwn_usb +dev/rtwn/rtl8192e/usb/r92eu_init.c optional rtwn_usb # RTL8812A dev/rtwn/rtl8812a/r12a_beacon.c optional rtwn dev/rtwn/rtl8812a/r12a_calib.c optional rtwn @@ -2788,6 +2799,20 @@ rtwn-rtl8192cfwU.fw optional rtwn-rtl81 compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rtwn-rtl8192cfwU.fw" +rtwn-rtl8192eufw.c optional rtwn-rtl8192eufw | rtwnfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk rtwn-rtl8192eufw.fw:rtwn-rtl8192eufw:111 -mrtwn-rtl8192eufw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "rtwn-rtl8192eufw.c" +rtwn-rtl8192eufw.fwo optional rtwn-rtl8192eufw | rtwnfw \ + dependency "rtwn-rtl8192eufw.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "rtwn-rtl8192eufw.fwo" +rtwn-rtl8192eufw.fw optional rtwn-rtl8192eufw | rtwnfw \ + dependency "$S/contrib/dev/rtwn/rtwn-rtl8192eufw.fw.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "rtwn-rtl8192eufw.fw" rtwn-rtl8812aufw.c optional rtwn-rtl8812aufw | rtwnfw \ compile-with "${AWK} -f $S/tools/fw_stub.awk rtwn-rtl8812aufw.fw:rtwn-rtl8812aufw:111 -mrtwn-rtl8812aufw -c${.TARGET}" \ no-implicit-rule before-depend local \ Added: head/sys/contrib/dev/rtwn/rtwn-rtl8192eufw.fw.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/rtwn/rtwn-rtl8192eufw.fw.uu Tue Jan 24 02:35:38 2017 (r312680) @@ -0,0 +1,711 @@ +begin 644 rtwn-rtl8192eufw.fw.uu +MX9(0`!,````#,1%`*GP``+@0```````````````````"24T"7_4````````` +M`````````F`Y``````````````````)P*``````````````````````````` +M`````````````E_V```````":$@```````)OZ@WP_P\````-\`\`````#?#_ +M#P````WP#P`````0\/\/````$/`/`````/4/``````#P#P``````#0`````` +M`!#P__\````0\#\`````"@@#`P`$"0<#`P`$"`8#`@`$"`4#`0`$#0H'!0`( +M#`H'!``("PH&!0`("PH%`P`("PH#`@`(%!(,!``0%!()!``0)"(<$@`@)"(8 +M#``@)"(4!@`@)"(/!``@)"$*!``@(R$,!``@(Q\*!``@(A\/!``@(1\6#``@ +M,2\@%``P,2\8$``P,2P8#``P,2H4#``P,2@4```P,204```P,1X4```P`@(" +M!0($!0<'!P@*`0($!@<*"PT"`P0'"`L-#P4%!P<("PT/!04'!P@+#0\!`@,& +M!PH+#`T.`@,$!P@+#`T.$`4%!P<("PT/#P\%!0<'"`L-#P\/!`0$!0<'"0D, +M#A`2!`4&!PL-$1,$!08'"PT1$PD)"0D,#A$3"0D)"0P.$1,$"`D*#`X0$A,4 +M!`@*#`X0$1,4%@D)"0D,#A$3$Q,)"0D)#`X1$Q,3````````````)"8J```` +M'R$E)R@`````(R8H*@`````C)B@J`````",F*"H`````("4G*2DJ`````"`E +M)RDI*@`````C)B@J*BH````?(R8H*BHJ````!`````0````(````$````!@` +M```D````,````$@```!@````D````,````#8````/````&0```!X````H``` +M`/````%````!D````>````"@````\````4````&0```"6````R````9````' +MT````,@```$8```!X````M````/H```$L```!D````?0````R````1@```'@ +M```"T````^@```2P```&0```!]`````\````9````'@```"@````\````4`` +M``&0```!X```!+````E@````R````1@```'@```"T````^@```?0```+N``` +M$X@``!=P```?0````,@```$8```!X````M````/H```$L```!D````?0```' +MT```!]````#(```!&````>````+0```#Z```!+````9````'T```!]````?0 +M``(``@`$``@`#``2`!@`)``P`$@`8`!L`!X`,@`\`%``>`"@`,@`\`!0`'@` +MH`#(`2P!D`.$!10`9`",`/`!:`'T`E@#(`/H`&0`C`#P`6@!]`)8`R`#Z``> +M`#(`/`!0`'@`H`#(`/`"6`2P`&0`C`#P`6@!]`/H!=P)Q`NX#Z``9`",`/`! +M:`'T`E@#(`/H`^@#Z`!D`(P`\`%H`?0"6`,@`^@#Z`/H`@0&"`H,$!@@,$!0 +M`@("`@("`P,$!`4%`0$"`@0$!04"`@,#!04&!@4&!@<'"`D*!08&!P<("0H! +M`0("!`0%!08'`@(#`P4%!@8("04&!@<'"`D*"@L%!@8'!P@)"@H+`0$!`0$" +M`P0%!@<(`0(#!`4&!P@%!@8'"`H+#`4&!@<("@L,!08'"`D*"PP%!@8'"`D+ +M#`P,!08&!P@)"PP,#`4&!P@)"@L,#`P%!@<("0H+#`P,&08$`@`8%`T5#A4/ +M%A`7$1@2&!,8'!4.%A`7$1@2&1P:'!L<%`P4#0X4%0\6$!<1$A<,'`X4%0\6 +M$!,7&!,9&!H9```````````````````````````````````````````````` +M``````````````````````````````````````#"KX#^,A)%=(70"W70"*K@ +MPHSEBB1G]8KEC#1Y]8S2C.PDA_CFO`("=/_#E8&T0`!`SGD#>(`6Y@AP"\*O +MYC#A`T08]M*O"-GMZHO0(N4,_R,D@?@/"`B_`P1_`'B!YC#D\@#E#,.?4"`% +M#'2&)0SXYOVF@0CFK@R^`@)T_\WXZ&U@X`CFP."`]N4,TY]`)^4,)(?XYJX, +MO@("=/_]&.;-^.6!;6`&T.#V&(#UY0PDALCV%0R`T^4,(R2!^'\$PJ_F,.`# +M$.(,?P`PX0(#V +M"/8(W_IX@78PD$EM=`&3P.#DD\#@0XD!=8I@=8QYTHS2KR("[].4`D`#?_\B +M=($O+_CF(.7TPJ_F1##VTJ^N#.[#GU`A#G2&+OCF^0CF&+X"`G3__>UI8`D) +MYQD9]PD)@/,6%H#:[M.?0`0%@06![M.?0")TAB[X".;Y[K4,`JF!&`8&YOWM +M:6`)&1GG"0GW&8#S'H#9[R2&^.8$^.\O!)!);9/V".\OD_9_`"+OTY0"0`-_ +M_R+O(R2!^.8PY?3"K^94C/;2K^4,M0<*=(8O^.;U@0)%O5`N=(Q(_"+KG_7PZIY"\.F=0O#HG$7P +M(N#\H^#]H^#^H^#_(N23_'0!D_UT`I/^=`.3_R+@^*/@^:/@^J/@^R+DD_AT +M`9/Y=`*3^G0#D_LBI"6"]8+E\#6#]8,BX/NCX/JCX/DBZ_"CZO"CZ?`BT(/0 +M@OCDDW`2=`&3<`VCHY/X=`&3]8*(@^1S=`*3:&#OHZ.C@-\"1DWDDZ/XY).C +M0`/V@`'R"-_T@"GDDZ/X5``O@))"`!!I=X`0:7?`$&EX`!! +MI><`0:7H`$&EZ0!!I@\`3#A07%A;TQ"O`*O;I'J0>)T$R5N]8+D-)SU@^#[ +MY/W_4?IU\`7E;I"7EA&)X!,35`/[#>3_4?IU\`7E;I"7EA&)X,03$Q-4`?L- +MY/]1^G7P!>5ND)>6$8G@Q%0#^PWD_U'Z=?`%Y6Z0EY,1B>#[Y/T/4?IU\`7E +M;I"7E%'U=?`%Y6Z0EY41B>#$$U0!^PU_`5'Z=?`%Y6Z0EY41B>!4'_L-4?IU +M\`CE;I")`!&)X/OD_0]1^G7P".5ND(D!4?5U\`CE;I")`E'U=?`(Y6Z0B0-1 +M]77P".5ND(D$$8G@^^3]#U'Z=?`(Y6Z0B051]77P".5ND(D&4?5U\`CE;I") +M!Q&)X/L-@#^0I$G@^^3]_U'ZD*1*H^#[#5'ZD*1,X/L-4?J0I$W@5`/[#5'Z +MD*1.H^#[Y/T/4?J0I$[@^PU1^I"D4.#['0]1^G^/<2+O,.`&Y/U_C7'>T-"2 +MKR(1B>#[#>]P!'3P@!;OM`$$=/2`#N^T`@1T^(`&[[0##'3\+?6"Y#0"]8/K +M\"+3$*\!P\#0CX)U@P#@D*8&\'\0?@`2/H>0I@;@_]#0DJ\B?_\24[K3$*\! +MP\#0$E?R<=1QR''(D`$`=#_PH^!4_?"0!5/@1"#PD*.[X/\3$Q-4'S#@!I`' +M>'0!\._#$S#@-Y"C_.!@")"E_G0!\(`%Y)"E_O"0H[O@Q!-4!S#@!^20I?_P +M@`:0I?]T`O"0I?X2:9:0!WAT`?"0H[K@8`+D\-#0DJ\B?P)Q(N]$`?U_`G'> +M?P)Q(N]4_OU_`M,0KP'#P-"/@G6#`.WP?Q!^`!(^A]#0DJ\B?U1Q(N4-7_41 +M?U5Q(N4.7_42?U9Q(N4/7_43?U=Q(N407_44K1%_5''>K1)_57'>K1-_5G'> +MK11_5W'>4Y'O(G^!<2+O5/[]?X%QWG^`<2+O1(#]?X!QWA*P4!(^2!*P71*Q +M*7\!$D:%D*0;=`+P_Q)&A9"D&^`$\/&"$G(,?X!Q(N]$0/U_@''>=2C_$E!5 +M$K">?X%Q(N]$!/U_@7'>$K$WY/\"1PZ0HQ3@1!#PD*,AX/U_DW'>D*,8X&`2 +MD`$OX##G!700\(`&D`$O=)#P?PAQ(N]$$/U_"''>?P'Q^G^0<2+O1`']?Y!Q +MWG\4?@`"/H?3$*\!P\#0D*8"[_!_CW$B[S#F2'^-<2+O9`%P/Y"F`_"0I@/@ +M_9"F`N!U\!"0@0`1B>6"+?6"Y#6#]8/@^^3_4?J0I@/@!/#@PY000--_CW$B +M[S#@!N3]?XUQWM#0DJ\BD/UHX/^0_6#@D*44\.\@X`+!YI"EX.!P&'\N<2*0 +MH_CO\'\M<2*0H_GO\)"EX'0!\)"E%.!D%7!LD/UBX/\PYAST5#\$_I"C^.`3 +M$U0_PYZ0I1/PTY0_0!WD\(`9D*/XX!,35#_^[U0_+I"E$_#3E#]``W0_\)"E +M$^#_5##$5`_^[R7@)>!.D*41\.#]?RYQWI"E$^#$5/#_D*/YX%0/3_U_+7'> +MD*44X+0A#)#]8N#_$I``?P31[)"E%."T(P1_`='GD*44X+0G!'\"T>>0I13@ +MM#`,Y/O]?P$2DD-_!-'LD*44X&0T<%"0_6+@,.`XD*/BX/_#$R#@/Y"E$70! +M\/MZI7D1_7\T$EC?D*41=`/PX/\2G\Z0!)WD\.!$`?"0`>?@5/[P@!$2:7>0 +M!)W@5/[PD`'GX$0!\)"E%.#]M#4'D*/$X$0!\.VT-B.0_6'@D*41\)#]8N"0 +MI1+PD*44X/^0I1'@_7L!>J5Y$A)8WY"E%."T-P,2H&:0I13@M$`4D/UBX##@ +M")"CX'0!\(`%Y)"CX/"0_6C@1`'P(A*0&G\$CW)_`A)'EY"AE.!%Y/U_47'>Y/U_4G'>Y/U_4V'>D`$T=/_PH_"C\*/PD`$\ +M\*/PH_"C\/U_5''>??]_57'>??]_5G'>??]_5V'>\1WQ21*P"1*P*,'[\9N0 +MH9GO\/%VD`%D=`'PD`0CX$2`\`(W^'_T<2+O(.4-?_1Q(N]_`2#D!7\"(G\# +M(A*V8'\(<2+O5._]?PAQWN3_\?J0HQ3@5._P(G\!?@`2/@Q_\G$B[R#F#'\% +M<2+O1(#]?P5QWB)]('%$D*,1=`+P(A*FZ(#PD*7P[_#DH_"C\)`!">!_`##G +M`G\!D*7PX&]@/L.0I?+@E(B0I?'@E!-`")`!P.!$$/`BD*7QY'7P`1((UG\4 +M?@`2/H?3D*7RX)0RD*7QX)0`0+>0`<;@,."P(G7H!W6HA2+DD*36\)"DUN!D +M`?`D7)`!Q/!T4*/P$CY[OP$#$C'WD*,7X&`.D*,:X/^0HQG@;V`"$:3"KQ*P +M^+\!`Q*W8]*O$DES$D6]@+V0HP[@D*,9,.`%X/\"MZ[@_WT!@`1]`7\$TQ"O +M`]P`B%^)/YP`B&X)/Y@223\<`(A\R3\8`)!">ZT#@)1J)"C&N!P!'\!4=B0 +MHQK@M`8"47Z0HQK@M`0.D*8.X/]@!/&E@`,2HCR0HQK@9`A@`D$)$KP400F0 +MHQK@<`1_`5'8D*,:X+0&`E%^D*,:X+0.!U$>OP$"4:B0HQK@9`Q@`D$)41[O +M9`%@`D$)<6]!"9"C&N"T#@=1'K\!`E&HD*,:X+0&`E%^D*,:X+0,!U$>OP$" +M<6^0HQK@9`1P7A*Y->]D`7!6$KI`@%&0HQK@M`X'41Z_`0)1J)"C&N"T!@)1 +M?I"C&N"T#`=1'K\!`G%OD*,:X'`$?P%1V)"C&N"T!!L2NF&`%I"C&N"T#`^0 +MHQ3@_Q,35#\PX`,2O`&0HQK@D`&Z\)"C&>"0`;OPT-"2KR*0H[W@,.`3D*/# +MX,035`#3E`1`")`!N'0(\(`(D`&XY/!_`2*0`;ET`O!_`"*0HQ3@ +MD`8$(.`,X$1`\'T$?P%Q`(`/4?B0!2?@5'_PD*,2=`SPY/W_8;J0HQ3@PQ,@ +MX`11_(`>D`8$X$1`\.!$@/!]!'\!<0"0!2?@1(#PD*,2=`3PY/W_8;J0I@WO +M\!)N-I"F#>!@!>3]_W&Z?01_`7$`D*,2=`3P(N!4?_!]#'\!TQ"O`WP?X\22R+O +M,.0QD*8,X!1@!Q1@'20"<".0HQ/@5`'$,S,S5(#_D*,:X%1_3_U_B(`'D*,9 +MX/U_B1)+WM#0DJ\BD**-X&0!<#&0HQ3@5/WP?2Q_;W&Z<<6_`120HQ/@1(#P +M?0Y_`7$`D*,2=`[P(I`!N70!\)`!N`3P(I"D*Q)(B>#_?@#D_=%2Y/W_D`4B +M[_"0H9CM\"*0H\3@1`+P?0A_`=,0KP'#P-"0I:WO\*/M\)"AEN`$\)`$'>!@ +M09`%(N"0I;'P?2;Q[N]D`7`+T;F0I!S@(.`:@!60H\'@Q!,35`,PX`S1N9"D +M'.`@X`,2N&F0I;'@_WTG<;JQW8`.L=W1N9"D'.`@X`,2N&F0H[W@,.`7D*/! +MX,03$U0#,.`+D`4BX%1O_WTH<;J0!!]T(/!_`=#0DJ\BD*4%[_"0I0=T`O!_ +M`1)OB9"CP>#_$Q-4/S#@()"E!>"T`@1]!X`)D*4%X+0%!GT-?_]QNO'ROP$# +M$DM)D*/!X,03$Q-4`9`'>##@!70#\(`#=`'PD*4%X+0"#9"CON`D`_^0H\T2 +M7\20H[W@PQ,PX`?DD*4&\(`&D*4&=`'PD*/`X,035`<@X!.0H_S@8`B0I0=T +M`?"`!>20I0?PD*4'X/^0I0;@_1)IF^20H\_PD*4%X/^T`@B0H]#@!/"`">^T +M!07DD*/0\)"CO>#$$U0',.`7D*4%X+0"!'T(@&20I07@9`5P8'T.@%B0H[W@ +MQ%0/,.`KD*/!X,035`<@X`F0HQG@_^3]$;V0I07@M`($?0F`+Y"E!>!D!7`K +M?0^`(Y"C%^!@(9"C&>#_Y/T1O9"E!>"T`@1]"H`)D*4%X+0%!GT0?V]QNI"C +MP.`PX`7D_?]QNI"CP.#$$Q,35`$PX`7D_Q*/V9"CP>##$Y`&S>!4[_"0!L_@ +M5._P(I"EK>#_TQ"O`#_?@!]`=,0KP'#P-"0I:?N\*/O +M\*/M\)`$'>!@+I`%(N"0I:SP?13Q[K\!%!*5?I"EJN[P_*/O\/V0I:G@_]'7 +MD*6LX/]]%7&Z@!02E7Z0I:KN\/RC[_#]D*6IX/_1UY`$'W0@\'\!T-"2KR*0 +MH9S@_Y"EKN#[?0$2E8B0I:_N\/RC[_#]D*6MX/]T"2WU@N0T_/6#X%0_\.]@ +M4G0I+?6"Y#3\]8/@1!#P=`DM]8+D-/SU@^!$@/"0H\'@Q!-4!S#@1Y"CU.#_ +MPY0@4!/O)>`EX/]T*RWU@N0T_/6#[_`B="LM]8+D-/SU@W1_\")T*2WU@N0T +M_/6#X%3O\'0)+?6"Y#3\]8/@1$#P(A*X]9"C&N!D#&`1Y/U_#!&]Y/W_<;I] +M".3_<=`BD*.]X"#@*9"C%^!D`7`A$I?(D*,5X%0/8`[D_7\,$;WD_?]QN@*X +M]9"C&N!P`A&Y(N]@19"BC>!D`7`]D*,4X%3^\'TK?P]QNI`&!.!4O_!]".3_ +M<="_`120HQ/@1$#P?09_`7$`D*,2=`;P(I`!N70!\)`!N'0(\")__W&ZY)"F +M`/"C\)`%^.!P#Z/@<`NCX'`'H^!P`W\!(I"CP>#$$Q-4`S#@%=.0I@'@E`.0 +MI@#@E`!``H`3?P&`&].0I@'@E.B0I@#@E`-`"I`!P.!$(/!_`")_,GX`$CZ' +MD*8`Y'7P`1((UH">Y/OZ_7\!$D>^[V#TD*&4X&#NPJ\PX`M4_O#D_Q)DTQ)Y +MT]*OPJ^0H93@_S#A!E3]\!*.;]*OPJ^0H93@_S#B!53[\#'DTJ_"KY"AE.#_ +M,.8%5+_P$;72KX"RY'L!>J1Y!A';[[0"&)"EWN!D!&`+?T#Q<9"EWN`$\"+D +MD*7>\")]`W\1TQ"O`$2 +M2)6.@G6#`!(&HO]T4B[U@N0T_?6#[_`.@-WNPY0&4#-T4B[U@N0T_?6#Y/`. +M@.ONPY0'4!Z0I>$22)6.@G6#`!(&HO]T42[U@N0T_?6#[_`.@-R0_5AT`?`B +MTQ"O`20HHCPT-"2KR*0I;H22)Z0 +MH^/@1!#P?0%_&Q'?D*6][_"_`1R0H^/@5._P1"#PY)"EI?"C=`KPY/O]?VA^ +M`8!1D*6]X/^T`@Z0I;H22)42!HF0H^;P(N^T!`>0H^/@5._P(I"D'.##$U0' +M_W7P#I"D*1)(B>#^=?`.[Y"D*!)(B>"0I:;PD*6E[O#D^_U_5'X!TQ"O`[PH^_PD*6EX/4[H^#U/!(VG9"EH>#^H^#U@HZ#HZ.C=`7PT-"2KR*0 +MI>022)Z0H^/@1`3P?0%_(Q'?CW#E<+0!')"CX^!4^_!$"/#DD*6E\*-T"O#D +M^_U_:'X!@)CE<+0"#I"EY!)(E1(&B9"CY?`BY7"T!!"0H^/@5/OPY/\2D!I_ +M!/%Q(I"D'.`PX'V0I![@<#Y]%G]O$E.Z$E?RD*0!$`?#DD*6E\*-T`U&WD*0>=`'P(I"D'N!D`7`OD*0< +MX,,35`?_=?`.D*0G$DB)X##@&77P#N\25D;DD*6E\*-T`_#D^_U_5'X!0;]Q +MU2*0I!S@_\,3_N]4\?_N!%0')>!/\*/@_Y"D'.#^PQ-4![4'!.Y4\?!1D.20 +MI![P$E?RD*0#Z=?`.[9"D(!)(B>#\5`/][!,3 +M5`?[[L14#Y"EU?"O`A)V7Y"D'.##$U0'=?`.L5J0I!S@PQ-4!_]U\`Z0I"H2 +M2(G@!/!U\`[O$E.ID*0#_D*77X'7P#I"D(Q)(B<"#P(*0I=C@T(+0@W7P`Q)(B>#^ +M=`&H!@B``L,SV/ST7Y"EV?"0I=G@_Y"EU^!U\`Z0I"$22(G`@\""D*78X-"" +MT(-U\`,22(G@_*/@]8*,@^_PD*78X`3P@8/0T)*O(I"D(!)(B>#^5`/_[A,3 +M5`?]TQ"O`WP[Q1@`L%VD`8#X%3[\)"F">#$,U3@_Y`$0N!4GT__ +M\)"E3!((>0````&0I5`2"'D````!?P!^"-'GD*5,$@AY`````9"E4!((>0`` +M``%_`'X)T>>0I4P2"'D````0D*8)X/_D_/W^[U0#_^1X`1((1W@$$@A:D*50 +M$@AM?P!^"M'GD*5,$@AY```,`)"F">#_Y/S]_N]4`__D>`H2"%J0I5`2"&U_ +M`'X-T>>0I4P2"'D,````D*8)X/_D_/W^[U0#_^1X&A((6I"E4!((;7\8?@C1 +MYY"E3!((>0``#`"0I5`2"'D`````T>.0I3H2"'D```P`D*4^$@AY```$`(!E +MD`8#X$0$\)"E3!((>0````&0I5`2"'D`````?P!^"-'GD*5,$@AY`````9"E +M4!((>0````!_`'X)T>>0I4P2"'D```P`D*50$@AY```,`-'CD*4Z$@AY```, +M`)"E/A((>0``#``2=N#0T)*O(G^$?@C3$*\!P\#0D*5*[O"C[_`2-ZV0I502 +M"&V0I4P22%$2"#J0I5022&T22";`!,`%P`;`!Y"E3!)(49"E4!)(;1)()M`# +MT`+0`=``$D@SD*58$@AMD*58$DA1D*JY$@AMD*5*X/ZCX/\2.*30T)*O(I"C +M%^!@`Q*[MV%0D*07D*&4X/^0I@?@ +M_N].D*&4\"(2MG_3D*1+X)0`D*1*X)0`0!;@_*/@_>R0I:7PH^WPY/O]?UQ^ +M`4&_D`%?Y/`B@-"`HGT!?Q4<,.4" +M$>/E'##F`G'LT`?0!M`%T`30`]`"T`'0`-#0T(+0@]#PT.`RY/5D=($E9/6" +MY#24]8/@_U0#]67O5`03$U0_]69TC25D]8+D-*+U@^!P`D%=Y603$Q-4'Y"D +M]?#E9%0'H_"0I/7@)`'U@N0TE?6#X)"D]_#]D*3VX/]T`7X`J`<(@`7#,\XS +MSMCY_^]=<`)!777P$.5DD($!$DB)X"#G`H`3=?`0Y620@0(22(G@D*3X\"#G +M"9`!P>!$(/!!79"D^.`PYCAT@25D]8+D-)3U@^!4^/!U\!#E9)"!`!)(B>#] +M=?`%Y620EY822(G@$Q-4`Y"EGO#D^Z]D46U!7>5E8$45972!)63U@N0TE/6# +MX%3\167_=($E9/6"Y#24]8/O\'7P!>5DD)>6$DB)X!,35`.0I9[P=!0E9/6" +MY#2A]8/@_7L!@$_E9F0!<$WU9G2!)63U@N0TE/6#X%3[_^5F)>`EX$__=($E +M9/6"Y#24]8/O\'7P!>5DD)>6$DB)X!,35`.0I9[P=!0E9/6"Y#2>]8/@_>3[ +MKV2`%:]D$G^*!63E9,.4@%`"`>8BK6&O8-,0KP'#P-"0I9OO\*/M\/F0I9O@ +M_A,3$U0?_>Y4!_YU\!#OD($!$DB)X)"EH/#I5'^0I9_PZW`K=`$M]8+D-)7U +M@\"#P(+@_W0!J`8(@`+#,]C\]%_0@M"#\)"EH.!4?_"`:9"EG^#_PY090`[O +MTY0;4`B0!,]T`O"`!9`$S^3P=`$M]8+D-)7U@\"#P(+@_W0!J`8(@`+#,]C\ +M3]""T(/PD*6;X'7P$)"!`1)(B>!4!_^0I:#PD*6?X)!$19/^,S,S5/A/D*6@ +M\$2`\)"EF^#[<`RCX)"E)_#D_?\2=^&0I9_@^R7@))'U@N0T0_6#Y)/^=`&3 +M_^3\_77P!.N00D$22(D22'D22!EX`1((1Y"EF^#])>`D$O6"Y#26]8/N\*/O +M\)"EG.#_=?`0[9"!`!)(B>_P[7`%D`'([_"0I:#@_Y"EF^#^=?`0D($!$DB) +M[_!U\!#ND($%$DB)X%3\_Y"EGN!/_I"EF^#_=?`0D($%$DB)[O!]`1)^_=#0 +MDJ\BD`!4`Q1@$!1@%B0"0!"W@1`[PY)"D4/"0I/?O\)"D]70"\)"E`Q3P^WJD +M>?7QWG\$`E]QY/^0I/7O\)`$?N#U9:/@]69E96!OD*3V=`/PD*4$=`CPY68$ +M5`_U9^3U9.5G=?`(I"0`]8+D-(#U@^6")63U@N0U@_6#X/]T^"5D]8+D-*3U +M@^_P!63E9+0(T'L!>J1Y]O'>Y68$5`_U9K0/`^3U9I`$?^5F\)"D]>!_!'`# +M`D[L$E]Q(N3_D*12[_#DH_"0I%/@_\.4@%!'=%0O]8+D-*3U@^3P=?`0[Y"! +M`Q)(B>"0I%,PYP[@)('U@N0TD_6#Y/"`%.#_\<^0I%/@)%3U@N0TI/6#=`'P +MD*13X`3P@*]_#'X`$CZ'Y)"D4_"0I%/@_\.4@$`"P2IT5"_U@N0TI/6#X'`" +MP2*0I%/@_W7P$)"!!A)(B>#]=?`0[Y"!!Q)(B>#^[?^0I%/@_"7@)`'U@N0T +MDO6#[O"C[_!U\!#LD($*$DB)X/UU\!#LD($+$DB)X/[M_Y"D4^!U\`J0C0$2 +M2(GN\*/O\'\!D*13X/YU\!"0@0L22(GE@B_U@N0U@_6#X/UU\`KND(T!$DB) +M=?`"[Q)(B>3PH^WP#^^T!#^=),O]8+D-)KU@^[P +MD*13X/^0I%+@_1)^_9"D4^`D@?6"Y#23]8-T`?"0I%/@!/"A."(2K.A_`@). +M[)"C#N`PX!"C=`'PD*,.X/_#$S#@`M'4$KKND*.]X##@!>3_$IP$(M'YD*,= +MX!20!7/P?0)_`M&4@."0HHW@M`$6D*,7X&`0D*,5X%0/9`)@`P*7GA)75R*0 +M`31T0/#]Y/]T%2_XYDW^]G0P+_6"Y#0!]8/N\"*0HQ?@<`>0HP[@,.`1D*,. +MX##@!]'(OP$%X5P25W0BD`5#X'\`,.<"?P$BTQ"O`"T`01_!(`+ +MT!@(Y"C&^!$$/#D +MD*6E\)"C'^"0I:826K>0HQK@(.(#$E"Y$I?((I"C%^!D`F`4D*,5X%0/8`P2 +MIY_O<`;]?PP24+TBD`$V='CPHW0"\'UX_]&4?0)_`]&4D`8*X$0'\)"C(J/@ +MD`58\)"BC>"T`160HQ3@5/OPD*,:X"#B#GT!?P0"4+V0HQ3@1`3P(I"C#N`P +MX`7DH_"C\")U\!#OD($#$DB)X$1`\"+3$*\!P\#0D**(X/]P!J/@9`E@"N\4 +M_Y"BB>"U!P1_`8`"?P#O8`F0`<'@1`+P@#7``9"BB>!U\`^D)/+Y=*$U\*@! +M_'T!T`%^`'\/$@9CD**)X`3PX'\`M`H"?P'O8`7DD**)\-#0DJ\BP.#`\,"# +MP(+`T'70`,``P`'``L`#P`3`!<`&P`<2L7?E(3#A`Q)?5>4A,.(",2[E(3#C +M`Q)?NN4A,.4#$E^\Y2(PX`,2LE?E(C#C`Q*0H^4C,.$#$K2CY2,PX`,2M#3E +M(S#B"=&WD`>/X$00\.4C,.,"\>#E)##A!7\$$D[LY20PY`,29EKE)##E`Q*U +M.N4D,.8#$K6"Y20PYP(Q`-`'T`;0!=`$T`/0`M`!T`#0T-""T(/0\-#@,I"C +MV.`PX`0Q&(`#$IITD*0)X##@`M'I(GT2?_\24[J0!WAT`?"0H_S@_^3]@&V0 +MHQ?@8!20!I+@,.$#`KCUD*,3X%3W\!)0I"(Q&)"CV.#_Q!-4!_[OPQ-4#\.> +M0`*`%Y"CV.#_PQ-4#_[O5.'_[@14#R7@3_`BD*/8X%3^\%3A\)"CW>"0!WCP +MD*/>,9;1-N3]_P)3NN#_H^#]TQ"O`MY/_L +MD*63$@AMY6R0I9.T`0@22%'O1`2`!A)(4>]$(/_LD*63$@AMD*63$DA1D*JY +M$@AM?RQ^"1(XI.5M9`)P`D&,?S!^"1(WK>3__OWLD*63$@AMY6UP%Y"EDQ)( +M4>Y$!_[M1'#][)"EDQ((;8!7D*63$DA1[D0&_NU$8/WLD*63$@AM?RQ^"1(W +MK>3_[)"EEQ((;9"C_."0I9=@"!)(4>]$((`&$DA1[T0$_^R0I9<2"&V0I9<2 +M2%&0JKD2"&U_+'X)$CBDD*63$DA1D*JY$@AM?S!^"1(XI-#0DJ\BTQ"O`]4^TW_ +MD*.]\.Y4$/[O5.].__`2!HG^5"#][U3?3?^0H[WP[E1`_N]4OT[_\!(&B52` +M_N]4?TZ0H[WPD``#$@:B_U0!_I"CP.!4_D[^\.]4`O_N5/U/__"0``,2!J+^ +M5`3][U3[3?^0H\#P[E00_N]4[T[_\)```Q(&HOY4(/WO5-]-_Y"CP/#N5$#^ +M[U2_3O_PD``#$@:B5(#^[U1_3I"CP/"0``02!J+_5"#^D*/!X%3?3O[P[U1` +M_^Y4OT__\)``!!(&HOY4@/WO5']-_Y"CP?#N5`'^[U3^3O_PD``$$@:B_E0$ +M_>]4^TW_D*/!\.Y4`O[O5/U.__"0``02!J+^5!#][U3O3?^0H\'P[E0(_N]4 +M]T[PX/\3$U0_(.`(T3;D_?\24[J0H\'@PQ,@X`Z0!LW@5._PD`;/X%3O\)"D +MVQ)(E1(&B2#@`J&$D`54X)"CSO#@PQ.0H\WPD*/`X,14#S#@%I```1(&HI"C +MOO"0``(2!J*0H[_P@$B0``$2!J+_PY0J4!+OPY0#D*.^4`5T`_"`"N_P@`:0 +MH[YT*O"0``(2!J+_PY0J4!+OPY0#D*._4`5T`_"`"N_P@`:0H[]T*O"0H\'@ +MQ!,35`,PX#V0H[[@=?`#A)"CQO#@PQ.C\)"CO^!U\`.$D*/(\)"CON##$Y"C +MR?"0H[_@PQ.0H\KPD`$^=`CP_7\"$G?,Y)"C^O"0I-L22)60``,2!J+$$Q-4 +M`R#@.Y"CO>#_PQ,@X`KOQ!,3$U0!,.`G$@:)$Q,35!\PX`B0H_S@8`B`"Y"C +M_.!@!751`8`#Y/51?0*O43&;D*.]X,14#S#@')"CP>#$$U0',.`'?01_`A)3 +M`)`%`'0<\*-T$?"0!5AT`O"0H\7@_[0!")"CT'0!\(`B[[0$")"CT'0$\(`6 +M[[0&")"CT'0"\(`*[[0'!I"CT'0%\.20H\7P@&V0I-L22)60``,2!J+_Q!,3 +M5`,PX`5U4@*`%!(&B?\3$Q-4'S#@!752`8`#Y/52$G=D?2!_0!)+WI"DVQ)( +ME9```Q(&HA,3$U0?D`=X,.`%=`/P@`-T`?"M4G\",9OD_?\24[J0!0!T'/"C +M=$/PD*/#X%3?\.20H\_PD*/`X,03$Q-4`3#@"9"C[>!$`O"`#'\!$H_9D*/M +MX%3]\'\#\8F0H[W@(.`'D*/!X%2_\-#0DJ\BTQ"O`!$`O"0`0!T +M__"0!K=T"?"0!K1TAO"0H[O@_Q,3$U0?,.`&D`=X=`/PD*/8X"#@-._#$S#@ +M+I"C_.!@!^20I?SP@`:0I?QT`?"0H[O@Q!-4!Y"E_3#@!70!\(`#=`+PD*7\ +M,99_`A)+(N]$`?U_`A)+WM#0DJ\BTQ"O``PX!^0I`[@M`$,H^"T +M`1-T`O#Q8H`,D*0.X+0"!70#\-'IT-"2KR+3$*\!P\#0D*00X+0!`H!*D*00 +MX+0"$?%B?P'QB1*@D9"D$'0#\(!,D*00X&0#<".0I!/Q9>3_\8D2H)&0I`G@ +MPQ-4`__D^_T2ER&0I!!T!/"`(9"D$."T!!J0I`G@PQ-4`_][`7T!$I`PX!?$5`\PX`OOD`;,<`/P@`B``Y`&S'0#\-#0 +MDJ\B(M$VD*,1=`/P(L#@P/#`@\""P-!UT`#``,`!P`+``\`$P`7`!L`'$DU+ +M4Y&_T`?0!M`%T`30`]`"T`'0`-#0T(+0@]#PT.`R,N3_Y/YTDR_U@N0TF_6# +MX%3^\'7P$.^0@0"^`Q(22(GE@B[U@N0U@_6#=(#P@`\22(GE@B[U@N0U@_6# +MY/!U\`COD(D`$DB)Y8(N]8+D-8/U@^3P#KX0K0^_@*?DD*WC\/_D_G7P"N^0 +MC0$22(EU\`+N$DB)Y/"C\`Z^!>=TE"_U@N0TH/6#Y/!T%"_U@N0TH?6#Y/!T +M%"_U@N0TG?6#Y/!T%"_U@N0TGO6#Y/!T@2_U@N0TE/6#Y/!TE"_U@N0TG/6# +MY/!TDR_U@N0TF_6#X%2=\)"5$70!\'24+_6"Y#2?]8/D\'03+_6"Y#2:]8/D +M\'22+_6"Y#25]8-T__#O)>`D`?6"Y#22]8/D\*/P=),O]8+D-)KU@^3P=?`% +M[Y"7DQ)(B70;\'7P!>^0EY022(GD\'7P!>^0EY422(G@5.#P=?`%[Y"7EA)( +MB>!4\_!U\`7OD)>6$DB)X%3\\'7P!>^0EY422(G@1"#P=?`%[Y"7EA)(B>!4 +MS_!U\`7OD)>6$DB)X$1`\'7P!>^0EY822(G@5'_P=?`%[Y"7EQ)(B>!4_O!U +M\`7OD)>4$DB)X/YU\!#OD($`$DB)[O`/[V2`8`(!BI`$273P\*/D\*-T__"0 +M!#-T`O"C=`3PHP3PHP3PHP3P(G&[<<$1*?&;439QSU'JD*1)=/_PY*/PH_"C +M\*/@5/Q$`O#DH_"C\*/P(GX`?Z-]`'L!>J-Y$Q((JI"C%G0"\)"C'13PH_"C +M=`CPD*,BY/"C=`+PD*-.X"0$D*,L\*-T"/#D_?\24P!]#'\"$E,`$E+\D*&9 +MX/^T`0B0HR%TW?"`#^^0HR&T`P5TU?"``W1`\)"CMG0#\*-T!?"CX%0!1"CP +MHW0%\)"C3N`D!)"C+/"C=`CP\7I^`'\"?0![`7JC>;H2"*J0!@3@5'_PD`8* +MX%3X\.3]_Q)3NN20H[SP(GX`?QE]`'L!>J-Y[1((JG^`?@@2-ZV0H_02"&V0 +MH_022%&0H_`2"&V0H9G@_V0"<"J0_8#@?@`PX`)^`9"C_.[PD/V`X'X`,.$" +M?@&0H_WN\)#]@."0`OOP@$KO9`%P'9#]<.!_`##@`G\!D*/\[_"0_7#@?P`P +MX0)_`8`CD*&9X&0#<""0_7C@?P`PX`)_`9"C_._PD/UXX'\`,.$"?P&0H_WO +M\)#]:.!$`O"0!WAT`?`2GBKQ9)"CUG0!\.3]?P$2:9N0I`G@5/[PD`2/Y/`B +MY)"BC?`BY)"BB/"C\)"A\/"C\")^`'\M?0![`7JD>1P""*J+48I2B5,2!HG$ +M5`__OP\:D*0K4:I2J5.0``$2!J+_ +M$@:)_E0/_77P#I"D'Q)(B>_PD``"$@:B5`/_=?`.[9"D(!)(B>!4_$_PD``" +M$@:B5!S_[E0/_G7P#I"D(!)(B>!4XT_PD``"$@:B5.#_=?`.[I"D(!)(B>!4 +M'T_PD``$$@:B_Q(&B50/_>3[L02K4:I2J5.0``42!J+_$@:)5`_]>P&Q!*M1 +MJE*I4Y```Q(&HC,S,U3X_Q(&B?Y4#_UU\`Z0I"@22(GO\)```Q(&HL035`?_ +M=?`.[9"D*1)(B>_P[L14#_\4;7`ED*0=[_"0``82!J)4#\14\/^0I!S@5`]/ +M\%3Q\$0!\'T@Y/_QS"*/5(U5K@-T'\.55$`4D*3?[O"K5>3]L9>0I-OO\"34 +M@%5T/\.55$`6D*3?[O"K57T@KU2QEY"DV^_P)(B`.'1?PY540!:0I-_N\*M5 +M?4"O5+&7D*3;[_`DT(`;='_#E51`,)"DW^[PJU5]8*]4L9>0I-OO\"2$_>0T +M!/QU\`[E59"D(1)(B77P`^X22(GL\*/M\"+#[YWU5L.4"%`DY/57=?`.ZY"D +M(Q)(B<"#P(*0I-_@T(+0@W7P`Q)(B>56\(!&Y5;#E!!0"757`>56)/B`%^56 +MPY084`EU5P+E5B3P@`=U5P/E5B3H_W7P#NN0I",22(G`@\""D*3?X-""T(-U +M\`,22(GO\*]7(H]4?1<25^YU\`[E5)"D'Q)(B>#\=?`.Y520I"`22(G@_E0# +M_>X3$U0'^Y"D'.#^Q%0/D*75\*\$T5]U\`[E5!)=6G7P#N54$E.IK53D_P)< +M<=,0KP'#P-"0I=+O\.UD`7`OZ[0!!^`D`O5S@`B0I=+@)/[U0`` +M`/^O<]'6D*4Z$@AY````_Z]S@""0I3H2"'D```#_D*72X/_1UI"E.A((>0`` +M`/^0I=+@_^3\_?Z0I3X2"&U]&'P`?P'1YM#0DJ\BY/S]_I"E/A((;7T8?`#D +M_],0KP'#P-"0I3CL\*/M\)"E-^_PHZ/@_1(^.9"E0A((;9"E.A)(41((.I"E +M0A)(;1)()L`$P`7`!L`'D*4Z$DA1D*4^$DAM$D@FT`/0`M`!T``22#.0I482 +M"&V0I3BCX/W`!9"E1A)(49"JEA((;9"E-^#_T`42/3G0T)*O(GX`?PI]`'L! +M>J-YXQ((JI"CT70"\"+D_W0O+_6"Y#2C]8/D\`_OM!GOY)"C*O"0HR[PD*,H +M\")^`'\!?0![`7JC>0X2"*J0HP[@5/WPY*/PH_"C\*-T#/`B[Q20!7/PD`$_ +M=!#P_7\#=!TO^.9-_O9T."_U@N0T`?6#[O`BD*4FZ_!P9)"E)N#^)!/U@N0T +MF_6#X/R0I2?@^^QK8$N0I2KK\*/N\*X%[B7@3_^0E1'@_B7@)>!/D*4L\)"E +M*'0,\)"E-G0$\'L!>J5Y*!)GWG\$$E]QD*4GX/^0I2;@)!/U@N0TF_6#[_`B +MCV!U\`7OD)>7$DB)X%0!^W7P$.5@D($`$DB)X/5A5'_Z=?`%Y6"0EY,22(G@ +M^9"DY?!U\`3JD$)!$DB)$DA=Y6`EX"02]8+D-);U@^[PH^_P=?`%Y6"0EY82 +M2(G@$Q-4`_5CZL.90`(A5704)6#U@N0TH/6#ZO!T%"5@]8+D-*#U@^#U8L.4 +M#$`EY6*4&U`?NP$H$_9"D +MY>#_[=.?0`(AQ>T3$Q-4'_]U\`CE8)")`!)(B>6"+_6"Y#6#]8/@]8)U@P#M +M5`?_=`%^`*@'"(`%PS/.,\[8^?_N58/^[U6"3F`&J@6*88!S#8"JD*3EX&IP +M4'04)6#U@N0TH/6#Y6'P=?`%Y6"0EY422(G@_\035`51D)>6$DB)X,03$Q-4`3#@`L'Q=($E4?6"Y#24]8/@5/CP=?`% +MY5&0EY422(G@5!^0I./P=?`%Y5&0EY822(G@$Q-4`Y"DY/#E427@)`'U@N0T +MDO6#X/ZCX-.4`.Z4`%`"P?'E477P"J0D`?ETC37P^GL!BU;U5XE8Y5$EX"0! +M]8+D-)+U@^#U6Z/@]5QTDR51]8+D-)KU@^#_D*38Y/"C[_"0``(2!ZO_KO`2 +M!X`O_^7P/OZ0``02!ZLO_^XU\/Z0``82!ZLO_^XU\/Z0``@2!ZLO_^XU\)"D +MVO"C[_`2!X#_PY"DV^"?_I"DVN"5\)"DW/"CSO"0``82!ZO]K/`EX/_L,_[O +M+?WN//R0``02!ZLEX/_E\#/^D``"$@>K+__N-?#/+?WO//RK5I``"!('J_NJ +M\*X">`+#,\XSSMCY+?_L/I"DWO"C[_#E4=.4`5!(Y5O#$_[E7!/_P^N?ZIY0 +M")"5$70!\(`PJU:J5ZE8D``($@>K^ZKPY5RN6W@#SL,3SA/8^?]\`'T%$@<# +MT^N?ZIY`!>20E1'P=?`0Y5&0@0`22(G@D*37\%1_]5)U\`7E49"7DQ)(B>"0 +MI.#P=)0E4?6"Y#2>]8/@PY0%0`+!ZY"DX.#_Y5*?0`V/4I"DU^!4@/[P[T[P +MY5*00>V3_W03)5'U@N0TG/6#X,.?Y5)`!9!!18`#D$&9D_5=D*/^X&!]Y5)D +M$V`%Y5*T"P60I`"`(^529!)@!>52M`H%D*0!@!/E4F018`7E4K0)!9"D`H`# +MD*/_X/5>Y5[#E(!0*.5>E!M``H`3Y5TE7O_D,_[3[Y0;[F2`E(!`!75=&X`@ +MY5XE7?5=@!C#Y)5>]5[E7=.57D`(Y5V57O5=@`/D]5WE777P!J0DH_ET0#7P +M=5/_]52)59"DU^"01)F3_].0I-G@GY"DV."4`$`"P>20!*GE7/##E`KE6Y0` +M4&:0!*C@!/"K5JI7J5B0``82!ZO_KO"0``@2!ZLO_>7P/OSE6\,3_N5<$__3 +M[9_LGD`$?0+!YN5`TY_E\)Y0`L'KP<7E427@)!+U@N0TEO6#X/59H^#U6M/E7)3HY5N4`T`( +MD*3B=`7P@!C3Y5R4&>5;E`!`")"DXG0"\(`%Y)"DXO#D]5^K5JI7J5AU\`+E +M7Z3U@H7P@Q('J_^N\)"DXN#][Z@%"(`%SL,3SA/8^?^K4ZI4J56%7X)U@P`2 +M!J+]?``2!P/O)5KU6NXU6?59!5_E7[0%L*M3JE2I59``!1(&HOU\`)"DXN#_ +MY5RN6Z@'"(`%SL,3SA/8^?\2!P/3Y5J?Y5F>0`SE6I_U6N59GO59@`7D]5GU +M6N51)>`D$O6"Y#26]8/E6?"CY5KPKEG_Y/S]=?`$Y5*00D$22(D22'G#$DA` +M0`+!RW02)5'U@N0TE?6#X/]T$R51]8+D-)SU@^#^TY]``^Z`&G03)5'U@N0T +MG/6#X/]T$B51]8+D-)7U@^##GY"DX?"0I.'@TY0$0`1TE(`A=)0E4?6"Y#2< +M]8/@TY0!=)1`#B51]8+D-)SU@^`4\(`+)5'U@N0TG/6#Y/!U\`3E4I!"01)( +MB1)(7>51)>`D$O6"Y#26]8/N\*/O\'24)5'U@N0TG/6#X'`FKU$138`@Y5(E +MX"21]8+D-$/U@]-T`9.56N23E5E`!WT!KU$2@$'D_:]1T?T%4>51PY2`4`(A +MUB+3$*\!P\#0[6!B=?`*[Y"-`1)(B>3PH_!U\`KOD(T#$DB)Y/"C\'7P"N^0 +MC0422(GD\*/P=?`*[Y"-!Q)(B>3PH_!U\`KOD(T)$DB)Y/"C\.\EX"0!]8+D +M-)+U@^3PH_!TDR_U@N0TFO6#Y/!U\!#OD($#$DB)X%2_1(#^=?`0[Y"!`Q)( +MB>[PT-"2KR)T@2_U@N0TE/6#X%3PQ%0/_G7P$.^0@0422(G@5`/]=?`%[Y"7 +MDQ)(B>#\=!0O]8+D-*#U@^!4?_5GTY0;4&'E9\.4#$!:#NZ4!$`TY/YT$R_U +M@N0TG/6#X/MT$B_U@N0TE?6#Z_!T$R_U@N0TG/6#X"0\^W24+_6"Y#2<]8/K +M\'2!+_6"Y#24]8/@5`_[[L14\$O^=($O]8+D-)3U@^[PY6?3G$`"C&>0I9[M +M\.3[K6<28FVO9R*/8'24+_6"Y#2<]8/D\'7P!>^0EY<22(G@5`'_=?`0Y6"0 +M@0`22(G@]6%4?Y"DY_!U\`7E8)"7E!)(B>"0I.KP=?`%Y6"0EY,22(G@^9"D +MZ_!U\!#E8)"!!1)(B>!4`_5BD*3GX/XEX"21]8+D-$/U@^23^G0!D_OE8"7@ +M)!+U@N0TEO6#ZO"CZ_!T%"5@]8+D-*#U@^[P=!0E8/6"Y#2@]8/@]6.0I.?@ +MTYE`"I"DZ^"0I.?P]6'M<`)!$)"DZ.WPY6$PYPJ0I.?@]6&CX!3PD*3HX/YP +M`D$0D*3JX/V0I.?@TYU0`D$*Y)"DYO#E8].4&U!9Y6.4#$!3[V0!<$[E8R3T +MPYZ0I.GP_:]@4;*K8JUCKV!1'H]A=($E8/6"Y#24]8/@5`3_OPP*D*6>Y6+P +M>P%!&'2!)6#U@N0TE/6#X##B"I"EGN5B\.3[01B0I.?@%)"DY?"0I.K@_Y"D +MY>#]PY]`:^#_$Q,35!_^=?`(Y6"0B0`22(GE@B[U@N0U@_6#X/MZ`.]4!_]T +M`7X`J`<(@`7#,\XSSMCY_^Y:_N];3F`?C6&0I.;@!/"0I.C@_Y"DYN!O8!F0 +MI.K@_^5ATY]`#I"DY>`4\("-D*3JX/5AD*6>Y6+PY/L28FFO82*0I.SK\'2! +M+_6"Y#24]8/@5/OP=!0O]8+D-)WU@^#[8"]T%"_U@N0TGO6#X&`BK@.L!G2! +M+_6"Y#24]8/@5/M$!/UT@2_U@N0TE/6#[?"`0704+_6"Y#2=]8/@`D$?6"Y#1%]8/DD_]T%"SU@N0TG?6#[_!T%"SU@N0TGO6#Y/!AU(!'[F0! +M<&GM8!AD`6`4[60#8`_M9`1@"NUD"6`%[60*<"?M)>`D$O6"Y#1%]8/DD_]T +M%"SU@N0TG?6#[_#M)>`D$?6"Y#1%@$SM)>`D$?6"Y#1%]8/DD_]T%"SU@N0T +MG?6#[_#M)>`D$O6"Y#1%@"7M)>`D$?6"Y#1%]8/DD_]T%"SU@N0TG?6#[_#M +M)>`D$O6"Y#1%]8/DD_]T%"SU@N0TGO6#[_!T%"SU@N0TG?6#X/ET%"SU@N0T +MGO6#X/WI$Q,35!__=?`([)")`!)(B>6"+_6"Y#6#]8/@^WH`Z50'_W0!?@"H +M!PB`!<,SSC/.V/G_[EK^[UM.<`IT%"SU@N0TG8!$[1,3$U0?_W7P".R0B0`2 +M2(GE@B_U@N0U@_6#X/MZ`.U4!_]T`7X`J`<(@`7#,\XSSMCY_^Y:_N];3G`, +M=!0L]8+D-)[U@^3P(H]2=?`%[Y"7EA)(B>`3$U0#_W03)5+U@N0TG/6#X/[3 +ME#)`+'7P!>52D)>3$DB)X/54=?`%Y5*0EY422(G@_,035`<@X`*A1N541(#U +M4X![[M.4'D`O[1)(IX3Q`(3V`83Q`H3V`X3Q!(3V!83[!H3[!P``A49U5!>` +M3754$(!(=50(@$-T$R52]8+D-)SU@^#3E`I`+^T22*>%,0"%-@&%,0*%-@.% +M,02%-@6%.P:%.P<``(5&=504@`UU5`R`"'54!(`#Y/54A513D`2EY5/PD*6> +M[_#D^ZU3KU(28FUTDB52]8+D-)7U@^"U4Q!TE"52]8+D-)_U@^`$\(`;=)(E +M4O6"Y#25]8/E4_!TE"52]8+D-)_U@^3P=)0E4O6"Y#2?]8/@M`(;=!,E4O6" +MY#2:]8-T"O!TE"52]8+D-)_U@^3P(I"DVQ)(GA(&B?51))/U@N0TF_6#X%2< +M\'23)5'U@N0TF_6#P(/`@N#_D*3;$DB5D``#$@:B5`'^[T[0@M"#\'23)5'U +M@N0TF_6#P(/`@N#_D*3;$DB5D``#$@:B5`+^[T[0@M"#\'23)5'U@N0TF_6# +MP(/`@N#_D*3;$DB5D``#$@:B5"#^[T[0@M"#\'23)5'U@N0TF_6#P(/`@N#_ +MD*3;$DB5D``#$@:B5$#^[T[0@M"#\'23)5'U@N0TF_6#X/]4(,035`?^=?`% +MY5&0EY422(G@5!_]D`2D[_#E4<.4@%`6D``"$@:B_W03)5'U@N0TG/6#[_"` +M#^51M(`*D``"$@:BD)<2\.Y@!*]1D7LBTQ"O`5$DB) +MX%0?_R3W4`*`6^3U:)"E]N#]=?`(D(D`$DB)Y8(E:/6"Y#6#]8/@_N]U\`>D +M)%;U@N0T0/6#Y8(E:/6"Y#6#]8/DD_SN7/YU\`CMD(D`$DB)Y8(E:/6"Y#6# +M]8/N\`5HY6BT"*CD_75I!N5IM`8=_Y"E]N!U\`B0B0`22(GE@B_U@N0U@_6# +MX%0/@!F0I?;@=?`(D(D`$DB)Y8(E:?6"Y#6#]8/@D*7W\)"E]^!@,75H!W0! +M?@"H:`B`!<,SSC/.V/G_D*7WX/OO6V`+Y6EU\`BD)6C]@!@5:.5HPY0`4-+E +M:6`+%6GE:<.4`$`"X4[D_/5IY6FT!AW_D*7VX'7P")")`!)(B>6"+_6"Y#6# +M]8/@5`^`&9"E]N!U\`B0B0`22(GE@B5I]8+D-8/U@^"0I??PD*7WX&`OY/5H +M=`%^`*AH"(`%PS/.,\[8^?^0I??@^^];8`OE:77P"*0E:/R`#P5HY6BT"-0% +M:>5I9`=PA)"E]N#_=?`%D)>3$DB)[?!U\`7OD)>4$DB)[/!U\!#OD($`$DB) +MX/]4?_5J[U2`]6OE:M.=0`?E:TWU:H`+Y6K#G%`%Y6M,]6J0I?;@_R04]8+D +M-)_U@^5J\'7P!>^0EY822(G@$Q-4`Y"EGO"0I?;@_^3[K6H28FV0I?;@=?`0 +MD($#$DB)Y/#0T)*O(G2!+_6"Y#24]8/@5/SP=)0O]8+D-*#U@^#^8#=T%"_U +M@N0TH?6#X&`J[GH`^Y"DYNKPH^OP=($O]8+D-)3U@^!4_$0"_G2!+_6"Y#24 +M]8/N\(!(=)0O]8+D-*#U@^!P#W04+_6"Y#2A]8/@8`*`''24+_6"Y#2@]8/@ +M_F`;=!0O]8+D-*'U@^!P#NYZ`/N0I.;J\*/K\(`#KP4BD*3FH^#_(JP'=),L +M]8+D-)OU@^#_5`+#$_[O5$#$$Q-4`V0!<$WMPY0`0`;MTY0#0`SMPY0(0"_M +MTY0*4"GM)>`D]/6"Y#1$]8/DD_]TE"SU@N0TH/6#[_!T%"SU@N0TH?6#Y/!! +MC>UD!6`B[60+<$2`&^YD`7!D[<.4`$`&[=.4`T`*[60(8`7M9`EP)^TEX"3T +M]8+D-$3U@^23_W24+/6"Y#2@]8/O\.TEX"3S]8+D-$2`3.TEX"3S]8+D-$3U +M@^23_W24+/6"Y#2@]8/O\.TEX"3T]8+D-$2`)>TEX"3S]8+D-$3U@^23_W24 +M+/6"Y#2@]8/O\.TEX"3T]8+D-$3U@^23_W04+/6"Y#2A]8/O\'24+/6"Y#2@ +M]8/@^704+/6"Y#2A]8/@_>D3$Q-4'_]U\`CLD(D`$DB)Y8(O]8+D-8/U@^#[ +M>@#I5`?_=`%^`*@'"(`%PS/.,\[8^?_N6O[O6TYP"G24+/6"Y#2@@$3M$Q,3 +M5!__=?`([)")`!)(B>6"+_6"Y#6#]8/@^WH`[50'_W0!?@"H!PB`!<,SSC/. +MV/G_[EK^[UM.<`QT%"SU@N0TH?6#Y/`B$@:)5'__D``!$@:B_E0?_>Y4@,03 +M$Q-4`9"DV_"0``(2!J+^5`.0I-SP[E0PQ%0/D*3>\)```A(&HOY40,03$U0# +MD*3=\.Y4@,03$Q-4`?Z0``(2!J)4"/P3$Q-4'Y"DW_#N5`'$,S,S5(#^=?`% +M[Y"7EA)(B>!4?T[PD*3=X%0!Q#,S5,#^=?`%[Y"7EA)(B>!4OT[PD*3?X&`" +M@9GM8`AD`F`$[;0$$'7P!>^0EY<22(G@1`'P@`YU\`7OD)>7$DB)X%3^\.U4 +M'_YU\`7OD)>5$DB)X%3@3O"0I-S@5`/^=?`%[Y"7EA)(B>!4_$[P[B7@)>#^ +M=?`%[Y"7EA)(B>!4\T[PD*3;X%0!Q#-4X/YU\`7OD)>5$DB)X%3?3O"0I-[@ +M5`/$5/#^=?`%[Y"7EA)(B>!4ST[PY/[N]8)U@P"CHZ,2!J+]=?`([Y")`!)( +MB>6"+O6"Y#6#]8/M\`[NM`38$H;/(I"DV!)(GI"DU^_P$DBGC0,`C0P!C14" +MC1T0C241C2X2C384C3\@C4@AC5$CC5DDC6(EC6M`C7Q!C7-"C85@C8YAC9=B +MC:!CC:EDC;)EC;IFC<-GC=LC?!MC?EN``".`I"DV!)(E0*A +M39"DV!)(E0*AF9"DV!)(E<$ED*38$DB5X;&0I-@22)4"<]Z0I-@22)7!$I"D +MV!)(E0*GTY"DV!)(E0*G_I"DV!)(E0*J#Y"DV!)(E>&7D*38$DB5`J/3D*38 +M$DB5`JI5D*38$DB58320I-@22)4"A;^0I-@22)4"MQZ0I-@22)4":I&0I-@2 +M2)4"6O&0I-@22)4"7[Z0I-@22)4"6C>0I-@22)4"JI.0I-@22)7AGY"DV!)( +ME0*3"Y"DV!)(E0*1B9"DV!)(E0*2HI"DV!)(E0*3Q)"DV!)(E0*J]9"DV!)( +ME0*L&9"DV!)(E0*L0Y"DV!)(E0*LMY`!P.!$`?"0I-?@D`'"\"(2!HG_D**, +M\+\!!]'3Y)"BC/`BTQ"O`JU&J4JE3D``!$@:B9`%@$9"C#N`@X`?D_Q*ELX`#$F;4T-"2KR+3$*\! +MP\#0D*'QX/^0H?#@M0<$?P&``G\`[W!#D*'PX/YU\`B0H:`22(G@_>YU\`BD +M)*'Y=*$U\/I[`:\%D9J0H?#@!/#@?P"T"@)_`>]@!>20H?#P$JSHD*&4X$0" +M\-#0DJ\B>P%ZI'G;?_5^`1(TO+\!!I"DV^"C\'L!>J1YVW_V?@$2-+R_`0B0 +MI-O@D*3=\'L!>J1YVW_T?@$2-+R_`0B0I-O@D*3>\'L!>J1YVW_S?@$2-+R_ +M`0B0I-O@D*3?\'L!>J1YVW_R?@$2-+R_`0B0I-O@D*3@\)"DW.#_H^#]H^#[ +MH^"0I.3PD*3@X)"DY?"0I.9T$O"0I/1T!?"0I.CO\*/M\*/K\)"DY."0I.OP +MD*3EX)"D[/![`7JD>>829]Y_!`)?<1(&B9"C(?`B$@:)D*/\\)```1(&HI"C +M_?`BD`0DX/51$@:))5&0I"OPD``!$@:B)5&0I#GPD``"$@:B)5&0I$?P(I"C +M[>#^PQ,PX!SOM`$%D*/T@`.0H_`22%&0JKD2"&U_@'X($CBD(I"E%70(\)"E +M(W0!\)"E%^_P>P%ZI7D5`F?>D*5<=`GPD*5J=`?PD*5>[_!P,9"CUN!@&J/@ +M8`*`#)`'<.!P!I`'=.!@")"E7W0!\(`%Y)"E7_#DD*5@\*/PH_"C@#F0_6+@ +MD*5?\)#]8^"0I6#PD/UDX)"E8?"0_67@D*5B\)#]9N"0I6/PD/UGX)"E9/"0 +MI5_@5`&0H];PH_![`7JE>5P"9]Z0H^/@_\,3,.`$[U3]\)"CX^#_$Q,35!\P +MX!#O5/?PD/U8X##@!>3_$D[GD*/CX/_$$U0',.`$[U3?\)"CX^#_Q!,3$U0! +M,.`K[U1_\)#]6.`@X`B0I05T`?"`!>20I07PD*4%X/V0H^C@^^3_44-_!!). +M[)"CY.#_PQ,PX`3O5/WPD/U8X"#@7)"CX^`PX`A[`7JD>09A"Y"CX^#_Q%0/ +M,.`)>P%ZHWGF`EHWD*/CX/_$$Q-4`S#@"'L!>J-YZ(`ED*/CX/\3$U0_,.`) +M>P%ZHWGE`EKQD*/DX##@"'L!>J-YYU&B(M,0KP'#P-"0I8D22)X2!HF0I8SP +MD``!$@:BD*6-\)```A(&HI"ECO"0``,2!J*0I8_PD``$$@:BD*60\.2C\*/P +MD*/CX$1`\'L!>J5YC'T'?S`26-^/<>5QM`$?D*/CX%2_\$2`\.20I:7PHW0* +M\.3[_7]H?@$26K^`.N5QM`(:D*6)$DB5BT"*08E"=4,%>P%ZHWGH$C6%@!OE +M<;0$%I"CX^!4O_"0I8S@^^3]_U%#?P027W'0T)*O(I"E:W0+\)"E>70'\)"E +M;>_P8#*0_6/@D*5N\)#]8>"0I6_PD/UDX)"EP%ZI7EK`F?>TQ"O`D*6^$DB5$@:)D*0&\)```1(&HI"D!_"0``(2!J*0I`CP +MD*/CX$0!\)"EOA)(E1)8VY"EP>_POP$=D*/CX%3^\$0"\.20I:7PHW0*\.3[ +M_7]H?@$"6K^0I<'@M`0'D*/CX%3^\"*0I-MT"O"0I.ET!O`2!HF0I-WPD``! +M$@:BD*3>\)```A(&HI"DW_"0``,2!J*0I.#PD``$$@:BD*3A\)``!1(&HI"D +MXO![`7JD>=L"9]X2!HGU49```1(&HO54D``"$@:B]560``,2!J+U5I``!!(& +MHO57D``%$@:B]5B0``82!J+U6>51$DBGE!<`E!\!E"<"E"\#E#<$E#\%E$<& +M``"47G52`G53*8!%=5(&=5,J@#UU4@%U4S&`-752`753,H`M=5(&=5,S@"5[ +M`'H`>51A=I"C_N54\*/E5?"CY5;PH^57\*/E6/`B=5(!=5/_>P!Z`'E4K5*O +M4P)8W],0KP'#P-"0I7IT%?"0I8AT`?"0I7SO\'L!>J5Y>A)GWM#0DJ\BD*&> +MX/]["'T!L8B0I0GN\/RC[_#]D*4&X/^CX/NCX)"E$/"0I0WL\*/M\*/K\)"E +M#>#\H^#]$E;7D*4-H^#__20-]8+D-/SU@^!$@/!T#2WU@N0T_/6#X%3O\'02 +M+_6"Y#3\]8/@1`+P=!(O]8+D-/SU@^!4`_"0I0_@_Y"E#:/@_B0J]8+D-/SU +M@^_PD*40X/]T*R[U@N0T_/6#[_!T+"[U@N0T_/6#X"0"\"*0I0;O\*/M\*/K +M\)`$'>!@()`%(N"0I0OP?0$25^[O9`%P`I&7D*4+X/]]`A)3NH`"D9>0!!]T +M(/`BD*6GH^#_>PA]`=,0KP'#P-"0I>[M\*/K\)"E[>_PY/W\\99\`*T'D*7M +MX)`$)?"0I>[@8`YT(2_U@N0T_/6#X$2`\*\%="`O]8+D-/SU@^!4P/!T(2_U +M@N0T_/6#X%3`\*\%=!(O]8+D-/SU@^!4`?Z0I>_@)>`EX/ON1`)+_G02+_6" +MY#3\]8/N\'01+_6"Y#3\]8-T__!T*2_U@N0T_/6#X%3W\*X$KP70T)*O(M,0 +MKP'#P-"0I0CN\*/O\)`$'>!@'I`%(N"0I0SP?3825^Z_`0+1>9"E#.#_?3<2 +M4[J``M%YD`4BX%1O_WTX$E.ZD`0?="#PT-"2KR*0H9_@_^3[?0&QB)"E"N[P +MH^_PD*4(X/RCX/VK!Y"E#>WP[/G@_ZX#="HN]8+D-/SU@^_P="LN]8+D-/SU +M@^GP(M,0KP'#P-"0I=KO\)`$'>!@,Y`%(N"0I=WP?2D25^Z_`1>0H9VQ@I"E +MV^[P_*/O\/V0I=K@_Q)6UY"EW>#_?2H24[J`%Y"AG;&"D*7;[O#\H^_P_9"E +MVN#_$E;7D`0?="#PT-"2KR*0I07O\*/M\*/K\)"D">`3$Q-4'R#@#I"E!N"T +M`0=]-G]O$E.ZD*4%X'`,D*4'X/]]!1)3T(`FD*4%X+0!"9"E!^#_T;J`%I"E +M!>"T`@^CX+0!"I"D%^#^H^#_T2V0I`G@$Q,35!\@X`N0I0;@<`7]_Q)3NB*0 +M_1#O\'\`(I"CN^#$5`\@X!^0!!W@!D`7`XD`:2X"#B +M!I`$X^!@()`&DG0$\)"CTN`$\)"CR>!U\`.$_Y"CTN"U!P*``D%8Y)"CQ?"0 +MH]`$\"*0H\7@9`1P-9`&DN`@X@:0!./@8!R0!I)T!/"0H]+@!/"0H\C@_Y"C +MTN"U!P*``D%8Y)"CQ?"0H]!T!/`BD*/%X&0&8`(AN9"CT^#_D*/2X"__Y#/^ +M?`!]`Q('`Y"CR>`O_^P^_L/OE$'N9("4@%`(D*/3X)0#0!&0H\#@Q%0/D*/0 +M(.`"(5M!`9"CQ.#_$Q-4/S#@>N]4^_#DH_"0H\#@Q%0/,.`.D*/BX##@`B'G +MD*/000&0H]/@_Y"CTN`O_^0S_GP`?0,2!P.0H\G@+__L/O[#[Y1![F2`E(!` +M#I"CXN`PX`(AYY"CT$$!D*/BX##@%I"CQ70)\)`&DG0$\.20H]+PD*7?00V0 +MH]!T`O`B$E/%D*/3X`3P?P,27\B0H]/@_Y"CTN`O_^0S_GP`?0,2!P.0H\G@ +M+__L/O[#[Y1![F2`E(!0"I"CT^"4`U`"07.0!WAT`_"0!2+@1!#_?0,24[J0 +M!)S@!/`BD*/%X&0'<$^0H]/@M`0%D*/0@#20H\3@_Q,35#\PX"SO5/OPY*/P +MD*/BX##@%Y"CQ70)\)`&DG0$\.20H]+PD*7?!(`/D*/0=`7P(A)3Q9"CT^`$ +M\(!(D*/%X&0)<%N0H\3@,.`.D*/0=`7PD*/$X%3^\"*0!I+@,.(I=`3PD*/2 +MX`3PX+0"%Y"EW^"0H]!@!70%\(`#=`+PY)"CQ?`B?P,"7\B0I=_@D*/08`5T +M!?"``W0"\.20H\7P(I"CO>`PX#41`I"CT.#_M`$"@!R0H]#@_[0"`H`@`_LM`0/D*._X/^0H\W@ +MPY^0H]3PD*.]X,035`#$5`\PX%20H\/@5-_PY/U_!!)0O9"CP>#$ +M$Q-4`S#@.I"CQ.!$`O!4^_#DD*/3\)"CT/"0I07@_[0!")"CQ70&\(`*[[0$ +M!I"CQ70'\)"CO.!@!Y"CQ.!$!/"0I07@M`$$?0:`"9"E!>"T!`=]#']O$E.Z +MD*/!X!,3$U0?,.`;D*/4X/_#E"!0"N]_`"7@)>#^@`1__WY_$I8MD*/`X##@ +M!N3]_Q)3NB+3$*\!P\#0D*6R[_"C=`+PY/\2;XF0H\'@_Q,35#\PX`,2;C:0 +MH\'@_S#@")`'>'0!\(!"D*.]X/[$$Q-4`S#@")`'>'0-\(`MD*/`X/[$5`\P +MX`WN$Q-4/Y`'>##@#X`2D*/`X/[#$Y`'>##@!70#\(`#=`GPD*6RX&0#8`*A +M#._$$Q-4`S#@<9"CQ^#_D*/2X/[3GT!#[G7P`Z3_D*/)X/[#[Y[_)`/]Y#/\ +MD*._X/[3G>QD@/AT@)A`".Z?D*6U\(`&D*6U=`/PD*6UX/\27\B0H]#@!/"` +M&9"CRN#_$E_(D*/%=`3PY)"CT/"0!I)T!/#DD*/2\(`.D*._X/\27\B0H]#@ +M!/"0H[W@Q!,3$U0!,.`'Y)"EM/"`!I"EM'0!\)"CP.#$$U0'(.`3D*/\X&`' +MY)"EL_"`!I"ELW0!\)"ELQ)IEI"CSW0!\)"CO>#$$U0',.`-D*6RX'!"_?\2 +M4[J`.Y"CO>#$5`\PX!V0H\/@1"#PD*.\X&`$?0&`&^3]_Q)3NGT!?PR`$9"E +MLN"T`PV0HQ?@8`?D_7\$$E"]D*.\X&`8D*6RX'`$?02`"I"ELN!D`W`T?0M_ +M;X`KD*6RX'`$_?^`(9"ELN"T`QV0H[W@_\035`<@X`OO$Q-4/S#@`Q*7GN3] +M_Q)3NI"CP.#$$Q,35`$PX`5_`1*/V9"CP>##$Y`&S3#@#>!$$/"0!L_@1!#P +M@`O@5._PD`;/X%3O\-#0DJ\B?@!_,'T`>P%ZHWF]$@BJD*.^=`OPHW0(\)"A +MF>#\9`)P'9#]@.!^`##B`GX![E0!Q#,S5,#^D*/`X%2_3O`B[&0!<`V0_7#@ +M?P`PX@)_`8`3D*&9X&0#]4`<0S,U3`_Y"CP.!4OT_P +M(N20I/7PD*.]X##@;)"CP>#$$Q-4`S#@'Y"CR>#_$E_(D`:2=`3PD*/%=`'P +MY)"CTO"0H]#P@!&0I/7@_Y"COA)?Q)"CT'0!\)"CSW0!\)"CO.!@!WT%?V\" +M4[KD_?\24[J0H[W@_\035`<@X`OO$Q-4/S#@`Q*7GB*0H]C@,.`%$FE)@`+1 +MH)"CP>#_Q!,35`,PX!.0I`7@!/#@M!0)D`2#][7@"SL,3SA/8^?^0HTCN +M\*/O\)"C%.`3$Q-4'S#@$Y`!.^`PY`P2HJ20HQW@%)`%<_"0I?KD=?`!$@C6 +MPY"E^^"4@)"E^N!D@)2`0`N0`9C@5/[PX$0!\'\!`D[LD*46[_!_+'X)$C>M +M[U0$_^3]_.]@")"CWG0!\(`%Y)"CWO!_,'X)$C>M[E0!_NU4$/WD_.U.8`?D +MD*/?\(`&D*/?=`'PD*/8X$0!\'T1$DM$D`=XX)"CW?"0H_S@_^3]$FF;D*46 +MX/UP`H`D[;0!"I"CV.!4'T0@\"*0I1;@_;0""I"CV.!4'T1@\"+MM`,'D*/8 +MX%0?\"*0H\#@Q!,35`,@X!Z0_6+@,.`7X)"E%3#A!70!\(`#=`+PD*45X/\2 +MG\XB[W`0 +M!W@$\(`?O@$(D`=X=`/P@!2^`@B0!WAT"?"`";X#!I`'>'0-\)"D">#^Q!-4 +M!S#@1>]P'Z/@$Q-4/S#@!^20I07P@`:0I05T`?"0I07@_>3_@""0I`K@Q!,3 +M5`,PX`?DD*4%\(`&D*4%=`'PD*4%X/U_`1)IFR*0I@CO\'\"$D>7D*&5X/^0 +MI@C@_N].D*&5\"*0`@G@]5$2!HDE49"AFO"0``$2!J(E49"AF_"0``(2!J(E +M49"AG/"0``,2!J(E49"AG?"0``02!J(E49"AGO"0``42!J(E49"AG_`BBU&* +M4HE3D``!$@:B__55$@:)_L,3,.`*D``"$@:B]5:``H]6A554Y533E590,ZM1 +MJE*I4Q(&B50!_W2-)53U@N0THO6#[_!TC254]8+D-*+U@^"O5'`$42N``E$: +M!52`QA)W>N55#_H^!O<`L2=[U1 +MI)"C'N`4\)`!YN`$\"*0HHW@9`%@`F'"D*,7X'`"8<*0HQ7@_\14#V0!<":0 +M!JO@D*,>\)`&JN`$D*,=\*/@_W`(D*,=X/[_@`/O!/^0HQ[O\)"C$^`PX`,2 +MLN20HQ3@1`3PY)"C(/"0HR*CX)`%6/"0`5?D\)`!/'0"\)"C&^!4_?!4[_"0 +MHQ7@_\14#R3]4`*`#Y"C#N`PX`42M\^``Q*Z?9"C%.`3$Q-4'S#@#Y"C'>#_ +MH^"U!P42=[U1JI"C#N##$R#@!Y"C%.!$!/`BTQ"O`]4^TW_D*,.\.Y4 +M"/[O5/=.__`2!HG^5!#][U3O3?^0HP[P[E0@_N]4WT[_\!(&B?Y40/WO5+]- +MD*,.\.[#$R#@`H'MX"#@`H'5=50A$Q-4/S#@"!)FBT-4"(`,Y)"C#_"C\'U` +M_U&ND*,.X/\3$Q-4'S#@`T-4$N_$5`\PX`-#5!20HP[@Q!-4!S#@`T-4@)"C +M#N#$$Q-4`R#@`T-40)`%)^54\)"C$>!P!'\!L;.0HP[@_\03$U0#,.`$?P2` +M(A)FR.]@!'\!@!A_`H`4=50!D`4GY53PD*,1X&0$8`*AKO^QLZ&ND*,.X/\@ +MX`*A>T-4,1,35#\PX`@29HM#5`B`!GU`Y/]1KI"C#N#_$Q,35!\PX`-#5`+O +MQ%0/,.`#0U0$D`4GY53PD*,.X/_$$Q-4`S#@#I"C$N!D`F!JY/U_`H`BD`4G +MX$1`\)"C$N"T`AGQN!)FR+\!"9"C&>#_?0&``^3]_Q)0O8`]D*,:X)"C$O"` +M,W54`9`%)^54\)"C$N"T`@9]`7\$@`N0HQ+@M`@'?0%_#!)0O?%!D*,9X/]] +M`1)0O1)WF]#0DJ\BTQ"O`"0I@KP;W`"P;SO%&!"%&!L%'`"P6<4 +M<`+!DR0$8`+!O)"F"N"T!`31[\&\D*8*X+0"!-'^P;R0I@K@M`,$\0+!O)"F +M"N!D`6`"P;S1\<&\D*8*X+0$!/$CP;R0I@K@M`($\1/!O)"F"N"T`P3Q!L&\ +MD*8*X&`"P;S1Z,&\D*8*X+0$!/%*@'>0I@K@M`$%$D_J@&N0I@K@M`,$\3>` +M8)"F"N!P6A)/]8!5D*8*X+0$!/%=@$J0I@K@M`$$T=J`/Y"F"N"T`@42;^&` +M,Y"F"N!P+='8@"F0I@K@M`,$\7*`'I"F"N"T`031PX`3D*8*X+0"!/&'@`B0 +MI@K@<`+1P=#0DJ\BT>A]'W]O$E.ZD`4GX%2_\)"C$70$\"+1Z'TA?_\24[J0 +MHQ%T`_`BD*,1=`'P(O$CD`4GX%2_\.20HQ'P(O$3@._Q!H#KY/W_$E.ZD*,1 +M=`'P(A)N-N3]_Q)3NI"C$70!\"+D_?\24[J0!2?@1$#PD*,1=`'P(A)+29"C +M$70"\"+QG^]P`Q)7="*0!2?@1$#P?2,22T20HQ%T`O`B?2)__Q)3NI`%)^!$ +M0/"0HQ%T`_`B?25_;Q)3NI`%)^!4O_"0HQ%T!/`B$FXV?21_;Q)3NI`%)^!4 +MO_"0HQ%T!/`BD`0:X/1@`W\`(I`$&^!4!V0'?P%@`G\`(N3]_Q)3NGT$?P$2 +M4P"0!2?@1$#PD*,2=`3P(A(&B50!_Y"D4>!4_D_P,.`9D*&9X/^T`0>0HR%T +MW/`B[[0#!I"C(734\"*0I-L22)X2!HG_5'^0HQ?P[\03$Q-4`:/PD``!$@:B +M_U3PQ%0/_I"C%>!4\$[PD``#$@:B5`$EX/Z0HQ/@5/U.\.]4#\14\/^0HQ7@ +M5`]/\)```A(&HI"C%O"0``82!J(PX%[#$U0'_\.4!)"C*5`$[_"`+G0#\)"D +MVQ)(E>DD!OGD.OH2!HG_=`,D_?[OQ%0/_>]4#__M+E0/_L14\$\2!L^0I-L2 +M2)60``82!J+$5`__PY0$D*,?4`5T!/"``N_PD*3;$DB5D``$$@:B_7\"$E,` +MD*3;$DB5D``%$@:B_U0!_I"CN^!4_D[^\.]4`O_N5/U/__"0``42!J+^5`3] +M[U3[3?^0H[OP[E0(_N]4]T[_\)``!1(&HOY4$/WO5.]-_Y"CN_#N5"#^[U3? +M3O_PD``%$@:B5$#^[U2_3I"CN_#@_\03$U0#(.`I[\,3(.`+=5(!D*/\X&`+ +M@`[D]5*0H_S@8`7D]5&``W51`:U2KU$2:9N0I-L22)4QGY`!N70!\)`!N/"0 +MHQ?@D`&Z\)"C&>"0`;OPD*,5X%0/D`&^\"*0I-X22)XQSI"C%^#_$J)0D*,7 +MX&`8D*3>$DB5D``!$@:B5`__D``"$@:B_3'?(I"C$^!4^_#DD*,@\)"C&_`B +M[R3^8`L$<">0HQUT`O"`%NUP"I"CN>"0HQWP@`60HQWM\)"C'>"C\)"C%.!$ +M"/`BD``"$@:B_S#@)A(&B9"CMO"0``$2!J*0H[?P[U3^_Z/@5`%/\)```Q(& +MHI"CN?`BD*.V=`/PHW0%\*/@5`%$*/"C=`7P(A(&B9"CO/!@-*/@(.`OY/U_ +M!!)0O9"CN^#_PQ,PX![O$Q,35!\@X!60H[O@$Q-4/Y`'>##@!'0-\")T"?`B +MD*3;$DB>D*7GX'`3?X!^"!(WK9"C]!((;9"EYW0!\)"DVQ)(E1(&B?_DCU3U +M4_52]5&0H_022%'L5,'\P`3`!<`&P`>O5*Y3K5*L47@9$@A:T`/0`M`!T``2 +M2#.0H_`""&T2!HG_5`'^D*0)X%3^3O[P[U0&_^Y4^4__\!(&B?Y4"/WO5/=- +M_Y"D"?#N5!#^[U3O3O_P$@:)5"#^[U3?3I"D"?"0``$2!J+_5`/^D*0*X%3\ +M3O[P[U0$_^Y4^T__\)```1(&HOY4,/WO5,]-_Y"D"O#N5$#^[U2_3O"0``(2 +M!J*0I`OPD``#$@:BD*0,\)``!!(&HI"D#?"0I`O@_WX`?`%]0!('`^]X!<[# +M$\X3V/G_D*03[O"C[_"0I`S@_WX`?`%]0!('`^]X!<[#$\X3V/G_D*05[O"C +M[_"0I`W@_WX`?`%]0!('`Y"D%^[PH^_PD*0)X##@%Y"D#G0!\*/PH_#DH_"C +M\)`'@^!$(/`BY)"D#O"C\*/PH_"C\)`'@^!4W_`BD*3;$DB>D*3;$DB5$@:) +MD*09\)```1(&HI"D&O"0I-L22)5]`G\X`EC?$@:)5`$EX/^0H^+@5/U/\.## +M$_]4`9`!YO"CX%3^\.\PX$E_HQ)+(N]4^$0%_7^C$DO>?Z`22R+O5`]D!'`E +MD*0#X##@`H`DD/UBX+2M$Z/@M#4.D`'GX%3^\)`!Y73?\"*``)`!Y^!$`?`B +MD`'GX%3^\"(2!HE4`27@)>#_D*/BX%3[3_#@$Q-4/S#@")`'9>!$&/`BD*0# +MX"#@!Y`'9>!4Y_`BD`',X%0/D*7X\)"E^.#]<`+!-Y"A\.#_<`:CX&0)8`KO +M%/^0H?'@M0<$?P&``G\`[V`(D`'!X$0!\"*0I>C@_W0!?@"H!PB`!<,SSC/. +MV/G_[UUP`L$4Y)"E^?"0I?G@^<.4!%!SD*7HX'7P!*3_Z?U\`"__[#7P_G30 +M+_6"=`$^]8/@_Y"A\>!U\`B0H:`22(GE@BGU@N0U@_6#[_"0I>C@=?`$I"W_ +M[#7P_G3P+_6"=`$^]8/@_Y"A\>!U\`B0H:022(GE@BGU@N0U@_6#[_"0I?G@ +M!/"`@Y"E^.#_D*7HX/YT`:@&"(`"PS/8_/1?D*7X\)"EZ.#_=`&H!PB``L,S +MV/R0``$\.!_`+0*`G\![W`"@?+DD*'Q\('RD`'` +MX$0"\)"EZ.!$@)``BO"0I>C@=?`$D`'0$DB)X)`!P_`BTQ"O``Q7\!T-"2KR+3$*\!P\#0D*7.$DB>?Y9^ +M`M$X[V!8D`$7X/Z0`1;@?``D`/_L/O[O)`'_Y#[^D*71[_#N_Y#]$?"0I='@ +M_9`"E/"C[_"0I`D&/^0I#^!/"0``'N$@;A=``O^>0T^_I[`<`# +MP`+``9"ERQ)(E8M`BD&)0G5#`M`!T`+0`Q(UA9"ERN`D`OGD-/OZ>P'``\`" +MP`&C$DB5Z20"^>0ZBT#U08E"D*7+$DB5D``.$@:B]4/0`=`"T`,"-860I>H2 +M2)[D_Y"EZA)(E8^"=8,`$@:B_G3P+_6"Y#0"]8/N\`_OM!#@(I``\>!4\,14 +M#_\B=142Y/46=1<'=1ARD`$PY17PH^46\*/E%_"CY1CP(G4=#G4>`4,>"'4? +M`W4@8D,@@$,?!)`!..4=\*/E'O"CY1_PH^4@\"*0`93@1`'PD`''Y/`BD`$! +MX$0$\)`!FN!4P/!_"GX`$CZ'D`&9X$3`\)`!FW2`\"*0`9K@5,!$"_!_"GX` +M$CZ'D`&8X%3`?P"T0`)_`2+DD*34\*/P$8#O9`%@1<.0I-7@E(B0I-3@E!-` +M#Y`!P>!$$/"0`<=T_?"`)Y"DU.1U\`$2"-9_%'X`$CZ'TY"DU>"4,I"DU."4 +M`$"[D`'&X##CM)`!QW3^\")]`I`!Q'3X\'2PH_"0I!O@_^W#GU`8[27@)('X +MYC#D"Y`!N'0(\*/P?P`B#8#>?P$BY)"AE/"C\*/PH_"C\"*0`>1T$_"CY/`B +MD`$TX%45]1FCX%46]1JCX%47]1NCX%48]1R0`33E&?"CY1KPH^4;\*/E'/"0 +M`23@527U)O`BD`$\X%4=]2&CX%4>]2*CX%4?]2.CX%4@]220`3SE(?"CY2+P +MH^4C\*/E)/!3D=\BD`'/X)"D]?#@_S#@!Y`!S^!4_O#O,.4CD`'/X%3?\)`! +M-'0@\.3UJ/7H$D\=D``#X%3[_7\#$DO>@/XBD**-X&0!<""0HQ?@8!J0`5?D +M\)`!/'0"\.20I:7PD*.WX)"EIA):MR*0HHW@9`%P)I"C%^!@()`!5^3PD`$\ +M=`+PD*,3X%3[\)"C&^!4_?!4!W`#$E"D(I"BC>"T`120HQ?@8`Z0HQO@5/[P +M5`=P`Q)0I")QZ9"E!>_P,.`%?0'D@`+D_?\24P"0I07@,.81D`$OX##G!.3P +M@`:0`2]T@/"0HRC@_Z/@_9"C+>#[K`>0HQ/@,.`RD*,IX-.4`U`'D*,?Z_"` +M"NTD_2N0HQ_P?0.0HT[@)`3#G2S_D*,L\)"C(N3PH^_P@`Z0HR+D\*-T`O"0 +MHQ_K\)"C(J/@D`58\"+DD*3U\/VC\)`%8N#^D`5AX/OK>`+.PQ/.$]CY_Y"C +M2N[PH^_PH^#^H^#_D*-*X/JCX/O#G^J>0"CKG_^0HRS@_L-T"IXO_<.4&5`3 +M="\M]8+D-*/U@^`$\)"C*N`$\'&WD*,JX,.49$!HY)"D]O"0I/7PD*3UX/_# +ME!E01W0O+_6"Y#2C]8/@_Y"D]N`O\.#3E`5`)Y"D]>#_E`I`"N\D]I"C*?#D +M@`[DD*,I\)"D]>#_PW0*GY"C*/"`")"D]>`$\("OD*,IX/U[".3_49$2=WHB +MD*.VX/^0HR#@TY]`))"C+N`$\.#_E`10&)"C*._P)>`D")"C+?#[D*,HX/^C +MX/U1D2+DD*4&\*/PH_!_@Q)+(I"E!N_P?X,22R*N!Y"E!N#_M08!(L.0I0C@ +ME&20I0?@E`!`#9`!P.!$0/"0I0;@_R*0I0?D=?`!$@C6@+Z0HP[@_S#@/I"C +M$N!^`+0"`GX!D*,1X'T`M`0"?0'M3G`D[\,3,.`#`F;4D7N0HQ+@M`@&Y/U_ +M#(`)D*,2X'`&_7\$$E"](I"C#N#_Q!,35`,PX`^0HQ+@9`)@!WT!?P(24+V0 +MHQ+@9`)@`Q)G7"*0HP[@_S#@/Y"C$N!^`+0"`GX!D*,1X'T`M`0"?0'M3G`E +M[\,3,.`#`F;4D>N0HQ+@M`P&Y/U_"(`*D*,2X+0$!N3]_Q)0O2*0`5?@8$CD +M\)`!/'0"\)"C$^#_$Q-4/S#@#.]4^_"0HQO@5/WP(I"C(.`$\)"C&^!4[_"0 +MH[;@_Y"C(.#3GT`.D**-X+0!!Y"C%.!4^_`BD*,3X/_$$Q-4`S#@.N]4O_"0 +M!.#@D*,4,.`&X$0!\(`0X%3^\)`!N70!\)`!N'0$\)"CP^#_Q!-4!S#@!WT! +M?PP"4+T24*0BD*,3X/_$$Q,35`$PX"SO5'_PD`3@X)"C%##A!N!$`O"`#^!4 +M_?"0`;ET`?"0`;@$\)"C%^!@`Q)0I)"CP>#_Q!,35`,PX"*0H\3@_\,3,.`8 +M[U3]\)`$X."0H\0PX0;@1`3P@`3@5/OPD`3@X##A`K'U(I"D'.`PX#7#$U0' +M_W7P#I"D)Q)(B>#^,.`B=?`.[Y"D)Q)(B>Y4_O"0I!YT!?"0I!S@PQ-4!_U_ +M`1)<<2+3$*\!P\#0D`0=X&`:D`4BX%208`>0`<#@1`CPD`'&X##AY'\`@`)_ +M`=#0DJ\BD`'$=&#P=+:C\'^0$DLB[R#@]W1@!)`!Q/!TMJ/P(N20I?/PH_"0 +M!2+@D*7U\)`$+>!4`?"0!!W@8#S#D*7TX)30D*7SX)0'4"V0I$G@M/\-?1A_ +M_Q)3NN20I%#P(I`%(G3_\'\!?@`2/H>0I?/D=?`!$@C6@+Z0I$G@_WL8?0$2 +ME8AT%"_U@N0T_/6#X,035`/_D*1-X%3\3_"0I?7@5&__?1D24[J0!!]T(/"0 +MI$[D=?`!$@C6D*10=`'P(A(&B9"DV_#T8!S@D*1)\)```A(&HG7P"J3_D*1* +MY?#PH^_P`E^,D*3;X)"D2?#DH_"C\)`!7_`BD*,1X&0"?P%@`G\`(I"C$^`P +MX!B0HP[@_S#@#L,3,.`'\5:_`0:``H``\8,BD*,:X/]@`[0(#A*Z!+\!"/&< +MD`'EX`3P(M,0KP'#P-`23)\23[/0T)*O(JX'$F;(OP$6D*,.X,03$U0#(.`* +MKP9]`1)0O7\!(G\`(I`&J>"0I/7PX/U4P'`)D*,;X%3^\(!_[3#F3I"C%^!D +M`G`KD*,3X/_#$R#@"9"C&^!$`?"`*9"C%>!4#V0!<#"0HQO@1`3P?P$2EKJ` +M(I"C&^!$`?"0HQ7@5`]D`F`%$I>>@`P25U>`!Y"C&^!4_O"0I/7@D*,;,.<; +MX$0"\.20I:7PD*.WX)"EIA):MY"C$^!$!/`BX%3]\"*0I:_@_J/@_Y"!`.!4 +M#_VL!W0-+/6"Y#3\]8/@1`'P=`TL]8+D-/SU@^!4^_"L!W02+/6"Y#3\]8/@ +M1/KP=!$L]8+D-/SU@^!$'_"L!W0&+/6"Y#3\]8/@1`[PD`2GY/"0!*;PD`2E +M=/_PD`2D=/WP=!0L]8+D-/SU@^!4P$W]=!0O]8+D-/SU@^WP(I"C$^`3$Q-4 +M'S#@!9`!6^3PD`:2=`+PD`$\=`3PY)"EI?"0H[C@PQ-4?Y"EIO#D^_U_6'X! +M$EJ_D*,3X$0(\"*0H[W@,.`CD*//X&`(D`&X=$#P(?N0HQG@TY0`0`*`-9"C +MO.!P`B'S@&<2IY_O9`%@")`!N'0!\"'[D*,;X/]4`V`(D`&X=`+P@'N0HQG@ +M_N3#GE`(D`&X=`3P@&GO,.((D`&X=`CP@%V0HQO@,.0(D`&X=!#P@$Z0HQ3@ +M$Q-4/R#@")`!N'0@\(`[D*.\X&`(D`&X=(#P@"V0!F+@,.$(D`&X=!'P@!Z0 +M!F+@,.`/X%3\_[^`")`!N'02\(`(D`&XY/!_`2*0`;ET!/!_`"*0`H?@8`B0 +M`;AT`?"`)9`"EN!@")`!N'00\(`7D`*&X"#A")`!N'0$\(`(D`&XY/!_`2*0 +M`;ET"/!_`")]+1)7[I`!-W0"\/U_`Q)FE!)+2>3]?P$24P#DD*,2\")]+G]O +M$E.Z?0)_`1)3`)`%)^!4O_"0HQ)T`O`BY/5DD`:IX/5D5,!P#9"C&^!4_O!4 +M_?`"4*3E9##F(Y"C%^!D`7`BD*,;X$0!\)"C%>!4#V0"8`42EYZ`#!)75X`' +MD*,;X%3^\.5DD*,;,.<;X$0"\.20I:7PD*.WX)"EIA):MY"C$^!$!/`BX%3] +M\"+D]620HQ?@<`)AMI"BC>!D`6`"8;:0HQ/@,.`=D`5BX/Z0!6'@_>UX`L[# +M$\X3V/G_D*-,[O"C[_"0HQ7@_\14#V`B)/Y@`P1P'I"C'N`4\.#_8`:0HR#@ +M8`[O<`B0HQW@H_"``'5D`9"C#N`PX!*0HQ+@M`(#Y/5D$F;([W`"]63E9&!# +MD*,;X$00\)"C(.!@`[0!"^20I:7PD*,@X(`/Y)"EI?"0HR#@=?`#I"3^_Y"C +M'^`OD*6F$EJWD*,:X"#B`Q)0N1*7R"*0HQ/@_Q,35#\PX!'O5/OPD*,;X%3] +M\%0'<"Z`*9"C(.`$\)"C&^!4[_"0H[;@_Y"C(.#3GT`/D**-X+0!"Y"C%.!4 +M^_`B$E"D(GTO$DM$?0A_`1)3`)"C$G0(\"(2;C;D_?\24[H24OR0HQ)T#/`B +#`*FO +` +end Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Tue Jan 24 02:09:30 2017 (r312679) +++ head/sys/dev/rtwn/if_rtwn.c Tue Jan 24 02:35:38 2017 (r312680) @@ -121,9 +121,6 @@ static int rtwn_run(struct rtwn_softc * static void rtwn_watchdog(void *); #endif static void rtwn_parent(struct ieee80211com *); -static int rtwn_llt_write(struct rtwn_softc *, uint32_t, - uint32_t); -static int rtwn_llt_init(struct rtwn_softc *); static int rtwn_dma_init(struct rtwn_softc *); static int rtwn_mac_init(struct rtwn_softc *); static void rtwn_mrr_init(struct rtwn_softc *); @@ -1383,54 +1380,6 @@ rtwn_parent(struct ieee80211com *ic) rtwn_stop(sc); } - -static int -rtwn_llt_write(struct rtwn_softc *sc, uint32_t addr, uint32_t data) -{ - int ntries, error; - - error = rtwn_write_4(sc, R92C_LLT_INIT, - SM(R92C_LLT_INIT_OP, R92C_LLT_INIT_OP_WRITE) | - SM(R92C_LLT_INIT_ADDR, addr) | - SM(R92C_LLT_INIT_DATA, data)); - if (error != 0) - return (error); - /* Wait for write operation to complete. */ - for (ntries = 0; ntries < 20; ntries++) { - if (MS(rtwn_read_4(sc, R92C_LLT_INIT), R92C_LLT_INIT_OP) == - R92C_LLT_INIT_OP_NO_ACTIVE) - return (0); - rtwn_delay(sc, 10); - } - return (ETIMEDOUT); -} - -static int -rtwn_llt_init(struct rtwn_softc *sc) -{ - int i, error; - - /* Reserve pages [0; page_count]. */ - for (i = 0; i < sc->page_count; i++) { - if ((error = rtwn_llt_write(sc, i, i + 1)) != 0) - return (error); - } - /* NB: 0xff indicates end-of-list. */ - if ((error = rtwn_llt_write(sc, i, 0xff)) != 0) - return (error); - /* - * Use pages [page_count + 1; pktbuf_count - 1] - * as ring buffer. - */ - for (++i; i < sc->pktbuf_count - 1; i++) { - if ((error = rtwn_llt_write(sc, i, i + 1)) != 0) - return (error); - } - /* Make the last page point to the beginning of the ring buffer. */ - error = rtwn_llt_write(sc, i, sc->page_count + 1); - return (error); -} - static int rtwn_dma_init(struct rtwn_softc *sc) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jan 24 03: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 310A4CBE6B4; Tue, 24 Jan 2017 03:00:24 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04F4CAB8; Tue, 24 Jan 2017 03:00:23 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O30NVs068031; Tue, 24 Jan 2017 03:00:23 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O30MMN068028; Tue, 24 Jan 2017 03:00:22 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201701240300.v0O30MMN068028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 24 Jan 2017 03:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312681 - in head: etc/devd sys/dev/rtwn/usb sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 03:00:24 -0000 Author: kevlo Date: Tue Jan 24 03:00:22 2017 New Revision: 312681 URL: https://svnweb.freebsd.org/changeset/base/312681 Log: Sort REALTEK section and remove duplicate entry for RTL8192CU. Modified: head/etc/devd/usb.conf head/sys/dev/rtwn/usb/rtwn_usb_attach.h head/sys/dev/usb/usbdevs Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Tue Jan 24 02:35:38 2017 (r312680) +++ head/etc/devd/usb.conf Tue Jan 24 03:00:22 2017 (r312681) @@ -2737,7 +2737,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0bda"; - match "product" "(0x8176|0x8177|0x8178|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)"; + match "product" "(0x8176|0x8177|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)"; action "kldload -n if_rtwn_usb"; }; Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Tue Jan 24 02:35:38 2017 (r312680) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Tue Jan 24 03:00:22 2017 (r312681) @@ -94,7 +94,6 @@ static const STRUCT_USB_HOST_ID rtwn_dev RTWN_RTL8192CU_DEV(REALTEK, RTL8191CU), RTWN_RTL8192CU_DEV(REALTEK, RTL8192CE), RTWN_RTL8192CU_DEV(REALTEK, RTL8192CU), - RTWN_RTL8192CU_DEV(REALTEK, RTL8192CU_1), RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_1), RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_2), RTWN_RTL8192CU_DEV(SITECOMEU, RTL8192CU), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Jan 24 02:35:38 2017 (r312680) +++ head/sys/dev/usb/usbdevs Tue Jan 24 03:00:22 2017 (r312681) @@ -3825,27 +3825,26 @@ product REALTEK RTL8172 0x8172 RTL8172 product REALTEK RTL8173 0x8173 RTL8173 product REALTEK RTL8174 0x8174 RTL8174 product REALTEK RTL8188CU_0 0x8176 RTL8188CU -product REALTEK RTL8192CU_1 0x8178 RTL8192CU +product REALTEK RTL8191CU 0x8177 RTL8191CU +product REALTEK RTL8192CU 0x8178 RTL8192CU product REALTEK RTL8188EU 0x8179 RTL8188EU -product REALTEK RTL8188CE_1 0x817e RTL8188CE product REALTEK RTL8188CU_1 0x817a RTL8188CU product REALTEK RTL8188CU_2 0x817b RTL8188CU +product REALTEK RTL8192CE 0x817c RTL8192CE +product REALTEK RTL8188RU_1 0x817d RTL8188RU +product REALTEK RTL8188CE_1 0x817e RTL8188CE +product REALTEK RTL8188RU_3 0x817f RTL8188RU product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter +product REALTEK RTL8188CUS 0x818a RTL8188CUS product REALTEK RTL8192EU 0x818b RTL8192EU product REALTEK RTL8188CU_3 0x8191 RTL8188CU product REALTEK RTL8196EU 0x8196 RTL8196EU product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter -product REALTEK RTL8188CUS 0x818a RTL8188CUS -product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU -product REALTEK RTL8191CU 0x8177 RTL8191CU -product REALTEK RTL8192CU 0x8178 RTL8192CU -product REALTEK RTL8192CE 0x817c RTL8192CE -product REALTEK RTL8188RU_1 0x817d RTL8188RU -product REALTEK RTL8188RU_3 0x817f RTL8188RU product REALTEK RTL8712 0x8712 RTL8712 -product REALTEK RTL8713 0x8712 RTL8713 +product REALTEK RTL8713 0x8713 RTL8713 +product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU product REALTEK RTL8723BU 0xb720 RTL8723BU product REALTEK RTL8192SU 0xc512 RTL8192SU From owner-svn-src-all@freebsd.org Tue Jan 24 07:48: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 F1C2ECBF017; Tue, 24 Jan 2017 07:48:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B918F798; Tue, 24 Jan 2017 07:48:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O7makI084871; Tue, 24 Jan 2017 07:48:36 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O7man7084870; Tue, 24 Jan 2017 07:48:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201701240748.v0O7man7084870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 24 Jan 2017 07:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312683 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 07:48:38 -0000 Author: delphij Date: Tue Jan 24 07:48:36 2017 New Revision: 312683 URL: https://svnweb.freebsd.org/changeset/base/312683 Log: Don't reference NULL pointer. MFC after: 2 weeks Modified: head/usr.bin/mail/popen.c Modified: head/usr.bin/mail/popen.c ============================================================================== --- head/usr.bin/mail/popen.c Tue Jan 24 05:06:52 2017 (r312682) +++ head/usr.bin/mail/popen.c Tue Jan 24 07:48:36 2017 (r312683) @@ -303,7 +303,7 @@ findchild(pid_t pid, int dont_alloc) cpp = &(*cpp)->link) ; if (*cpp == NULL) { - if (dont_alloc) + if (dont_alloc) return(NULL); if (child_freelist) { *cpp = child_freelist; @@ -344,6 +344,8 @@ sigchild(int signo __unused) save_errno = errno; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { cp = findchild(pid, 1); + if (cp == NULL) + continue; if (cp->free) delchild(cp); else { From owner-svn-src-all@freebsd.org Tue Jan 24 08:56: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 8AFBDCBEA60; Tue, 24 Jan 2017 08:56:55 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B752FB5; Tue, 24 Jan 2017 08:56:55 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O8usZM012969; Tue, 24 Jan 2017 08:56:54 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O8usE3012968; Tue, 24 Jan 2017 08:56:54 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201701240856.v0O8usE3012968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Tue, 24 Jan 2017 08:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312684 - head/usr.sbin/wpa/wpa_cli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 08:56:55 -0000 Author: sevan (doc committer) Date: Tue Jan 24 08:56:54 2017 New Revision: 312684 URL: https://svnweb.freebsd.org/changeset/base/312684 Log: Extend manual to cover more commands and options. PR: 203406 Submitted by: Fehmi Noyan Isi (fnoyanisi AT yahoo DOT com) Approved by: wblock (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D8691 Modified: head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Modified: head/usr.sbin/wpa/wpa_cli/wpa_cli.8 ============================================================================== --- head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Tue Jan 24 07:48:36 2017 (r312683) +++ head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Tue Jan 24 08:56:54 2017 (r312684) @@ -24,15 +24,22 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2005 +.Dd January 24, 2017 .Dt WPA_CLI 8 .Os .Sh NAME .Nm wpa_cli .Nd "text-based frontend program for interacting with wpa_supplicant" .Sh SYNOPSIS -.Nm -.Op Ar commands +.Nm wpa_cli +.Op Fl p Ar path_to_ctrl_sockets +.Op Fl i Ar ifname +.Op Fl hvB +.Op Fl a Ar action_file +.Op Fl P Ar pid_file +.Op Fl g Ar global_ctrl +.Op Fl G Ar ping_interval +.Ar command ... .Sh DESCRIPTION The .Nm @@ -144,26 +151,75 @@ Example request for generic token card c CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar > otp 2 9876 .Ed +.Sh OPTIONS +These options are available: +.Bl -tag -width indent +.It Fl p Ar path +Control sockets path. +This should match the +.Ic ctrl_interface +in +.Xr wpa_supplicant.conf 5 . +The default path is +.Pa /var/run/wpa_supplicant . +.It Fl i Ar ifname +Interface to be configured. +By default, the first interface found in the socket path is used. +.It Fl h +Show help. +.It Fl v +Show version information. +.It Fl B +Run the daemon in the background. +.It Fl a Ar action_file +Run in daemon mode, executing the action file based on events from +.Xr wpa_supplicant 8 . +.It Fl P Ar pid_file +PID file location. +.It Fl g Ar global_ctrl +Use a global control interface to +.Xr wpa_supplicant 8 +rather than the default Unix domain sockets. +.It Fl G Ar ping_interval +Wait +.Dq ping_interval +seconds before sending each ping to +.Xr wpa_supplicant 8 . +See the +.Ic ping +command. +.It command +See available commands in the next section. +.El .Sh COMMANDS -The following commands may be supplied on the command line +These commands can be supplied on the command line or at a prompt when operating interactively. .Bl -tag -width indent .It Ic status Report the current WPA/EAPOL/EAP status for the current interface. +.It Ic ifname +Show the current interface name. +The default interface is the first interface found in the socket path. +.It Ic ping +Ping the +.Xr wpa_supplicant 8 +utility. +This command can be used to test the status of the +.Xr wpa_supplicant 8 +daemon. .It Ic mib Report MIB variables (dot1x, dot11) for the current interface. .It Ic help Show usage help. .It Ic interface Op Ar ifname Show available interfaces and/or set the current interface -when multiple are available. +when multiple interfaces are available. .It Ic level Ar debug_level Change the debugging level in .Xr wpa_supplicant 8 . Larger numbers generate more messages. .It Ic license -Display the full -license for +Display the full license for .Nm . .It Ic logoff Send the IEEE 802.1X EAPOL state machine into the @@ -192,12 +248,68 @@ Force preauthentication of the specified Configure an identity for an SSID. .It Ic password Ar network_id password Configure a password for an SSID. +.It Ic new_password Ar network_id password +Change the password for an SSID. +.It Ic PIN Ar network_id pin +Configure a PIN for an SSID. +.It Ic passphrase Ar network_id passphrase +Configure a private key passphrase for an SSID. +.It Ic bssid Ar network_id bssid +Set a preferred BSSID for an SSID +.It Ic blacklist Op Ar bssid | clear +Add a BSSID to the blacklist. +When invoked without any extra arguments, display the blacklist. +Specifying +.Ar clear +causes +.Nm +to clear the blacklist. +.It Ic list_networks +List configured networks. +.It Ic select_network Ar network_id +Select a network and disable others. +.It Ic enable_network Ar network_id +Enable a network. +.It Ic disable_network Ar network_id +Disable a network. +.It Ic add_network +Add a network. +.It Ic remove_network Ar network_id +Remove a network. +.It Ic set_network Op Ar network_id variable value +Set network variables. +Shows a list of variables when run without arguments. +.It Ic get_network Ar network_id variable +Get network variables. +.It Ic disconnect +Disconnect and wait for reassociate/reconnect command before connecting. +.It Ic reconnect +Similar to +.Ic reassociate , +but only takes effect if already disconnected. +.It Ic scan +Request new BSS scan. +.It Ic scan_results +Get the latest BSS scan results. +This command can be invoked after running a BSS scan with +.Ic scan . +.It Ic bss Op Ar idx | bssid +Get a detailed BSS scan result for the network identified by +.Dq bssid +or +.Dq idx . .It Ic otp Ar network_id password Configure a one-time password for an SSID. .It Ic terminate Force .Xr wpa_supplicant 8 to terminate. +.It Ic interface_add Ar ifname Op Ar confname driver ctrl_interface driver_param bridge_name +Add a new interface with the given parameters. +.It Ic interface_remove Ar ifname +Remove the interface. +.It Ic interface_list +List available interfaces. .It Ic quit Exit .Nm . @@ -217,6 +329,8 @@ utility was written by .An Jouni Malinen Aq Mt j@w1.fi . This manual page is derived from the .Pa README -file included in the +and +.Pa wpa_cli.c +files included in the .Nm wpa_supplicant distribution. From owner-svn-src-all@freebsd.org Tue Jan 24 09:09: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 CDF8ECBEFC8; Tue, 24 Jan 2017 09:09:54 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D90C176B; Tue, 24 Jan 2017 09:09:54 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O99rBv017072; Tue, 24 Jan 2017 09:09:53 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O99rB6017070; Tue, 24 Jan 2017 09:09:53 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240909.v0O99rB6017070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312685 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:09:54 -0000 Author: dexuan Date: Tue Jan 24 09:09:53 2017 New Revision: 312685 URL: https://svnweb.freebsd.org/changeset/base/312685 Log: hyperv/hn: remember the channel pointer in struct hn_rx_ring This will be used by the coming NIC SR-IOV patch. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8909 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 Tue Jan 24 08:56:54 2017 (r312684) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:09:53 2017 (r312685) @@ -4323,6 +4323,7 @@ hn_chan_attach(struct hn_softc *sc, stru KASSERT((rxr->hn_rx_flags & HN_RX_FLAG_ATTACHED) == 0, ("RX ring %d already attached", idx)); rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; + rxr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to chan%u\n", Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 08:56:54 2017 (r312684) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 09:09:53 2017 (r312685) @@ -85,6 +85,8 @@ struct hn_rx_ring { void *hn_br; /* TX/RX bufring */ struct hyperv_dma hn_br_dma; + + struct vmbus_channel *hn_chan; } __aligned(CACHE_LINE_SIZE); #define HN_TRUST_HCSUM_IP 0x0001 From owner-svn-src-all@freebsd.org Tue Jan 24 09:15: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 3D16BCBD229; Tue, 24 Jan 2017 09:15:38 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CA231C68; Tue, 24 Jan 2017 09:15:37 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O9FbPB020816; Tue, 24 Jan 2017 09:15:37 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9FbDl020815; Tue, 24 Jan 2017 09:15:37 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240915.v0O9FbDl020815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312686 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:15:38 -0000 Author: dexuan Date: Tue Jan 24 09:15:36 2017 New Revision: 312686 URL: https://svnweb.freebsd.org/changeset/base/312686 Log: hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt() It's unnecessary because the upper nework stack does the same checking. In the case of Hyper-V SR-IOV, we need to remove the checking because 1) multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface; 2) we must inject the packets even if the synthetic NIC is down, or has a different MTU from the VF device. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8962 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 Tue Jan 24 09:09:53 2017 (r312685) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:15:36 2017 (r312686) @@ -2129,15 +2129,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const v int size, do_lro = 0, do_csum = 1; int hash_type; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - return (0); - - /* - * Bail out if packet contains more data than configured MTU. - */ - if (dlen > (ifp->if_mtu + ETHER_HDR_LEN)) { - return (0); - } else if (dlen <= MHLEN) { + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); From owner-svn-src-all@freebsd.org Tue Jan 24 09:19: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 7AB91CBD3C1; Tue, 24 Jan 2017 09:19:48 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31FA331B; Tue, 24 Jan 2017 09:19:48 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O9JltZ021009; Tue, 24 Jan 2017 09:19:47 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9JlM7021007; Tue, 24 Jan 2017 09:19:47 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240919.v0O9JlM7021007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312687 - in head/sys: net sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:19:48 -0000 Author: dexuan Date: Tue Jan 24 09:19:46 2017 New Revision: 312687 URL: https://svnweb.freebsd.org/changeset/base/312687 Log: ifnet: introduce event handlers for ifup/ifdown events Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together, mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). So the synthetic NIC driver needs to know when a VF device is becoming UP or DOWN and hence the patch is made. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8963 Modified: head/sys/net/if.c head/sys/sys/eventhandler.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jan 24 09:15:36 2017 (r312686) +++ head/sys/net/if.c Tue Jan 24 09:19:46 2017 (r312687) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -2218,6 +2219,7 @@ void if_down(struct ifnet *ifp) { + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_DOWN); if_unroute(ifp, IFF_UP, AF_UNSPEC); } @@ -2230,6 +2232,7 @@ if_up(struct ifnet *ifp) { if_route(ifp, IFF_UP, AF_UNSPEC); + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_UP); } /* Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017 (r312686) +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017 (r312687) @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); +/* ifup/ifdown events */ +#define IFNET_EVENT_UP 0 +#define IFNET_EVENT_DOWN 1 +struct ifnet; +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ From owner-svn-src-all@freebsd.org Tue Jan 24 09:24: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 7AD51CBD784; Tue, 24 Jan 2017 09:24:16 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55725B8D; Tue, 24 Jan 2017 09:24:16 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O9OFpA025017; Tue, 24 Jan 2017 09:24:15 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9OFEM025012; Tue, 24 Jan 2017 09:24:15 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240924.v0O9OFEM025012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312688 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:24:16 -0000 Author: dexuan Date: Tue Jan 24 09:24:14 2017 New Revision: 312688 URL: https://svnweb.freebsd.org/changeset/base/312688 Log: hyperv/hn: add the support for VF drivers (SR-IOV) Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together (both NICs have the same MAC address), mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). Note: multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface (if the VF is UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP). Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8964 Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/hn_nvs.h head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jan 24 09:24:14 2017 (r312688) @@ -500,6 +500,8 @@ hn_nvs_conf_ndis(struct hn_softc *sc, in conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; conf.nvs_mtu = mtu; conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); @@ -719,3 +721,15 @@ hn_nvs_send_rndis_ctrl(struct vmbus_chan return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, gpa, gpa_cnt); } + +void +hn_nvs_set_datapath(struct hn_softc *sc, uint32_t path) +{ + struct hn_nvs_datapath dp; + + memset(&dp, 0, sizeof(dp)); + dp.nvs_type = HN_NVS_TYPE_SET_DATAPATH; + dp.nvs_active_path = path; + + hn_nvs_req_send(sc, &dp, sizeof(dp)); +} Modified: head/sys/dev/hyperv/netvsc/hn_nvs.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.h Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Tue Jan 24 09:24:14 2017 (r312688) @@ -100,6 +100,7 @@ void hn_nvs_sent_xact(struct hn_nvs_sen int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); +void hn_nvs_set_datapath(struct hn_softc *sc, uint32_t path); extern struct hn_nvs_sendctx hn_nvs_sendctx_none; Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:24:14 2017 (r312688) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -84,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -216,6 +218,11 @@ struct hn_rxinfo { uint32_t hash_value; }; +struct hn_update_vf { + struct hn_rx_ring *rxr; + struct ifnet *vf; +}; + #define HN_RXINFO_VLAN 0x0001 #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 @@ -295,7 +302,7 @@ static int hn_txagg_pktmax_sysctl(SYSC static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); -static void hn_stop(struct hn_softc *); +static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); @@ -707,7 +714,8 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if (ifp->if_flags & IFF_PROMISC) { + if ((ifp->if_flags & IFF_PROMISC) || + (sc->hn_flags & HN_FLAG_VF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -896,6 +904,119 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmr->ifm_active |= IFM_10G_T | IFM_FDX; } +static void +hn_update_vf_task(void *arg, int pending __unused) +{ + struct hn_update_vf *uv = arg; + + uv->rxr->hn_vf = uv->vf; +} + +static void +hn_update_vf(struct hn_softc *sc, struct ifnet *vf) +{ + struct hn_rx_ring *rxr; + struct hn_update_vf uv; + struct task task; + int i; + + HN_LOCK_ASSERT(sc); + + TASK_INIT(&task, 0, hn_update_vf_task, &uv); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { + rxr = &sc->hn_rx_ring[i]; + + if (i < sc->hn_rx_ring_inuse) { + uv.rxr = rxr; + uv.vf = vf; + vmbus_chan_run_task(rxr->hn_chan, &task); + } else { + rxr->hn_vf = vf; + } + } +} + +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; + + hn_ifp = sc->hn_ifp; + + if (ifp == hn_ifp) + goto out; + + if (ifp->if_alloctype != IFT_ETHER) + goto out; + + /* Ignore lagg/vlan interfaces */ + if (strcmp(ifp->if_dname, "lagg") == 0 || + strcmp(ifp->if_dname, "vlan") == 0) + goto out; + + if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0) + goto out; + + /* Now we're sure 'ifp' is a real VF device. */ + if (vf) { + if (sc->hn_flags & HN_FLAG_VF) + goto out; + + sc->hn_flags |= HN_FLAG_VF; + hn_rxfilter_config(sc); + } else { + if (!(sc->hn_flags & HN_FLAG_VF)) + goto out; + + sc->hn_flags &= ~HN_FLAG_VF; + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_rxfilter_config(sc); + else + hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); + } + + hn_nvs_set_datapath(sc, + vf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + + hn_update_vf(sc, vf ? ifp : NULL); + + if (vf) { + 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); + } else { + hn_resume_mgmt(sc); + } + + if (bootverbose) + if_printf(hn_ifp, "Data path is switched %s %s\n", + vf ? "to" : "from", if_name(ifp)); +out: + HN_UNLOCK(sc); +} + +static void +hn_ifnet_event(void *arg, struct ifnet *ifp, int event) +{ + if (event != IFNET_EVENT_UP && event != IFNET_EVENT_DOWN) + return; + + hn_set_vf(arg, ifp, event == IFNET_EVENT_UP); +} + +static void +hn_ifaddr_event(void *arg, struct ifnet *ifp) +{ + hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); +} + /* {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, @@ -1221,6 +1342,12 @@ hn_attach(device_t dev) sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; hn_update_link_status(sc); + 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); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -1235,6 +1362,11 @@ hn_detach(device_t dev) struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_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_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { /* * In case that the vmbus missed the orphan handler @@ -1247,7 +1379,7 @@ hn_detach(device_t dev) HN_LOCK(sc); if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_stop(sc); + hn_stop(sc, true); /* * NOTE: * hn_stop() only suspends data, so managment @@ -2124,11 +2256,14 @@ static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_rxinfo *info) { - struct ifnet *ifp = rxr->hn_ifp; + struct ifnet *ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; int hash_type; + /* If the VF is active, inject the packet through the VF */ + ifp = rxr->hn_vf ? rxr->hn_vf : rxr->hn_ifp; + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { @@ -2439,7 +2574,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_stop(sc); + hn_stop(sc, false); } sc->hn_if_flags = ifp->if_flags; @@ -2529,7 +2664,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } static void -hn_stop(struct hn_softc *sc) +hn_stop(struct hn_softc *sc, bool detaching) { struct ifnet *ifp = sc->hn_ifp; int i; @@ -2550,6 +2685,13 @@ hn_stop(struct hn_softc *sc) atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) sc->hn_tx_ring[i].hn_oactive = 0; + + /* + * If the VF is active, make sure the filter is not 0, even if + * the synthetic NIC is down. + */ + if (!detaching && (sc->hn_flags & HN_FLAG_VF)) + hn_rxfilter_config(sc); } static void @@ -4894,7 +5036,8 @@ hn_suspend(struct hn_softc *sc) /* Disable polling. */ hn_polling(sc, 0); - if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || + (sc->hn_flags & HN_FLAG_VF)) hn_suspend_data(sc); hn_suspend_mgmt(sc); } @@ -4983,9 +5126,18 @@ static void hn_resume(struct hn_softc *sc) { - if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || + (sc->hn_flags & HN_FLAG_VF)) hn_resume_data(sc); - hn_resume_mgmt(sc); + + /* + * When the VF is activated, the synthetic interface is changed + * to DOWN in hn_set_vf(). Here, if the VF is still active, we + * don't call hn_resume_mgmt() until the VF is deactivated in + * hn_set_vf(). + */ + if (!(sc->hn_flags & HN_FLAG_VF)) + hn_resume_mgmt(sc); /* * Re-enable polling if this interface is running and Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Tue Jan 24 09:24:14 2017 (r312688) @@ -133,6 +133,17 @@ struct hn_nvs_ndis_init { } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); +#define HN_NVS_DATAPATH_SYNTHETIC 0 +#define HN_NVS_DATAPATH_VF 1 + +/* No response */ +struct hn_nvs_datapath { + uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ + uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ + uint32_t nvs_rsvd[6]; +} __packed; +CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); + struct hn_nvs_rxbuf_conn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_CONN */ uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 09:24:14 2017 (r312688) @@ -59,6 +59,7 @@ struct hn_tx_ring; struct hn_rx_ring { struct ifnet *hn_ifp; + struct ifnet *hn_vf; /* SR-IOV VF */ struct hn_tx_ring *hn_txr; void *hn_pktbuf; int hn_pktbuf_len; @@ -234,6 +235,9 @@ struct hn_softc { int hn_rss_ind_size; uint32_t hn_rss_hash; /* NDIS_HASH_ */ struct ndis_rssprm_toeplitz hn_rss; + + eventhandler_tag hn_ifaddr_evthand; + eventhandler_tag hn_ifnet_evthand; }; #define HN_FLAG_RXBUF_CONNECTED 0x0001 @@ -244,6 +248,7 @@ struct hn_softc { #define HN_FLAG_NO_SLEEPING 0x0020 #define HN_FLAG_RXBUF_REF 0x0040 #define HN_FLAG_CHIM_REF 0x0080 +#define HN_FLAG_VF 0x0100 #define HN_FLAG_ERRORS (HN_FLAG_RXBUF_REF | HN_FLAG_CHIM_REF) From owner-svn-src-all@freebsd.org Tue Jan 24 09:25: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 E00B7CBD83C; Tue, 24 Jan 2017 09:25:43 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96BDFD2C; Tue, 24 Jan 2017 09:25:43 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O9Pgb1025117; Tue, 24 Jan 2017 09:25:42 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9PgYE025116; Tue, 24 Jan 2017 09:25:42 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240925.v0O9PgYE025116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312689 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:25:44 -0000 Author: dexuan Date: Tue Jan 24 09:25:42 2017 New Revision: 312689 URL: https://svnweb.freebsd.org/changeset/base/312689 Log: hyperv/hn: add a sysctl name for the VF interface This makes it easier for the userland script to find the releated VF interface. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9101 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 Tue Jan 24 09:24:14 2017 (r312688) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:25:42 2017 (r312689) @@ -301,6 +301,7 @@ static int hn_txagg_pkts_sysctl(SYSCTL static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARGS); 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 void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -1254,6 +1255,9 @@ hn_attach(device_t dev) CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_polling_sysctl, "I", "Polling frequency: [100,1000000], 0 disable polling"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_vf_sysctl, "A", "Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -3222,6 +3226,22 @@ hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_vf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[128]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_vf; + 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_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; From owner-svn-src-all@freebsd.org Tue Jan 24 09:27: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 3B2CDCBD951; Tue, 24 Jan 2017 09:27:15 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A7F2EF1; Tue, 24 Jan 2017 09:27:14 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0O9REb9025210; Tue, 24 Jan 2017 09:27:14 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9RE6O025209; Tue, 24 Jan 2017 09:27:14 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701240927.v0O9RE6O025209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 24 Jan 2017 09:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312690 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:27:15 -0000 Author: dexuan Date: Tue Jan 24 09:27:13 2017 New Revision: 312690 URL: https://svnweb.freebsd.org/changeset/base/312690 Log: hyperv/hn: add devctl_notify for VF_UP/DOWN events Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9102 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 Tue Jan 24 09:25:42 2017 (r312689) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:27:13 2017 (r312690) @@ -996,6 +996,9 @@ hn_set_vf(struct hn_softc *sc, struct if hn_resume_mgmt(sc); } + devctl_notify("HYPERV_NIC_VF", if_name(hn_ifp), + vf ? "VF_UP" : "VF_DOWN", NULL); + if (bootverbose) if_printf(hn_ifp, "Data path is switched %s %s\n", vf ? "to" : "from", if_name(ifp)); From owner-svn-src-all@freebsd.org Tue Jan 24 09:41: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 603B0CBDE61; Tue, 24 Jan 2017 09:41:46 +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 20DC2DD2; Tue, 24 Jan 2017 09:41:46 +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 v0O9fjY8033413; Tue, 24 Jan 2017 09:41:45 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0O9fjAF033410; Tue, 24 Jan 2017 09:41:45 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201701240941.v0O9fjAF033410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 24 Jan 2017 09:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312691 - in head: sys/riscv/include sys/riscv/riscv usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 09:41:46 -0000 Author: lwhsu (ports committer) Date: Tue Jan 24 09:41:44 2017 New Revision: 312691 URL: https://svnweb.freebsd.org/changeset/base/312691 Log: Add RISC-V support for truss(1) While here, extract NARGREG as a definition. Reviewed by: br Differential Revision: https://reviews.freebsd.org/D9249 Added: head/usr.bin/truss/riscv64-freebsd.c (contents, props changed) Modified: head/sys/riscv/include/frame.h head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/include/frame.h ============================================================================== --- head/sys/riscv/include/frame.h Tue Jan 24 09:27:13 2017 (r312690) +++ head/sys/riscv/include/frame.h Tue Jan 24 09:41:44 2017 (r312691) @@ -74,4 +74,7 @@ struct sigframe { #endif /* !LOCORE */ +/* Definitions for syscalls */ +#define NARGREG 8 /* 8 args in regs */ + #endif /* !_MACHINE_FRAME_H_ */ Modified: head/sys/riscv/riscv/trap.c ============================================================================== --- head/sys/riscv/riscv/trap.c Tue Jan 24 09:27:13 2017 (r312690) +++ head/sys/riscv/riscv/trap.c Tue Jan 24 09:41:44 2017 (r312691) @@ -95,7 +95,7 @@ cpu_fetch_syscall_args(struct thread *td register_t *ap; int nap; - nap = 8; + nap = NARGREG; p = td->td_proc; ap = &td->td_frame->tf_a[0]; @@ -116,7 +116,7 @@ cpu_fetch_syscall_args(struct thread *td sa->narg = sa->callp->sy_narg; memcpy(sa->args, ap, nap * sizeof(register_t)); if (sa->narg > nap) - panic("TODO: Could we have more then 8 args?"); + panic("TODO: Could we have more then %d args?", NARGREG); td->td_retval[0] = 0; td->td_retval[1] = 0; Added: head/usr.bin/truss/riscv64-freebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/riscv64-freebsd.c Tue Jan 24 09:41:44 2017 (r312691) @@ -0,0 +1,106 @@ +/*- + * Copyright 2017 Li-Wen Hsu + * + * 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$"); + +/* FreeBSD/riscv64-specific system call handling. */ + +#include +#include + +#include +#include + +#include +#include +#include + +#include "truss.h" + +static int +riscv64_fetch_args(struct trussinfo *trussinfo, u_int narg) +{ + struct reg regs; + struct current_syscall *cs; + lwpid_t tid; + u_int i, reg, syscall_num; + + tid = trussinfo->curthread->tid; + cs = &trussinfo->curthread->cs; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + /* + * FreeBSD has two special kinds of system call redirections -- + * SYS_syscall, and SYS___syscall. The former is the old syscall() + * routine, basically; the latter is for quad-aligned arguments. + * + * The system call argument count and code from ptrace() already + * account for these, but we need to skip over the first argument. + */ + syscall_num = regs.t[0]; + if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) { + reg = 1; + syscall_num = regs.a[0]; + } else { + reg = 0; + } + + for (i = 0; i < narg && reg < NARGREG; i++, reg++) + cs->args[i] = regs.a[reg]; + return (0); +} + +static int +riscv64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) +{ + struct reg regs; + lwpid_t tid; + + tid = trussinfo->curthread->tid; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + retval[0] = regs.a[0]; + retval[1] = regs.a[1]; + *errorp = !!(regs.t[0]); + return (0); +} + +static struct procabi riscv64_freebsd = { + "FreeBSD ELF64", + SYSDECODE_ABI_FREEBSD, + riscv64_fetch_args, + riscv64_fetch_retval, + STAILQ_HEAD_INITIALIZER(riscv64_freebsd.extra_syscalls), + { NULL } +}; + +PROCABI(riscv64_freebsd); From owner-svn-src-all@freebsd.org Tue Jan 24 10:42: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 CDF6ACBF14A; Tue, 24 Jan 2017 10:42:22 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3F2FB3; Tue, 24 Jan 2017 10:42:22 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OAgLdu056521; Tue, 24 Jan 2017 10:42:21 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OAgLro056520; Tue, 24 Jan 2017 10:42:21 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201701241042.v0OAgLro056520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Tue, 24 Jan 2017 10:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312692 - head/usr.bin/find X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 10:42:22 -0000 Author: sevan (doc committer) Date: Tue Jan 24 10:42:21 2017 New Revision: 312692 URL: https://svnweb.freebsd.org/changeset/base/312692 Log: Improve wording when describing -mmin. PR: 215922 Submitted by: danielsh AT apache DOT org Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D9313 Modified: head/usr.bin/find/find.1 Modified: head/usr.bin/find/find.1 ============================================================================== --- head/usr.bin/find/find.1 Tue Jan 24 09:41:44 2017 (r312691) +++ head/usr.bin/find/find.1 Tue Jan 24 10:42:21 2017 (r312692) @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 13, 2014 +.Dd January 24, 2017 .Dt FIND 1 .Os .Sh NAME @@ -572,6 +572,7 @@ processes all but the command line argum True if the difference between the file last modification time and the time .Nm was started, rounded up to the next full minute, is +more than .Ar n .Pq + Ns Ar n , less than From owner-svn-src-all@freebsd.org Tue Jan 24 11:13: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 0FDE0CBFE71; Tue, 24 Jan 2017 11:13:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4D132B1; Tue, 24 Jan 2017 11:13: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 v0OBDfUx069371; Tue, 24 Jan 2017 11:13:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OBDfkU069370; Tue, 24 Jan 2017 11:13:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701241113.v0OBDfkU069370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Jan 2017 11:13: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: r312693 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 11:13:43 -0000 Author: kib Date: Tue Jan 24 11:13:41 2017 New Revision: 312693 URL: https://svnweb.freebsd.org/changeset/base/312693 Log: MFC r311886: Fix acquisition of nested write compat rtld locks. PR: 215826 Modified: stable/11/libexec/rtld-elf/rtld_lock.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld_lock.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld_lock.c Tue Jan 24 10:42:21 2017 (r312692) +++ stable/11/libexec/rtld-elf/rtld_lock.c Tue Jan 24 11:13:41 2017 (r312693) @@ -64,7 +64,7 @@ typedef struct Struct_Lock { } Lock; static sigset_t fullsigmask, oldsigmask; -static int thread_flag; +static int thread_flag, wnested; static void * def_lock_create(void) @@ -117,29 +117,34 @@ def_rlock_acquire(void *lock) static void def_wlock_acquire(void *lock) { - Lock *l = (Lock *)lock; - sigset_t tmp_oldsigmask; + Lock *l; + sigset_t tmp_oldsigmask; - for ( ; ; ) { - sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); - if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) - break; - sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - } - oldsigmask = tmp_oldsigmask; + l = (Lock *)lock; + for (;;) { + sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); + if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) + break; + sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); + } + if (atomic_fetchadd_int(&wnested, 1) == 0) + oldsigmask = tmp_oldsigmask; } static void def_lock_release(void *lock) { - Lock *l = (Lock *)lock; + Lock *l; - if ((l->lock & WAFLAG) == 0) - atomic_add_rel_int(&l->lock, -RC_INCR); - else { - atomic_add_rel_int(&l->lock, -WAFLAG); - sigprocmask(SIG_SETMASK, &oldsigmask, NULL); - } + l = (Lock *)lock; + if ((l->lock & WAFLAG) == 0) + atomic_add_rel_int(&l->lock, -RC_INCR); + else { + assert(wnested > 0); + atomic_add_rel_int(&l->lock, -WAFLAG); + if (atomic_fetchadd_int(&wnested, -1) == 1) + sigprocmask(SIG_SETMASK, &oldsigmask, NULL); + } } static int @@ -373,12 +378,12 @@ _rtld_atfork_pre(int *locks) return; /* - * Warning: this does not work with the rtld compat locks - * above, since the thread signal mask is corrupted (set to - * all signals blocked) if two locks are taken in write mode. - * The caller of the _rtld_atfork_pre() must provide the - * working implementation of the locks, and libthr locks are - * fine. + * Warning: this did not worked well with the rtld compat + * locks above, when the thread signal mask was corrupted (set + * to all signals blocked) if two locks were taken + * simultaneously in the write mode. The caller of the + * _rtld_atfork_pre() must provide the working implementation + * of the locks anyway, and libthr locks are fine. */ wlock_acquire(rtld_phdr_lock, &ls[0]); wlock_acquire(rtld_bind_lock, &ls[1]); From owner-svn-src-all@freebsd.org Tue Jan 24 12:13: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 B5266CBF8F0; Tue, 24 Jan 2017 12:13: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 7DA911908; Tue, 24 Jan 2017 12:13:42 +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 v0OCDfUt096427; Tue, 24 Jan 2017 12:13:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OCDfpa096425; Tue, 24 Jan 2017 12:13:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701241213.v0OCDfpa096425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 24 Jan 2017 12:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312694 - in head: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 12:13:42 -0000 Author: mav Date: Tue Jan 24 12:13:41 2017 New Revision: 312694 URL: https://svnweb.freebsd.org/changeset/base/312694 Log: Make CTL ramdisk backend a real RAM disk. If "capacity" LU option is set, ramdisk backend now implements featured thin provisioned disk, storing data in malloc(9) allocated memory blocks of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU size is used for indirection tree (bigger pblocksize reduce the overhead). Backend supports all unmap and anchor operations. If configured capacity is overflowed, proper error conditions are reported. If "capacity" LU option is not set, the backend operates mostly the same as before without allocating real storage: writes go to nowhere, reads return zeroes, reporting that all LBAs are unmapped. This backend is still mostly oriented on testing and benchmarking (it is still a volatile RAM disk), but now it should allow to run real FS tests, not only simple dumb dd. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c head/usr.sbin/ctladm/ctladm.8 Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Jan 24 11:13:41 2017 (r312693) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Jan 24 12:13:41 2017 (r312694) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003, 2008 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -35,7 +35,7 @@ * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_ramdisk.c#3 $ */ /* - * CAM Target Layer backend for a "fake" ramdisk. + * CAM Target Layer black hole and RAM disk backend. * * Author: Ken Merry */ @@ -48,9 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -71,6 +73,29 @@ __FBSDID("$FreeBSD$"); #include #include +#define PRIV(io) \ + ((struct ctl_ptr_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_BACKEND]) +#define ARGS(io) \ + ((struct ctl_lba_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]) + +#define PPP (PAGE_SIZE / sizeof(uint8_t **)) +#ifdef __LP64__ +#define PPPS (PAGE_SHIFT - 3) +#else +#define PPPS (PAGE_SHIFT - 2) +#endif +#define SGPP (PAGE_SIZE / sizeof(struct ctl_sg_entry)) + +#define P_UNMAPPED NULL /* Page is unmapped. */ +#define P_ANCHORED ((void *)(uintptr_t)1) /* Page is anchored. */ + +typedef enum { + GP_READ, /* Return data page or zero page. */ + GP_WRITE, /* Return data page, try allocate if none. */ + GP_ANCHOR, /* Return data page, try anchor if none. */ + GP_OTHER, /* Return what present, do not allocate/anchor. */ +} getpage_op_t; + typedef enum { CTL_BE_RAMDISK_LUN_UNCONFIGURED = 0x01, CTL_BE_RAMDISK_LUN_CONFIG_ERR = 0x02, @@ -79,28 +104,29 @@ typedef enum { struct ctl_be_ramdisk_lun { struct ctl_lun_create_params params; - char lunname[32]; - uint64_t size_bytes; - uint64_t size_blocks; + char lunname[32]; + int indir; + uint8_t **pages; + uint8_t *zero_page; + struct sx page_lock; + u_int pblocksize; + u_int pblockmul; + uint64_t size_bytes; + uint64_t size_blocks; + uint64_t cap_bytes; + uint64_t cap_used; struct ctl_be_ramdisk_softc *softc; ctl_be_ramdisk_lun_flags flags; STAILQ_ENTRY(ctl_be_ramdisk_lun) links; - struct ctl_be_lun cbe_lun; - struct taskqueue *io_taskqueue; - struct task io_task; + struct ctl_be_lun cbe_lun; + struct taskqueue *io_taskqueue; + struct task io_task; STAILQ_HEAD(, ctl_io_hdr) cont_queue; - struct mtx_padalign queue_lock; + struct mtx_padalign queue_lock; }; struct ctl_be_ramdisk_softc { struct mtx lock; - int rd_size; -#ifdef CTL_RAMDISK_PAGES - uint8_t **ramdisk_pages; - int num_pages; -#else - uint8_t *ramdisk_buffer; -#endif int num_luns; STAILQ_HEAD(, ctl_be_ramdisk_lun) lun_list; }; @@ -111,8 +137,13 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static void ctl_backend_ramdisk_compare(union ctl_io *io); +static void ctl_backend_ramdisk_rw(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); -static void ctl_backend_ramdisk_continue(union ctl_io *io); +static void ctl_backend_ramdisk_worker(void *context, int pending); +static int ctl_backend_ramdisk_config_read(union ctl_io *io); +static int ctl_backend_ramdisk_config_write(union ctl_io *io); +static uint64_t ctl_backend_ramdisk_lun_attr(void *be_lun, const char *attrname); static int ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static int ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc, @@ -121,12 +152,9 @@ static int ctl_backend_ramdisk_create(st struct ctl_lun_req *req); static int ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc, struct ctl_lun_req *req); -static void ctl_backend_ramdisk_worker(void *context, int pending); static void ctl_backend_ramdisk_lun_shutdown(void *be_lun); static void ctl_backend_ramdisk_lun_config_status(void *be_lun, ctl_lun_config_status status); -static int ctl_backend_ramdisk_config_write(union ctl_io *io); -static int ctl_backend_ramdisk_config_read(union ctl_io *io); static struct ctl_backend_driver ctl_be_ramdisk_driver = { @@ -138,36 +166,21 @@ static struct ctl_backend_driver ctl_be_ .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, .config_write = ctl_backend_ramdisk_config_write, - .ioctl = ctl_backend_ramdisk_ioctl + .ioctl = ctl_backend_ramdisk_ioctl, + .lun_attr = ctl_backend_ramdisk_lun_attr, }; MALLOC_DEFINE(M_RAMDISK, "ramdisk", "Memory used for CTL RAMdisk"); CTL_BACKEND_DECLARE(cbr, ctl_be_ramdisk_driver); -int +static int ctl_backend_ramdisk_init(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; -#ifdef CTL_RAMDISK_PAGES - int i; -#endif memset(softc, 0, sizeof(*softc)); mtx_init(&softc->lock, "ctlramdisk", NULL, MTX_DEF); STAILQ_INIT(&softc->lun_list); - softc->rd_size = 1024 * 1024; -#ifdef CTL_RAMDISK_PAGES - softc->num_pages = softc->rd_size / PAGE_SIZE; - softc->ramdisk_pages = (uint8_t **)malloc(sizeof(uint8_t *) * - softc->num_pages, M_RAMDISK, - M_WAITOK); - for (i = 0; i < softc->num_pages; i++) - softc->ramdisk_pages[i] = malloc(PAGE_SIZE, M_RAMDISK,M_WAITOK); -#else - softc->ramdisk_buffer = (uint8_t *)malloc(softc->rd_size, M_RAMDISK, - M_WAITOK); -#endif - return (0); } @@ -176,9 +189,6 @@ ctl_backend_ramdisk_shutdown(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; struct ctl_be_ramdisk_lun *lun, *next_lun; -#ifdef CTL_RAMDISK_PAGES - int i; -#endif mtx_lock(&softc->lock); STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { @@ -193,30 +203,210 @@ ctl_backend_ramdisk_shutdown(void) mtx_lock(&softc->lock); } mtx_unlock(&softc->lock); - -#ifdef CTL_RAMDISK_PAGES - for (i = 0; i < softc->num_pages; i++) - free(softc->ramdisk_pages[i], M_RAMDISK); - free(softc->ramdisk_pages, M_RAMDISK); -#else - free(softc->ramdisk_buffer, M_RAMDISK); -#endif mtx_destroy(&softc->lock); return (0); } +static uint8_t * +ctl_backend_ramdisk_getpage(struct ctl_be_ramdisk_lun *be_lun, off_t pn, + getpage_op_t op) +{ + uint8_t **p, ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) { + switch (op) { + case GP_READ: + return (be_lun->zero_page); + case GP_WRITE: + return ((uint8_t *)be_lun->pages); + case GP_ANCHOR: + return (P_ANCHORED); + default: + return (P_UNMAPPED); + } + } + if (op == GP_WRITE || op == GP_ANCHOR) { + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) { + *pp = malloc(PAGE_SIZE, M_RAMDISK, + M_WAITOK|M_ZERO); + } + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_UNMAPPED && be_lun->cap_used < be_lun->cap_bytes) { + if (op == GP_WRITE) { + *pp = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); + } else + *pp = P_ANCHORED; + be_lun->cap_used += be_lun->pblocksize; + } else if (*pp == P_ANCHORED && op == GP_WRITE) { + *pp = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); + } + sx_xunlock(&be_lun->page_lock); + return ((uint8_t *)*pp); + } else { + sx_slock(&be_lun->page_lock); + p = be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (p == NULL) + break; + i = pn >> s; + p = (uint8_t **)p[i]; + pn -= i << s; + } + sx_sunlock(&be_lun->page_lock); + if ((p == P_UNMAPPED || p == P_ANCHORED) && op == GP_READ) + return (be_lun->zero_page); + return ((uint8_t *)p); + } +}; + +static void +ctl_backend_ramdisk_unmappage(struct ctl_be_ramdisk_lun *be_lun, off_t pn) +{ + uint8_t ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) + return; + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) + goto noindir; + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_ANCHORED) { + be_lun->cap_used -= be_lun->pblocksize; + *pp = P_UNMAPPED; + } else if (*pp != P_UNMAPPED) { + free(*pp, M_RAMDISK); + be_lun->cap_used -= be_lun->pblocksize; + *pp = P_UNMAPPED; + } +noindir: + sx_xunlock(&be_lun->page_lock); +}; + +static void +ctl_backend_ramdisk_anchorpage(struct ctl_be_ramdisk_lun *be_lun, off_t pn) +{ + uint8_t ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) + return; + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) + goto noindir; + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_UNMAPPED && be_lun->cap_used < be_lun->cap_bytes) { + be_lun->cap_used += be_lun->pblocksize; + *pp = P_ANCHORED; + } else if (*pp != P_ANCHORED) { + free(*pp, M_RAMDISK); + *pp = P_ANCHORED; + } +noindir: + sx_xunlock(&be_lun->page_lock); +}; + +static void +ctl_backend_ramdisk_freeallpages(uint8_t **p, int indir) +{ + int i; + + if (p == NULL) + return; + if (indir == 0) { + free(p, M_RAMDISK); + return; + } + for (i = 0; i < PPP; i++) { + if (p[i] == NULL) + continue; + ctl_backend_ramdisk_freeallpages((uint8_t **)p[i], indir - 1); + } + free(p, M_RAMDISK); +}; + +static size_t +cmp(uint8_t *a, uint8_t *b, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) { + if (a[i] != b[i]) + break; + } + return (i); +} + +static int +ctl_backend_ramdisk_cmp(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + uint8_t *page; + uint8_t info[8]; + uint64_t lba; + u_int lbaoff, lbas, res, off; + + lbas = io->scsiio.kern_data_len / cbe_lun->blocksize; + lba = ARGS(io)->lba + PRIV(io)->len - lbas; + off = 0; + for (; lbas > 0; lbas--, lba++) { + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, GP_READ); + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + page += lbaoff * cbe_lun->blocksize; + res = cmp(io->scsiio.kern_data_ptr + off, page, + cbe_lun->blocksize); + off += res; + if (res < cbe_lun->blocksize) + break; + } + if (lbas > 0) { + off += io->scsiio.kern_rel_offset - io->scsiio.kern_data_len; + scsi_u64to8b(off, info); + ctl_set_sense(&io->scsiio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_MISCOMPARE, + /*asc*/ 0x1D, /*ascq*/ 0x00, + /*type*/ SSD_ELEM_INFO, + /*size*/ sizeof(info), /*data*/ &info, + /*type*/ SSD_ELEM_NONE); + return (1); + } + return (0); +} + static int ctl_backend_ramdisk_move_done(union ctl_io *io) { - struct ctl_be_lun *cbe_lun; - struct ctl_be_ramdisk_lun *be_lun; + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; #ifdef CTL_TIME_IO struct bintime cur_bt; #endif CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n")); - cbe_lun = CTL_BACKEND_LUN(io); - be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun; #ifdef CTL_TIME_IO getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); @@ -240,7 +430,12 @@ ctl_backend_ramdisk_move_done(union ctl_ ctl_set_invalid_field_ciu(&io->scsiio); } else if ((io->io_hdr.port_status == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { - if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) { + if (ARGS(io)->flags & CTL_LLF_COMPARE) { + /* We have data block ready for comparison. */ + if (ctl_backend_ramdisk_cmp(io)) + goto done; + } + if (ARGS(io)->len > PRIV(io)->len) { mtx_lock(&be_lun->queue_lock); STAILQ_INSERT_TAIL(&be_lun->cont_queue, &io->io_hdr, links); @@ -251,75 +446,109 @@ ctl_backend_ramdisk_move_done(union ctl_ } ctl_set_success(&io->scsiio); } +done: ctl_data_submit_done(io); return(0); } -static int -ctl_backend_ramdisk_submit(union ctl_io *io) +static void +ctl_backend_ramdisk_compare(union ctl_io *io) { - struct ctl_be_lun *cbe_lun; - struct ctl_lba_len_flags *lbalen; + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + u_int lbas, len; - cbe_lun = CTL_BACKEND_LUN(io); - lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; - if (lbalen->flags & CTL_LLF_VERIFY) { - ctl_set_success(&io->scsiio); - ctl_data_submit_done(io); - return (CTL_RETVAL_COMPLETE); - } - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer = - lbalen->len * cbe_lun->blocksize; - ctl_backend_ramdisk_continue(io); - return (CTL_RETVAL_COMPLETE); + lbas = ARGS(io)->len - PRIV(io)->len; + lbas = MIN(lbas, 131072 / cbe_lun->blocksize); + len = lbas * cbe_lun->blocksize; + + io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; + io->scsiio.kern_data_ptr = malloc(len, M_RAMDISK, M_WAITOK); + io->scsiio.kern_data_len = len; + io->scsiio.kern_sg_entries = 0; + io->io_hdr.flags |= CTL_FLAG_ALLOCATED; + PRIV(io)->len += lbas; +#ifdef CTL_TIME_IO + getbinuptime(&io->io_hdr.dma_start_bt); +#endif + ctl_datamove(io); } static void -ctl_backend_ramdisk_continue(union ctl_io *io) +ctl_backend_ramdisk_rw(union ctl_io *io) { - struct ctl_be_ramdisk_softc *softc; - int len, len_filled, sg_filled; -#ifdef CTL_RAMDISK_PAGES + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; struct ctl_sg_entry *sg_entries; - int i; -#endif - - softc = &rd_softc; - len = io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer; -#ifdef CTL_RAMDISK_PAGES - sg_filled = min(btoc(len), softc->num_pages); - if (sg_filled > 1) { + uint8_t *page; + uint64_t lba; + u_int i, len, lbaoff, lbas, sgs, off; + getpage_op_t op; + + lba = ARGS(io)->lba + PRIV(io)->len; + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + lbas = ARGS(io)->len - PRIV(io)->len; + lbas = MIN(lbas, (SGPP << cbe_lun->pblockexp) - lbaoff); + sgs = (lbas + lbaoff + be_lun->pblockmul - 1) >> cbe_lun->pblockexp; + off = lbaoff * cbe_lun->blocksize; + op = (ARGS(io)->flags & CTL_LLF_WRITE) ? GP_WRITE : GP_READ; + if (sgs > 1) { io->scsiio.kern_data_ptr = malloc(sizeof(struct ctl_sg_entry) * - sg_filled, M_RAMDISK, - M_WAITOK); + sgs, M_RAMDISK, M_WAITOK); sg_entries = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - for (i = 0, len_filled = 0; i < sg_filled; i++) { - sg_entries[i].addr = softc->ramdisk_pages[i]; - sg_entries[i].len = MIN(PAGE_SIZE, len - len_filled); - len_filled += sg_entries[i].len; + len = lbas * cbe_lun->blocksize; + for (i = 0; i < sgs; i++) { + page = ctl_backend_ramdisk_getpage(be_lun, + (lba >> cbe_lun->pblockexp) + i, op); + if (page == P_UNMAPPED || page == P_ANCHORED) { + free(io->scsiio.kern_data_ptr, M_RAMDISK); +nospc: + ctl_set_space_alloc_fail(&io->scsiio); + ctl_data_submit_done(io); + return; + } + sg_entries[i].addr = page + off; + sg_entries[i].len = MIN(len, be_lun->pblocksize - off); + len -= sg_entries[i].len; + off = 0; } } else { - sg_filled = 0; - len_filled = len; - io->scsiio.kern_data_ptr = softc->ramdisk_pages[0]; + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, op); + if (page == P_UNMAPPED || page == P_ANCHORED) + goto nospc; + sgs = 0; + io->scsiio.kern_data_ptr = page + off; } -#else - sg_filled = 0; - len_filled = min(len, softc->rd_size); - io->scsiio.kern_data_ptr = softc->ramdisk_buffer; -#endif /* CTL_RAMDISK_PAGES */ io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; - io->scsiio.kern_data_len = len_filled; - io->scsiio.kern_sg_entries = sg_filled; + io->scsiio.kern_data_len = lbas * cbe_lun->blocksize; + io->scsiio.kern_sg_entries = sgs; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer -= len_filled; + PRIV(io)->len += lbas; #ifdef CTL_TIME_IO getbinuptime(&io->io_hdr.dma_start_bt); #endif ctl_datamove(io); } +static int +ctl_backend_ramdisk_submit(union ctl_io *io) +{ + struct ctl_lba_len_flags *lbalen = ARGS(io); + + if (lbalen->flags & CTL_LLF_VERIFY) { + ctl_set_success(&io->scsiio); + ctl_data_submit_done(io); + return (CTL_RETVAL_COMPLETE); + } + PRIV(io)->len = 0; + if (lbalen->flags & CTL_LLF_COMPARE) + ctl_backend_ramdisk_compare(io); + else + ctl_backend_ramdisk_rw(io); + return (CTL_RETVAL_COMPLETE); +} + static void ctl_backend_ramdisk_worker(void *context, int pending) { @@ -327,7 +556,6 @@ ctl_backend_ramdisk_worker(void *context union ctl_io *io; be_lun = (struct ctl_be_ramdisk_lun *)context; - mtx_lock(&be_lun->queue_lock); for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); @@ -335,7 +563,10 @@ ctl_backend_ramdisk_worker(void *context STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - ctl_backend_ramdisk_continue(io); + if (ARGS(io)->flags & CTL_LLF_COMPARE) + ctl_backend_ramdisk_compare(io); + else + ctl_backend_ramdisk_rw(io); mtx_lock(&be_lun->queue_lock); continue; } @@ -350,6 +581,259 @@ ctl_backend_ramdisk_worker(void *context } static int +ctl_backend_ramdisk_gls(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + struct scsi_get_lba_status_data *data; + uint8_t *page; + u_int lbaoff; + + data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; + scsi_u64to8b(ARGS(io)->lba, data->descr[0].addr); + lbaoff = ARGS(io)->lba & ~(UINT_MAX << cbe_lun->pblockexp); + scsi_ulto4b(be_lun->pblockmul - lbaoff, data->descr[0].length); + page = ctl_backend_ramdisk_getpage(be_lun, + ARGS(io)->lba >> cbe_lun->pblockexp, GP_OTHER); + if (page == P_UNMAPPED) + data->descr[0].status = 1; + else if (page == P_ANCHORED) + data->descr[0].status = 2; + else + data->descr[0].status = 0; + ctl_config_read_done(io); + return (CTL_RETVAL_COMPLETE); +} + +static int +ctl_backend_ramdisk_config_read(union ctl_io *io) +{ + int retval = 0; + + switch (io->scsiio.cdb[0]) { + case SERVICE_ACTION_IN: + if (io->scsiio.cdb[1] == SGLS_SERVICE_ACTION) { + retval = ctl_backend_ramdisk_gls(io); + break; + } + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 1, + /*bit_valid*/ 1, + /*bit*/ 4); + ctl_config_read_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + default: + ctl_set_invalid_opcode(&io->scsiio); + ctl_config_read_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + } + return (retval); +} + +static void +ctl_backend_ramdisk_delete(struct ctl_be_lun *cbe_lun, off_t lba, off_t len, + int anchor) +{ + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + uint8_t *page; + uint64_t p, lp; + u_int lbaoff; + getpage_op_t op = anchor ? GP_ANCHOR : GP_OTHER; + + /* Partially zero first partial page. */ + p = lba >> cbe_lun->pblockexp; + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + if (lbaoff != 0) { + page = ctl_backend_ramdisk_getpage(be_lun, p, op); + if (page != P_UNMAPPED && page != P_ANCHORED) { + memset(page + lbaoff * cbe_lun->blocksize, 0, + min(len, be_lun->pblockmul - lbaoff) * + cbe_lun->blocksize); + } + p++; + } + + /* Partially zero last partial page. */ + lp = (lba + len) >> cbe_lun->pblockexp; + lbaoff = (lba + len) & ~(UINT_MAX << cbe_lun->pblockexp); + if (p <= lp && lbaoff != 0) { + page = ctl_backend_ramdisk_getpage(be_lun, lp, op); + if (page != P_UNMAPPED && page != P_ANCHORED) + memset(page, 0, lbaoff * cbe_lun->blocksize); + } + + /* Delete remaining full pages. */ + if (anchor) { + for (; p < lp; p++) + ctl_backend_ramdisk_anchorpage(be_lun, p); + } else { + for (; p < lp; p++) + ctl_backend_ramdisk_unmappage(be_lun, p); + } +} + +static void +ctl_backend_ramdisk_ws(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + struct ctl_lba_len_flags *lbalen = ARGS(io); + uint8_t *page; + uint64_t lba; + u_int lbaoff, lbas; + + if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB)) { + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 1, + /*bit_valid*/ 0, + /*bit*/ 0); + ctl_config_write_done(io); + return; + } + if (lbalen->flags & SWS_UNMAP) { + ctl_backend_ramdisk_delete(cbe_lun, lbalen->lba, lbalen->len, + (lbalen->flags & SWS_ANCHOR) != 0); + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + return; + } + + for (lba = lbalen->lba, lbas = lbalen->len; lbas > 0; lba++, lbas--) { + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, GP_WRITE); + if (page == P_UNMAPPED || page == P_ANCHORED) { + ctl_set_space_alloc_fail(&io->scsiio); + ctl_data_submit_done(io); + return; + } + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + page += lbaoff * cbe_lun->blocksize; + if (lbalen->flags & SWS_NDOB) { + memset(page, 0, cbe_lun->blocksize); + } else { + memcpy(page, io->scsiio.kern_data_ptr, + cbe_lun->blocksize); + } + if (lbalen->flags & SWS_LBDATA) + scsi_ulto4b(lba, page); + } + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); +} + +static void +ctl_backend_ramdisk_unmap(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_ptr_len_flags *ptrlen = (struct ctl_ptr_len_flags *)ARGS(io); + struct scsi_unmap_desc *buf, *end; + + if ((ptrlen->flags & ~SU_ANCHOR) != 0) { + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 0, + /*command*/ 0, + /*field*/ 0, + /*bit_valid*/ 0, + /*bit*/ 0); + ctl_config_write_done(io); + return; + } + + buf = (struct scsi_unmap_desc *)ptrlen->ptr; + end = buf + ptrlen->len / sizeof(*buf); + for (; buf < end; buf++) { + ctl_backend_ramdisk_delete(cbe_lun, + scsi_8btou64(buf->lba), scsi_4btoul(buf->length), + (ptrlen->flags & SU_ANCHOR) != 0); + } + + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); +} + +static int +ctl_backend_ramdisk_config_write(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + int retval = 0; + + switch (io->scsiio.cdb[0]) { + case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: + /* We have no cache to flush. */ + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + case START_STOP_UNIT: { + struct scsi_start_stop_unit *cdb; + + cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; + if ((cdb->how & SSS_PC_MASK) != 0) { + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } + if (cdb->how & SSS_START) { + if (cdb->how & SSS_LOEJ) + ctl_lun_has_media(cbe_lun); + ctl_start_lun(cbe_lun); + } else { + ctl_stop_lun(cbe_lun); + if (cdb->how & SSS_LOEJ) + ctl_lun_ejected(cbe_lun); + } + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } + case PREVENT_ALLOW: + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + case WRITE_SAME_10: + case WRITE_SAME_16: + ctl_backend_ramdisk_ws(io); + break; + case UNMAP: + ctl_backend_ramdisk_unmap(io); + break; + default: + ctl_set_invalid_opcode(&io->scsiio); + ctl_config_write_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + } + + return (retval); +} + +static uint64_t +ctl_backend_ramdisk_lun_attr(void *arg, const char *attrname) +{ + struct ctl_be_ramdisk_lun *be_lun = arg; + uint64_t val; + + val = UINT64_MAX; + if (be_lun->cap_bytes == 0) + return (val); + sx_slock(&be_lun->page_lock); + if (strcmp(attrname, "blocksused") == 0) { + val = be_lun->cap_used / be_lun->cbe_lun.blocksize; + } else if (strcmp(attrname, "blocksavail") == 0) { + val = (be_lun->cap_bytes - be_lun->cap_used) / + be_lun->cbe_lun.blocksize; + } + sx_sunlock(&be_lun->page_lock); + return (val); +} + +static int ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { @@ -466,6 +950,9 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram taskqueue_drain_all(be_lun->io_taskqueue); taskqueue_free(be_lun->io_taskqueue); ctl_free_opts(&be_lun->cbe_lun.options); + free(be_lun->zero_page, M_RAMDISK); + ctl_backend_ramdisk_freeallpages(be_lun->pages, be_lun->indir); + sx_destroy(&be_lun->page_lock); mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -487,6 +974,7 @@ ctl_backend_ramdisk_create(struct ctl_be struct ctl_lun_create_params *params; char *value; char tmpstr[32]; + uint64_t t; int retval; retval = 0; @@ -513,6 +1001,19 @@ ctl_backend_ramdisk_create(struct ctl_be } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; + be_lun->pblocksize = PAGE_SIZE; + value = ctl_get_opt(&cbe_lun->options, "pblocksize"); + if (value != NULL) { + ctl_expand_number(value, &t); + be_lun->pblocksize = t; + } + if (be_lun->pblocksize < 512 || be_lun->pblocksize > 131072) { + snprintf(req->error_str, sizeof(req->error_str), + "%s: unsupported pblocksize %u", __func__, + be_lun->pblocksize); + goto bailout_error; + } + if (cbe_lun->lun_type == T_DIRECT || cbe_lun->lun_type == T_CDROM) { if (params->blocksize_bytes != 0) @@ -521,6 +1022,14 @@ ctl_backend_ramdisk_create(struct ctl_be cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; + be_lun->pblockmul = be_lun->pblocksize / cbe_lun->blocksize; + if (be_lun->pblockmul < 1 || !powerof2(be_lun->pblockmul)) { + snprintf(req->error_str, sizeof(req->error_str), + "%s: pblocksize %u not exp2 of blocksize %u", + __func__, + be_lun->pblocksize, cbe_lun->blocksize); + goto bailout_error; + } if (params->lun_size_bytes < cbe_lun->blocksize) { snprintf(req->error_str, sizeof(req->error_str), "%s: LUN size %ju < blocksize %u", __func__, @@ -529,9 +1038,25 @@ ctl_backend_ramdisk_create(struct ctl_be } be_lun->size_blocks = params->lun_size_bytes / cbe_lun->blocksize; be_lun->size_bytes = be_lun->size_blocks * cbe_lun->blocksize; + be_lun->indir = 0; + t = be_lun->size_bytes / be_lun->pblocksize; + while (t > 1) { + t /= PPP; + be_lun->indir++; + } cbe_lun->maxlba = be_lun->size_blocks - 1; - cbe_lun->atomicblock = UINT32_MAX; - cbe_lun->opttxferlen = softc->rd_size / cbe_lun->blocksize; + cbe_lun->pblockexp = fls(be_lun->pblockmul) - 1; + cbe_lun->pblockoff = 0; + cbe_lun->ublockexp = cbe_lun->pblockexp; + cbe_lun->ublockoff = 0; + cbe_lun->atomicblock = be_lun->pblocksize; + cbe_lun->opttxferlen = SGPP * be_lun->pblocksize; + value = ctl_get_opt(&cbe_lun->options, "capacity"); + if (value != NULL) + ctl_expand_number(value, &be_lun->cap_bytes); + } else { + be_lun->pblockmul = 1; + cbe_lun->pblockexp = 0; } /* Tell the user the blocksize we ended up using */ @@ -539,7 +1064,7 @@ ctl_backend_ramdisk_create(struct ctl_be params->lun_size_bytes = be_lun->size_bytes; value = ctl_get_opt(&cbe_lun->options, "unmap"); - if (value != NULL && strcmp(value, "on") == 0) + if (value == NULL || strcmp(value, "off") != 0) cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; value = ctl_get_opt(&cbe_lun->options, "readonly"); if (value != NULL) { @@ -594,6 +1119,11 @@ ctl_backend_ramdisk_create(struct ctl_be } STAILQ_INIT(&be_lun->cont_queue); + sx_init(&be_lun->page_lock, "cram page lock"); + if (be_lun->cap_bytes == 0) + be_lun->pages = malloc(be_lun->pblocksize, M_RAMDISK, M_WAITOK); + be_lun->zero_page = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); mtx_init(&be_lun->queue_lock, "cram queue lock", NULL, MTX_DEF); TASK_INIT(&be_lun->io_task, /*priority*/0, ctl_backend_ramdisk_worker, be_lun); @@ -668,10 +1198,12 @@ ctl_backend_ramdisk_create(struct ctl_be bailout_error: req->status = CTL_LUN_ERROR; if (be_lun != NULL) { - if (be_lun->io_taskqueue != NULL) { + if (be_lun->io_taskqueue != NULL) taskqueue_free(be_lun->io_taskqueue); - } ctl_free_opts(&cbe_lun->options); + free(be_lun->zero_page, M_RAMDISK); + ctl_backend_ramdisk_freeallpages(be_lun->pages, be_lun->indir); + sx_destroy(&be_lun->page_lock); mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -827,103 +1359,3 @@ ctl_backend_ramdisk_lun_config_status(vo } mtx_unlock(&softc->lock); } - -static int -ctl_backend_ramdisk_config_write(union ctl_io *io) -{ - struct ctl_be_lun *cbe_lun; - int retval; - - cbe_lun = CTL_BACKEND_LUN(io); - retval = 0; - switch (io->scsiio.cdb[0]) { - case SYNCHRONIZE_CACHE: - case SYNCHRONIZE_CACHE_16: - /* - * The upper level CTL code will filter out any CDBs with - * the immediate bit set and return the proper error. It - * will also not allow a sync cache command to go to a LUN - * that is powered down. - * - * We don't really need to worry about what LBA range the - * user asked to be synced out. When they issue a sync - * cache command, we'll sync out the whole thing. - * - * This is obviously just a stubbed out implementation. - * The real implementation will be in the RAIDCore/CTL *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jan 24 12:15: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 D5ED9CBF9B0; Tue, 24 Jan 2017 12:15:11 +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 A54731AC6; Tue, 24 Jan 2017 12:15:11 +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 v0OCFAJW096552; Tue, 24 Jan 2017 12:15:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OCFAHM096550; Tue, 24 Jan 2017 12:15:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701241215.v0OCFAHM096550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 24 Jan 2017 12:15:10 +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: r312695 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 12:15:11 -0000 Author: avg Date: Tue Jan 24 12:15:10 2017 New Revision: 312695 URL: https://svnweb.freebsd.org/changeset/base/312695 Log: MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 Modified: stable/9/sys/kern/sched_4bsd.c stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_4bsd.c ============================================================================== --- stable/9/sys/kern/sched_4bsd.c Tue Jan 24 12:13:41 2017 (r312694) +++ stable/9/sys/kern/sched_4bsd.c Tue Jan 24 12:15:10 2017 (r312695) @@ -985,8 +985,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Tue Jan 24 12:13:41 2017 (r312694) +++ stable/9/sys/kern/sched_ule.c Tue Jan 24 12:15:10 2017 (r312695) @@ -1838,8 +1838,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !((td->td_flags & TDF_SLICEEND) || - (flags & SWT_RELINQUISH)); + preempted = (td->td_flags & TDF_SLICEEND) == 0 && + (flags & SW_PREEMPT) != 0; td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) From owner-svn-src-all@freebsd.org Tue Jan 24 13:14: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 21680CBFC9E; Tue, 24 Jan 2017 13:14:34 +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 95A4F1E5A; Tue, 24 Jan 2017 13:14:33 +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 v0ODESSv068034 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 24 Jan 2017 15:14:28 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0ODESSv068034 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0ODESPp068033; Tue, 24 Jan 2017 15:14:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 24 Jan 2017 15:14:28 +0200 From: Konstantin Belousov To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312694 - in head: sys/cam/ctl usr.sbin/ctladm Message-ID: <20170124131427.GK2349@kib.kiev.ua> References: <201701241213.v0OCDfpa096425@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701241213.v0OCDfpa096425@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) 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: Tue, 24 Jan 2017 13:14:34 -0000 On Tue, Jan 24, 2017 at 12:13:41PM +0000, Alexander Motin wrote: > Author: mav > Date: Tue Jan 24 12:13:41 2017 > New Revision: 312694 > URL: https://svnweb.freebsd.org/changeset/base/312694 > > Log: > Make CTL ramdisk backend a real RAM disk. > > If "capacity" LU option is set, ramdisk backend now implements featured > thin provisioned disk, storing data in malloc(9) allocated memory blocks > of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU > size is used for indirection tree (bigger pblocksize reduce the overhead). > Backend supports all unmap and anchor operations. If configured capacity > is overflowed, proper error conditions are reported. > > If "capacity" LU option is not set, the backend operates mostly the same > as before without allocating real storage: writes go to nowhere, reads > return zeroes, reporting that all LBAs are unmapped. > > This backend is still mostly oriented on testing and benchmarking (it is > still a volatile RAM disk), but now it should allow to run real FS tests, > not only simple dumb dd. This sounds too much like malloc-backed md(4). From owner-svn-src-all@freebsd.org Tue Jan 24 13:28: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 74057CC01C9; Tue, 24 Jan 2017 13:28:47 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::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 07A7D8E9; Tue, 24 Jan 2017 13:28:47 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x241.google.com with SMTP id q89so17343648lfi.1; Tue, 24 Jan 2017 05:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=d34IP/O5A9wflOn04DNO/SmNbRlNLDPZtcasZeV3sBM=; b=nXbpYOot/XWaW9U0w6fpAphOsY29UFEC1u9doJh9iUwkQVFk9gNVYGk8M291Mwo8Bz KbT0AFv4KetmL9uSiTZz9UNbAgLdUZI264GtsbwKRE4dX0PQvl5ExRNNYfus/zuLoLvr s658G/QGkZUNt3FBZeFCZnO3y45VO6sTSiAq9M69/7kkbBlMxruJD2Ah2fgyw6Tt6NHg sBqeLl+JcPouRjwKwR8wIoeUp9QrS2y7TmOMiQF4dEFNtFvfC97yGxso7u5GuPw2m7Wb w25f97FZ4NLlMWj79oqrHvDmn8ykShNYM78VMoSrq7HKogRqBv9L4tByDc8mbqa2D6M1 qxmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=d34IP/O5A9wflOn04DNO/SmNbRlNLDPZtcasZeV3sBM=; b=rQxrM8xzXB4BaPWNe2iXEb5pxvqjeUFPbfC22vV5dTLi6nsRu8f3XNtcalA57sAPXa nK6lQSlvDYKUwfZ3QE9bCWueO4F0AoWP9AZ88L58s7muKpxVnkXBZ0XYKq1d5XtyIuvf PYfPpBHOEaph/3pyILaQ3S6IZ737p0ufOllUD8okK3MrO5wffpaO4pmKI+ipPo3bDALs ekeq9hMTY82sWGHoWvEc7fVpsnmUU/TezjHLyuifmeHoSSu38gdnanqUJL+EyvTzfD1w c+8G4TqbD4lZcFDnKaeF9cSVCfWB+I1VT6+E8F0O1TYsjePuPgYLimBiLPbvgCAlIc4k tlNQ== X-Gm-Message-State: AIkVDXLrYGTACZRq3+OB254nNHW2VMkPwZhO1ZpLjF6mYLaVapRGdrku7ZIb+sqYuRHsAA== X-Received: by 10.46.75.25 with SMTP id y25mr14161276lja.45.1485264523307; Tue, 24 Jan 2017 05:28:43 -0800 (PST) Received: from spectre.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id j87sm7453981lfi.25.2017.01.24.05.28.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 05:28:42 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r312694 - in head: sys/cam/ctl usr.sbin/ctladm To: Konstantin Belousov References: <201701241213.v0OCDfpa096425@repo.freebsd.org> <20170124131427.GK2349@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alexander Motin Message-ID: <1e84f54f-89ab-e453-d80a-25d2a54ed378@FreeBSD.org> Date: Tue, 24 Jan 2017 15:28:41 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170124131427.GK2349@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 13:28:47 -0000 On 24.01.2017 15:14, Konstantin Belousov wrote: > On Tue, Jan 24, 2017 at 12:13:41PM +0000, Alexander Motin wrote: >> Author: mav >> Date: Tue Jan 24 12:13:41 2017 >> New Revision: 312694 >> URL: https://svnweb.freebsd.org/changeset/base/312694 >> >> Log: >> Make CTL ramdisk backend a real RAM disk. >> >> If "capacity" LU option is set, ramdisk backend now implements featured >> thin provisioned disk, storing data in malloc(9) allocated memory blocks >> of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU >> size is used for indirection tree (bigger pblocksize reduce the overhead). >> Backend supports all unmap and anchor operations. If configured capacity >> is overflowed, proper error conditions are reported. >> >> If "capacity" LU option is not set, the backend operates mostly the same >> as before without allocating real storage: writes go to nowhere, reads >> return zeroes, reporting that all LBAs are unmapped. >> >> This backend is still mostly oriented on testing and benchmarking (it is >> still a volatile RAM disk), but now it should allow to run real FS tests, >> not only simple dumb dd. > > This sounds too much like malloc-backed md(4). Yes, it is. Just without memory copies and GEOM calls, and with some additional SCSI features. -- Alexander Motin From owner-svn-src-all@freebsd.org Tue Jan 24 14: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 56524CBEE43; Tue, 24 Jan 2017 14:48:34 +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 30ED8DE7; Tue, 24 Jan 2017 14:48:34 +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 v0OEmXNP059131; Tue, 24 Jan 2017 14:48:33 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OEmWjd059127; Tue, 24 Jan 2017 14:48:32 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701241448.v0OEmWjd059127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 24 Jan 2017 14:48:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312696 - in head/sys: dev/e1000 kern net sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 14:48:34 -0000 Author: sbruno Date: Tue Jan 24 14:48:32 2017 New Revision: 312696 URL: https://svnweb.freebsd.org/changeset/base/312696 Log: iflib: Add internal tracking of smp startup status to reliably figure out what methods are to be used to get gtaskqueue up and running. e1000: Calculating this pointer gives undefined behaviour when (last == -1) (it is before the buffer). The pointer is always followed. Panics occurred when it points to an unmapped page. Otherwise, the pointed-to garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the broken case the loop was usually null and the function just returned, and this was acidentally correct. Submitted by: bde Reviewed by: Matt Macy Modified: head/sys/dev/e1000/em_txrx.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Tue Jan 24 12:15:10 2017 (r312695) +++ head/sys/dev/e1000/em_txrx.c Tue Jan 24 14:48:32 2017 (r312696) @@ -408,10 +408,13 @@ em_isc_txd_credits_update(void *arg, uin cidx = cidx_init; buf = &txr->tx_buffers[cidx]; tx_desc = &txr->tx_base[cidx]; - last = buf->eop; + last = buf->eop; + if (last == -1) + return (processed); eop_desc = &txr->tx_base[last]; - DPRINTF(iflib_get_dev(adapter->ctx), "credits_update: cidx_init=%d clear=%d last=%d\n", + DPRINTF(iflib_get_dev(adapter->ctx), + "credits_update: cidx_init=%d clear=%d last=%d\n", cidx_init, clear, last); /* * What this does is get the index of the @@ -420,7 +423,7 @@ em_isc_txd_credits_update(void *arg, uin * simple comparison on the inner while loop. */ if (++last == scctx->isc_ntxd[0]) - last = 0; + last = 0; done = last; @@ -436,7 +439,7 @@ em_isc_txd_credits_update(void *arg, uin tx_desc++; buf++; processed++; - + /* wrap the ring ? */ if (++cidx == scctx->isc_ntxd[0]) { cidx = 0; Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Jan 24 12:15:10 2017 (r312695) +++ head/sys/kern/subr_gtaskqueue.c Tue Jan 24 14:48:32 2017 (r312696) @@ -630,6 +630,29 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } +/* + * smp_started is unusable since it is not set for UP kernels or even for + * SMP kernels when there is 1 CPU. This is usually handled by adding a + * (mp_ncpus == 1) test, but that would be broken here since we need to + * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case + * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. + * + * So maintain our own flag. It must be set after all CPUs are started + * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed + * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before + * SI_ORDER_ANY and unclearly after the CPUs are started. It would be + * simpler for adjustment to pass a flag indicating if it is delayed. + */ +static int tqg_smp_started; + +static void +tqg_record_smp_started(void *arg) +{ + tqg_smp_started = 1; +} + +SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, + tqg_record_smp_started, NULL); void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, @@ -647,7 +670,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && (smp_started || mp_ncpus == 1)) { + if (irq != -1 && tqg_smp_started ) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -697,7 +720,7 @@ taskqgroup_attach_cpu(struct taskqgroup gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (smp_started || mp_ncpus == 1) { + if (tqg_smp_started) for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -731,7 +754,7 @@ taskqgroup_attach_cpu_deferred(struct ta qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started || mp_ncpus == 1); + MPASS(tqg_smp_started); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -824,9 +847,10 @@ _taskqgroup_adjust(struct taskqgroup *qg mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { - printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", - cnt, stride, mp_ncpus, smp_started); + if (cnt < 1 || cnt * stride > mp_ncpus || !tqg_smp_started) { + printf("%s: failed cnt: %d stride: %d " + "mp_ncpus: %d smp_started: %d\n", + __func__, cnt, stride, mp_ncpus, smp_started); return (EINVAL); } if (qgroup->tqg_adjusting) { Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Jan 24 12:15:10 2017 (r312695) +++ head/sys/net/iflib.c Tue Jan 24 14:48:32 2017 (r312696) @@ -1193,13 +1193,36 @@ iflib_dma_free_multi(iflib_dma_info_t *d iflib_dma_free(*dmaiter); } +#ifdef EARLY_AP_STARTUP +static const int iflib_started = 1; +#else +/* + * We used to abuse the smp_started flag to decide if the queues have been + * fully initialized (by late taskqgroup_adjust() calls in a SYSINIT()). + * That gave bad races, since the SYSINIT() runs strictly after smp_started + * is set. Run a SYSINIT() strictly after that to just set a usable + * completion flag. + */ + +static int iflib_started; + +static void +iflib_record_started(void *arg) +{ + iflib_started = 1; +} + +SYSINIT(iflib_record_started, SI_SUB_SMP + 1, SI_ORDER_FIRST, + iflib_record_started, NULL); +#endif + static int iflib_fast_intr(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; - if (!smp_started && mp_ncpus > 1) + if (!iflib_started) return (FILTER_HANDLED); DBG_COUNTER_INC(fast_intrs); @@ -3728,7 +3751,16 @@ iflib_device_register(device_t dev, void device_printf(dev, "qset structure setup failed %d\n", err); goto fail_queues; } - + /* + * Group taskqueues aren't properly set up until SMP is started, + * so we disable interrupts until we can handle them post + * SI_SUB_SMP. + * + * XXX: disabling interrupts doesn't actually work, at least for + * the non-MSI case. When they occur before SI_SUB_SMP completes, + * we do null handling and depend on this not causing too large an + * interrupt storm. + */ IFDI_INTR_DISABLE(ctx); if (msix > 1 && (err = IFDI_MSIX_INTR_ASSIGN(ctx, msix)) != 0) { device_printf(dev, "IFDI_MSIX_INTR_ASSIGN failed %d\n", err); @@ -4556,13 +4588,6 @@ iflib_legacy_setup(if_ctx_t ctx, driver_ void *q; int err; - /* - * group taskqueues aren't properly set up until SMP is started - * so we disable interrupts until we can handle them post - * SI_SUB_SMP - */ - IFDI_INTR_DISABLE(ctx); - q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Tue Jan 24 12:15:10 2017 (r312695) +++ head/sys/sys/gtaskqueue.h Tue Jan 24 14:48:32 2017 (r312696) @@ -81,7 +81,7 @@ int taskqgroup_adjust(struct taskqgroup extern struct taskqgroup *qgroup_##name -#if (!defined(SMP) || defined(EARLY_AP_STARTUP)) +#ifdef EARLY_AP_STARTUP #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -95,7 +95,8 @@ taskqgroup_define_##name(void *arg) \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ taskqgroup_define_##name, NULL) -#else /* SMP && !EARLY_AP_STARTUP */ + +#else /* !EARLY_AP_STARTUP */ #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -104,15 +105,6 @@ static void \ taskqgroup_define_##name(void *arg) \ { \ qgroup_##name = taskqgroup_create(#name); \ - /* Adjustment will be null unless smp_cpus == 1. */ \ - /* \ - * XXX this was intended to fix the smp_cpus == 1 case, but \ - * doesn't actually work for that. It gives thes same strange \ - * panic as adjustment at SI_SUB_INIT_IF:SI_ORDER_ANY for a \ - * device that works with a pure UP kernel. \ - */ \ - /* XXX this code is common now, so should not be ifdefed. */ \ - taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ @@ -121,17 +113,13 @@ SYSINIT(taskqgroup_##name, SI_SUB_INIT_I static void \ taskqgroup_adjust_##name(void *arg) \ { \ - /* \ - * Adjustment when smp_cpus > 1 only works accidentally \ - * (when there is no device interrupt before adjustment). \ - */ \ taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ taskqgroup_adjust_##name, NULL); \ -#endif /* !SMP || EARLY_AP_STARTUP */ +#endif /* EARLY_AP_STARTUP */ TASKQGROUP_DECLARE(net); From owner-svn-src-all@freebsd.org Tue Jan 24 15:55: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 542D2CC08D0; Tue, 24 Jan 2017 15:55: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 14FBA1FB8; Tue, 24 Jan 2017 15:55: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 v0OFtrRQ088379; Tue, 24 Jan 2017 15:55:53 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OFtqG0088375; Tue, 24 Jan 2017 15:55:52 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701241555.v0OFtqG0088375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 24 Jan 2017 15:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312697 - in head/sys: dev/e1000 kern net sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 15:55:54 -0000 Author: sbruno Date: Tue Jan 24 15:55:52 2017 New Revision: 312697 URL: https://svnweb.freebsd.org/changeset/base/312697 Log: Revert 312696 due to build tests. Modified: head/sys/dev/e1000/em_txrx.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Tue Jan 24 14:48:32 2017 (r312696) +++ head/sys/dev/e1000/em_txrx.c Tue Jan 24 15:55:52 2017 (r312697) @@ -408,13 +408,10 @@ em_isc_txd_credits_update(void *arg, uin cidx = cidx_init; buf = &txr->tx_buffers[cidx]; tx_desc = &txr->tx_base[cidx]; - last = buf->eop; - if (last == -1) - return (processed); + last = buf->eop; eop_desc = &txr->tx_base[last]; - DPRINTF(iflib_get_dev(adapter->ctx), - "credits_update: cidx_init=%d clear=%d last=%d\n", + DPRINTF(iflib_get_dev(adapter->ctx), "credits_update: cidx_init=%d clear=%d last=%d\n", cidx_init, clear, last); /* * What this does is get the index of the @@ -423,7 +420,7 @@ em_isc_txd_credits_update(void *arg, uin * simple comparison on the inner while loop. */ if (++last == scctx->isc_ntxd[0]) - last = 0; + last = 0; done = last; @@ -439,7 +436,7 @@ em_isc_txd_credits_update(void *arg, uin tx_desc++; buf++; processed++; - + /* wrap the ring ? */ if (++cidx == scctx->isc_ntxd[0]) { cidx = 0; Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Jan 24 14:48:32 2017 (r312696) +++ head/sys/kern/subr_gtaskqueue.c Tue Jan 24 15:55:52 2017 (r312697) @@ -630,29 +630,6 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } -/* - * smp_started is unusable since it is not set for UP kernels or even for - * SMP kernels when there is 1 CPU. This is usually handled by adding a - * (mp_ncpus == 1) test, but that would be broken here since we need to - * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case - * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. - * - * So maintain our own flag. It must be set after all CPUs are started - * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed - * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before - * SI_ORDER_ANY and unclearly after the CPUs are started. It would be - * simpler for adjustment to pass a flag indicating if it is delayed. - */ -static int tqg_smp_started; - -static void -tqg_record_smp_started(void *arg) -{ - tqg_smp_started = 1; -} - -SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, - tqg_record_smp_started, NULL); void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, @@ -670,7 +647,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && tqg_smp_started ) { + if (irq != -1 && (smp_started || mp_ncpus == 1)) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -720,7 +697,7 @@ taskqgroup_attach_cpu(struct taskqgroup gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (tqg_smp_started) + if (smp_started || mp_ncpus == 1) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -754,7 +731,7 @@ taskqgroup_attach_cpu_deferred(struct ta qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(tqg_smp_started); + MPASS(smp_started || mp_ncpus == 1); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -847,10 +824,9 @@ _taskqgroup_adjust(struct taskqgroup *qg mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || !tqg_smp_started) { - printf("%s: failed cnt: %d stride: %d " - "mp_ncpus: %d smp_started: %d\n", - __func__, cnt, stride, mp_ncpus, smp_started); + if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { + printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", + cnt, stride, mp_ncpus, smp_started); return (EINVAL); } if (qgroup->tqg_adjusting) { Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Jan 24 14:48:32 2017 (r312696) +++ head/sys/net/iflib.c Tue Jan 24 15:55:52 2017 (r312697) @@ -1193,36 +1193,13 @@ iflib_dma_free_multi(iflib_dma_info_t *d iflib_dma_free(*dmaiter); } -#ifdef EARLY_AP_STARTUP -static const int iflib_started = 1; -#else -/* - * We used to abuse the smp_started flag to decide if the queues have been - * fully initialized (by late taskqgroup_adjust() calls in a SYSINIT()). - * That gave bad races, since the SYSINIT() runs strictly after smp_started - * is set. Run a SYSINIT() strictly after that to just set a usable - * completion flag. - */ - -static int iflib_started; - -static void -iflib_record_started(void *arg) -{ - iflib_started = 1; -} - -SYSINIT(iflib_record_started, SI_SUB_SMP + 1, SI_ORDER_FIRST, - iflib_record_started, NULL); -#endif - static int iflib_fast_intr(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; - if (!iflib_started) + if (!smp_started && mp_ncpus > 1) return (FILTER_HANDLED); DBG_COUNTER_INC(fast_intrs); @@ -3751,16 +3728,7 @@ iflib_device_register(device_t dev, void device_printf(dev, "qset structure setup failed %d\n", err); goto fail_queues; } - /* - * Group taskqueues aren't properly set up until SMP is started, - * so we disable interrupts until we can handle them post - * SI_SUB_SMP. - * - * XXX: disabling interrupts doesn't actually work, at least for - * the non-MSI case. When they occur before SI_SUB_SMP completes, - * we do null handling and depend on this not causing too large an - * interrupt storm. - */ + IFDI_INTR_DISABLE(ctx); if (msix > 1 && (err = IFDI_MSIX_INTR_ASSIGN(ctx, msix)) != 0) { device_printf(dev, "IFDI_MSIX_INTR_ASSIGN failed %d\n", err); @@ -4588,6 +4556,13 @@ iflib_legacy_setup(if_ctx_t ctx, driver_ void *q; int err; + /* + * group taskqueues aren't properly set up until SMP is started + * so we disable interrupts until we can handle them post + * SI_SUB_SMP + */ + IFDI_INTR_DISABLE(ctx); + q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Tue Jan 24 14:48:32 2017 (r312696) +++ head/sys/sys/gtaskqueue.h Tue Jan 24 15:55:52 2017 (r312697) @@ -81,7 +81,7 @@ int taskqgroup_adjust(struct taskqgroup extern struct taskqgroup *qgroup_##name -#ifdef EARLY_AP_STARTUP +#if (!defined(SMP) || defined(EARLY_AP_STARTUP)) #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -95,8 +95,7 @@ taskqgroup_define_##name(void *arg) \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ taskqgroup_define_##name, NULL) - -#else /* !EARLY_AP_STARTUP */ +#else /* SMP && !EARLY_AP_STARTUP */ #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -105,6 +104,15 @@ static void \ taskqgroup_define_##name(void *arg) \ { \ qgroup_##name = taskqgroup_create(#name); \ + /* Adjustment will be null unless smp_cpus == 1. */ \ + /* \ + * XXX this was intended to fix the smp_cpus == 1 case, but \ + * doesn't actually work for that. It gives thes same strange \ + * panic as adjustment at SI_SUB_INIT_IF:SI_ORDER_ANY for a \ + * device that works with a pure UP kernel. \ + */ \ + /* XXX this code is common now, so should not be ifdefed. */ \ + taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ @@ -113,13 +121,17 @@ SYSINIT(taskqgroup_##name, SI_SUB_INIT_I static void \ taskqgroup_adjust_##name(void *arg) \ { \ + /* \ + * Adjustment when smp_cpus > 1 only works accidentally \ + * (when there is no device interrupt before adjustment). \ + */ \ taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ taskqgroup_adjust_##name, NULL); \ -#endif /* EARLY_AP_STARTUP */ +#endif /* !SMP || EARLY_AP_STARTUP */ TASKQGROUP_DECLARE(net); From owner-svn-src-all@freebsd.org Tue Jan 24 16:05: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 99BE8CC0D29; Tue, 24 Jan 2017 16:05:43 +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 743BD994; Tue, 24 Jan 2017 16:05:43 +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 v0OG5gT1092328; Tue, 24 Jan 2017 16:05:42 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OG5gqR092323; Tue, 24 Jan 2017 16:05:42 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701241605.v0OG5gqR092323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 24 Jan 2017 16:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312698 - in head/sys: dev/e1000 kern net sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 16:05:43 -0000 Author: sbruno Date: Tue Jan 24 16:05:42 2017 New Revision: 312698 URL: https://svnweb.freebsd.org/changeset/base/312698 Log: iflib: Add internal tracking of smp startup status to reliably figure out what methods are to be used to get gtaskqueue up and running. e1000: Calculating this pointer gives undefined behaviour when (last == -1) (it is before the buffer). The pointer is always followed. Panics occurred when it points to an unmapped page. Otherwise, the pointed-to garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the broken case the loop was usually null and the function just returned, and this was acidentally correct. Submitted by: bde Reported by: Matt Macy Modified: head/sys/dev/e1000/em_txrx.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Tue Jan 24 15:55:52 2017 (r312697) +++ head/sys/dev/e1000/em_txrx.c Tue Jan 24 16:05:42 2017 (r312698) @@ -408,10 +408,13 @@ em_isc_txd_credits_update(void *arg, uin cidx = cidx_init; buf = &txr->tx_buffers[cidx]; tx_desc = &txr->tx_base[cidx]; - last = buf->eop; + last = buf->eop; + if (last == -1) + return (processed); eop_desc = &txr->tx_base[last]; - DPRINTF(iflib_get_dev(adapter->ctx), "credits_update: cidx_init=%d clear=%d last=%d\n", + DPRINTF(iflib_get_dev(adapter->ctx), + "credits_update: cidx_init=%d clear=%d last=%d\n", cidx_init, clear, last); /* * What this does is get the index of the @@ -420,7 +423,7 @@ em_isc_txd_credits_update(void *arg, uin * simple comparison on the inner while loop. */ if (++last == scctx->isc_ntxd[0]) - last = 0; + last = 0; done = last; @@ -436,7 +439,7 @@ em_isc_txd_credits_update(void *arg, uin tx_desc++; buf++; processed++; - + /* wrap the ring ? */ if (++cidx == scctx->isc_ntxd[0]) { cidx = 0; Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Jan 24 15:55:52 2017 (r312697) +++ head/sys/kern/subr_gtaskqueue.c Tue Jan 24 16:05:42 2017 (r312698) @@ -630,6 +630,29 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } +/* + * smp_started is unusable since it is not set for UP kernels or even for + * SMP kernels when there is 1 CPU. This is usually handled by adding a + * (mp_ncpus == 1) test, but that would be broken here since we need to + * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case + * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. + * + * So maintain our own flag. It must be set after all CPUs are started + * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed + * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before + * SI_ORDER_ANY and unclearly after the CPUs are started. It would be + * simpler for adjustment to pass a flag indicating if it is delayed. + */ +static int tqg_smp_started; + +static void +tqg_record_smp_started(void *arg) +{ + tqg_smp_started = 1; +} + +SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, + tqg_record_smp_started, NULL); void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, @@ -647,7 +670,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && (smp_started || mp_ncpus == 1)) { + if (irq != -1 && tqg_smp_started ) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -697,7 +720,7 @@ taskqgroup_attach_cpu(struct taskqgroup gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (smp_started || mp_ncpus == 1) { + if (tqg_smp_started) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -731,7 +754,7 @@ taskqgroup_attach_cpu_deferred(struct ta qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started || mp_ncpus == 1); + MPASS(tqg_smp_started); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -824,9 +847,10 @@ _taskqgroup_adjust(struct taskqgroup *qg mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { - printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", - cnt, stride, mp_ncpus, smp_started); + if (cnt < 1 || cnt * stride > mp_ncpus || !tqg_smp_started) { + printf("%s: failed cnt: %d stride: %d " + "mp_ncpus: %d smp_started: %d\n", + __func__, cnt, stride, mp_ncpus, smp_started); return (EINVAL); } if (qgroup->tqg_adjusting) { Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Jan 24 15:55:52 2017 (r312697) +++ head/sys/net/iflib.c Tue Jan 24 16:05:42 2017 (r312698) @@ -1193,13 +1193,36 @@ iflib_dma_free_multi(iflib_dma_info_t *d iflib_dma_free(*dmaiter); } +#ifdef EARLY_AP_STARTUP +static const int iflib_started = 1; +#else +/* + * We used to abuse the smp_started flag to decide if the queues have been + * fully initialized (by late taskqgroup_adjust() calls in a SYSINIT()). + * That gave bad races, since the SYSINIT() runs strictly after smp_started + * is set. Run a SYSINIT() strictly after that to just set a usable + * completion flag. + */ + +static int iflib_started; + +static void +iflib_record_started(void *arg) +{ + iflib_started = 1; +} + +SYSINIT(iflib_record_started, SI_SUB_SMP + 1, SI_ORDER_FIRST, + iflib_record_started, NULL); +#endif + static int iflib_fast_intr(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; - if (!smp_started && mp_ncpus > 1) + if (!iflib_started) return (FILTER_HANDLED); DBG_COUNTER_INC(fast_intrs); @@ -3728,7 +3751,16 @@ iflib_device_register(device_t dev, void device_printf(dev, "qset structure setup failed %d\n", err); goto fail_queues; } - + /* + * Group taskqueues aren't properly set up until SMP is started, + * so we disable interrupts until we can handle them post + * SI_SUB_SMP. + * + * XXX: disabling interrupts doesn't actually work, at least for + * the non-MSI case. When they occur before SI_SUB_SMP completes, + * we do null handling and depend on this not causing too large an + * interrupt storm. + */ IFDI_INTR_DISABLE(ctx); if (msix > 1 && (err = IFDI_MSIX_INTR_ASSIGN(ctx, msix)) != 0) { device_printf(dev, "IFDI_MSIX_INTR_ASSIGN failed %d\n", err); @@ -4556,13 +4588,6 @@ iflib_legacy_setup(if_ctx_t ctx, driver_ void *q; int err; - /* - * group taskqueues aren't properly set up until SMP is started - * so we disable interrupts until we can handle them post - * SI_SUB_SMP - */ - IFDI_INTR_DISABLE(ctx); - q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Tue Jan 24 15:55:52 2017 (r312697) +++ head/sys/sys/gtaskqueue.h Tue Jan 24 16:05:42 2017 (r312698) @@ -81,7 +81,7 @@ int taskqgroup_adjust(struct taskqgroup extern struct taskqgroup *qgroup_##name -#if (!defined(SMP) || defined(EARLY_AP_STARTUP)) +#ifdef EARLY_AP_STARTUP #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -95,7 +95,8 @@ taskqgroup_define_##name(void *arg) \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ taskqgroup_define_##name, NULL) -#else /* SMP && !EARLY_AP_STARTUP */ + +#else /* !EARLY_AP_STARTUP */ #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -104,15 +105,6 @@ static void \ taskqgroup_define_##name(void *arg) \ { \ qgroup_##name = taskqgroup_create(#name); \ - /* Adjustment will be null unless smp_cpus == 1. */ \ - /* \ - * XXX this was intended to fix the smp_cpus == 1 case, but \ - * doesn't actually work for that. It gives thes same strange \ - * panic as adjustment at SI_SUB_INIT_IF:SI_ORDER_ANY for a \ - * device that works with a pure UP kernel. \ - */ \ - /* XXX this code is common now, so should not be ifdefed. */ \ - taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ @@ -121,17 +113,13 @@ SYSINIT(taskqgroup_##name, SI_SUB_INIT_I static void \ taskqgroup_adjust_##name(void *arg) \ { \ - /* \ - * Adjustment when smp_cpus > 1 only works accidentally \ - * (when there is no device interrupt before adjustment). \ - */ \ taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ taskqgroup_adjust_##name, NULL); \ -#endif /* !SMP || EARLY_AP_STARTUP */ +#endif /* EARLY_AP_STARTUP */ TASKQGROUP_DECLARE(net); From owner-svn-src-all@freebsd.org Tue Jan 24 16:14: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 EFD94CC0049; Tue, 24 Jan 2017 16:14:00 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4D511FA; Tue, 24 Jan 2017 16:14:00 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OGDxY7096791; Tue, 24 Jan 2017 16:13:59 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OGDxLR096790; Tue, 24 Jan 2017 16:13:59 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201701241613.v0OGDxLR096790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Tue, 24 Jan 2017 16:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312699 - head/sys/amd64/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 16:14:01 -0000 Author: tijl Date: Tue Jan 24 16:13:59 2017 New Revision: 312699 URL: https://svnweb.freebsd.org/changeset/base/312699 Log: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 MFC after: 3 days Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:05:42 2017 (r312698) +++ head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:13:59 2017 (r312699) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) From owner-svn-src-all@freebsd.org Tue Jan 24 16:47: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 3E47DCC0C03; Tue, 24 Jan 2017 16:47:08 +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 0D74AE8A; Tue, 24 Jan 2017 16:47: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 v0OGl7fc009836; Tue, 24 Jan 2017 16:47:07 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OGl7pr009835; Tue, 24 Jan 2017 16:47:07 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201701241647.v0OGl7pr009835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 24 Jan 2017 16:47:07 +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: r312700 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 16:47:08 -0000 Author: bdrewery Date: Tue Jan 24 16:47:06 2017 New Revision: 312700 URL: https://svnweb.freebsd.org/changeset/base/312700 Log: MFC r310025: Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr(). Modified: stable/10/libexec/rtld-elf/rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Tue Jan 24 16:13:59 2017 (r312699) +++ stable/10/libexec/rtld-elf/rtld.c Tue Jan 24 16:47:06 2017 (r312700) @@ -3470,7 +3470,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac error = 0; wlock_acquire(rtld_phdr_lock, &phdr_lockstate); - rlock_acquire(rtld_bind_lock, &bind_lockstate); + wlock_acquire(rtld_bind_lock, &bind_lockstate); for (obj = globallist_curr(TAILQ_FIRST(&obj_list)); obj != NULL;) { TAILQ_INSERT_AFTER(&obj_list, obj, &marker, next); rtld_fill_dl_phdr_info(obj, &phdr_info); @@ -3478,7 +3478,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac error = callback(&phdr_info, sizeof phdr_info, param); - rlock_acquire(rtld_bind_lock, &bind_lockstate); + wlock_acquire(rtld_bind_lock, &bind_lockstate); obj = globallist_next(&marker); TAILQ_REMOVE(&obj_list, &marker, next); if (error != 0) { From owner-svn-src-all@freebsd.org Tue Jan 24 17: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 E05A2CC0009; Tue, 24 Jan 2017 17:30:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A29A89D; Tue, 24 Jan 2017 17:30:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OHUDxh026295; Tue, 24 Jan 2017 17:30:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OHUD4u026294; Tue, 24 Jan 2017 17:30:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701241730.v0OHUD4u026294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Jan 2017 17:30:13 +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: r312701 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 17:30:15 -0000 Author: kib Date: Tue Jan 24 17:30:13 2017 New Revision: 312701 URL: https://svnweb.freebsd.org/changeset/base/312701 Log: MFC r311886: Fix acquisition of nested write compat rtld locks. PR: 215826 Modified: stable/10/libexec/rtld-elf/rtld_lock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld_lock.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld_lock.c Tue Jan 24 16:47:06 2017 (r312700) +++ stable/10/libexec/rtld-elf/rtld_lock.c Tue Jan 24 17:30:13 2017 (r312701) @@ -64,7 +64,7 @@ typedef struct Struct_Lock { } Lock; static sigset_t fullsigmask, oldsigmask; -static int thread_flag; +static int thread_flag, wnested; static void * def_lock_create(void) @@ -117,29 +117,34 @@ def_rlock_acquire(void *lock) static void def_wlock_acquire(void *lock) { - Lock *l = (Lock *)lock; - sigset_t tmp_oldsigmask; + Lock *l; + sigset_t tmp_oldsigmask; - for ( ; ; ) { - sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); - if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) - break; - sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); - } - oldsigmask = tmp_oldsigmask; + l = (Lock *)lock; + for (;;) { + sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); + if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) + break; + sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); + } + if (atomic_fetchadd_int(&wnested, 1) == 0) + oldsigmask = tmp_oldsigmask; } static void def_lock_release(void *lock) { - Lock *l = (Lock *)lock; + Lock *l; - if ((l->lock & WAFLAG) == 0) - atomic_add_rel_int(&l->lock, -RC_INCR); - else { - atomic_add_rel_int(&l->lock, -WAFLAG); - sigprocmask(SIG_SETMASK, &oldsigmask, NULL); - } + l = (Lock *)lock; + if ((l->lock & WAFLAG) == 0) + atomic_add_rel_int(&l->lock, -RC_INCR); + else { + assert(wnested > 0); + atomic_add_rel_int(&l->lock, -WAFLAG); + if (atomic_fetchadd_int(&wnested, -1) == 1) + sigprocmask(SIG_SETMASK, &oldsigmask, NULL); + } } static int @@ -373,12 +378,12 @@ _rtld_atfork_pre(int *locks) return; /* - * Warning: this does not work with the rtld compat locks - * above, since the thread signal mask is corrupted (set to - * all signals blocked) if two locks are taken in write mode. - * The caller of the _rtld_atfork_pre() must provide the - * working implementation of the locks, and libthr locks are - * fine. + * Warning: this did not worked well with the rtld compat + * locks above, when the thread signal mask was corrupted (set + * to all signals blocked) if two locks were taken + * simultaneously in the write mode. The caller of the + * _rtld_atfork_pre() must provide the working implementation + * of the locks anyway, and libthr locks are fine. */ wlock_acquire(rtld_phdr_lock, &ls[0]); wlock_acquire(rtld_bind_lock, &ls[1]); From owner-svn-src-all@freebsd.org Tue Jan 24 18:05: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 08161CC0E7F; Tue, 24 Jan 2017 18:05:31 +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 BCDDD813; Tue, 24 Jan 2017 18:05:30 +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 v0OI5TMU043553; Tue, 24 Jan 2017 18:05:29 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OI5Tb6043549; Tue, 24 Jan 2017 18:05:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201701241805.v0OI5Tb6043549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 24 Jan 2017 18:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312702 - in head/sys: kern libkern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 18:05:31 -0000 Author: cem Date: Tue Jan 24 18:05:29 2017 New Revision: 312702 URL: https://svnweb.freebsd.org/changeset/base/312702 Log: Use time_t for intermediate values to avoid overflow in clock_ts_to_ct Add additionally safety and overflow checks to clock_ts_to_ct and the BCD routines while we're here. Perform a safety check in sys_clock_settime() first to avoid easy local root panic, without having to propagate an error value back through dozens of APIs currently lacking error returns. PR: 211960, 214300 Submitted by: Justin McOmie , kib@ Reported by: Tim Newsham Reviewed by: kib@ Sponsored by: Dell EMC Isilon, FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9279 Modified: head/sys/kern/kern_time.c head/sys/kern/subr_clock.c head/sys/libkern/bcd.c head/sys/sys/libkern.h Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Tue Jan 24 17:30:13 2017 (r312701) +++ head/sys/kern/kern_time.c Tue Jan 24 18:05:29 2017 (r312702) @@ -387,6 +387,11 @@ sys_clock_settime(struct thread *td, str return (kern_clock_settime(td, uap->clock_id, &ats)); } +static int allow_insane_settime = 0; +SYSCTL_INT(_debug, OID_AUTO, allow_insane_settime, CTLFLAG_RWTUN, + &allow_insane_settime, 0, + "do not perform possibly restrictive checks on settime(2) args"); + int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) { @@ -400,6 +405,8 @@ kern_clock_settime(struct thread *td, cl if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || ats->tv_sec < 0) return (EINVAL); + if (!allow_insane_settime && ats->tv_sec > 9999ULL * 366 * 24 * 60 * 60) + return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(&atv, ats); error = settime(td, &atv); Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Tue Jan 24 17:30:13 2017 (r312701) +++ head/sys/kern/subr_clock.c Tue Jan 24 18:05:29 2017 (r312702) @@ -178,7 +178,7 @@ clock_ct_to_ts(struct clocktime *ct, str void clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) { - int i, year, days; + time_t i, year, days; time_t rsec; /* remainder seconds */ time_t secs; @@ -214,6 +214,20 @@ clock_ts_to_ct(struct timespec *ts, stru print_ct(ct); printf("\n"); } + + KASSERT(ct->year >= 0 && ct->year < 10000, + ("year %d isn't a 4 digit year", ct->year)); + KASSERT(ct->mon >= 1 && ct->mon <= 12, + ("month %d not in 1-12", ct->mon)); + KASSERT(ct->day >= 1 && ct->day <= 31, + ("day %d not in 1-31", ct->day)); + KASSERT(ct->hour >= 0 && ct->hour <= 23, + ("hour %d not in 0-23", ct->hour)); + KASSERT(ct->min >= 0 && ct->min <= 59, + ("minute %d not in 0-59", ct->min)); + /* Not sure if this interface needs to handle leapseconds or not. */ + KASSERT(ct->sec >= 0 && ct->sec <= 60, + ("seconds %d not in 0-60", ct->sec)); } int Modified: head/sys/libkern/bcd.c ============================================================================== --- head/sys/libkern/bcd.c Tue Jan 24 17:30:13 2017 (r312701) +++ head/sys/libkern/bcd.c Tue Jan 24 18:05:29 2017 (r312702) @@ -6,6 +6,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include u_char const bcd2bin_data[] = { @@ -20,6 +21,7 @@ u_char const bcd2bin_data[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; +CTASSERT(nitems(bcd2bin_data) == LIBKERN_LEN_BCD2BIN); u_char const bin2bcd_data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, @@ -33,6 +35,8 @@ u_char const bin2bcd_data[] = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 }; +CTASSERT(nitems(bin2bcd_data) == LIBKERN_LEN_BIN2BCD); /* This is actually used with radix [2..36] */ char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; +CTASSERT(nitems(hex2ascii_data) == LIBKERN_LEN_HEX2ASCII + 1); Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Tue Jan 24 17:30:13 2017 (r312701) +++ head/sys/sys/libkern.h Tue Jan 24 18:05:29 2017 (r312702) @@ -49,9 +49,36 @@ extern u_char const bcd2bin_data[]; extern u_char const bin2bcd_data[]; extern char const hex2ascii_data[]; -#define bcd2bin(bcd) (bcd2bin_data[bcd]) -#define bin2bcd(bin) (bin2bcd_data[bin]) -#define hex2ascii(hex) (hex2ascii_data[hex]) +#define LIBKERN_LEN_BCD2BIN 154 +#define LIBKERN_LEN_BIN2BCD 100 +#define LIBKERN_LEN_HEX2ASCII 36 + +static inline u_char +bcd2bin(int bcd) +{ + + KASSERT(bcd >= 0 && bcd < LIBKERN_LEN_BCD2BIN, + ("invalid bcd %d", bcd)); + return (bcd2bin_data[bcd]); +} + +static inline u_char +bin2bcd(int bin) +{ + + KASSERT(bin >= 0 && bin < LIBKERN_LEN_BIN2BCD, + ("invalid bin %d", bin)); + return (bin2bcd_data[bin]); +} + +static inline char +hex2ascii(int hex) +{ + + KASSERT(hex >= 0 && hex < LIBKERN_LEN_HEX2ASCII, + ("invalid hex %d", hex)); + return (hex2ascii_data[hex]); +} static __inline int imax(int a, int b) { return (a > b ? a : b); } static __inline int imin(int a, int b) { return (a < b ? a : b); } From owner-svn-src-all@freebsd.org Tue Jan 24 18:44: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 AA51BCC0B33; Tue, 24 Jan 2017 18:44:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 93CEC1B3; Tue, 24 Jan 2017 18:44:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id AA3D05649D; Tue, 24 Jan 2017 12:44:26 -0600 (CST) Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Andriy Gapon , Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Eric van Gyzen Message-ID: <0f2c3b59-54d3-a83a-29ba-4fcda2db25f2@FreeBSD.org> Date: Tue, 24 Jan 2017 12:44:25 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 18:44:27 -0000 On 01/23/2017 12:12, Eric van Gyzen wrote: > On 01/23/2017 10:03, Andriy Gapon wrote: >> On 23/01/2017 15:34, Bruce Evans wrote: >>> What is a good benchmark for showing that the fix helps? >> >> Honestly, I do not know. We ran into a pathology where a thread was not getting >> scheduled for a long time after being preempted while in a critical section (so >> the actual preemption was a voluntary switch when exiting the critical section). >> I am not sure what kind of a synthetic benchmark or a test case would readily >> demonstrate the problem. > > I submitted r270423, which introduced the bug Andriy just fixed. I'm > already setting up the performance test that I used for that change. > It's a macro-benchmark of a commercial product, so I can't elaborate on > details, but at least I can give a thumb indication in the style of a > Roman Dictator. My performance tests showed no change, so although r312666 does not improve performance under my workload, it also does not hurt. Specifically, it does not reintroduce the regression introduced in r239157 that I poorly fixed in r270423. Thanks again for the fix, Andriy. Eric From owner-svn-src-all@freebsd.org Tue Jan 24 18:56: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 1AB50CC0D63; Tue, 24 Jan 2017 18:56:11 +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 D3BAA9E2; Tue, 24 Jan 2017 18:56:10 +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 v0OIu9v0063915; Tue, 24 Jan 2017 18:56:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OIu9ZT063914; Tue, 24 Jan 2017 18:56:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201701241856.v0OIu9ZT063914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 24 Jan 2017 18:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312703 - head/lib/libc/aarch64/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 18:56:11 -0000 Author: andrew Date: Tue Jan 24 18:56:09 2017 New Revision: 312703 URL: https://svnweb.freebsd.org/changeset/base/312703 Log: Fix the error value we write in cerror. __error returns an int *, however we were writing a 64 bit value meaning the 32 bits after this would be trashed. MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/lib/libc/aarch64/sys/cerror.S Modified: head/lib/libc/aarch64/sys/cerror.S ============================================================================== --- head/lib/libc/aarch64/sys/cerror.S Tue Jan 24 18:05:29 2017 (r312702) +++ head/lib/libc/aarch64/sys/cerror.S Tue Jan 24 18:56:09 2017 (r312703) @@ -34,7 +34,7 @@ ENTRY(cerror) stp x0, lr, [sp] bl _C_LABEL(__error) ldp x1, lr, [sp] - str x1, [x0] + str w1, [x0] movn x0, #0 movn x1, #0 add sp, sp, #16 From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 4E8E8CBF51C; Tue, 24 Jan 2017 19:18: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 04424A38; Tue, 24 Jan 2017 19:17: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 v0OJHxsV072238; Tue, 24 Jan 2017 19:17:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJHxbb072237; Tue, 24 Jan 2017 19:17:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241917.v0OJHxbb072237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312705 - vendor/llvm/llvm-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:00 -0000 Author: dim Date: Tue Jan 24 19:17:58 2017 New Revision: 312705 URL: https://svnweb.freebsd.org/changeset/base/312705 Log: Tag llvm release_40 branch r292951. Added: vendor/llvm/llvm-release_40-r292951/ - copied from r312704, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:17: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 88C02CBF518; Tue, 24 Jan 2017 19:17: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 3F0FFA36; Tue, 24 Jan 2017 19:17:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJHtRZ072190; Tue, 24 Jan 2017 19:17:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJHsaj072176; Tue, 24 Jan 2017 19:17:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241917.v0OJHsaj072176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312704 - in vendor/llvm/dist: lib/Bitcode/Reader lib/Target/AArch64 lib/Target/ARM lib/Target/X86 lib/Transforms/Instrumentation lib/Transforms/Scalar test/CodeGen/AArch64 test/CodeGen... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:17:56 -0000 Author: dim Date: Tue Jan 24 19:17:53 2017 New Revision: 312704 URL: https://svnweb.freebsd.org/changeset/base/312704 Log: Vendor import of llvm release_40 branch r292951: https://llvm.org/svn/llvm-project/llvm/branches/release_40@292951 Added: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll vendor/llvm/dist/test/Transforms/NewGVN/pr31682.ll vendor/llvm/dist/test/tools/llvm-cxxfilt/invalid.test Deleted: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt-dbg-limit.mir Modified: vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll vendor/llvm/dist/test/CodeGen/X86/sse1.ll vendor/llvm/dist/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll vendor/llvm/dist/tools/llvm-cxxfilt/llvm-cxxfilt.cpp vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -512,7 +512,7 @@ private: } Metadata *getFnMetadataByID(unsigned ID) { - return MDLoader->getMetadataFwdRef(ID); + return MDLoader->getMetadataFwdRefOrLoad(ID); } BasicBlock *getBasicBlock(unsigned ID) const { Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -485,8 +485,21 @@ public: Error parseMetadata(bool ModuleLevel); bool hasFwdRefs() const { return MetadataList.hasFwdRefs(); } - Metadata *getMetadataFwdRef(unsigned Idx) { - return MetadataList.getMetadataFwdRef(Idx); + + Metadata *getMetadataFwdRefOrLoad(unsigned ID) { + if (ID < MDStringRef.size()) + return lazyLoadOneMDString(ID); + if (auto *MD = MetadataList.lookup(ID)) + return MD; + // If lazy-loading is enabled, we try recursively to load the operand + // instead of creating a temporary. + if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) { + PlaceholderQueue Placeholders; + lazyLoadOneMetadata(ID, Placeholders); + resolveForwardRefsAndPlaceholders(Placeholders); + return MetadataList.lookup(ID); + } + return MetadataList.getMetadataFwdRef(ID); } MDNode *getMDNodeFwdRefOrNull(unsigned Idx) { @@ -1727,8 +1740,8 @@ bool MetadataLoader::hasFwdRefs() const /// Return the given metadata, creating a replaceable forward reference if /// necessary. -Metadata *MetadataLoader::getMetadataFwdRef(unsigned Idx) { - return Pimpl->getMetadataFwdRef(Idx); +Metadata *MetadataLoader::getMetadataFwdRefOrLoad(unsigned Idx) { + return Pimpl->getMetadataFwdRefOrLoad(Idx); } MDNode *MetadataLoader::getMDNodeFwdRefOrNull(unsigned Idx) { Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h Tue Jan 24 19:17:53 2017 (r312704) @@ -63,7 +63,7 @@ public: /// Return the given metadata, creating a replaceable forward reference if /// necessary. - Metadata *getMetadataFwdRef(unsigned Idx); + Metadata *getMetadataFwdRefOrLoad(unsigned Idx); MDNode *getMDNodeFwdRefOrNull(unsigned Idx); Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -687,9 +687,30 @@ AArch64LoadStoreOpt::mergePairedInsns(Ma MachineInstrBuilder MIB; DebugLoc DL = I->getDebugLoc(); MachineBasicBlock *MBB = I->getParent(); + MachineOperand RegOp0 = getLdStRegOp(*RtMI); + MachineOperand RegOp1 = getLdStRegOp(*Rt2MI); + // Kill flags may become invalid when moving stores for pairing. + if (RegOp0.isUse()) { + if (!MergeForward) { + // Clear kill flags on store if moving upwards. Example: + // STRWui %w0, ... + // USE %w1 + // STRWui kill %w1 ; need to clear kill flag when moving STRWui upwards + RegOp0.setIsKill(false); + RegOp1.setIsKill(false); + } else { + // Clear kill flags of the first stores register. Example: + // STRWui %w1, ... + // USE kill %w1 ; need to clear kill flag when moving STRWui downwards + // STRW %w0 + unsigned Reg = getLdStRegOp(*I).getReg(); + for (MachineInstr &MI : make_range(std::next(I), Paired)) + MI.clearRegisterKills(Reg, TRI); + } + } MIB = BuildMI(*MBB, InsertionPoint, DL, TII->get(getMatchingPairOpcode(Opc))) - .addOperand(getLdStRegOp(*RtMI)) - .addOperand(getLdStRegOp(*Rt2MI)) + .addOperand(RegOp0) + .addOperand(RegOp1) .addOperand(BaseRegOp) .addImm(OffsetImm) .setMemRefs(I->mergeMemRefsWith(*Paired)); Modified: vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -97,171 +97,6 @@ namespace { }; } -void ARMTargetLowering::InitLibcallCallingConvs() { - // The builtins on ARM always use AAPCS, irrespective of wheter C is AAPCS or - // AAPCS_VFP. - for (const auto LC : { - RTLIB::SHL_I16, - RTLIB::SHL_I32, - RTLIB::SHL_I64, - RTLIB::SHL_I128, - RTLIB::SRL_I16, - RTLIB::SRL_I32, - RTLIB::SRL_I64, - RTLIB::SRL_I128, - RTLIB::SRA_I16, - RTLIB::SRA_I32, - RTLIB::SRA_I64, - RTLIB::SRA_I128, - RTLIB::MUL_I8, - RTLIB::MUL_I16, - RTLIB::MUL_I32, - RTLIB::MUL_I64, - RTLIB::MUL_I128, - RTLIB::MULO_I32, - RTLIB::MULO_I64, - RTLIB::MULO_I128, - RTLIB::SDIV_I8, - RTLIB::SDIV_I16, - RTLIB::SDIV_I32, - RTLIB::SDIV_I64, - RTLIB::SDIV_I128, - RTLIB::UDIV_I8, - RTLIB::UDIV_I16, - RTLIB::UDIV_I32, - RTLIB::UDIV_I64, - RTLIB::UDIV_I128, - RTLIB::SREM_I8, - RTLIB::SREM_I16, - RTLIB::SREM_I32, - RTLIB::SREM_I64, - RTLIB::SREM_I128, - RTLIB::UREM_I8, - RTLIB::UREM_I16, - RTLIB::UREM_I32, - RTLIB::UREM_I64, - RTLIB::UREM_I128, - RTLIB::SDIVREM_I8, - RTLIB::SDIVREM_I16, - RTLIB::SDIVREM_I32, - RTLIB::SDIVREM_I64, - RTLIB::SDIVREM_I128, - RTLIB::UDIVREM_I8, - RTLIB::UDIVREM_I16, - RTLIB::UDIVREM_I32, - RTLIB::UDIVREM_I64, - RTLIB::UDIVREM_I128, - RTLIB::NEG_I32, - RTLIB::NEG_I64, - RTLIB::ADD_F32, - RTLIB::ADD_F64, - RTLIB::ADD_F80, - RTLIB::ADD_F128, - RTLIB::SUB_F32, - RTLIB::SUB_F64, - RTLIB::SUB_F80, - RTLIB::SUB_F128, - RTLIB::MUL_F32, - RTLIB::MUL_F64, - RTLIB::MUL_F80, - RTLIB::MUL_F128, - RTLIB::DIV_F32, - RTLIB::DIV_F64, - RTLIB::DIV_F80, - RTLIB::DIV_F128, - RTLIB::POWI_F32, - RTLIB::POWI_F64, - RTLIB::POWI_F80, - RTLIB::POWI_F128, - RTLIB::FPEXT_F64_F128, - RTLIB::FPEXT_F32_F128, - RTLIB::FPEXT_F32_F64, - RTLIB::FPEXT_F16_F32, - RTLIB::FPROUND_F32_F16, - RTLIB::FPROUND_F64_F16, - RTLIB::FPROUND_F80_F16, - RTLIB::FPROUND_F128_F16, - RTLIB::FPROUND_F64_F32, - RTLIB::FPROUND_F80_F32, - RTLIB::FPROUND_F128_F32, - RTLIB::FPROUND_F80_F64, - RTLIB::FPROUND_F128_F64, - RTLIB::FPTOSINT_F32_I32, - RTLIB::FPTOSINT_F32_I64, - RTLIB::FPTOSINT_F32_I128, - RTLIB::FPTOSINT_F64_I32, - RTLIB::FPTOSINT_F64_I64, - RTLIB::FPTOSINT_F64_I128, - RTLIB::FPTOSINT_F80_I32, - RTLIB::FPTOSINT_F80_I64, - RTLIB::FPTOSINT_F80_I128, - RTLIB::FPTOSINT_F128_I32, - RTLIB::FPTOSINT_F128_I64, - RTLIB::FPTOSINT_F128_I128, - RTLIB::FPTOUINT_F32_I32, - RTLIB::FPTOUINT_F32_I64, - RTLIB::FPTOUINT_F32_I128, - RTLIB::FPTOUINT_F64_I32, - RTLIB::FPTOUINT_F64_I64, - RTLIB::FPTOUINT_F64_I128, - RTLIB::FPTOUINT_F80_I32, - RTLIB::FPTOUINT_F80_I64, - RTLIB::FPTOUINT_F80_I128, - RTLIB::FPTOUINT_F128_I32, - RTLIB::FPTOUINT_F128_I64, - RTLIB::FPTOUINT_F128_I128, - RTLIB::SINTTOFP_I32_F32, - RTLIB::SINTTOFP_I32_F64, - RTLIB::SINTTOFP_I32_F80, - RTLIB::SINTTOFP_I32_F128, - RTLIB::SINTTOFP_I64_F32, - RTLIB::SINTTOFP_I64_F64, - RTLIB::SINTTOFP_I64_F80, - RTLIB::SINTTOFP_I64_F128, - RTLIB::SINTTOFP_I128_F32, - RTLIB::SINTTOFP_I128_F64, - RTLIB::SINTTOFP_I128_F80, - RTLIB::SINTTOFP_I128_F128, - RTLIB::UINTTOFP_I32_F32, - RTLIB::UINTTOFP_I32_F64, - RTLIB::UINTTOFP_I32_F80, - RTLIB::UINTTOFP_I32_F128, - RTLIB::UINTTOFP_I64_F32, - RTLIB::UINTTOFP_I64_F64, - RTLIB::UINTTOFP_I64_F80, - RTLIB::UINTTOFP_I64_F128, - RTLIB::UINTTOFP_I128_F32, - RTLIB::UINTTOFP_I128_F64, - RTLIB::UINTTOFP_I128_F80, - RTLIB::UINTTOFP_I128_F128, - RTLIB::OEQ_F32, - RTLIB::OEQ_F64, - RTLIB::OEQ_F128, - RTLIB::UNE_F32, - RTLIB::UNE_F64, - RTLIB::UNE_F128, - RTLIB::OGE_F32, - RTLIB::OGE_F64, - RTLIB::OGE_F128, - RTLIB::OLT_F32, - RTLIB::OLT_F64, - RTLIB::OLT_F128, - RTLIB::OLE_F32, - RTLIB::OLE_F64, - RTLIB::OLE_F128, - RTLIB::OGT_F32, - RTLIB::OGT_F64, - RTLIB::OGT_F128, - RTLIB::UO_F32, - RTLIB::UO_F64, - RTLIB::UO_F128, - RTLIB::O_F32, - RTLIB::O_F64, - RTLIB::O_F128, - }) - setLibcallCallingConv(LC, CallingConv::ARM_AAPCS); -} - // The APCS parameter registers. static const MCPhysReg GPRArgRegs[] = { ARM::R0, ARM::R1, ARM::R2, ARM::R3 @@ -349,7 +184,22 @@ ARMTargetLowering::ARMTargetLowering(con setBooleanVectorContents(ZeroOrNegativeOneBooleanContent); - InitLibcallCallingConvs(); + if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetIOS() && + !Subtarget->isTargetWatchOS()) { + const auto &E = Subtarget->getTargetTriple().getEnvironment(); + + bool IsHFTarget = E == Triple::EABIHF || E == Triple::GNUEABIHF || + E == Triple::MuslEABIHF; + // Windows is a special case. Technically, we will replace all of the "GNU" + // calls with calls to MSVCRT if appropriate and adjust the calling + // convention then. + IsHFTarget = IsHFTarget || Subtarget->isTargetWindows(); + + for (int LCID = 0; LCID < RTLIB::UNKNOWN_LIBCALL; ++LCID) + setLibcallCallingConv(static_cast(LCID), + IsHFTarget ? CallingConv::ARM_AAPCS_VFP + : CallingConv::ARM_AAPCS); + } if (Subtarget->isTargetMachO()) { // Uses VFP for Thumb libfuncs if available. Modified: vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h Tue Jan 24 19:17:53 2017 (r312704) @@ -538,8 +538,6 @@ class InstrItineraryData; bool HasStandaloneRem = true; - void InitLibcallCallingConvs(); - void addTypeForNEON(MVT VT, MVT PromotedLdStVT, MVT PromotedBitwiseVT); void addDRTypeForNEON(MVT VT); void addQRTypeForNEON(MVT VT); Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -28788,10 +28788,12 @@ static SDValue combineExtractVectorElt(S return SDValue(); } -/// If a vector select has an operand that is -1 or 0, simplify the select to a -/// bitwise logic operation. -static SDValue combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, - const X86Subtarget &Subtarget) { +/// If a vector select has an operand that is -1 or 0, try to simplify the +/// select to a bitwise logic operation. +static SDValue +combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, + TargetLowering::DAGCombinerInfo &DCI, + const X86Subtarget &Subtarget) { SDValue Cond = N->getOperand(0); SDValue LHS = N->getOperand(1); SDValue RHS = N->getOperand(2); @@ -28853,18 +28855,28 @@ static SDValue combineVSelectWithAllOnes } } - if (!TValIsAllOnes && !FValIsAllZeros) + // vselect Cond, 111..., 000... -> Cond + if (TValIsAllOnes && FValIsAllZeros) + return DAG.getBitcast(VT, Cond); + + if (!DCI.isBeforeLegalize() && !TLI.isTypeLegal(CondVT)) return SDValue(); - SDValue Ret; - if (TValIsAllOnes && FValIsAllZeros) - Ret = Cond; - else if (TValIsAllOnes) - Ret = DAG.getNode(ISD::OR, DL, CondVT, Cond, DAG.getBitcast(CondVT, RHS)); - else if (FValIsAllZeros) - Ret = DAG.getNode(ISD::AND, DL, CondVT, Cond, DAG.getBitcast(CondVT, LHS)); + // vselect Cond, 111..., X -> or Cond, X + if (TValIsAllOnes) { + SDValue CastRHS = DAG.getBitcast(CondVT, RHS); + SDValue Or = DAG.getNode(ISD::OR, DL, CondVT, Cond, CastRHS); + return DAG.getBitcast(VT, Or); + } - return DAG.getBitcast(VT, Ret); + // vselect Cond, X, 000... -> and Cond, X + if (FValIsAllZeros) { + SDValue CastLHS = DAG.getBitcast(CondVT, LHS); + SDValue And = DAG.getNode(ISD::AND, DL, CondVT, Cond, CastLHS); + return DAG.getBitcast(VT, And); + } + + return SDValue(); } static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) { @@ -29353,7 +29365,7 @@ static SDValue combineSelect(SDNode *N, } } - if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, Subtarget)) + if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DCI, Subtarget)) return V; // If this is a *dynamic* select (non-constant condition) and we can match Modified: vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -600,6 +600,22 @@ private: void initializeCallbacks(Module &M); bool InstrumentGlobals(IRBuilder<> &IRB, Module &M); + void InstrumentGlobalsCOFF(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + void InstrumentGlobalsMachO(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + void + InstrumentGlobalsWithMetadataArray(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + + GlobalVariable *CreateMetadataGlobal(Module &M, Constant *Initializer, + StringRef OriginalName); + void SetComdatForGlobalMetadata(GlobalVariable *G, GlobalVariable *Metadata); + IRBuilder<> CreateAsanModuleDtor(Module &M); + bool ShouldInstrumentGlobal(GlobalVariable *G); bool ShouldUseMachOGlobalsSection() const; StringRef getGlobalMetadataSection() const; @@ -1553,17 +1569,173 @@ void AddressSanitizerModule::initializeC // Declare the functions that find globals in a shared object and then invoke // the (un)register function on them. - AsanRegisterImageGlobals = checkSanitizerInterfaceFunction( - M.getOrInsertFunction(kAsanRegisterImageGlobalsName, - IRB.getVoidTy(), IntptrTy, nullptr)); + AsanRegisterImageGlobals = + checkSanitizerInterfaceFunction(M.getOrInsertFunction( + kAsanRegisterImageGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr)); AsanRegisterImageGlobals->setLinkage(Function::ExternalLinkage); - AsanUnregisterImageGlobals = checkSanitizerInterfaceFunction( - M.getOrInsertFunction(kAsanUnregisterImageGlobalsName, - IRB.getVoidTy(), IntptrTy, nullptr)); + AsanUnregisterImageGlobals = + checkSanitizerInterfaceFunction(M.getOrInsertFunction( + kAsanUnregisterImageGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr)); AsanUnregisterImageGlobals->setLinkage(Function::ExternalLinkage); } +// Put the metadata and the instrumented global in the same group. This ensures +// that the metadata is discarded if the instrumented global is discarded. +void AddressSanitizerModule::SetComdatForGlobalMetadata( + GlobalVariable *G, GlobalVariable *Metadata) { + Module &M = *G->getParent(); + Comdat *C = G->getComdat(); + if (!C) { + if (!G->hasName()) { + // If G is unnamed, it must be internal. Give it an artificial name + // so we can put it in a comdat. + assert(G->hasLocalLinkage()); + G->setName(Twine(kAsanGenPrefix) + "_anon_global"); + } + C = M.getOrInsertComdat(G->getName()); + // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. + if (TargetTriple.isOSBinFormatCOFF()) + C->setSelectionKind(Comdat::NoDuplicates); + G->setComdat(C); + } + + assert(G->hasComdat()); + Metadata->setComdat(G->getComdat()); +} + +// Create a separate metadata global and put it in the appropriate ASan +// global registration section. +GlobalVariable * +AddressSanitizerModule::CreateMetadataGlobal(Module &M, Constant *Initializer, + StringRef OriginalName) { + GlobalVariable *Metadata = + new GlobalVariable(M, Initializer->getType(), false, + GlobalVariable::InternalLinkage, Initializer, + Twine("__asan_global_") + + GlobalValue::getRealLinkageName(OriginalName)); + Metadata->setSection(getGlobalMetadataSection()); + return Metadata; +} + +IRBuilder<> AddressSanitizerModule::CreateAsanModuleDtor(Module &M) { + Function *AsanDtorFunction = + Function::Create(FunctionType::get(Type::getVoidTy(*C), false), + GlobalValue::InternalLinkage, kAsanModuleDtorName, &M); + BasicBlock *AsanDtorBB = BasicBlock::Create(*C, "", AsanDtorFunction); + appendToGlobalDtors(M, AsanDtorFunction, kAsanCtorAndDtorPriority); + + return IRBuilder<>(ReturnInst::Create(*C, AsanDtorBB)); +} + +void AddressSanitizerModule::InstrumentGlobalsCOFF( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + auto &DL = M.getDataLayout(); + + for (size_t i = 0; i < ExtendedGlobals.size(); i++) { + Constant *Initializer = MetadataInitializers[i]; + GlobalVariable *G = ExtendedGlobals[i]; + GlobalVariable *Metadata = + CreateMetadataGlobal(M, Initializer, G->getName()); + + // The MSVC linker always inserts padding when linking incrementally. We + // cope with that by aligning each struct to its size, which must be a power + // of two. + unsigned SizeOfGlobalStruct = DL.getTypeAllocSize(Initializer->getType()); + assert(isPowerOf2_32(SizeOfGlobalStruct) && + "global metadata will not be padded appropriately"); + Metadata->setAlignment(SizeOfGlobalStruct); + + SetComdatForGlobalMetadata(G, Metadata); + } +} + +void AddressSanitizerModule::InstrumentGlobalsMachO( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + + // On recent Mach-O platforms, use a structure which binds the liveness of + // the global variable to the metadata struct. Keep the list of "Liveness" GV + // created to be added to llvm.compiler.used + StructType *LivenessTy = StructType::get(IntptrTy, IntptrTy, nullptr); + SmallVector LivenessGlobals(ExtendedGlobals.size()); + + for (size_t i = 0; i < ExtendedGlobals.size(); i++) { + Constant *Initializer = MetadataInitializers[i]; + GlobalVariable *G = ExtendedGlobals[i]; + GlobalVariable *Metadata = + CreateMetadataGlobal(M, Initializer, G->getName()); + + // On recent Mach-O platforms, we emit the global metadata in a way that + // allows the linker to properly strip dead globals. + auto LivenessBinder = ConstantStruct::get( + LivenessTy, Initializer->getAggregateElement(0u), + ConstantExpr::getPointerCast(Metadata, IntptrTy), nullptr); + GlobalVariable *Liveness = new GlobalVariable( + M, LivenessTy, false, GlobalVariable::InternalLinkage, LivenessBinder, + Twine("__asan_binder_") + G->getName()); + Liveness->setSection("__DATA,__asan_liveness,regular,live_support"); + LivenessGlobals[i] = Liveness; + } + + // Update llvm.compiler.used, adding the new liveness globals. This is + // needed so that during LTO these variables stay alive. The alternative + // would be to have the linker handling the LTO symbols, but libLTO + // current API does not expose access to the section for each symbol. + if (!LivenessGlobals.empty()) + appendToCompilerUsed(M, LivenessGlobals); + + // RegisteredFlag serves two purposes. First, we can pass it to dladdr() + // to look up the loaded image that contains it. Second, we can store in it + // whether registration has already occurred, to prevent duplicate + // registration. + // + // common linkage ensures that there is only one global per shared library. + GlobalVariable *RegisteredFlag = new GlobalVariable( + M, IntptrTy, false, GlobalVariable::CommonLinkage, + ConstantInt::get(IntptrTy, 0), kAsanGlobalsRegisteredFlagName); + RegisteredFlag->setVisibility(GlobalVariable::HiddenVisibility); + + IRB.CreateCall(AsanRegisterImageGlobals, + {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); + + // We also need to unregister globals at the end, e.g., when a shared library + // gets closed. + IRBuilder<> IRB_Dtor = CreateAsanModuleDtor(M); + IRB_Dtor.CreateCall(AsanUnregisterImageGlobals, + {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); +} + +void AddressSanitizerModule::InstrumentGlobalsWithMetadataArray( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + unsigned N = ExtendedGlobals.size(); + assert(N > 0); + + // On platforms that don't have a custom metadata section, we emit an array + // of global metadata structures. + ArrayType *ArrayOfGlobalStructTy = + ArrayType::get(MetadataInitializers[0]->getType(), N); + auto AllGlobals = new GlobalVariable( + M, ArrayOfGlobalStructTy, false, GlobalVariable::InternalLinkage, + ConstantArray::get(ArrayOfGlobalStructTy, MetadataInitializers), ""); + + IRB.CreateCall(AsanRegisterGlobals, + {IRB.CreatePointerCast(AllGlobals, IntptrTy), + ConstantInt::get(IntptrTy, N)}); + + // We also need to unregister globals at the end, e.g., when a shared library + // gets closed. + IRBuilder<> IRB_Dtor = CreateAsanModuleDtor(M); + IRB_Dtor.CreateCall(AsanUnregisterGlobals, + {IRB.CreatePointerCast(AllGlobals, IntptrTy), + ConstantInt::get(IntptrTy, N)}); +} + // This function replaces all global variables with new variables that have // trailing redzones. It also creates a function that poisons // redzones and inserts this function into llvm.global_ctors. @@ -1580,9 +1752,6 @@ bool AddressSanitizerModule::InstrumentG if (n == 0) return false; auto &DL = M.getDataLayout(); - bool UseComdatMetadata = TargetTriple.isOSBinFormatCOFF(); - bool UseMachOGlobalsSection = ShouldUseMachOGlobalsSection(); - bool UseMetadataArray = !(UseComdatMetadata || UseMachOGlobalsSection); // A global is described by a structure // size_t beg; @@ -1597,19 +1766,8 @@ bool AddressSanitizerModule::InstrumentG StructType *GlobalStructTy = StructType::get(IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, nullptr); - unsigned SizeOfGlobalStruct = DL.getTypeAllocSize(GlobalStructTy); - assert(isPowerOf2_32(SizeOfGlobalStruct) && - "global metadata will not be padded appropriately"); - SmallVector Initializers(UseMetadataArray ? n : 0); - - // On recent Mach-O platforms, use a structure which binds the liveness of - // the global variable to the metadata struct. Keep the list of "Liveness" GV - // created to be added to llvm.compiler.used - StructType *LivenessTy = nullptr; - if (UseMachOGlobalsSection) - LivenessTy = StructType::get(IntptrTy, IntptrTy, nullptr); - SmallVector LivenessGlobals( - UseMachOGlobalsSection ? n : 0); + SmallVector NewGlobals(n); + SmallVector Initializers(n); bool HasDynamicallyInitializedGlobals = false; @@ -1681,25 +1839,7 @@ bool AddressSanitizerModule::InstrumentG ConstantExpr::getGetElementPtr(NewTy, NewGlobal, Indices2, true)); NewGlobal->takeName(G); G->eraseFromParent(); - G = NewGlobal; - - if (UseComdatMetadata) { - // Get or create a COMDAT for G so that we can use it with our metadata. - Comdat *C = G->getComdat(); - if (!C) { - if (!G->hasName()) { - // If G is unnamed, it must be internal. Give it an artificial name - // so we can put it in a comdat. - assert(G->hasLocalLinkage()); - G->setName(Twine(kAsanGenPrefix) + "_anon_global"); - } - C = M.getOrInsertComdat(G->getName()); - // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. - if (TargetTriple.isOSBinFormatCOFF()) - C->setSelectionKind(Comdat::NoDuplicates); - G->setComdat(C); - } - } + NewGlobals[i] = NewGlobal; Constant *SourceLoc; if (!MD.SourceLoc.empty()) { @@ -1750,117 +1890,21 @@ bool AddressSanitizerModule::InstrumentG DEBUG(dbgs() << "NEW GLOBAL: " << *NewGlobal << "\n"); - // If we aren't using separate metadata globals, add it to the initializer - // list and continue. - if (UseMetadataArray) { - Initializers[i] = Initializer; - continue; - } - - // Create a separate metadata global and put it in the appropriate ASan - // global registration section. - GlobalVariable *Metadata = new GlobalVariable( - M, GlobalStructTy, false, GlobalVariable::InternalLinkage, - Initializer, Twine("__asan_global_") + - GlobalValue::getRealLinkageName(G->getName())); - Metadata->setSection(getGlobalMetadataSection()); - - // We don't want any padding, but we also need a reasonable alignment. - // The MSVC linker always inserts padding when linking incrementally. We - // cope with that by aligning each struct to its size, which must be a power - // of two. - Metadata->setAlignment(SizeOfGlobalStruct); - - // On platforms that support comdats, put the metadata and the - // instrumented global in the same group. This ensures that the metadata - // is discarded if the instrumented global is discarded. - if (UseComdatMetadata) { - assert(G->hasComdat()); - Metadata->setComdat(G->getComdat()); - continue; - } - assert(UseMachOGlobalsSection); + Initializers[i] = Initializer; + } - // On recent Mach-O platforms, we emit the global metadata in a way that - // allows the linker to properly strip dead globals. - auto LivenessBinder = ConstantStruct::get( - LivenessTy, Initializer->getAggregateElement(0u), - ConstantExpr::getPointerCast(Metadata, IntptrTy), nullptr); - GlobalVariable *Liveness = new GlobalVariable( - M, LivenessTy, false, GlobalVariable::InternalLinkage, LivenessBinder, - Twine("__asan_binder_") + G->getName()); - Liveness->setSection("__DATA,__asan_liveness,regular,live_support"); - LivenessGlobals[i] = Liveness; + if (TargetTriple.isOSBinFormatCOFF()) { + InstrumentGlobalsCOFF(IRB, M, NewGlobals, Initializers); + } else if (ShouldUseMachOGlobalsSection()) { + InstrumentGlobalsMachO(IRB, M, NewGlobals, Initializers); + } else { + InstrumentGlobalsWithMetadataArray(IRB, M, NewGlobals, Initializers); } // Create calls for poisoning before initializers run and unpoisoning after. if (HasDynamicallyInitializedGlobals) createInitializerPoisonCalls(M, ModuleName); - // Platforms with a dedicated metadata section don't need to emit any more - // code. - if (UseComdatMetadata) - return true; - - GlobalVariable *AllGlobals = nullptr; - GlobalVariable *RegisteredFlag = nullptr; - - if (UseMachOGlobalsSection) { - // RegisteredFlag serves two purposes. First, we can pass it to dladdr() - // to look up the loaded image that contains it. Second, we can store in it - // whether registration has already occurred, to prevent duplicate - // registration. - // - // common linkage ensures that there is only one global per shared library. - RegisteredFlag = new GlobalVariable( - M, IntptrTy, false, GlobalVariable::CommonLinkage, - ConstantInt::get(IntptrTy, 0), kAsanGlobalsRegisteredFlagName); - RegisteredFlag->setVisibility(GlobalVariable::HiddenVisibility); - - // Update llvm.compiler.used, adding the new liveness globals. This is - // needed so that during LTO these variables stay alive. The alternative - // would be to have the linker handling the LTO symbols, but libLTO - // current API does not expose access to the section for each symbol. - if (!LivenessGlobals.empty()) - appendToCompilerUsed(M, LivenessGlobals); - } else if (UseMetadataArray) { - // On platforms that don't have a custom metadata section, we emit an array - // of global metadata structures. - ArrayType *ArrayOfGlobalStructTy = ArrayType::get(GlobalStructTy, n); - AllGlobals = new GlobalVariable( - M, ArrayOfGlobalStructTy, false, GlobalVariable::InternalLinkage, - ConstantArray::get(ArrayOfGlobalStructTy, Initializers), ""); - } - - // Create a call to register the globals with the runtime. - if (UseMachOGlobalsSection) { - IRB.CreateCall(AsanRegisterImageGlobals, - {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); - } else { - IRB.CreateCall(AsanRegisterGlobals, - {IRB.CreatePointerCast(AllGlobals, IntptrTy), - ConstantInt::get(IntptrTy, n)}); - } - - // We also need to unregister globals at the end, e.g., when a shared library - // gets closed. - Function *AsanDtorFunction = - Function::Create(FunctionType::get(Type::getVoidTy(*C), false), - GlobalValue::InternalLinkage, kAsanModuleDtorName, &M); - BasicBlock *AsanDtorBB = BasicBlock::Create(*C, "", AsanDtorFunction); - IRBuilder<> IRB_Dtor(ReturnInst::Create(*C, AsanDtorBB)); - - if (UseMachOGlobalsSection) { - IRB_Dtor.CreateCall(AsanUnregisterImageGlobals, - {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); - } else { - IRB_Dtor.CreateCall(AsanUnregisterGlobals, - {IRB.CreatePointerCast(AllGlobals, IntptrTy), - ConstantInt::get(IntptrTy, n)}); - } - - appendToGlobalDtors(M, AsanDtorFunction, kAsanCtorAndDtorPriority); - DEBUG(dbgs() << M); return true; } Modified: vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -85,6 +85,8 @@ STATISTIC(NumGVNLeaderChanges, "Number o STATISTIC(NumGVNSortedLeaderChanges, "Number of sorted leader changes"); STATISTIC(NumGVNAvoidedSortedLeaderChanges, "Number of avoided sorted leader changes"); +STATISTIC(NumGVNNotMostDominatingLeader, + "Number of times a member dominated it's new classes' leader"); //===----------------------------------------------------------------------===// // GVN Pass @@ -1073,17 +1075,20 @@ void NewGVN::moveValueToNewCongruenceCla if (I == OldClass->NextLeader.first) OldClass->NextLeader = {nullptr, ~0U}; - // The new instruction and new class leader may either be siblings in the - // dominator tree, or the new class leader should dominate the new member - // instruction. We simply check that the member instruction does not properly - // dominate the new class leader. - assert( - !isa(NewClass->RepLeader) || !NewClass->RepLeader || - I == NewClass->RepLeader || - !DT->properlyDominates( + // It's possible, though unlikely, for us to discover equivalences such + // that the current leader does not dominate the old one. + // This statistic tracks how often this happens. + // We assert on phi nodes when this happens, currently, for debugging, because + // we want to make sure we name phi node cycles properly. + if (isa(NewClass->RepLeader) && NewClass->RepLeader && + I != NewClass->RepLeader && + DT->properlyDominates( I->getParent(), - cast(NewClass->RepLeader)->getParent()) && - "New class for instruction should not be dominated by instruction"); + cast(NewClass->RepLeader)->getParent())) { + ++NumGVNNotMostDominatingLeader; + assert(!isa(I) && + "New class for instruction should not be dominated by instruction"); + } if (NewClass->RepLeader != I) { auto DFSNum = InstrDFS.lookup(I); Added: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir Tue Jan 24 19:17:53 2017 (r312704) @@ -0,0 +1,132 @@ +# RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - 2>&1 | FileCheck %s +--- | + define void @promote-load-from-store() { ret void } + define void @store-pair() { ret void } + define void @store-pair-clearkill0() { ret void } + define void @store-pair-clearkill1() { ret void } +... +--- +name: promote-load-from-store +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui killed %w1, %x0, 0 :: (store 4) + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + %w0 = LDRHHui killed %x0, 1 :: (load 2) + RET %lr, implicit %w0 + +... +# Don't count transient instructions towards search limits. +# CHECK-LABEL: name: promote-load-from-store +# CHECK: STRWui %w1 +# CHECK: UBFMWri %w1 +--- +name: store-pair +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui %w1, %x0, 0 :: (store 4) + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + STRWui killed %w1, killed %x0, 1 :: (store 4) + RET %lr + +... +# CHECK-LABEL: name: store-pair +# CHECK: STPWi +--- +name: store-pair-clearkill0 +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui %w1, %x0, 0 :: (store 4) + %w2 = COPY %w1 + %x3 = COPY %x0 + STRWui killed %w1, killed %x0, 1 :: (store 4) + RET %lr +... +# When merging a lower store with an upper one, we must clear kill flags on +# the lower store. +# CHECK-LABEL: store-pair-clearkill0 +# CHECK-NOT: STPWi %w1, killed %w1, %x0, 0 :: (store 4) +# CHECK: STPWi %w1, %w1, %x0, 0 :: (store 4) +# CHECK: %w2 = COPY %w1 +# CHECK: RET %lr +--- +name: store-pair-clearkill1 +tracksRegLiveness: true +body: | + bb.0: + liveins: %x0, %lr + + %w1 = MOVi32imm 13 + %w2 = MOVi32imm 7 + STRWui %w1, %x0, 1 :: (store 4) + %w2 = COPY killed %w1 + STRWui killed %w2, %x0, 0 :: (store 4) + + %w1 = MOVi32imm 42 + %w2 = MOVi32imm 7 + STRWui %w1, %x0, 0 :: (store 4) + %w2 = COPY killed %w1 + STRWui killed %w2, killed %x0, 1 :: (store 4) + + RET %lr +... +# When merging an upper store with a lower one, kill flags along the way need +# to be removed; In this case the kill flag on %w1. +# CHECK-LABEL: store-pair-clearkill1 +# CHECK: %w1 = MOVi32imm +# CHECK: %w2 = MOVi32imm +# CHECK-NOT: %w2 = COPY killed %w1 +# CHECK: %w2 = COPY %w1 +# CHECK: STPWi killed %w2, %w1, %x0, 0 + +# CHECK: %w1 = MOVi32imm +# CHECK: %w2 = MOVi32imm +# CHECK-NOT: %w2 = COPY killed %w1 +# CHECK: %w2 = COPY %w1 +# CHECK: STPWi %w1, killed %w2, killed %x0, 0 Modified: vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -18,7 +18,7 @@ declare double @llvm.powi.f64(double define double @powi_d(double %a, i32 %b) { ; CHECK-LABEL: powi_d: ; SOFT: {{(bl|b)}} __powidf2 -; HARD: bl __powidf2 +; HARD: b __powidf2 %1 = call double @llvm.powi.f64(double %a, i32 %b) ret double %1 } Modified: vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -18,7 +18,7 @@ declare float @llvm.powi.f32(float % define float @powi_f(float %a, i32 %b) { ; CHECK-LABEL: powi_f: ; SOFT: bl __powisf2 -; HARD: bl __powisf2 +; HARD: b __powisf2 %1 = call float @llvm.powi.f32(float %a, i32 %b) ret float %1 } Added: vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -0,0 +1,41 @@ +; RUN: llc -mtriple thumbv7-unknown-none-eabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-eabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-eabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-eabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +; RUN: llc -mtriple thumbv7-unknown-none-gnueabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-gnueabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-gnueabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-gnueabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +; RUN: llc -mtriple thumbv7-unknown-none-musleabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-musleabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-musleabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-musleabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +declare float @llvm.powi.f32(float, i32) + +define float @f(float %f, i32 %i) { +entry: + %0 = call float @llvm.powi.f32(float %f, i32 %i) + ret float %0 +} + +; CHECK-MATCH: b __powisf2 +; CHECK-MISMATCH: bl __powisf2 +; CHECK-TO-SOFT: vmov s0, r0 +; CHECK-TO-HARD: vmov r0, s0 + +declare double @llvm.powi.f64(double, i32) + +define double @g(double %d, i32 %i) { +entry: + %0 = call double @llvm.powi.f64(double %d, i32 %i) + ret double %0 +} + +; CHECK-MATCH: b __powidf2 +; CHECK-MISMATCH: bl __powidf2 +; CHECK-TO-SOFT: vmov d0, r0, r1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 3A622CBF56C; Tue, 24 Jan 2017 19:18: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 04390A9F; Tue, 24 Jan 2017 19:18:06 +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 v0OJI62v072303; Tue, 24 Jan 2017 19:18:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJI4q2072290; Tue, 24 Jan 2017 19:18:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJI4q2072290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312706 - in vendor/clang/dist: docs include/clang/Basic lib/AST lib/CodeGen lib/Lex lib/Sema test/CodeGenCXX test/Lexer test/Sema test/SemaCXX X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:07 -0000 Author: dim Date: Tue Jan 24 19:18:04 2017 New Revision: 312706 URL: https://svnweb.freebsd.org/changeset/base/312706 Log: Vendor import of clang release_40 branch r292951: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292951 Added: vendor/clang/dist/test/Sema/PR28181.c (contents, props changed) vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp (contents, props changed) Modified: vendor/clang/dist/docs/LanguageExtensions.rst vendor/clang/dist/include/clang/Basic/Builtins.def vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/test/CodeGenCXX/builtins.cpp vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Modified: vendor/clang/dist/docs/LanguageExtensions.rst ============================================================================== --- vendor/clang/dist/docs/LanguageExtensions.rst Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/docs/LanguageExtensions.rst Tue Jan 24 19:18:04 2017 (r312706) @@ -1776,6 +1776,46 @@ numeric primitives such as frexp. See `L `_ for more information on the semantics. +String builtins +--------------- + +Clang provides constant expression evaluation support for builtins forms of +the following functions from the C standard library ```` header: + +* ``memchr`` +* ``memcmp`` +* ``strchr`` +* ``strcmp`` +* ``strlen`` +* ``strncmp`` +* ``wcschr`` +* ``wcscmp`` +* ``wcslen`` +* ``wcsncmp`` +* ``wmemchr`` +* ``wmemcmp`` + +In each case, the builtin form has the name of the C library function prefixed +by ``__builtin_``. Example: + +.. code-block:: c + + void *p = __builtin_memchr("foobar", 'b', 5); + +In addition to the above, one further builtin is provided: + +.. code-block:: c + + char *__builtin_char_memchr(const char *haystack, int needle, size_t size); + +``__builtin_char_memchr(a, b, c)`` is identical to +``(char*)__builtin_memchr(a, b, c)`` except that its use is permitted within +constant expressions in C++11 onwards (where a cast from ``void*`` to ``char*`` +is disallowed in general). + +Support for constant expression evaluation for the above builtins be detected +with ``__has_feature(cxx_constexpr_string_builtins)``. + .. _langext-__c11_atomic: __c11_atomic builtins Modified: vendor/clang/dist/include/clang/Basic/Builtins.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Builtins.def Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/include/clang/Basic/Builtins.def Tue Jan 24 19:18:04 2017 (r312706) @@ -1339,6 +1339,7 @@ BUILTIN(__builtin_smulll_overflow, "bSLL BUILTIN(__builtin_addressof, "v*v&", "nct") BUILTIN(__builtin_operator_new, "v*z", "c") BUILTIN(__builtin_operator_delete, "vv*", "n") +BUILTIN(__builtin_char_memchr, "c*cC*iz", "n") // Safestack builtins BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprConstant.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/AST/ExprConstant.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -5683,6 +5683,7 @@ bool PointerExprEvaluator::VisitBuiltinC case Builtin::BI__builtin_strchr: case Builtin::BI__builtin_wcschr: case Builtin::BI__builtin_memchr: + case Builtin::BI__builtin_char_memchr: case Builtin::BI__builtin_wmemchr: { if (!Visit(E->getArg(0))) return false; @@ -5720,6 +5721,7 @@ bool PointerExprEvaluator::VisitBuiltinC // Fall through. case Builtin::BImemchr: case Builtin::BI__builtin_memchr: + case Builtin::BI__builtin_char_memchr: // memchr compares by converting both sides to unsigned char. That's also // correct for strchr if we get this far (to cope with plain char being // unsigned in the strchr case). Modified: vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -1189,6 +1189,10 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(Dest.getPointer()); } + case Builtin::BI__builtin_char_memchr: + BuiltinID = Builtin::BI__builtin_memchr; + break; + case Builtin::BI__builtin___memcpy_chk: { // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memcpy iff cst1<=cst2. llvm::APSInt Size, DstSize; Modified: vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -1183,6 +1183,7 @@ static bool HasFeature(const Preprocesso .Case("cxx_attributes", LangOpts.CPlusPlus11) .Case("cxx_auto_type", LangOpts.CPlusPlus11) .Case("cxx_constexpr", LangOpts.CPlusPlus11) + .Case("cxx_constexpr_string_builtins", LangOpts.CPlusPlus11) .Case("cxx_decltype", LangOpts.CPlusPlus11) .Case("cxx_decltype_incomplete_return_types", LangOpts.CPlusPlus11) .Case("cxx_default_function_template_args", LangOpts.CPlusPlus11) Modified: vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -12383,9 +12383,9 @@ ExprResult Sema::BuildCXXDefaultInitExpr Diag(Loc, diag::err_in_class_initializer_not_yet_parsed) << OutermostClass << Field; Diag(Field->getLocEnd(), diag::note_in_class_initializer_not_yet_parsed); - - // Don't diagnose this again. - Field->setInvalidDecl(); + // Recover by marking the field invalid, unless we're in a SFINAE context. + if (!isSFINAEContext()) + Field->setInvalidDecl(); return ExprError(); } Modified: vendor/clang/dist/lib/Sema/SemaExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -11496,7 +11496,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr); // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload) { + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) { // We can't actually test that if we still have a placeholder, // though. Fortunately, none of the exceptions we see in that // code below are valid when the LHS is an overload set. Note @@ -11521,17 +11521,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So // An overload in the RHS can potentially be resolved by the type // being assigned to. if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) { - if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) - return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); - - if (LHSExpr->getType()->isOverloadableType()) + if (getLangOpts().CPlusPlus && + (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() || + LHSExpr->getType()->isOverloadableType())) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr); } // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload && + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload && LHSExpr->getType()->isOverloadableType()) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); Modified: vendor/clang/dist/test/CodeGenCXX/builtins.cpp ============================================================================== --- vendor/clang/dist/test/CodeGenCXX/builtins.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/CodeGenCXX/builtins.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -26,3 +26,7 @@ int x = __builtin_abs(-2); long y = __builtin_abs(-2l); // CHECK: [[Y:%.+]] = call i64 @_Z13__builtin_absl(i64 -2) // CHECK: store i64 [[Y]], i64* @y, align 8 + +extern const char char_memchr_arg[32]; +char *memchr_result = __builtin_char_memchr(char_memchr_arg, 123, 32); +// CHECK: call i8* @memchr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @char_memchr_arg, i32 0, i32 0), i32 123, i64 32) Modified: vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp ============================================================================== --- vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -301,6 +301,17 @@ int no_constexpr(); // CHECK-11: has_constexpr // CHECK-NO-11: no_constexpr +#if __has_feature(cxx_constexpr_string_builtins) +int has_constexpr_string_builtins(); +#else +int no_constexpr_string_builtins(); +#endif + +// CHECK-1Z: has_constexpr_string_builtins +// CHECK-14: has_constexpr_string_builtins +// CHECK-11: has_constexpr_string_builtins +// CHECK-NO-11: no_constexpr_string_builtins + #if __has_feature(cxx_generalized_initializers) int has_generalized_initializers(); #else Added: vendor/clang/dist/test/Sema/PR28181.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/Sema/PR28181.c Tue Jan 24 19:18:04 2017 (r312706) @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct spinlock_t { + int lock; +} audit_skb_queue; + +void fn1() { + audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{assigning to 'struct spinlock_t' from incompatible type ''}} + +void fn2() { + audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} Modified: vendor/clang/dist/test/SemaCXX/constexpr-string.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -166,6 +166,27 @@ namespace StrchrEtc { static_assert(__builtin_memchr(nullptr, 'x', 3) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced null}} static_assert(__builtin_memchr(nullptr, 'x', 0) == nullptr); // FIXME: Should we reject this? + static_assert(__builtin_char_memchr(kStr, 'a', 0) == nullptr); + static_assert(__builtin_char_memchr(kStr, 'a', 1) == kStr); + static_assert(__builtin_char_memchr(kStr, '\0', 5) == nullptr); + static_assert(__builtin_char_memchr(kStr, '\0', 6) == kStr + 5); + static_assert(__builtin_char_memchr(kStr, '\xff', 8) == kStr + 4); + static_assert(__builtin_char_memchr(kStr, '\xff' + 256, 8) == kStr + 4); + static_assert(__builtin_char_memchr(kStr, '\xff' - 256, 8) == kStr + 4); + static_assert(__builtin_char_memchr(kFoo, 'x', 3) == nullptr); + static_assert(__builtin_char_memchr(kFoo, 'x', 4) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}} + static_assert(__builtin_char_memchr(nullptr, 'x', 3) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced null}} + static_assert(__builtin_char_memchr(nullptr, 'x', 0) == nullptr); // FIXME: Should we reject this? + + static_assert(*__builtin_char_memchr(kStr, '\xff', 8) == '\xff'); + constexpr bool char_memchr_mutable() { + char buffer[] = "mutable"; + *__builtin_char_memchr(buffer, 't', 8) = 'r'; + *__builtin_char_memchr(buffer, 'm', 8) = 'd'; + return __builtin_strcmp(buffer, "durable") == 0; + } + static_assert(char_memchr_mutable()); + constexpr bool a = !strchr("hello", 'h'); // expected-error {{constant expression}} expected-note {{non-constexpr function 'strchr' cannot be used in a constant expression}} constexpr bool b = !memchr("hello", 'h', 3); // expected-error {{constant expression}} expected-note {{non-constexpr function 'memchr' cannot be used in a constant expression}} } Added: vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s -pedantic + +namespace PR31692 { + struct A { + struct X { int n = 0; } x; + // Trigger construction of X() from a SFINAE context. This must not mark + // any part of X as invalid. + static_assert(!__is_constructible(X), ""); + // Check that X::n is not marked invalid. + double &r = x.n; // expected-error {{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}} + }; + // A::X can now be default-constructed. + static_assert(__is_constructible(A::X), ""); +} From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 B722ECBF5FF; Tue, 24 Jan 2017 19:18:18 +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 6BEFFBEC; Tue, 24 Jan 2017 19:18:18 +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 v0OJIHXc072452; Tue, 24 Jan 2017 19:18:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIH9l072450; Tue, 24 Jan 2017 19:18:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIH9l072450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312709 - vendor/libc++/dist/include X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:18 -0000 Author: dim Date: Tue Jan 24 19:18:17 2017 New Revision: 312709 URL: https://svnweb.freebsd.org/changeset/base/312709 Log: Vendor import of libc++ release_40 branch r292951: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@292951 Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/string Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Tue Jan 24 19:18:12 2017 (r312708) +++ vendor/libc++/dist/include/__config Tue Jan 24 19:18:17 2017 (r312709) @@ -103,6 +103,9 @@ #if defined(__clang__) #define _LIBCPP_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif #elif defined(__GNUC__) #define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) @@ -111,6 +114,10 @@ #define _LIBCPP_COMPILER_IBM #endif +#ifndef _LIBCPP_CLANG_VER +# define _LIBCPP_CLANG_VER 0 +#endif + // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the microsoft ABI. @@ -741,7 +748,7 @@ template struct __static_asse #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -#if !__is_identifier(__decltype) || _GNUC_VER >= 406 +#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 # define decltype(__x) __decltype(__x) #else # define decltype(__x) __typeof__(__x) @@ -838,7 +845,7 @@ template struct __static_asse #if defined(__APPLE__) # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ # endif # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 Modified: vendor/libc++/dist/include/string ============================================================================== --- vendor/libc++/dist/include/string Tue Jan 24 19:18:12 2017 (r312708) +++ vendor/libc++/dist/include/string Tue Jan 24 19:18:17 2017 (r312709) @@ -818,7 +818,10 @@ public: operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); + +#ifndef _LIBCPP_CXX03_LANG template +#endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 71970CBF586; Tue, 24 Jan 2017 19:18:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D6DCAF8; Tue, 24 Jan 2017 19:18:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJIATn072349; Tue, 24 Jan 2017 19:18:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIAYv072348; Tue, 24 Jan 2017 19:18:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIAYv072348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312707 - vendor/clang/clang-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:11 -0000 Author: dim Date: Tue Jan 24 19:18:10 2017 New Revision: 312707 URL: https://svnweb.freebsd.org/changeset/base/312707 Log: Tag clang release_40 branch r292951. Added: vendor/clang/clang-release_40-r292951/ - copied from r312706, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 49DE3CBF5BD; Tue, 24 Jan 2017 19:18: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 F2BAEB5B; Tue, 24 Jan 2017 19:18: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 v0OJIDLN072399; Tue, 24 Jan 2017 19:18:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIDTa072398; Tue, 24 Jan 2017 19:18:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIDTa072398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312708 - vendor/compiler-rt/compiler-rt-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:14 -0000 Author: dim Date: Tue Jan 24 19:18:12 2017 New Revision: 312708 URL: https://svnweb.freebsd.org/changeset/base/312708 Log: Tag compiler-rt release_40 branch r292951. Added: vendor/compiler-rt/compiler-rt-release_40-r292951/ - copied from r312707, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 CDD06CBF64A; Tue, 24 Jan 2017 19:18:21 +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 7BA4DC3E; Tue, 24 Jan 2017 19:18:21 +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 v0OJIKi9072498; Tue, 24 Jan 2017 19:18:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIKH2072497; Tue, 24 Jan 2017 19:18:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIKH2072497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312710 - vendor/libc++/libc++-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:21 -0000 Author: dim Date: Tue Jan 24 19:18:20 2017 New Revision: 312710 URL: https://svnweb.freebsd.org/changeset/base/312710 Log: Tag libc++ release_40 branch r292951. Added: vendor/libc++/libc++-release_40-r292951/ - copied from r312709, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 A72C1CBF6DD; Tue, 24 Jan 2017 19:18:28 +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 5C272D2A; Tue, 24 Jan 2017 19:18:28 +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 v0OJIRcR072593; Tue, 24 Jan 2017 19:18:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIRDL072592; Tue, 24 Jan 2017 19:18:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIRDL072592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312712 - vendor/lldb/lldb-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:28 -0000 Author: dim Date: Tue Jan 24 19:18:27 2017 New Revision: 312712 URL: https://svnweb.freebsd.org/changeset/base/312712 Log: Tag lldb release_40 branch r292951. Added: vendor/lldb/lldb-release_40-r292951/ - copied from r312711, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:18: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 08C77CBF68F; Tue, 24 Jan 2017 19:18:25 +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 B2781CB5; Tue, 24 Jan 2017 19:18:24 +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 v0OJINWs072547; Tue, 24 Jan 2017 19:18:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJINBJ072546; Tue, 24 Jan 2017 19:18:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJINBJ072546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312711 - vendor/lld/lld-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:18:25 -0000 Author: dim Date: Tue Jan 24 19:18:23 2017 New Revision: 312711 URL: https://svnweb.freebsd.org/changeset/base/312711 Log: Tag lld release_40 branch r292951. Added: vendor/lld/lld-release_40-r292951/ - copied from r312710, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Tue Jan 24 19:27: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 F3339CC000C; Tue, 24 Jan 2017 19:27:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C10D41D6B; Tue, 24 Jan 2017 19:27:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v0OJRPRb013573 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 24 Jan 2017 11:27:25 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v0OJRPjC013572; Tue, 24 Jan 2017 11:27:25 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 24 Jan 2017 11:27:25 -0800 From: Gleb Smirnoff To: Dexuan Cui Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312687 - in head/sys: net sys Message-ID: <20170124192725.GX2611@FreeBSD.org> References: <201701240919.v0O9JlM7021007@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701240919.v0O9JlM7021007@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:27:35 -0000 Dexuan, On Tue, Jan 24, 2017 at 09:19:47AM +0000, Dexuan Cui wrote: D> Author: dexuan D> Date: Tue Jan 24 09:19:46 2017 D> New Revision: 312687 D> URL: https://svnweb.freebsd.org/changeset/base/312687 D> D> Log: D> ifnet: introduce event handlers for ifup/ifdown events D> D> Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and D> a VF NIC to work together, mainly to support seamless live migration. D> D> When the VF device becomes UP (or DOWN), the synthetic NIC driver needs D> to switch the data path from the synthetic NIC to the VF (or the opposite). D> D> So the synthetic NIC driver needs to know when a VF device is becoming D> UP or DOWN and hence the patch is made. D> D> Reviewed by: sephe D> Approved by: sephe (mentor) D> MFC after: 2 weeks D> Sponsored by: Microsoft D> Differential Revision: https://reviews.freebsd.org/D8963 D> D> Modified: D> head/sys/net/if.c D> head/sys/sys/eventhandler.h ... D> Modified: head/sys/sys/eventhandler.h D> ============================================================================== D> --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017 (r312686) D> +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017 (r312687) D> @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc D> EVENTHANDLER_DECLARE(swapon, swapon_fn); D> EVENTHANDLER_DECLARE(swapoff, swapoff_fn); D> D> +/* ifup/ifdown events */ D> +#define IFNET_EVENT_UP 0 D> +#define IFNET_EVENT_DOWN 1 D> +struct ifnet; D> +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); D> +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); D> + D> #endif /* _SYS_EVENTHANDLER_H_ */ The network stuff shall not be added to sys/eventhandler.h. All these declarations should go to net/if_var.h. There is already a block of event(9) defines there. Please move it there. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Tue Jan 24 19:38: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 968BFCC049C; Tue, 24 Jan 2017 19:38:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65856ABA; Tue, 24 Jan 2017 19:38:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJcAWP081550; Tue, 24 Jan 2017 19:38:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJcAtl081549; Tue, 24 Jan 2017 19:38:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241938.v0OJcAtl081549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:38: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: r312713 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:38:11 -0000 Author: mjg Date: Tue Jan 24 19:38:10 2017 New Revision: 312713 URL: https://svnweb.freebsd.org/changeset/base/312713 Log: MFC r310907: Use vrefact in vnode_pager_alloc. Modified: stable/11/sys/vm/vnode_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Tue Jan 24 19:18:27 2017 (r312712) +++ stable/11/sys/vm/vnode_pager.c Tue Jan 24 19:38:10 2017 (r312713) @@ -265,7 +265,7 @@ retry: #endif VM_OBJECT_WUNLOCK(object); } - vref(vp); + vrefact(vp); return (object); } From owner-svn-src-all@freebsd.org Tue Jan 24 19:39: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 5F6D8CC0534; Tue, 24 Jan 2017 19:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15F25D04; Tue, 24 Jan 2017 19:39:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJdP9S081650; Tue, 24 Jan 2017 19:39:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJdOmP081646; Tue, 24 Jan 2017 19:39:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241939.v0OJdOmP081646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:39: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: r312714 - in stable/11/sys: kern sys vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:39:26 -0000 Author: mjg Date: Tue Jan 24 19:39:24 2017 New Revision: 312714 URL: https://svnweb.freebsd.org/changeset/base/312714 Log: MFC r310805: Remove cpu_spinwait after seq_consistent. It does not add any benefit as the read routine will do it as necessary. Modified: stable/11/sys/kern/kern_descrip.c stable/11/sys/sys/seq.h stable/11/sys/vm/vm_domain.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:39:24 2017 (r312714) @@ -2477,10 +2477,8 @@ fget_unlocked(struct filedesc *fdp, int fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde(fde); fp = fde->fde_file; - if (!seq_consistent(fd_seq(fdt, fd), seq)) { - cpu_spinwait(); + if (!seq_consistent(fd_seq(fdt, fd), seq)) continue; - } #else fp = fdt->fdt_ofiles[fd].fde_file; #endif Modified: stable/11/sys/sys/seq.h ============================================================================== --- stable/11/sys/sys/seq.h Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/sys/seq.h Tue Jan 24 19:39:24 2017 (r312714) @@ -59,7 +59,6 @@ typedef uint32_t seq_t; * lobj = gobj; * if (seq_consistent(&gobj->seq, seq)) * break; - * cpu_spinwait(); * } * foo(lobj); */ Modified: stable/11/sys/vm/vm_domain.c ============================================================================== --- stable/11/sys/vm/vm_domain.c Tue Jan 24 19:38:10 2017 (r312713) +++ stable/11/sys/vm/vm_domain.c Tue Jan 24 19:39:24 2017 (r312714) @@ -140,7 +140,6 @@ vm_domain_policy_localcopy(struct vm_dom *dst = *src; if (seq_consistent(&src->seq, seq)) return; - cpu_spinwait(); } } @@ -168,7 +167,6 @@ vm_domain_policy_copy(struct vm_domain_p seq_write_end(&dst->seq); return; } - cpu_spinwait(); } } @@ -330,7 +328,6 @@ vm_domain_iterator_set_policy(struct vm_ _vm_domain_iterator_set_policy(vi, &vt_lcl); return; } - cpu_spinwait(); } } From owner-svn-src-all@freebsd.org Tue Jan 24 19:40: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 6571CCC05B5; Tue, 24 Jan 2017 19:40:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 400A9E99; Tue, 24 Jan 2017 19:40:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJeZ2R081772; Tue, 24 Jan 2017 19:40:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJeZnS081771; Tue, 24 Jan 2017 19:40:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241940.v0OJeZnS081771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:40:35 +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: r312715 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:40:36 -0000 Author: mjg Date: Tue Jan 24 19:40:35 2017 New Revision: 312715 URL: https://svnweb.freebsd.org/changeset/base/312715 Log: MFC r310983: vfs: switch nodes_created, recycles_count and free_owe_inact to counter(9) Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:39:24 2017 (r312714) +++ stable/11/sys/kern/vfs_subr.c Tue Jan 24 19:40:35 2017 (r312715) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -123,9 +124,9 @@ static unsigned long numvnodes; SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "Number of vnodes in existence"); -static u_long vnodes_created; -SYSCTL_ULONG(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, - 0, "Number of vnodes created by getnewvnode"); +static counter_u64_t vnodes_created; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, vnodes_created, CTLFLAG_RD, &vnodes_created, + "Number of vnodes created by getnewvnode"); /* * Conversion tables for conversion from vnode types to inode formats @@ -175,8 +176,8 @@ static u_long freevnodes; SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, "Number of \"free\" vnodes"); -static u_long recycles_count; -SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0, +static counter_u64_t recycles_count; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, "Number of vnodes recycled to meet vnode cache targets"); /* @@ -188,8 +189,8 @@ static int reassignbufcalls; SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, &reassignbufcalls, 0, "Number of calls to reassignbuf"); -static u_long free_owe_inact; -SYSCTL_ULONG(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, 0, +static counter_u64_t free_owe_inact; +SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, "Number of times free vnodes kept on active list due to VFS " "owing inactivation"); @@ -472,6 +473,11 @@ vntblinit(void *dummy __unused) NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); uma_prealloc(buf_trie_zone, nbuf); + + vnodes_created = counter_u64_alloc(M_WAITOK); + recycles_count = counter_u64_alloc(M_WAITOK); + free_owe_inact = counter_u64_alloc(M_WAITOK); + /* * Initialize the filesystem syncer. */ @@ -918,7 +924,7 @@ vlrureclaim(struct mount *mp, int reclai } KASSERT((vp->v_iflag & VI_DOOMED) == 0, ("VI_DOOMED unexpectedly detected in vlrureclaim()")); - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); VOP_UNLOCK(vp, 0); vdropl(vp); @@ -1217,7 +1223,7 @@ vtryrecycle(struct vnode *vp) return (EBUSY); } if ((vp->v_iflag & VI_DOOMED) == 0) { - atomic_add_long(&recycles_count, 1); + counter_u64_add(recycles_count, 1); vgonel(vp); } VOP_UNLOCK(vp, LK_INTERLOCK); @@ -1376,7 +1382,7 @@ getnewvnode(const char *tag, struct moun atomic_add_long(&numvnodes, 1); mtx_unlock(&vnode_free_list_mtx); alloc: - atomic_add_long(&vnodes_created, 1); + counter_u64_add(vnodes_created, 1); vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK); /* * Locks are given the generic name "vnode" when created. @@ -2855,7 +2861,7 @@ _vdrop(struct vnode *vp, bool locked) vp->v_iflag |= VI_FREE; mtx_unlock(&vnode_free_list_mtx); } else { - atomic_add_long(&free_owe_inact, 1); + counter_u64_add(free_owe_inact, 1); } VI_UNLOCK(vp); return; From owner-svn-src-all@freebsd.org Tue Jan 24 19:41: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 3EA67CC064E; Tue, 24 Jan 2017 19:41:57 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D90711F5; Tue, 24 Jan 2017 19:41:56 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJfulP084824; Tue, 24 Jan 2017 19:41:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJfuZ4084823; Tue, 24 Jan 2017 19:41:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241941.v0OJfuZ4084823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:41: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: r312716 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:41:57 -0000 Author: mjg Date: Tue Jan 24 19:41:55 2017 New Revision: 312716 URL: https://svnweb.freebsd.org/changeset/base/312716 Log: MFC r311004: fd: access openfiles once in falloc_noinstall This is similar to what's done with nprocs. Note this is only a band aid. Modified: stable/11/sys/kern/kern_descrip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:40:35 2017 (r312715) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 24 19:41:55 2017 (r312716) @@ -1751,21 +1751,23 @@ falloc_noinstall(struct thread *td, stru { struct file *fp; int maxuserfiles = maxfiles - (maxfiles / 20); + int openfiles_new; static struct timeval lastfail; static int curfail; KASSERT(resultfp != NULL, ("%s: resultfp == NULL", __func__)); - if ((openfiles >= maxuserfiles && + openfiles_new = atomic_fetchadd_int(&openfiles, 1) + 1; + if ((openfiles_new >= maxuserfiles && priv_check(td, PRIV_MAXFILES) != 0) || - openfiles >= maxfiles) { + openfiles_new >= maxfiles) { + atomic_subtract_int(&openfiles, 1); if (ppsratecheck(&lastfail, &curfail, 1)) { printf("kern.maxfiles limit exceeded by uid %i, (%s) " "please see tuning(7).\n", td->td_ucred->cr_ruid, td->td_proc->p_comm); } return (ENFILE); } - atomic_add_int(&openfiles, 1); fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); refcount_init(&fp->f_count, 1); fp->f_cred = crhold(td->td_ucred); From owner-svn-src-all@freebsd.org Tue Jan 24 19:45: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 96470CC0836; Tue, 24 Jan 2017 19:45:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70F141660; Tue, 24 Jan 2017 19:45:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OJjXZ9086095; Tue, 24 Jan 2017 19:45:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJjXM6086094; Tue, 24 Jan 2017 19:45:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701241945.v0OJjXM6086094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 19:45: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: r312718 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 19:45:34 -0000 Author: mjg Date: Tue Jan 24 19:45:33 2017 New Revision: 312718 URL: https://svnweb.freebsd.org/changeset/base/312718 Log: MFC r310766,r310767,r310774,r310779: cache: drop the NULL check from VP2VNODELOCK Now that negative entries are annotated with a dedicated flag, NULL vnodes are no longer passed. == cache: depessimize hashing macros/inlines All hash sizes are power-of-2, but the compiler does not know that for sure and 'foo % size' forces doing a division. Store the size - 1 and use 'foo & hash' instead which allows mere shift. == cache: move shrink lock init to nchinit This gets rid of unnecesary sysinit usage. While here also rename the lock to be consistent with the rest. == cache: sprinkle __predict_false Modified: stable/11/sys/kern/vfs_cache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_cache.c ============================================================================== --- stable/11/sys/kern/vfs_cache.c Tue Jan 24 19:42:24 2017 (r312717) +++ stable/11/sys/kern/vfs_cache.c Tue Jan 24 19:45:33 2017 (r312718) @@ -229,8 +229,6 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsreq struct nchstats nchstats; /* cache effectiveness statistics */ static struct mtx ncneg_shrink_lock; -MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg", - MTX_DEF); struct neglist { struct mtx nl_lock; @@ -242,30 +240,29 @@ static struct neglist ncneg_hot; static int shrink_list_turn; -static u_int numneglists; +#define numneglists (ncneghash + 1) +static u_int ncneghash; static inline struct neglist * NCP2NEGLIST(struct namecache *ncp) { - return (&neglists[(((uintptr_t)(ncp) >> 8) % numneglists)]); + return (&neglists[(((uintptr_t)(ncp) >> 8) & ncneghash)]); } -static u_int numbucketlocks; +#define numbucketlocks (ncbuckethash + 1) +static u_int ncbuckethash; static struct rwlock_padalign *bucketlocks; #define HASH2BUCKETLOCK(hash) \ - ((struct rwlock *)(&bucketlocks[((hash) % numbucketlocks)])) + ((struct rwlock *)(&bucketlocks[((hash) & ncbuckethash)])) -static u_int numvnodelocks; +#define numvnodelocks (ncvnodehash + 1) +static u_int ncvnodehash; static struct mtx *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { - struct mtx *vlp; - if (vp == NULL) - return (NULL); - vlp = &vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]; - return (vlp); + return (&vnodelocks[(((uintptr_t)(vp) >> 8) & ncvnodehash)]); } /* @@ -1107,7 +1104,7 @@ cache_lookup(struct vnode *dvp, struct v uint32_t hash; int error, ltype; - if (!doingcache) { + if (__predict_false(!doingcache)) { cnp->cn_flags &= ~MAKEENTRY; return (0); } @@ -1374,8 +1371,8 @@ cache_lock_vnodes_cel_3(struct celocksta cache_assert_vlp_locked(cel->vlp[1]); MPASS(cel->vlp[2] == NULL); + MPASS(vp != NULL); vlp = VP2VNODELOCK(vp); - MPASS(vlp != NULL); ret = true; if (vlp >= cel->vlp[1]) { @@ -1547,13 +1544,13 @@ cache_enter_time(struct vnode *dvp, stru VNASSERT(dvp == NULL || (dvp->v_iflag & VI_DOOMED) == 0, dvp, ("cache_enter: Doomed vnode used as src")); - if (!doingcache) + if (__predict_false(!doingcache)) return; /* * Avoid blowout in namecache entries. */ - if (numcache >= desiredvnodes * ncsizefactor) + if (__predict_false(numcache >= desiredvnodes * ncsizefactor)) return; cache_celockstate_init(&cel); @@ -1779,21 +1776,21 @@ nchinit(void *dummy __unused) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); - numbucketlocks = cache_roundup_2(mp_ncpus * 64); - if (numbucketlocks > nchash + 1) - numbucketlocks = nchash + 1; + ncbuckethash = cache_roundup_2(mp_ncpus * 64) - 1; + if (ncbuckethash > nchash) + ncbuckethash = nchash; bucketlocks = malloc(sizeof(*bucketlocks) * numbucketlocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numbucketlocks; i++) rw_init_flags(&bucketlocks[i], "ncbuc", RW_DUPOK | RW_RECURSE); - numvnodelocks = cache_roundup_2(mp_ncpus * 64); + ncvnodehash = cache_roundup_2(mp_ncpus * 64) - 1; vnodelocks = malloc(sizeof(*vnodelocks) * numvnodelocks, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numvnodelocks; i++) mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); ncpurgeminvnodes = numbucketlocks; - numneglists = 4; + ncneghash = 3; neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numneglists; i++) { @@ -1803,6 +1800,8 @@ nchinit(void *dummy __unused) mtx_init(&ncneg_hot.nl_lock, "ncneglh", NULL, MTX_DEF); TAILQ_INIT(&ncneg_hot.nl_list); + mtx_init(&ncneg_shrink_lock, "ncnegs", NULL, MTX_DEF); + numcalls = counter_u64_alloc(M_WAITOK); dothits = counter_u64_alloc(M_WAITOK); dotdothits = counter_u64_alloc(M_WAITOK); @@ -2055,9 +2054,9 @@ kern___getcwd(struct thread *td, char *b struct vnode *cdir, *rdir; int error; - if (disablecwd) + if (__predict_false(disablecwd)) return (ENODEV); - if (buflen < 2) + if (__predict_false(buflen < 2)) return (EINVAL); if (buflen > path_max) buflen = path_max; @@ -2108,9 +2107,9 @@ vn_fullpath(struct thread *td, struct vn struct vnode *rdir; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); @@ -2142,9 +2141,9 @@ vn_fullpath_global(struct thread *td, st char *buf; int error; - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); - if (vn == NULL) + if (__predict_false(vn == NULL)) return (EINVAL); buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); error = vn_fullpath1(td, vn, rootvnode, buf, retbuf, MAXPATHLEN); @@ -2408,7 +2407,7 @@ vn_path_to_global_path(struct thread *td ASSERT_VOP_ELOCKED(vp, __func__); /* Return ENODEV if sysctl debug.disablefullpath==1 */ - if (disablefullpath) + if (__predict_false(disablefullpath)) return (ENODEV); /* Construct global filesystem path from vp. */ From owner-svn-src-all@freebsd.org Tue Jan 24 20:12: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 6CE8BCC0ED8; Tue, 24 Jan 2017 20:12:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id B5E0096E; Tue, 24 Jan 2017 20:12:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id A8B4DD44B8C; Wed, 25 Jan 2017 07:12:16 +1100 (AEDT) Date: Wed, 25 Jan 2017 07:12:14 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Conrad E. Meyer" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312702 - in head/sys: kern libkern sys In-Reply-To: <201701241805.v0OI5Tb6043549@repo.freebsd.org> Message-ID: <20170125050656.J2916@besplex.bde.org> References: <201701241805.v0OI5Tb6043549@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=c+HbeV1l c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=6I5d2MoRAAAA:8 a=KH79ZE8_bf9aFMxDw-gA:9 a=6QXdkIH_neLgjM73:21 a=KVQZsPGOW9ByJIub:21 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 20:12:28 -0000 On Tue, 24 Jan 2017, Conrad E. Meyer wrote: > Log: > Use time_t for intermediate values to avoid overflow in clock_ts_to_ct This is bogus. time_t is for storing times in seconds, not for times in days, hours or minutes. > Add additionally safety and overflow checks to clock_ts_to_ct and the > BCD routines while we're here. I also disagreed with previous versions of this fix. > Perform a safety check in sys_clock_settime() first to avoid easy local > root panic, without having to propagate an error value back through > dozens of APIs currently lacking error returns. I agree with not over-engineering this to check at all levels. But top-level check needs to be more stringent and magic to work. It is easier to check a couple of levels lower. > PR: 211960, 214300 > Submitted by: Justin McOmie , kib@ > Reported by: Tim Newsham > Reviewed by: kib@ > Sponsored by: Dell EMC Isilon, FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D9279 > > Modified: > head/sys/kern/kern_time.c > head/sys/kern/subr_clock.c > head/sys/libkern/bcd.c > head/sys/sys/libkern.h > > Modified: head/sys/kern/kern_time.c > ============================================================================== > --- head/sys/kern/kern_time.c Tue Jan 24 17:30:13 2017 (r312701) > +++ head/sys/kern/kern_time.c Tue Jan 24 18:05:29 2017 (r312702) > @@ -387,6 +387,11 @@ sys_clock_settime(struct thread *td, str > return (kern_clock_settime(td, uap->clock_id, &ats)); > } > > +static int allow_insane_settime = 0; > +SYSCTL_INT(_debug, OID_AUTO, allow_insane_settime, CTLFLAG_RWTUN, > + &allow_insane_settime, 0, > + "do not perform possibly restrictive checks on settime(2) args"); Debugging code; shoouldn't be committed. > + > int > kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) > { > @@ -400,6 +405,8 @@ kern_clock_settime(struct thread *td, cl > if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || > ats->tv_sec < 0) > return (EINVAL); Times before the Epoch were already disallowed here, but this doesn't prevent negative times being passed to lower levels -- see below. > + if (!allow_insane_settime && ats->tv_sec > 9999ULL * 366 * 24 * 60 * 60) > + return (EINVAL); This uses the long long abomination. This checking belongs in lower levels. It has a buggy limit. Since the average length of a year is below 366, this can give a year later than 9999, so the year is not guaranteed to be represntable which is not representable in hardware with 4 decimal digits, so even lower levels with such hardware must do their own the check. INT_MAX - is a more reasonable arbitrary limit. Not LONG_MAX, since that is usually the same as TIME_T_MAX, and we want to be able to add the timezone offset without overflow. On arches with 32-bit time_t, the above limit exceeds TIME_T_MAX, so the code should fail to compile due to being tautologically true. The compiler must be smart enough to see the previous check that ats->tv_sec < 0, so that it knows that the comparison cannot fail due to sign extension bugs (negative times promoting to ULLONG_MAX). Using the signed abomination 9999LL would avoid the sign extension. > /* XXX Don't convert nsec->usec and back */ > TIMESPEC_TO_TIMEVAL(&atv, ats); > error = settime(td, &atv); > > Modified: head/sys/kern/subr_clock.c > ============================================================================== > --- head/sys/kern/subr_clock.c Tue Jan 24 17:30:13 2017 (r312701) > +++ head/sys/kern/subr_clock.c Tue Jan 24 18:05:29 2017 (r312702) > @@ -178,7 +178,7 @@ clock_ct_to_ts(struct clocktime *ct, str > void > clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) > { > - int i, year, days; > + time_t i, year, days; > time_t rsec; /* remainder seconds */ > time_t secs; This works provided the caller never passes a negative time, but obfuscates the range checking. rsec should also be int. > > @@ -214,6 +214,20 @@ clock_ts_to_ct(struct timespec *ts, stru > print_ct(ct); > printf("\n"); > } > + > + KASSERT(ct->year >= 0 && ct->year < 10000, > + ("year %d isn't a 4 digit year", ct->year)); This is too device-dependent, and inconsistent with clock_ct_to_ts(). clock_ct_to_cs() checks that the year is < 2037. So allowing years >= 2037 here is worse than useless -- it allows writing times that will be rejected when read back on the next boot of FreeBSD, although BIOSes and other OSes might accept them. The correct check here is simply an up-front test that tv->tv_sec >= 0 (don't trust callers to pass non-negative years) && tv->tv_sec < INT32_MAX. This allows calculation of everything without overflow using int variables. Further range checks are required: (1) It was correct to not trust callers to pass nonnegative times, so the check here is necessary. Negative times are passed here when the time in clock_settime is small and utc_offset() is negative. (2) Similarly for your sanity check. On arches with 64-bit time_t, it accidentally preverts overlow when a positive utc_offset() is added, but nothing prevents overflow on arches with 32-bit time_t. We could allow this overflow since it usually gives the benign behaviour of a large negative value which will be detected here. (3) The year should be limited to 2037 to be consistent wth clock_ct_to_cs() checks that the year is < 2037. Early days in year 2038 fit in a 32-bit time_t, but later days don't, so the code uses 2037 for simplicity. 2037 should fit in even unreasonable hardware. It would be a good idea to also limit to >= 2000 or >= 1980. < 1970 is already disallowed, except for the negative times bugs. The code here is broken for negative times. I think gives year 1969 for small negative offsets, but divison and modulo round the days, minutes and seconds variables towards minus infinity, giving negative or zero values (usually negative)). > + KASSERT(ct->mon >= 1 && ct->mon <= 12, > + ("month %d not in 1-12", ct->mon)); > + KASSERT(ct->day >= 1 && ct->day <= 31, > + ("day %d not in 1-31", ct->day)); > + KASSERT(ct->hour >= 0 && ct->hour <= 23, > + ("hour %d not in 0-23", ct->hour)); > + KASSERT(ct->min >= 0 && ct->min <= 59, > + ("minute %d not in 0-59", ct->min)); Over-engineered, but it would detect the negative times bugs. > + /* Not sure if this interface needs to handle leapseconds or not. */ > + KASSERT(ct->sec >= 0 && ct->sec <= 60, > + ("seconds %d not in 0-60", ct->sec)); It really can't. POSIX time is broken by not supporting leap seconds, so the leap seconds are not visible here, and in the opposite direction we leap seconds in the hardware would just get in the way -- we would have to drop then to get POSIX time. > } > > int > > ... > Modified: head/sys/sys/libkern.h > ============================================================================== > --- head/sys/sys/libkern.h Tue Jan 24 17:30:13 2017 (r312701) > +++ head/sys/sys/libkern.h Tue Jan 24 18:05:29 2017 (r312702) > @@ -49,9 +49,36 @@ extern u_char const bcd2bin_data[]; > extern u_char const bin2bcd_data[]; > extern char const hex2ascii_data[]; > > -#define bcd2bin(bcd) (bcd2bin_data[bcd]) > -#define bin2bcd(bin) (bin2bcd_data[bin]) > -#define hex2ascii(hex) (hex2ascii_data[hex]) > +#define LIBKERN_LEN_BCD2BIN 154 > +#define LIBKERN_LEN_BIN2BCD 100 > +#define LIBKERN_LEN_HEX2ASCII 36 This uses Much ugliness to avoid namespace pollution. > + > +static inline u_char Style bugs: 'inline' not spelled __inline. > +bcd2bin(int bcd) > +{ > + > + KASSERT(bcd >= 0 && bcd < LIBKERN_LEN_BCD2BIN, > + ("invalid bcd %d", bcd)); > + return (bcd2bin_data[bcd]); > +} > + > +static inline u_char > +bin2bcd(int bin) > +{ > + > + KASSERT(bin >= 0 && bin < LIBKERN_LEN_BIN2BCD, > + ("invalid bin %d", bin)); > + return (bin2bcd_data[bin]); > +} > + > +static inline char > +hex2ascii(int hex) > +{ > + > + KASSERT(hex >= 0 && hex < LIBKERN_LEN_HEX2ASCII, > + ("invalid hex %d", hex)); > + return (hex2ascii_data[hex]); > +} The macros were excessive optimization, but at least didn't take much source code. The inlines are more excessive. I think converting everything to extern only gives minor space pessimizations and time pessimizations too small to measure. hex2ascii() is mainly used by printf(). The others are used by a bit more than clock code (some cam). contrib/octeon has private versions implemented using runtime divisions and multiplications instead of table lookup. These take args of type uint8_t, so some bounds checking is automatic, but silent truncation can occur when the args are passed. > > static __inline int imax(int a, int b) { return (a > b ? a : b); } > static __inline int imin(int a, int b) { return (a < b ? a : b); } Bruce From owner-svn-src-all@freebsd.org Tue Jan 24 21:07: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 70D58CBD36B; Tue, 24 Jan 2017 21:07:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FF6A19C; Tue, 24 Jan 2017 21:07:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OL7Dpp020078; Tue, 24 Jan 2017 21:07:13 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OL7Dit020077; Tue, 24 Jan 2017 21:07:13 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201701242107.v0OL7Dit020077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 24 Jan 2017 21:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312721 - head/share/skel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 21:07:14 -0000 Author: jilles Date: Tue Jan 24 21:07:13 2017 New Revision: 312721 URL: https://svnweb.freebsd.org/changeset/base/312721 Log: skel: Remove reference to deleted part in previous commit to this file. Reported by: Rodney W. Grimes MFC after: 1 week Modified: head/share/skel/dot.shrc Modified: head/share/skel/dot.shrc ============================================================================== --- head/share/skel/dot.shrc Tue Jan 24 19:59:25 2017 (r312720) +++ head/share/skel/dot.shrc Tue Jan 24 21:07:13 2017 (r312721) @@ -13,8 +13,8 @@ # # umask 022 -# Uncomment this and comment the above to enable the builtin vi(1) command -# line editor in sh(1), e.g. ESC to go into visual mode. +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-all@freebsd.org Tue Jan 24 21: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 3A20ACBD3DA; Tue, 24 Jan 2017 21:07:45 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 088B2334; Tue, 24 Jan 2017 21:07:45 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id E577A3D; Tue, 24 Jan 2017 22:07:42 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id D708328494; Tue, 24 Jan 2017 22:07:42 +0100 (CET) Date: Tue, 24 Jan 2017 22:07:42 +0100 From: Jilles Tjoelker To: "Rodney W. Grimes" 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: r312653 - stable/11/share/skel Message-ID: <20170124210742.GA83102@stack.nl> References: <201701222131.v0MLVWjg037264@repo.freebsd.org> <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701222330.v0MNUJMp000255@pdx.rh.CN85.dnsmgr.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 21:07:45 -0000 On Sun, Jan 22, 2017 at 03:30:19PM -0800, Rodney W. Grimes wrote: > > -# Enable the builtin emacs(1) command line editor in sh(1), > > -# e.g. C-a -> beginning-of-line. > > -set -o emacs > > - > > # Uncomment this and comment the above to enable the builtin vi(1) command > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > documentation error.... please correct that too. Fixed, thanks. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Tue Jan 24 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 B961ACBDA12; Tue, 24 Jan 2017 21:30:32 +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 7A1DDF32; Tue, 24 Jan 2017 21:30:32 +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 v0OLUVgV028624; Tue, 24 Jan 2017 21:30:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OLUVsC028623; Tue, 24 Jan 2017 21:30:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201701242130.v0OLUVsC028623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 24 Jan 2017 21:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312722 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 21:30:32 -0000 Author: tuexen Date: Tue Jan 24 21:30:31 2017 New Revision: 312722 URL: https://svnweb.freebsd.org/changeset/base/312722 Log: Fix a bug where the overhead of the I-DATA chunk was not considered. MFC after: 1 week Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Tue Jan 24 21:07:13 2017 (r312721) +++ head/sys/netinet/sctp_output.c Tue Jan 24 21:30:31 2017 (r312722) @@ -7080,11 +7080,9 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, } } - -static int -sctp_can_we_split_this(struct sctp_tcb *stcb, - uint32_t length, - uint32_t goal_mtu, uint32_t frag_point, int eeor_on) +static uint32_t +sctp_can_we_split_this(struct sctp_tcb *stcb, uint32_t length, + uint32_t space_left, uint32_t frag_point, int eeor_on) { /* * Make a decision on if I should split a msg into multiple parts. @@ -7096,7 +7094,7 @@ sctp_can_we_split_this(struct sctp_tcb * * entire thing, since it might be all the guy is putting in * the hopper. */ - if (goal_mtu >= length) { + if (space_left >= length) { /*- * If we have data outstanding, * we get another chance when the sack @@ -7113,7 +7111,7 @@ sctp_can_we_split_this(struct sctp_tcb * } else { /* You can fill the rest */ - return (goal_mtu); + return (space_left); } } /*- @@ -7124,28 +7122,27 @@ sctp_can_we_split_this(struct sctp_tcb * if (SCTP_SB_LIMIT_SND(stcb->sctp_socket) < frag_point) { return (length); } - if ((length <= goal_mtu) || - ((length - goal_mtu) < SCTP_BASE_SYSCTL(sctp_min_residual))) { + if ((length <= space_left) || + ((length - space_left) < SCTP_BASE_SYSCTL(sctp_min_residual))) { /* Sub-optimial residual don't split in non-eeor mode. */ return (0); } /* - * If we reach here length is larger than the goal_mtu. Do we wish + * If we reach here length is larger than the space_left. Do we wish * to split it for the sake of packet putting together? */ - if (goal_mtu >= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) { + if (space_left >= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) { /* Its ok to split it */ - return (min(goal_mtu, frag_point)); + return (min(space_left, frag_point)); } /* Nope, can't split */ return (0); - } static uint32_t sctp_move_to_outqueue(struct sctp_tcb *stcb, struct sctp_stream_out *strq, - uint32_t goal_mtu, + uint32_t space_left, uint32_t frag_point, int *giveup, int eeor_mode, @@ -7306,7 +7303,7 @@ re_look: sp->some_taken = 1; } } else { - to_move = sctp_can_we_split_this(stcb, length, goal_mtu, frag_point, eeor_mode); + to_move = sctp_can_we_split_this(stcb, length, space_left, frag_point, eeor_mode); if (to_move) { /*- * We use a snapshot of length in case it @@ -7701,56 +7698,66 @@ sctp_fill_outqueue(struct sctp_tcb *stcb { struct sctp_association *asoc; struct sctp_stream_out *strq; - int goal_mtu, moved_how_much, total_moved = 0, bail = 0; - int giveup; + uint32_t space_left, moved, total_moved; + int bail, giveup; SCTP_TCB_LOCK_ASSERT(stcb); asoc = &stcb->asoc; + total_moved = 0; switch (net->ro._l_addr.sa.sa_family) { #ifdef INET case AF_INET: - goal_mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + space_left = net->mtu - SCTP_MIN_V4_OVERHEAD; break; #endif #ifdef INET6 case AF_INET6: - goal_mtu = net->mtu - SCTP_MIN_OVERHEAD; + space_left = net->mtu - SCTP_MIN_OVERHEAD; break; #endif default: /* TSNH */ - goal_mtu = net->mtu; + space_left = net->mtu; break; } /* Need an allowance for the data chunk header too */ if (stcb->asoc.idata_supported == 0) { - goal_mtu -= sizeof(struct sctp_data_chunk); + space_left -= sizeof(struct sctp_data_chunk); } else { - goal_mtu -= sizeof(struct sctp_idata_chunk); + space_left -= sizeof(struct sctp_idata_chunk); } /* must make even word boundary */ - goal_mtu &= 0xfffffffc; + space_left &= 0xfffffffc; strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); - while ((goal_mtu > 0) && strq) { + while ((space_left > 0) && (strq != NULL)) { giveup = 0; bail = 0; - moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, + moved = sctp_move_to_outqueue(stcb, strq, space_left, frag_point, &giveup, eeor_mode, &bail, so_locked); - stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much); - - if ((giveup) || bail) { + stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved); + if ((giveup != 0) || (bail != 0)) { break; } strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); - if (strq == NULL) { - break; + total_moved += moved; + space_left -= moved; + if (stcb->asoc.idata_supported == 0) { + if (space_left >= sizeof(struct sctp_data_chunk)) { + space_left -= sizeof(struct sctp_data_chunk); + } else { + space_left = 0; + } + } else { + if (space_left >= sizeof(struct sctp_idata_chunk)) { + space_left -= sizeof(struct sctp_idata_chunk); + } else { + space_left = 0; + } } - total_moved += moved_how_much; - goal_mtu -= (moved_how_much + sizeof(struct sctp_data_chunk)); - goal_mtu &= 0xfffffffc; + space_left &= 0xfffffffc; } - if (bail) + if (bail != 0) *quit_now = 1; stcb->asoc.ss_functions.sctp_ss_packet_done(stcb, net, asoc); From owner-svn-src-all@freebsd.org Tue Jan 24 21: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 2AA80CC0FBE; Tue, 24 Jan 2017 21:48:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEA521569; Tue, 24 Jan 2017 21:48:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OLmwFZ037502; Tue, 24 Jan 2017 21:48:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OLmwNt037501; Tue, 24 Jan 2017 21:48:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701242148.v0OLmwNt037501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 21:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312723 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 21:48:59 -0000 Author: mjg Date: Tue Jan 24 21:48:57 2017 New Revision: 312723 URL: https://svnweb.freebsd.org/changeset/base/312723 Log: proc: perform a lockless check in sys_issetugid Discussed with: kib MFC after: 1 week Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Tue Jan 24 21:30:31 2017 (r312722) +++ head/sys/kern/kern_prot.c Tue Jan 24 21:48:57 2017 (r312723) @@ -1225,9 +1225,7 @@ sys_issetugid(register struct thread *td * a user without an exec - programs cannot know *everything* * that libc *might* have put in their data segment. */ - PROC_LOCK(p); td->td_retval[0] = (p->p_flag & P_SUGID) ? 1 : 0; - PROC_UNLOCK(p); return (0); } From owner-svn-src-all@freebsd.org Tue Jan 24 22:00: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 BEA94CBF3AD; Tue, 24 Jan 2017 22:00:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 995EF1D01; Tue, 24 Jan 2017 22:00:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0OM0GMu042086; Tue, 24 Jan 2017 22:00:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OM0GRO042084; Tue, 24 Jan 2017 22:00:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701242200.v0OM0GRO042084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 24 Jan 2017 22:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312724 - in head/sys: sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 22:00:17 -0000 Author: mjg Date: Tue Jan 24 22:00:16 2017 New Revision: 312724 URL: https://svnweb.freebsd.org/changeset/base/312724 Log: hwpmc: partially depessimize munmap handling if the module is not loaded HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the common (module not loaded) case. In particular this avoids permission checks + lock downgrade singlethreaded and in cases were an executable mapping is found the pmc sx lock is no longer bounced. Note this is a band aid. MFC after: 1 week Modified: head/sys/sys/pmckern.h head/sys/vm/vm_mmap.c Modified: head/sys/sys/pmckern.h ============================================================================== --- head/sys/sys/pmckern.h Tue Jan 24 21:48:57 2017 (r312723) +++ head/sys/sys/pmckern.h Tue Jan 24 22:00:16 2017 (r312724) @@ -174,6 +174,9 @@ extern const int pmc_kernel_version; /* PMC soft per cpu trapframe */ extern struct trapframe pmc_tf[MAXCPU]; +/* Quick check if preparatory work is necessary */ +#define PMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL) + /* Hook invocation; for use within the kernel */ #define PMC_CALL_HOOK(t, cmd, arg) \ do { \ Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Jan 24 21:48:57 2017 (r312723) +++ head/sys/vm/vm_mmap.c Tue Jan 24 22:00:16 2017 (r312724) @@ -526,6 +526,7 @@ sys_munmap(td, uap) #ifdef HWPMC_HOOKS struct pmckern_map_out pkm; vm_map_entry_t entry; + bool pmc_handled; #endif vm_offset_t addr; vm_size_t size, pageoff; @@ -551,20 +552,24 @@ sys_munmap(td, uap) return (EINVAL); vm_map_lock(map); #ifdef HWPMC_HOOKS - /* - * Inform hwpmc if the address range being unmapped contains - * an executable region. - */ - pkm.pm_address = (uintptr_t) NULL; - if (vm_map_lookup_entry(map, addr, &entry)) { - for (; - entry != &map->header && entry->start < addr + size; - entry = entry->next) { - if (vm_map_check_protection(map, entry->start, - entry->end, VM_PROT_EXECUTE) == TRUE) { - pkm.pm_address = (uintptr_t) addr; - pkm.pm_size = (size_t) size; - break; + pmc_handled = false; + if (PMC_HOOK_INSTALLED(PMC_FN_MUNMAP)) { + pmc_handled = true; + /* + * Inform hwpmc if the address range being unmapped contains + * an executable region. + */ + pkm.pm_address = (uintptr_t) NULL; + if (vm_map_lookup_entry(map, addr, &entry)) { + for (; + entry != &map->header && entry->start < addr + size; + entry = entry->next) { + if (vm_map_check_protection(map, entry->start, + entry->end, VM_PROT_EXECUTE) == TRUE) { + pkm.pm_address = (uintptr_t) addr; + pkm.pm_size = (size_t) size; + break; + } } } } @@ -572,14 +577,16 @@ sys_munmap(td, uap) vm_map_delete(map, addr, addr + size); #ifdef HWPMC_HOOKS - /* downgrade the lock to prevent a LOR with the pmc-sx lock */ - vm_map_lock_downgrade(map); - if (pkm.pm_address != (uintptr_t) NULL) - PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm); - vm_map_unlock_read(map); -#else - vm_map_unlock(map); + if (__predict_false(pmc_handled)) { + /* downgrade the lock to prevent a LOR with the pmc-sx lock */ + vm_map_lock_downgrade(map); + if (pkm.pm_address != (uintptr_t) NULL) + PMC_CALL_HOOK(td, PMC_FN_MUNMAP, (void *) &pkm); + vm_map_unlock_read(map); + } else #endif + vm_map_unlock(map); + /* vm_map_delete returns nothing but KERN_SUCCESS anyway */ return (0); } From owner-svn-src-all@freebsd.org Tue Jan 24 22:20: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 0D1E0CBFAB9; Tue, 24 Jan 2017 22:20:56 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0113.outbound.protection.outlook.com [104.47.36.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE518B8F; Tue, 24 Jan 2017 22:20:55 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IhfhCdDmFeoC7OjfPf0zsj+6wxYow3iDrTLZR7xwYMg=; b=F/7YEa2nXT5CpKCUkj1Uog6bcbvgBONiMqm3ylTDqOe1s/bTyIm1mHbG+8C2I3oZh71zrlIthB1ftOAJz6wV4LJaz30Wvl6FR3HMc5rIw+7PjDGc7czgqEsV+LfR9c5LyAKoMqH4D4CiNkkeLTPoz2ILOorrP1d3RQkYtuE78ko= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2670.namprd03.prod.outlook.com (10.168.207.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Tue, 24 Jan 2017 22:20:53 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0860.021; Tue, 24 Jan 2017 22:20:53 +0000 From: Dexuan Cui To: Gleb Smirnoff , Dexuan Cui CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r312687 - in head/sys: net sys Thread-Topic: svn commit: r312687 - in head/sys: net sys Thread-Index: AQHSdnftoCXmn3KP+kO3oJR5DjhMrKFIMlEw Date: Tue, 24 Jan 2017 22:20:53 +0000 Message-ID: References: <201701240919.v0O9JlM7021007@repo.freebsd.org> <20170124192725.GX2611@FreeBSD.org> In-Reply-To: <20170124192725.GX2611@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [139.226.141.22] x-ms-office365-filtering-correlation-id: 38c5bb1d-b56c-48b2-e256-08d444a742bb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2670; x-microsoft-exchange-diagnostics: 1; MWHPR03MB2670; 7:OxK4EIQNVK5DppB/SsUOi8PS+ocz3kmr7kdymci07SXDEG7ogvNFwx6wWY5jY27JCLSPNl2Xcv//VWP7jG5UtHXI2emPdJLGIvmt59uODAvljcwcCWUTjx5zJ3oUlJ6qrs5zlXBOM7LiF2BNK6/jDXsqJ4NlpRBVx1UKXO9pzLg+jwg/DrQg18D0Ad9aLlDtwYQKbS28XbxepDOemIdb6NHoqjXUU9BsU5cYbn3z0n45dTt3oHNsgYfLLlplZORTC1w4FxcI3md4ofdmO8DR3Nco0nFhn6hksSIv+SsGZD5i0NXq4ZatD9BnnMruB7lG/AiDPqCnUaB4pu7i6DwfBfAiBlUXoJQl6DJD7BxgAZXQZc+O4UJ9jAzLf3Ee0frut26mnOAOR5p1AOFafGv8ugLDZSb4wEIKvDjE8UgWI9wW27N0SPsxCOurK75PPFwN0mdhf7Cz/HUDwO0+DY+bJfLPcopLe8RviX7XIaJfhUU= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148)(6047074); SRVR:MWHPR03MB2670; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2670; x-forefront-prvs: 0197AFBD92 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39450400003)(39850400002)(39860400002)(39410400002)(39840400002)(24454002)(189002)(199003)(101416001)(305945005)(92566002)(74316002)(106356001)(105586002)(10090500001)(189998001)(106116001)(76176999)(5660300001)(7736002)(50986999)(86362001)(54356999)(2950100002)(7696004)(86612001)(68736007)(5001770100001)(66066001)(97736004)(2900100001)(81166006)(6506006)(6116002)(3846002)(38730400001)(33656002)(229853002)(122556002)(450100001)(6436002)(3660700001)(2906002)(4326007)(102836003)(54906002)(8990500004)(8676002)(55016002)(9686003)(10290500002)(99286003)(5005710100001)(345774005)(3280700002)(81156014)(25786008)(8936002)(77096006)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2670; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2017 22:20:53.2826 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2670 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 22:20:56 -0000 > From: Gleb Smirnoff [mailto:glebius@FreeBSD.org] > Dexuan, >=20 > On Tue, Jan 24, 2017 at 09:19:47AM +0000, Dexuan Cui wrote: > D> --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017 > (r312686) > D> +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017 > (r312687) > D> @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc > D> EVENTHANDLER_DECLARE(swapon, swapon_fn); > D> EVENTHANDLER_DECLARE(swapoff, swapoff_fn); > D> > D> +/* ifup/ifdown events */ > D> +#define IFNET_EVENT_UP 0 > D> +#define IFNET_EVENT_DOWN 1 > D> +struct ifnet; > D> +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); > D> +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); > D> + > D> #endif /* _SYS_EVENTHANDLER_H_ */ >=20 > The network stuff shall not be added to sys/eventhandler.h. >=20 > All these declarations should go to net/if_var.h. There is already > a block of event(9) defines there. Please move it there. >=20 > -- > Totus tuus, Glebius. Hi Gleb, Sorry, I didn't realize this... I'll move it as you suggested. Thank you for the reminder! -- Dexuan From owner-svn-src-all@freebsd.org Tue Jan 24 22:46: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 99812CC026B; Tue, 24 Jan 2017 22:46:44 +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 691F7C86; Tue, 24 Jan 2017 22:46:44 +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 v0OMkhoI063220; Tue, 24 Jan 2017 22:46:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OMkhRs063219; Tue, 24 Jan 2017 22:46:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701242246.v0OMkhRs063219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 24 Jan 2017 22:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312725 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 22:46:44 -0000 Author: emaste Date: Tue Jan 24 22:46:43 2017 New Revision: 312725 URL: https://svnweb.freebsd.org/changeset/base/312725 Log: imgact_elf: refactor et_dyn_addr calculation This simplifies the logic somewhat. It is extracted from the change in review in D5603. Differential Revision: https://reviews.freebsd.org/D9321 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Tue Jan 24 22:00:16 2017 (r312724) +++ head/sys/kern/imgact_elf.c Tue Jan 24 22:46:43 2017 (r312725) @@ -859,6 +859,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i error = ENOEXEC; goto ret; } + et_dyn_addr = 0; if (hdr->e_type == ET_DYN) { if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) { uprintf("Cannot execute shared object\n"); @@ -871,10 +872,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i */ if (baddr == 0) et_dyn_addr = ET_DYN_LOAD_ADDR; - else - et_dyn_addr = 0; - } else - et_dyn_addr = 0; + } sv = brand_info->sysvec; if (interp != NULL && brand_info->interp_newpath != NULL) newinterp = brand_info->interp_newpath; @@ -1058,7 +1056,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i imgp->reloc_base = addr; imgp->proc->p_osrel = osrel; - ret: +ret: free(interp_buf, M_TEMP); return (error); } From owner-svn-src-all@freebsd.org Tue Jan 24 22:52: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 56C12CC0848; Tue, 24 Jan 2017 22:52:10 +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 266E111EA; Tue, 24 Jan 2017 22:52:10 +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 v0OMq97S067365; Tue, 24 Jan 2017 22:52:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OMq9e7067364; Tue, 24 Jan 2017 22:52:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701242252.v0OMq9e7067364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 24 Jan 2017 22:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312726 - head/sys/dev/ath/ath_hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 24 Jan 2017 22:52:10 -0000 Author: adrian Date: Tue Jan 24 22:52:09 2017 New Revision: 312726 URL: https://svnweb.freebsd.org/changeset/base/312726 Log: [ath_hal] note that the CCA configuration setting may be chip-dependent. I bet it isn't, but who knows - this is making assumptions about the layout of AR_DIAG. Modified: head/sys/dev/ath/ath_hal/ah.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Jan 24 22:46:43 2017 (r312725) +++ head/sys/dev/ath/ath_hal/ah.c Tue Jan 24 22:52:09 2017 (r312726) @@ -1415,6 +1415,9 @@ ath_hal_setcca(struct ath_hal *ah, int e /* * Get CCA setting. + * + * XXX TODO: turn this and the above function into methods + * in case there are chipset differences in handling CCA. */ int ath_hal_getcca(struct ath_hal *ah) From owner-svn-src-all@freebsd.org Wed Jan 25 00: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 0138ACC0E34; Wed, 25 Jan 2017 00:11:21 +0000 (UTC) (envelope-from danfe@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 D8515CCE; Wed, 25 Jan 2017 00:11:20 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2A3055398; Wed, 25 Jan 2017 00:11:20 +0000 (UTC) Date: Wed, 25 Jan 2017 00:11:20 +0000 From: Alexey Dokuchaev To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312723 - head/sys/kern Message-ID: <20170125001120.GA4257@FreeBSD.org> References: <201701242148.v0OLmwNt037501@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701242148.v0OLmwNt037501@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 00:11:21 -0000 On Tue, Jan 24, 2017 at 09:48:58PM +0000, Mateusz Guzik wrote: > New Revision: 312723 > URL: https://svnweb.freebsd.org/changeset/base/312723 > > Log: > proc: perform a lockless check in sys_issetugid > > Discussed with: kib Shouldn't the summary of this discussion be included in the commmit log? ./danfe From owner-svn-src-all@freebsd.org Wed Jan 25 00:23: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 198B3CBE482; Wed, 25 Jan 2017 00:23:40 +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 D636284E; Wed, 25 Jan 2017 00:23:39 +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 v0P0Nd23004399; Wed, 25 Jan 2017 00:23:39 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P0Ncs2004392; Wed, 25 Jan 2017 00:23:38 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201701250023.v0P0Ncs2004392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 25 Jan 2017 00:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312728 - head/sys/dev/qlxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 00:23:40 -0000 Author: davidcs Date: Wed Jan 25 00:23:38 2017 New Revision: 312728 URL: https://svnweb.freebsd.org/changeset/base/312728 Log: Added support for if_transmit and if_qflush Removed if_start updated version to 3.10.33 MFC after:5 days Modified: head/sys/dev/qlxgbe/ql_def.h head/sys/dev/qlxgbe/ql_glbl.h head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_hw.h head/sys/dev/qlxgbe/ql_isr.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/qlxgbe/ql_os.h head/sys/dev/qlxgbe/ql_ver.h Modified: head/sys/dev/qlxgbe/ql_def.h ============================================================================== --- head/sys/dev/qlxgbe/ql_def.h Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_def.h Wed Jan 25 00:23:38 2017 (r312728) @@ -112,6 +112,16 @@ typedef struct _qla_tx_ring { uint64_t count; } qla_tx_ring_t; +typedef struct _qla_tx_fp { + struct mtx tx_mtx; + char tx_mtx_name[32]; + struct buf_ring *tx_br; + struct task fp_task; + struct taskqueue *fp_taskqueue; + void *ha; + uint32_t txr_idx; +} qla_tx_fp_t; + /* * Adapter structure contains the hardware independent information of the * pci function. @@ -178,10 +188,9 @@ struct qla_host { qla_tx_ring_t tx_ring[NUM_TX_RINGS]; bus_dma_tag_t tx_tag; - struct task tx_task; - struct taskqueue *tx_tq; struct callout tx_callout; - struct mtx tx_lock; + + qla_tx_fp_t tx_fp[MAX_SDS_RINGS]; qla_rx_ring_t rx_ring[MAX_RDS_RINGS]; bus_dma_tag_t rx_tag; Modified: head/sys/dev/qlxgbe/ql_glbl.h ============================================================================== --- head/sys/dev/qlxgbe/ql_glbl.h Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_glbl.h Wed Jan 25 00:23:38 2017 (r312728) @@ -39,6 +39,7 @@ */ extern void ql_mbx_isr(void *arg); extern void ql_isr(void *arg); +extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count); /* * from ql_os.c @@ -66,7 +67,7 @@ extern void qla_reset_promisc(qla_host_t extern int ql_set_allmulti(qla_host_t *ha); extern void qla_reset_allmulti(qla_host_t *ha); extern void ql_update_link_state(qla_host_t *ha); -extern void ql_hw_tx_done(qla_host_t *ha); +extern void ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx); extern int ql_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id); extern void ql_hw_stop_rcv(qla_host_t *ha); extern void ql_get_stats(qla_host_t *ha); @@ -76,7 +77,7 @@ extern void qla_hw_async_event(qla_host_ extern int qla_get_nic_partition(qla_host_t *ha, uint32_t *supports_9kb, uint32_t *num_rcvq); -extern int qla_iscsi_pdu(qla_host_t *ha, struct mbuf *mp); +extern int ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp); extern void ql_minidump(qla_host_t *ha); extern int ql_minidump_init(qla_host_t *ha); Modified: head/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.c Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_hw.c Wed Jan 25 00:23:38 2017 (r312728) @@ -51,7 +51,6 @@ static void qla_del_rcv_cntxt(qla_host_t static int qla_init_rcv_cntxt(qla_host_t *ha); static void qla_del_xmt_cntxt(qla_host_t *ha); static int qla_init_xmt_cntxt(qla_host_t *ha); -static void qla_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx); static int qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t n_hmbox, uint32_t *fw_mbox, uint32_t n_fwmbox, uint32_t no_pause); static int qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_idx, @@ -2047,7 +2046,7 @@ ql_hw_send(qla_host_t *ha, bus_dma_segme ha->hw.iscsi_pkt_count++; if (hw->tx_cntxt[txr_idx].txr_free <= (num_tx_cmds + QLA_TX_MIN_FREE)) { - qla_hw_tx_done_locked(ha, txr_idx); + ql_hw_tx_done_locked(ha, txr_idx); if (hw->tx_cntxt[txr_idx].txr_free <= (num_tx_cmds + QLA_TX_MIN_FREE)) { QL_DPRINT8(ha, (dev, "%s: (hw->txr_free <= " @@ -2552,15 +2551,8 @@ qla_init_rcv_cntxt(qla_host_t *ha) qla_host_to_le64(hw->dma_buf.sds_ring[i].dma_addr); rcntxt->sds[i].size = qla_host_to_le32(NUM_STATUS_DESCRIPTORS); - if (ha->msix_count == 2) { - rcntxt->sds[i].intr_id = - qla_host_to_le16(hw->intr_id[0]); - rcntxt->sds[i].intr_src_bit = qla_host_to_le16((i)); - } else { - rcntxt->sds[i].intr_id = - qla_host_to_le16(hw->intr_id[i]); - rcntxt->sds[i].intr_src_bit = qla_host_to_le16(0); - } + rcntxt->sds[i].intr_id = qla_host_to_le16(hw->intr_id[i]); + rcntxt->sds[i].intr_src_bit = qla_host_to_le16(0); } for (i = 0; i < rcntxt_rds_rings; i++) { @@ -2672,17 +2664,11 @@ qla_add_rcv_rings(qla_host_t *ha, uint32 add_rcv->sds[i].size = qla_host_to_le32(NUM_STATUS_DESCRIPTORS); - if (ha->msix_count == 2) { - add_rcv->sds[i].intr_id = - qla_host_to_le16(hw->intr_id[0]); - add_rcv->sds[i].intr_src_bit = qla_host_to_le16(j); - } else { - add_rcv->sds[i].intr_id = - qla_host_to_le16(hw->intr_id[j]); - add_rcv->sds[i].intr_src_bit = qla_host_to_le16(0); - } + add_rcv->sds[i].intr_id = qla_host_to_le16(hw->intr_id[j]); + add_rcv->sds[i].intr_src_bit = qla_host_to_le16(0); } + for (i = 0; (i < nsds); i++) { j = i + sds_idx; @@ -2803,6 +2789,7 @@ qla_init_xmt_cntxt_i(qla_host_t *ha, uin q80_rsp_tx_cntxt_t *tcntxt_rsp; uint32_t err; qla_hw_tx_cntxt_t *hw_tx_cntxt; + uint32_t intr_idx; hw_tx_cntxt = &hw->tx_cntxt[txr_idx]; @@ -2818,6 +2805,8 @@ qla_init_xmt_cntxt_i(qla_host_t *ha, uin tcntxt->count_version = (sizeof (q80_rq_tx_cntxt_t) >> 2); tcntxt->count_version |= Q8_MBX_CMD_VERSION; + intr_idx = txr_idx; + #ifdef QL_ENABLE_ISCSI_TLV tcntxt->cap0 = Q8_TX_CNTXT_CAP0_BASEFW | Q8_TX_CNTXT_CAP0_LSO | @@ -2827,8 +2816,9 @@ qla_init_xmt_cntxt_i(qla_host_t *ha, uin tcntxt->traffic_class = 1; } -#else + intr_idx = txr_idx % (ha->hw.num_tx_rings >> 1); +#else tcntxt->cap0 = Q8_TX_CNTXT_CAP0_BASEFW | Q8_TX_CNTXT_CAP0_LSO; #endif /* #ifdef QL_ENABLE_ISCSI_TLV */ @@ -2841,10 +2831,9 @@ qla_init_xmt_cntxt_i(qla_host_t *ha, uin qla_host_to_le64(hw_tx_cntxt->tx_cons_paddr); tcntxt->tx_ring[0].nentries = qla_host_to_le16(NUM_TX_DESCRIPTORS); - tcntxt->tx_ring[0].intr_id = qla_host_to_le16(hw->intr_id[0]); + tcntxt->tx_ring[0].intr_id = qla_host_to_le16(hw->intr_id[intr_idx]); tcntxt->tx_ring[0].intr_src_bit = qla_host_to_le16(0); - hw_tx_cntxt->txr_free = NUM_TX_DESCRIPTORS; hw_tx_cntxt->txr_next = hw_tx_cntxt->txr_comp = 0; @@ -3166,11 +3155,11 @@ ql_hw_set_multi(qla_host_t *ha, uint8_t } /* - * Name: qla_hw_tx_done_locked + * Name: ql_hw_tx_done_locked * Function: Handle Transmit Completions */ -static void -qla_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) +void +ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) { qla_tx_buf_t *txb; qla_hw_t *hw = &ha->hw; @@ -3208,34 +3197,6 @@ qla_hw_tx_done_locked(qla_host_t *ha, ui return; } -/* - * Name: ql_hw_tx_done - * Function: Handle Transmit Completions - */ -void -ql_hw_tx_done(qla_host_t *ha) -{ - int i; - uint32_t flag = 0; - - if (!mtx_trylock(&ha->tx_lock)) { - QL_DPRINT8(ha, (ha->pci_dev, - "%s: !mtx_trylock(&ha->tx_lock)\n", __func__)); - return; - } - for (i = 0; i < ha->hw.num_tx_rings; i++) { - qla_hw_tx_done_locked(ha, i); - if (ha->hw.tx_cntxt[i].txr_free <= (NUM_TX_DESCRIPTORS >> 1)) - flag = 1; - } - - if (!flag) - ha->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - QLA_TX_UNLOCK(ha); - return; -} - void ql_update_link_state(qla_host_t *ha) { @@ -3655,7 +3616,7 @@ qla_get_port_config(qla_host_t *ha, uint } int -qla_iscsi_pdu(qla_host_t *ha, struct mbuf *mp) +ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp) { struct ether_vlan_header *eh; uint16_t etype; Modified: head/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.h Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_hw.h Wed Jan 25 00:23:38 2017 (r312728) @@ -1543,7 +1543,6 @@ typedef struct _qla_hw_tx_cntxt { uint32_t tx_prod_reg; uint16_t tx_cntxt_id; - uint8_t frame_hdr[QL_FRAME_HDR_SIZE]; } qla_hw_tx_cntxt_t; Modified: head/sys/dev/qlxgbe/ql_isr.c ============================================================================== --- head/sys/dev/qlxgbe/ql_isr.c Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_isr.c Wed Jan 25 00:23:38 2017 (r312728) @@ -159,7 +159,12 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); mpf->m_pkthdr.flowid = sgc->rss_hash; + +#if __FreeBSD_version >= 1100000 M_HASHTYPE_SET(mpf, M_HASHTYPE_OPAQUE_HASH); +#else + M_HASHTYPE_SET(mpf, M_HASHTYPE_NONE); +#endif /* #if __FreeBSD_version >= 1100000 */ (*ifp->if_input)(ifp, mpf); @@ -449,11 +454,11 @@ qla_rcv_cont_sds(qla_host_t *ha, uint32_ } /* - * Name: qla_rcv_isr + * Name: ql_rcv_isr * Function: Main Interrupt Service Routine */ -static uint32_t -qla_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count) +uint32_t +ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count) { device_t dev; qla_hw_t *hw; @@ -703,7 +708,7 @@ qla_rcv_isr(qla_host_t *ha, uint32_t sds } if (ha->flags.stop_rcv) - goto qla_rcv_isr_exit; + goto ql_rcv_isr_exit; if (hw->sds[sds_idx].sdsr_next != comp_idx) { QL_UPDATE_SDS_CONSUMER_INDEX(ha, sds_idx, comp_idx); @@ -726,7 +731,7 @@ qla_rcv_isr(qla_host_t *ha, uint32_t sds if (opcode) ret = -1; -qla_rcv_isr_exit: +ql_rcv_isr_exit: hw->sds[sds_idx].rcv_active = 0; return (ret); @@ -930,7 +935,7 @@ ql_isr(void *arg) int idx; qla_hw_t *hw; struct ifnet *ifp; - uint32_t ret = 0; + qla_tx_fp_t *fp; ha = ivec->ha; hw = &ha->hw; @@ -939,17 +944,12 @@ ql_isr(void *arg) if ((idx = ivec->sds_idx) >= ha->hw.num_sds_rings) return; - if (idx == 0) - taskqueue_enqueue(ha->tx_tq, &ha->tx_task); - - ret = qla_rcv_isr(ha, idx, -1); - if (idx == 0) - taskqueue_enqueue(ha->tx_tq, &ha->tx_task); + fp = &ha->tx_fp[idx]; + + if (fp->fp_taskqueue != NULL) + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); - if (!ha->flags.stop_rcv) { - QL_ENABLE_INTERRUPTS(ha, idx); - } return; } Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_os.c Wed Jan 25 00:23:38 2017 (r312728) @@ -76,11 +76,11 @@ static void qla_release(qla_host_t *ha); static void qla_dmamap_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void qla_stop(qla_host_t *ha); -static int qla_send(qla_host_t *ha, struct mbuf **m_headp); -static void qla_tx_done(void *context, int pending); static void qla_get_peer(qla_host_t *ha); static void qla_error_recovery(void *context, int pending); static void qla_async_event(void *context, int pending); +static int qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32_t txr_idx, + uint32_t iscsi_pdu); /* * Hooks to the Operating Systems @@ -93,7 +93,14 @@ static void qla_init(void *arg); static int qla_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int qla_media_change(struct ifnet *ifp); static void qla_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); -static void qla_start(struct ifnet *ifp); + +static int qla_transmit(struct ifnet *ifp, struct mbuf *mp); +static void qla_qflush(struct ifnet *ifp); +static int qla_alloc_tx_br(qla_host_t *ha, qla_tx_fp_t *tx_fp); +static void qla_free_tx_br(qla_host_t *ha, qla_tx_fp_t *tx_fp); +static int qla_create_fp_taskqueues(qla_host_t *ha); +static void qla_destroy_fp_taskqueues(qla_host_t *ha); +static void qla_drain_fp_taskqueues(qla_host_t *ha); static device_method_t qla_pci_methods[] = { /* Device interface */ @@ -225,7 +232,6 @@ qla_watchdog(void *arg) qla_hw_t *hw; struct ifnet *ifp; uint32_t i; - qla_hw_tx_cntxt_t *hw_tx_cntxt; hw = &ha->hw; ifp = ha->ifp; @@ -254,19 +260,14 @@ qla_watchdog(void *arg) &ha->async_event_task); } - for (i = 0; i < ha->hw.num_tx_rings; i++) { - hw_tx_cntxt = &hw->tx_cntxt[i]; - if (qla_le32_to_host(*(hw_tx_cntxt->tx_cons)) != - hw_tx_cntxt->txr_comp) { - taskqueue_enqueue(ha->tx_tq, - &ha->tx_task); - break; - } - } + for (i = 0; i < ha->hw.num_sds_rings; i++) { + qla_tx_fp_t *fp = &ha->tx_fp[i]; - if ((ifp->if_snd.ifq_head != NULL) && QL_RUNNING(ifp)) { - taskqueue_enqueue(ha->tx_tq, &ha->tx_task); + if (fp->fp_taskqueue != NULL) + taskqueue_enqueue(fp->fp_taskqueue, + &fp->fp_task); } + ha->qla_watchdog_paused = 0; } else { ha->qla_watchdog_paused = 0; @@ -322,9 +323,7 @@ qla_pci_attach(device_t dev) rsrc_len = (uint32_t) bus_get_resource_count(dev, SYS_RES_MEMORY, ha->reg_rid); - mtx_init(&ha->hw_lock, "qla83xx_hw_lock", MTX_NETWORK_LOCK, MTX_SPIN); - - mtx_init(&ha->tx_lock, "qla83xx_tx_lock", MTX_NETWORK_LOCK, MTX_DEF); + mtx_init(&ha->hw_lock, "qla83xx_hw_lock", MTX_NETWORK_LOCK, MTX_DEF); qla_add_sysctls(ha); ql_hw_add_sysctls(ha); @@ -344,8 +343,9 @@ qla_pci_attach(device_t dev) } QL_DPRINT2(ha, (dev, "%s: ha %p pci_func 0x%x rsrc_count 0x%08x" - " msix_count 0x%x pci_reg %p\n", __func__, ha, - ha->pci_func, rsrc_len, ha->msix_count, ha->pci_reg)); + " msix_count 0x%x pci_reg %p pci_reg1 %p\n", __func__, ha, + ha->pci_func, rsrc_len, ha->msix_count, ha->pci_reg, + ha->pci_reg1)); /* initialize hardware */ if (ql_init_hw(ha)) { @@ -366,14 +366,15 @@ qla_pci_attach(device_t dev) goto qla_pci_attach_err; } device_printf(dev, "%s: ha %p pci_func 0x%x rsrc_count 0x%08x" - " msix_count 0x%x pci_reg %p num_rcvq = %d\n", __func__, ha, - ha->pci_func, rsrc_len, ha->msix_count, ha->pci_reg, num_rcvq); + " msix_count 0x%x pci_reg %p pci_reg1 %p num_rcvq = %d\n", + __func__, ha, ha->pci_func, rsrc_len, ha->msix_count, + ha->pci_reg, ha->pci_reg1, num_rcvq); #ifdef QL_ENABLE_ISCSI_TLV if ((ha->msix_count < 64) || (num_rcvq != 32)) { ha->hw.num_sds_rings = 15; - ha->hw.num_tx_rings = 32; + ha->hw.num_tx_rings = ha->hw.num_sds_rings * 2; } #endif /* #ifdef QL_ENABLE_ISCSI_TLV */ ha->hw.num_rds_rings = ha->hw.num_sds_rings; @@ -421,8 +422,20 @@ qla_pci_attach(device_t dev) device_printf(dev, "could not setup interrupt\n"); goto qla_pci_attach_err; } + + ha->tx_fp[i].ha = ha; + ha->tx_fp[i].txr_idx = i; + + if (qla_alloc_tx_br(ha, &ha->tx_fp[i])) { + device_printf(dev, "%s: could not allocate tx_br[%d]\n", + __func__, i); + goto qla_pci_attach_err; + } } + if (qla_create_fp_taskqueues(ha) != 0) + goto qla_pci_attach_err; + printf("%s: mp__ncpus %d sds %d rds %d msi-x %d\n", __func__, mp_ncpus, ha->hw.num_sds_rings, ha->hw.num_rds_rings, ha->msix_count); @@ -452,13 +465,6 @@ qla_pci_attach(device_t dev) ha->flags.qla_watchdog_active = 1; ha->flags.qla_watchdog_pause = 0; - - TASK_INIT(&ha->tx_task, 0, qla_tx_done, ha); - ha->tx_tq = taskqueue_create("qla_txq", M_NOWAIT, - taskqueue_thread_enqueue, &ha->tx_tq); - taskqueue_start_threads(&ha->tx_tq, 1, PI_NET, "%s txq", - device_get_nameunit(ha->pci_dev)); - callout_init(&ha->tx_callout, TRUE); ha->flags.qla_callout_init = 1; @@ -584,11 +590,6 @@ qla_release(qla_host_t *ha) taskqueue_free(ha->err_tq); } - if (ha->tx_tq) { - taskqueue_drain(ha->tx_tq, &ha->tx_task); - taskqueue_free(ha->tx_tq); - } - ql_del_cdev(ha); if (ha->flags.qla_watchdog_active) { @@ -626,13 +627,15 @@ qla_release(qla_host_t *ha) ha->irq_vec[i].irq_rid, ha->irq_vec[i].irq); } + + qla_free_tx_br(ha, &ha->tx_fp[i]); } + qla_destroy_fp_taskqueues(ha); if (ha->msix_count) pci_release_msi(dev); if (ha->flags.lock_init) { - mtx_destroy(&ha->tx_lock); mtx_destroy(&ha->hw_lock); } @@ -807,7 +810,9 @@ qla_init_ifnet(device_t dev, qla_host_t ifp->if_softc = ha; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = qla_ioctl; - ifp->if_start = qla_start; + + ifp->if_transmit = qla_transmit; + ifp->if_qflush = qla_qflush; IFQ_SET_MAXLEN(&ifp->if_snd, qla_get_ifq_snd_maxlen(ha)); ifp->if_snd.ifq_drv_maxlen = qla_get_ifq_snd_maxlen(ha); @@ -817,12 +822,13 @@ qla_init_ifnet(device_t dev, qla_host_t ether_ifattach(ifp, qla_get_mac_addr(ha)); - ifp->if_capabilities = IFCAP_HWCSUM | + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | - IFCAP_JUMBO_MTU; - - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_VLAN_HWTSO; + IFCAP_JUMBO_MTU | + IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_MTU | + IFCAP_VLAN_HWTSO | + IFCAP_LRO; ifp->if_capenable = ifp->if_capabilities; @@ -917,10 +923,13 @@ qla_set_multi(qla_host_t *ha, uint32_t a if_maddr_runlock(ifp); - if (QLA_LOCK(ha, __func__, 1) == 0) { - ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); - QLA_UNLOCK(ha, __func__); - } + //if (QLA_LOCK(ha, __func__, 1) == 0) { + // ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); + // QLA_UNLOCK(ha, __func__); + //} + QLA_LOCK(ha, __func__, 1); + ret = ql_hw_set_multi(ha, mta, mcnt, add_multi); + QLA_UNLOCK(ha, __func__); return (ret); } @@ -1125,64 +1134,10 @@ qla_media_status(struct ifnet *ifp, stru return; } -static void -qla_start(struct ifnet *ifp) -{ - struct mbuf *m_head; - qla_host_t *ha = (qla_host_t *)ifp->if_softc; - - QL_DPRINT8(ha, (ha->pci_dev, "%s: enter\n", __func__)); - - if (!mtx_trylock(&ha->tx_lock)) { - QL_DPRINT8(ha, (ha->pci_dev, - "%s: mtx_trylock(&ha->tx_lock) failed\n", __func__)); - return; - } - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) { - QL_DPRINT8(ha, - (ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__)); - QLA_TX_UNLOCK(ha); - return; - } - - if (!ha->hw.link_up || !ha->watchdog_ticks) - ql_update_link_state(ha); - - if (!ha->hw.link_up) { - QL_DPRINT8(ha, (ha->pci_dev, "%s: link down\n", __func__)); - QLA_TX_UNLOCK(ha); - return; - } - - while (ifp->if_snd.ifq_head != NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); - - if (m_head == NULL) { - QL_DPRINT8(ha, (ha->pci_dev, "%s: m_head == NULL\n", - __func__)); - break; - } - - if (qla_send(ha, &m_head)) { - if (m_head == NULL) - break; - QL_DPRINT8(ha, (ha->pci_dev, "%s: PREPEND\n", __func__)); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IF_PREPEND(&ifp->if_snd, m_head); - break; - } - /* Send a copy of the frame to the BPF listener */ - ETHER_BPF_MTAP(ifp, m_head); - } - QLA_TX_UNLOCK(ha); - QL_DPRINT8(ha, (ha->pci_dev, "%s: exit\n", __func__)); - return; -} static int -qla_send(qla_host_t *ha, struct mbuf **m_headp) +qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32_t txr_idx, + uint32_t iscsi_pdu) { bus_dma_segment_t segs[QLA_MAX_SEGMENTS]; bus_dmamap_t map; @@ -1190,29 +1145,9 @@ qla_send(qla_host_t *ha, struct mbuf **m int ret = -1; uint32_t tx_idx; struct mbuf *m_head = *m_headp; - uint32_t txr_idx = ha->txr_idx; - uint32_t iscsi_pdu = 0; QL_DPRINT8(ha, (ha->pci_dev, "%s: enter\n", __func__)); - /* check if flowid is set */ - - if (M_HASHTYPE_GET(m_head) != M_HASHTYPE_NONE) { -#ifdef QL_ENABLE_ISCSI_TLV - if (qla_iscsi_pdu(ha, m_head) == 0) { - iscsi_pdu = 1; - txr_idx = m_head->m_pkthdr.flowid & - ((ha->hw.num_tx_rings >> 1) - 1); - } else { - txr_idx = m_head->m_pkthdr.flowid & - (ha->hw.num_tx_rings - 1); - } -#else - txr_idx = m_head->m_pkthdr.flowid & (ha->hw.num_tx_rings - 1); -#endif /* #ifdef QL_ENABLE_ISCSI_TLV */ - } - - tx_idx = ha->hw.tx_cntxt[txr_idx].txr_next; map = ha->tx_ring[txr_idx].tx_buf[tx_idx].map; @@ -1290,16 +1225,302 @@ qla_send(qla_host_t *ha, struct mbuf **m return (ret); } +static int +qla_alloc_tx_br(qla_host_t *ha, qla_tx_fp_t *fp) +{ + snprintf(fp->tx_mtx_name, sizeof(fp->tx_mtx_name), + "qla%d_fp%d_tx_mq_lock", ha->pci_func, fp->txr_idx); + + mtx_init(&fp->tx_mtx, fp->tx_mtx_name, NULL, MTX_DEF); + + fp->tx_br = buf_ring_alloc(NUM_TX_DESCRIPTORS, M_DEVBUF, + M_NOWAIT, &fp->tx_mtx); + if (fp->tx_br == NULL) { + QL_DPRINT1(ha, (ha->pci_dev, "buf_ring_alloc failed for " + " fp[%d, %d]\n", ha->pci_func, fp->txr_idx)); + return (-ENOMEM); + } + return 0; +} + +static void +qla_free_tx_br(qla_host_t *ha, qla_tx_fp_t *fp) +{ + struct mbuf *mp; + struct ifnet *ifp = ha->ifp; + + if (mtx_initialized(&fp->tx_mtx)) { + + if (fp->tx_br != NULL) { + + mtx_lock(&fp->tx_mtx); + + while ((mp = drbr_dequeue(ifp, fp->tx_br)) != NULL) { + m_freem(mp); + } + + mtx_unlock(&fp->tx_mtx); + + buf_ring_free(fp->tx_br, M_DEVBUF); + fp->tx_br = NULL; + } + mtx_destroy(&fp->tx_mtx); + } + return; +} + +static void +qla_fp_taskqueue(void *context, int pending) +{ + qla_tx_fp_t *fp; + qla_host_t *ha; + struct ifnet *ifp; + struct mbuf *mp; + int ret; + uint32_t txr_idx; + uint32_t iscsi_pdu = 0; + uint32_t rx_pkts_left; + + fp = context; + + if (fp == NULL) + return; + + ha = (qla_host_t *)fp->ha; + + ifp = ha->ifp; + + txr_idx = fp->txr_idx; + + mtx_lock(&fp->tx_mtx); + + if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) || (!ha->hw.link_up)) { + mtx_unlock(&fp->tx_mtx); + goto qla_fp_taskqueue_exit; + } + + rx_pkts_left = ql_rcv_isr(ha, fp->txr_idx, 64); + +#ifdef QL_ENABLE_ISCSI_TLV + ql_hw_tx_done_locked(ha, fp->txr_idx); + ql_hw_tx_done_locked(ha, (fp->txr_idx + (ha->hw.num_tx_rings >> 1))); + txr_idx = txr_idx + (ha->hw.num_tx_rings >> 1); +#else + ql_hw_tx_done_locked(ha, fp->txr_idx); +#endif /* #ifdef QL_ENABLE_ISCSI_TLV */ + + mp = drbr_peek(ifp, fp->tx_br); + + while (mp != NULL) { + + if (M_HASHTYPE_GET(mp) != M_HASHTYPE_NONE) { +#ifdef QL_ENABLE_ISCSI_TLV + if (ql_iscsi_pdu(ha, mp) == 0) { + iscsi_pdu = 1; + } +#endif /* #ifdef QL_ENABLE_ISCSI_TLV */ + } + + ret = qla_send(ha, &mp, txr_idx, iscsi_pdu); + + if (ret) { + if (mp != NULL) + drbr_putback(ifp, fp->tx_br, mp); + else { + drbr_advance(ifp, fp->tx_br); + } + + mtx_unlock(&fp->tx_mtx); + + goto qla_fp_taskqueue_exit0; + } else { + drbr_advance(ifp, fp->tx_br); + } + + mp = drbr_peek(ifp, fp->tx_br); + } + + mtx_unlock(&fp->tx_mtx); + +qla_fp_taskqueue_exit0: + + if (rx_pkts_left || ((mp != NULL) && ret)) { + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + } else { + if (!ha->flags.stop_rcv) { + QL_ENABLE_INTERRUPTS(ha, fp->txr_idx); + } + } + +qla_fp_taskqueue_exit: + + QL_DPRINT2(ha, (ha->pci_dev, "%s: exit ret = %d\n", __func__, ret)); + return; +} + +static int +qla_create_fp_taskqueues(qla_host_t *ha) +{ + int i; + uint8_t tq_name[32]; + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + + qla_tx_fp_t *fp = &ha->tx_fp[i]; + + bzero(tq_name, sizeof (tq_name)); + snprintf(tq_name, sizeof (tq_name), "ql_fp_tq_%d", i); + + TASK_INIT(&fp->fp_task, 0, qla_fp_taskqueue, fp); + + fp->fp_taskqueue = taskqueue_create_fast(tq_name, M_NOWAIT, + taskqueue_thread_enqueue, + &fp->fp_taskqueue); + + if (fp->fp_taskqueue == NULL) + return (-1); + + taskqueue_start_threads(&fp->fp_taskqueue, 1, PI_NET, "%s", + tq_name); + + QL_DPRINT1(ha, (ha->pci_dev, "%s: %p\n", __func__, + fp->fp_taskqueue)); + } + + return (0); +} + +static void +qla_destroy_fp_taskqueues(qla_host_t *ha) +{ + int i; + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + + qla_tx_fp_t *fp = &ha->tx_fp[i]; + + if (fp->fp_taskqueue != NULL) { + taskqueue_drain(fp->fp_taskqueue, &fp->fp_task); + taskqueue_free(fp->fp_taskqueue); + fp->fp_taskqueue = NULL; + } + } + return; +} + +static void +qla_drain_fp_taskqueues(qla_host_t *ha) +{ + int i; + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + qla_tx_fp_t *fp = &ha->tx_fp[i]; + + if (fp->fp_taskqueue != NULL) { + taskqueue_drain(fp->fp_taskqueue, &fp->fp_task); + } + } + return; +} + +static int +qla_transmit(struct ifnet *ifp, struct mbuf *mp) +{ + qla_host_t *ha = (qla_host_t *)ifp->if_softc; + qla_tx_fp_t *fp; + int rss_id = 0; + int ret = 0; + + QL_DPRINT2(ha, (ha->pci_dev, "%s: enter\n", __func__)); + +#if __FreeBSD_version >= 1100000 + if (M_HASHTYPE_GET(mp) != M_HASHTYPE_NONE) +#else + if (mp->m_flags & M_FLOWID) +#endif + rss_id = (mp->m_pkthdr.flowid & Q8_RSS_IND_TBL_MAX_IDX) % + ha->hw.num_sds_rings; + fp = &ha->tx_fp[rss_id]; + + if (fp->tx_br == NULL) { + ret = EINVAL; + goto qla_transmit_exit; + } + + if (mp != NULL) { + ret = drbr_enqueue(ifp, fp->tx_br, mp); + } + + if (fp->fp_taskqueue != NULL) + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + + ret = 0; + +qla_transmit_exit: + + QL_DPRINT2(ha, (ha->pci_dev, "%s: exit ret = %d\n", __func__, ret)); + return ret; +} + +static void +qla_qflush(struct ifnet *ifp) +{ + int i; + qla_tx_fp_t *fp; + struct mbuf *mp; + qla_host_t *ha; + + ha = (qla_host_t *)ifp->if_softc; + + QL_DPRINT2(ha, (ha->pci_dev, "%s: enter\n", __func__)); + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + + fp = &ha->tx_fp[i]; + + if (fp == NULL) + continue; + + if (fp->tx_br) { + mtx_lock(&fp->tx_mtx); + + while ((mp = drbr_dequeue(ifp, fp->tx_br)) != NULL) { + m_freem(mp); + } + mtx_unlock(&fp->tx_mtx); + } + } + QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__)); + + return; +} + + static void qla_stop(qla_host_t *ha) { struct ifnet *ifp = ha->ifp; device_t dev; + int i = 0; dev = ha->pci_dev; ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); - QLA_TX_LOCK(ha); QLA_TX_UNLOCK(ha); + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + qla_tx_fp_t *fp; + + fp = &ha->tx_fp[i]; + + if (fp == NULL) + continue; + + if (fp->tx_br != NULL) { + mtx_lock(&fp->tx_mtx); + mtx_unlock(&fp->tx_mtx); + } + } ha->flags.qla_watchdog_pause = 1; @@ -1308,6 +1529,8 @@ qla_stop(qla_host_t *ha) ha->flags.qla_interface_up = 0; + qla_drain_fp_taskqueues(ha); + ql_hw_stop_rcv(ha); ql_del_hw_if(ha); @@ -1648,25 +1871,6 @@ exit_ql_get_mbuf: return (ret); } -static void -qla_tx_done(void *context, int pending) -{ - qla_host_t *ha = context; - struct ifnet *ifp; - - ifp = ha->ifp; - - if (!ifp) - return; - - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - QL_DPRINT8(ha, (ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__)); - return; - } - ql_hw_tx_done(ha); - - qla_start(ha->ifp); -} static void qla_get_peer(qla_host_t *ha) @@ -1709,18 +1913,32 @@ qla_error_recovery(void *context, int pe qla_host_t *ha = context; uint32_t msecs_100 = 100; struct ifnet *ifp = ha->ifp; + int i = 0; (void)QLA_LOCK(ha, __func__, 0); if (ha->flags.qla_interface_up) { - ha->hw.imd_compl = 1; - qla_mdelay(__func__, 300); + ha->hw.imd_compl = 1; + qla_mdelay(__func__, 300); - ql_hw_stop_rcv(ha); + ql_hw_stop_rcv(ha); - ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); - QLA_TX_LOCK(ha); QLA_TX_UNLOCK(ha); + ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); + + for (i = 0; i < ha->hw.num_sds_rings; i++) { + qla_tx_fp_t *fp; + + fp = &ha->tx_fp[i]; + + if (fp == NULL) + continue; + + if (fp->tx_br != NULL) { + mtx_lock(&fp->tx_mtx); + mtx_unlock(&fp->tx_mtx); + } + } } QLA_UNLOCK(ha, __func__); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jan 25 00:44: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 B6A86CBEF92; Wed, 25 Jan 2017 00:44:22 +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 7751B816; Wed, 25 Jan 2017 00:44: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 v0P0iLDK012609; Wed, 25 Jan 2017 00:44:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P0iLaS012608; Wed, 25 Jan 2017 00:44:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250044.v0P0iLaS012608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 00:44: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: r312729 - stable/11/contrib/elftoolchain/libelftc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 00:44:22 -0000 Author: emaste Date: Wed Jan 25 00:44:21 2017 New Revision: 312729 URL: https://svnweb.freebsd.org/changeset/base/312729 Log: readelf: add PPC64 relocation types MFC of r311941, r311942 Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Jan 25 00:23:38 2017 (r312728) +++ stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Wed Jan 25 00:44:21 2017 (r312729) @@ -501,6 +501,120 @@ elftc_reloc_type_str(unsigned int mach, case 116: return "R_PPC_EMB_RELSDA"; } break; + case EM_PPC64: + switch(type) { + case 0: return "R_PPC64_NONE"; + case 1: return "R_PPC64_ADDR32"; + case 2: return "R_PPC64_ADDR24"; + case 3: return "R_PPC64_ADDR16"; + case 4: return "R_PPC64_ADDR16_LO"; + case 5: return "R_PPC64_ADDR16_HI"; + case 6: return "R_PPC64_ADDR16_HA"; + case 7: return "R_PPC64_ADDR14"; + case 8: return "R_PPC64_ADDR14_BRTAKEN"; + case 9: return "R_PPC64_ADDR14_BRNTAKEN"; + case 10: return "R_PPC64_REL24"; + case 11: return "R_PPC64_REL14"; + case 12: return "R_PPC64_REL14_BRTAKEN"; + case 13: return "R_PPC64_REL14_BRNTAKEN"; + case 14: return "R_PPC64_GOT16"; + case 15: return "R_PPC64_GOT16_LO"; + case 16: return "R_PPC64_GOT16_HI"; + case 17: return "R_PPC64_GOT16_HA"; + case 19: return "R_PPC64_COPY"; + case 20: return "R_PPC64_GLOB_DAT"; + case 21: return "R_PPC64_JMP_SLOT"; + case 22: return "R_PPC64_RELATIVE"; + case 24: return "R_PPC64_UADDR32"; + case 25: return "R_PPC64_UADDR16"; + case 26: return "R_PPC64_REL32"; + case 27: return "R_PPC64_PLT32"; + case 28: return "R_PPC64_PLTREL32"; + case 29: return "R_PPC64_PLT16_LO"; + case 30: return "R_PPC64_PLT16_HI"; + case 31: return "R_PPC64_PLT16_HA"; + case 33: return "R_PPC64_SECTOFF"; + case 34: return "R_PPC64_SECTOFF_LO"; + case 35: return "R_PPC64_SECTOFF_HI"; + case 36: return "R_PPC64_SECTOFF_HA"; + case 37: return "R_PPC64_ADDR30"; + case 38: return "R_PPC64_ADDR64"; + case 39: return "R_PPC64_ADDR16_HIGHER"; + case 40: return "R_PPC64_ADDR16_HIGHERA"; + case 41: return "R_PPC64_ADDR16_HIGHEST"; + case 42: return "R_PPC64_ADDR16_HIGHESTA"; + case 43: return "R_PPC64_UADDR64"; + case 44: return "R_PPC64_REL64"; + case 45: return "R_PPC64_PLT64"; + case 46: return "R_PPC64_PLTREL64"; + case 47: return "R_PPC64_TOC16"; + case 48: return "R_PPC64_TOC16_LO"; + case 49: return "R_PPC64_TOC16_HI"; + case 50: return "R_PPC64_TOC16_HA"; + case 51: return "R_PPC64_TOC"; + case 52: return "R_PPC64_PLTGOT16"; + case 53: return "R_PPC64_PLTGOT16_LO"; + case 54: return "R_PPC64_PLTGOT16_HI"; + case 55: return "R_PPC64_PLTGOT16_HA"; + case 56: return "R_PPC64_ADDR16_DS"; + case 57: return "R_PPC64_ADDR16_LO_DS"; + case 58: return "R_PPC64_GOT16_DS"; + case 59: return "R_PPC64_GOT16_LO_DS"; + case 60: return "R_PPC64_PLT16_LO_DS"; + case 61: return "R_PPC64_SECTOFF_DS"; + case 62: return "R_PPC64_SECTOFF_LO_DS"; + case 63: return "R_PPC64_TOC16_DS"; + case 64: return "R_PPC64_TOC16_LO_DS"; + case 65: return "R_PPC64_PLTGOT16_DS"; + case 66: return "R_PPC64_PLTGOT16_LO_DS"; + case 67: return "R_PPC64_TLS"; + case 68: return "R_PPC64_DTPMOD64"; + case 69: return "R_PPC64_TPREL16"; + case 70: return "R_PPC64_TPREL16_LO"; + case 71: return "R_PPC64_TPREL16_HI"; + case 72: return "R_PPC64_TPREL16_HA"; + case 73: return "R_PPC64_TPREL64"; + case 74: return "R_PPC64_DTPREL16"; + case 75: return "R_PPC64_DTPREL16_LO"; + case 76: return "R_PPC64_DTPREL16_HI"; + case 77: return "R_PPC64_DTPREL16_HA"; + case 78: return "R_PPC64_DTPREL64"; + case 79: return "R_PPC64_GOT_TLSGD16"; + case 80: return "R_PPC64_GOT_TLSGD16_LO"; + case 81: return "R_PPC64_GOT_TLSGD16_HI"; + case 82: return "R_PPC64_GOT_TLSGD16_HA"; + case 83: return "R_PPC64_GOT_TLSLD16"; + case 84: return "R_PPC64_GOT_TLSLD16_LO"; + case 85: return "R_PPC64_GOT_TLSLD16_HI"; + case 86: return "R_PPC64_GOT_TLSLD16_HA"; + case 87: return "R_PPC64_GOT_TPREL16_DS"; + case 88: return "R_PPC64_GOT_TPREL16_LO_DS"; + case 89: return "R_PPC64_GOT_TPREL16_HI"; + case 90: return "R_PPC64_GOT_TPREL16_HA"; + case 91: return "R_PPC64_GOT_DTPREL16_DS"; + case 92: return "R_PPC64_GOT_DTPREL16_LO_DS"; + case 93: return "R_PPC64_GOT_DTPREL16_HI"; + case 94: return "R_PPC64_GOT_DTPREL16_HA"; + case 95: return "R_PPC64_TPREL16_DS"; + case 96: return "R_PPC64_TPREL16_LO_DS"; + case 97: return "R_PPC64_TPREL16_HIGHER"; + case 98: return "R_PPC64_TPREL16_HIGHERA"; + case 99: return "R_PPC64_TPREL16_HIGHEST"; + case 100: return "R_PPC64_TPREL16_HIGHESTA"; + case 101: return "R_PPC64_DTPREL16_DS"; + case 102: return "R_PPC64_DTPREL16_LO_DS"; + case 103: return "R_PPC64_DTPREL16_HIGHER"; + case 104: return "R_PPC64_DTPREL16_HIGHERA"; + case 105: return "R_PPC64_DTPREL16_HIGHEST"; + case 106: return "R_PPC64_DTPREL16_HIGHESTA"; + case 107: return "R_PPC64_TLSGD"; + case 108: return "R_PPC64_TLSLD"; + case 249: return "R_PPC64_REL16"; + case 250: return "R_PPC64_REL16_LO"; + case 251: return "R_PPC64_REL16_HI"; + case 252: return "R_PPC64_REL16_HA"; + } + break; case EM_RISCV: switch(type) { case 0: return "R_RISCV_NONE"; From owner-svn-src-all@freebsd.org Wed Jan 25 01:04: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 5E379CC0548; Wed, 25 Jan 2017 01:04: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 200E811F; Wed, 25 Jan 2017 01:04: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 v0P14q9b020556; Wed, 25 Jan 2017 01:04:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P14pCu020550; Wed, 25 Jan 2017 01:04:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250104.v0P14pCu020550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 01:04: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: r312730 - in stable/11: share/mk sys/boot/common sys/conf tools/build/options X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 01:04:53 -0000 Author: emaste Date: Wed Jan 25 01:04:51 2017 New Revision: 312730 URL: https://svnweb.freebsd.org/changeset/base/312730 Log: Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob MFC r310128: Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata The kernel builds reproducibly, except for the time, date, user, and hostname baked into the kernel (reported at startup and via the kern.version sysctl for uname). Add a build knob to disable the inclusion of this metadata. MFC r310268: Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the time, user, and host from the loader's version information. This allows builds to produce bit-for-bit identical output. Added: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD - copied, changed from r310128, head/tools/build/options/WITH_REPRODUCIBLE_BUILD Modified: stable/11/share/mk/src.opts.mk stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/common/newvers.sh stable/11/sys/conf/kern.opts.mk stable/11/sys/conf/kern.post.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/share/mk/src.opts.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -187,6 +187,7 @@ __DEFAULT_NO_OPTIONS = \ NAND \ OFED \ OPENLDAP \ + REPRODUCIBLE_BUILD \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/boot/common/Makefile.inc Wed Jan 25 01:04:51 2017 (r312730) @@ -73,5 +73,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/lib CLEANFILES+= vers.c VERSION_FILE?= ${.CURDIR}/version +.if ${MK_REPRODUCIBLE_BUILD} != no +REPRO_FLAG= -r +.endif vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} - sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT} + sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ + ${NEWVERSWHAT} Modified: stable/11/sys/boot/common/newvers.sh ============================================================================== --- stable/11/sys/boot/common/newvers.sh Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/boot/common/newvers.sh Wed Jan 25 01:04:51 2017 (r312730) @@ -35,11 +35,26 @@ tempfile=$(mktemp tmp.XXXXXX) || exit trap "rm -f $tempfile" EXIT INT TERM +include_metadata=true +while getopts r opt; do + case "$opt" in + r) + include_metadata= + ;; + esac +done +shift $((OPTIND - 1)) + LC_ALL=C; export LC_ALL u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` -echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile +bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n" +if [ -n "${include_metadata}" ]; then + bootprog_info="$bootprog_info(${t} ${u}@${h})\\n" +fi + +echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile mv $tempfile vers.c Modified: stable/11/sys/conf/kern.opts.mk ============================================================================== --- stable/11/sys/conf/kern.opts.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/conf/kern.opts.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -47,7 +47,8 @@ __DEFAULT_NO_OPTIONS = \ EISA \ EXTRA_TCP_STACKS \ NAND \ - OFED + OFED \ + REPRODUCIBLE_BUILD # Some options are totally broken on some architectures. We disable # them. If you need to enable them on an experimental basis, you Modified: stable/11/sys/conf/kern.post.mk ============================================================================== --- stable/11/sys/conf/kern.post.mk Wed Jan 25 00:44:21 2017 (r312729) +++ stable/11/sys/conf/kern.post.mk Wed Jan 25 01:04:51 2017 (r312730) @@ -357,8 +357,11 @@ config.o env.o hints.o vers.o vnode_if.o config.ln env.ln hints.ln vers.ln vnode_if.ln: ${NORMAL_LINT} +.if ${MK_REPRODUCIBLE_BUILD} != "no" +REPRO_FLAG="-r" +.endif vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT} + MAKE=${MAKE} sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c Copied and modified: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD (from r310128, head/tools/build/options/WITH_REPRODUCIBLE_BUILD) ============================================================================== --- head/tools/build/options/WITH_REPRODUCIBLE_BUILD Thu Dec 15 21:26:58 2016 (r310128, copy source) +++ stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD Wed Jan 25 01:04:51 2017 (r312730) @@ -1,3 +1,4 @@ $FreeBSD$ -Set to exclude build metadata (build time, user, host and path) from the -kernel and uname output. +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. From owner-svn-src-all@freebsd.org Wed Jan 25 01:16: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 99DDFCC0A41; Wed, 25 Jan 2017 01:16: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 5054A938; Wed, 25 Jan 2017 01:16:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P1GArX024797; Wed, 25 Jan 2017 01:16:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P1GATb024796; Wed, 25 Jan 2017 01:16:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701250116.v0P1GATb024796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 01:16: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: r312731 - stable/11/share/man/man5 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 01:16:11 -0000 Author: emaste Date: Wed Jan 25 01:16:10 2017 New Revision: 312731 URL: https://svnweb.freebsd.org/changeset/base/312731 Log: Regen src.conf.5 after r312730 WITH_REPRODUCIBLE_BUILD Also pick up r312019 Modified: stable/11/share/man/man5/src.conf.5 Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Wed Jan 25 01:04:51 2017 (r312730) +++ stable/11/share/man/man5/src.conf.5 Wed Jan 25 01:16:10 2017 (r312731) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/11/tools/build/options/makeman 292283 2015-12-15 18:42:30Z bdrewery .\" $FreeBSD$ -.Dd January 6, 2017 +.Dd January 25, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1352,6 +1352,11 @@ Set to not build .Xr rcs 1 , .Xr etcupdate 8 , and related utilities. +.It Va WITH_REPRODUCIBLE_BUILD +from FreeBSD: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD 312730 2017-01-25 01:04:51Z emaste +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. .It Va WITHOUT_RESCUE .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 07:50:50Z ru Set to not build @@ -1580,8 +1585,8 @@ and related programs. .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. .It Va WITHOUT_USB_GADGET_EXAMPLES -.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 274665 2014-11-18 17:06:50Z imp -Set to build USB gadget kernel modules. +.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_USB_GADGET_EXAMPLES 312019 2017-01-13 08:15:32Z ngie +Set to not build USB gadget kernel modules. .It Va WITHOUT_UTMPX .\" from FreeBSD: stable/11/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed Set to not build user accounting tools such as From owner-svn-src-all@freebsd.org Wed Jan 25 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 1E4BACBE9E6; Wed, 25 Jan 2017 02:05:10 +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 D453D11EB; Wed, 25 Jan 2017 02:05:09 +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 v0P258MO044639; Wed, 25 Jan 2017 02:05:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P2581U044638; Wed, 25 Jan 2017 02:05:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201701250205.v0P2581U044638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Jan 2017 02:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312732 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 02:05:10 -0000 Author: imp Date: Wed Jan 25 02:05:08 2017 New Revision: 312732 URL: https://svnweb.freebsd.org/changeset/base/312732 Log: Preening pass to fix up trailing white space and other minor style(9) nits (though I'm sure others remain). MFC After: 3 days Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Wed Jan 25 01:16:10 2017 (r312731) +++ head/sys/cam/cam_iosched.c Wed Jan 25 02:05:08 2017 (r312732) @@ -112,7 +112,7 @@ typedef enum { bandwidth, /* Limit bandwidth to the drive */ limiter_max } io_limiter; - + static const char *cam_iosched_limiter_names[] = { "none", "queue_depth", "iops", "bandwidth" }; @@ -131,7 +131,7 @@ typedef int l_tick_t(struct iop_stats *) * Called to see if the limiter thinks this IOP can be allowed to * proceed. If so, the limiter assumes that the while IOP proceeded * and makes any accounting of it that's needed. - */ + */ typedef int l_iop_t(struct iop_stats *, struct bio *); /* @@ -157,8 +157,7 @@ static l_tick_t cam_iosched_bw_tick; static l_iop_t cam_iosched_bw_caniop; static l_iop_t cam_iosched_bw_iop; -struct limswitch -{ +struct limswitch { l_init_t *l_init; l_tick_t *l_tick; l_iop_t *l_iop; @@ -195,8 +194,7 @@ struct limswitch }, }; -struct iop_stats -{ +struct iop_stats { /* * sysctl state for this subnode. */ @@ -212,7 +210,6 @@ struct iop_stats int current; /* Current rate limiter */ int l_value1; /* per-limiter scratch value 1. */ int l_value2; /* per-limiter scratch value 2. */ - /* * Debug information about counts of I/Os that have gone through the @@ -223,7 +220,7 @@ struct iop_stats int total; /* Total for all time -- wraps */ int in; /* number queued all time -- wraps */ int out; /* number completed all time -- wraps */ - + /* * Statistics on different bits of the process. */ @@ -251,8 +248,7 @@ typedef enum { static const char *cam_iosched_control_type_names[] = { "set_max", "read_latency" }; -struct control_loop -{ +struct control_loop { /* * sysctl state for this subnode. */ @@ -272,8 +268,7 @@ struct control_loop #endif -struct cam_iosched_softc -{ +struct cam_iosched_softc { struct bio_queue_head bio_queue; struct bio_queue_head trim_queue; /* scheduler flags < 16, user flags >= 16 */ @@ -385,7 +380,7 @@ cam_iosched_limiter_iodone(struct iop_st static int cam_iosched_qd_iop(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending < ios->current) return 0; @@ -395,7 +390,7 @@ cam_iosched_qd_iop(struct iop_stats *ios static int cam_iosched_qd_caniop(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending < ios->current) return 0; @@ -405,7 +400,7 @@ cam_iosched_qd_caniop(struct iop_stats * static int cam_iosched_qd_iodone(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending != ios->current) return 0; @@ -773,7 +768,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLE struct cam_iosched_softc *isc; int value, i, error; const char *p; - + ios = arg1; isc = ios->softc; value = ios->limiter; @@ -781,7 +776,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLE p = "UNKNOWN"; else p = cam_iosched_limiter_names[value]; - + strlcpy(buf, p, sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -819,7 +814,7 @@ cam_iosched_control_type_sysctl(SYSCTL_H struct cam_iosched_softc *isc; int value, i, error; const char *p; - + clp = arg1; isc = clp->softc; value = clp->type; @@ -827,7 +822,7 @@ cam_iosched_control_type_sysctl(SYSCTL_H p = "UNKNOWN"; else p = cam_iosched_control_type_names[value]; - + strlcpy(buf, p, sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -852,7 +847,7 @@ cam_iosched_sbintime_sysctl(SYSCTL_HANDL sbintime_t value; int error; uint64_t us; - + value = *(sbintime_t *)arg1; us = (uint64_t)value / SBT_1US; snprintf(buf, sizeof(buf), "%ju", (intmax_t)us); @@ -969,7 +964,7 @@ cam_iosched_cl_sysctl_init(struct cam_io struct sysctl_oid_list *n; struct sysctl_ctx_list *ctx; struct control_loop *clp; - + clp = &isc->cl; clp->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, SYSCTL_CHILDREN(isc->sysctl_tree), OID_AUTO, "control", @@ -1007,7 +1002,7 @@ cam_iosched_cl_sysctl_fini(struct contro printf("can't remove iosched sysctl control loop context\n"); } #endif - + /* * Allocate the iosched structure. This also insulates callers from knowing * sizeof struct cam_iosched_softc. @@ -1069,7 +1064,6 @@ cam_iosched_fini(struct cam_iosched_soft callout_drain(&isc->ticker); isc->flags &= ~ CAM_IOSCHED_FLAG_CALLOUT_ACTIVE; } - #endif free(isc, M_CAMSCHED); } @@ -1328,7 +1322,7 @@ cam_iosched_next_bio(struct cam_iosched_ #endif return bp; } - + /* * Driver has been given some work to do by the block layer. Tell the * scheduler about it and have it queue the work up. The scheduler module @@ -1385,7 +1379,7 @@ cam_iosched_queue_work(struct cam_iosche } } -/* +/* * If we have work, get it scheduled. Called with the periph lock held. */ void @@ -1525,7 +1519,7 @@ isqrt64(uint64_t val) res >>= 1; bit >>= 2; } - + return res; } @@ -1707,7 +1701,7 @@ DB_SHOW_COMMAND(iosched, cam_iosched_db_ db_printf("Current Q len %d\n", biolen(&isc->trim_queue)); db_printf("read_bias: %d\n", isc->read_bias); db_printf("current_read_bias: %d\n", isc->current_read_bias); - db_printf("Trim active? %s\n", + db_printf("Trim active? %s\n", (isc->flags & CAM_IOSCHED_FLAG_TRIM_ACTIVE) ? "yes" : "no"); } #endif From owner-svn-src-all@freebsd.org Wed Jan 25 02:29: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 4EB8ECBEFC5; Wed, 25 Jan 2017 02:29:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 241D01B0C; Wed, 25 Jan 2017 02:29:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 0019B1A4DA1; Wed, 25 Jan 2017 13:29:22 +1100 (AEDT) Date: Wed, 25 Jan 2017 13:29:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312724 - in head/sys: sys vm In-Reply-To: <201701242200.v0OM0GRO042084@repo.freebsd.org> Message-ID: <20170125130904.Q857@besplex.bde.org> References: <201701242200.v0OM0GRO042084@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=c+HbeV1l c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=CJxvRpRaVkH0iAdldpkA:9 a=31PSgW2phgJ1oaFY:21 a=Tiq5K0jSM5oNRDWs:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 02:29:34 -0000 On Tue, 24 Jan 2017, Mateusz Guzik wrote: > Log: > hwpmc: partially depessimize munmap handling if the module is not loaded > > HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the > common (module not loaded) case. > ... > Modified: head/sys/sys/pmckern.h > ============================================================================== > --- head/sys/sys/pmckern.h Tue Jan 24 21:48:57 2017 (r312723) > +++ head/sys/sys/pmckern.h Tue Jan 24 22:00:16 2017 (r312724) > @@ -174,6 +174,9 @@ extern const int pmc_kernel_version; > /* PMC soft per cpu trapframe */ > extern struct trapframe pmc_tf[MAXCPU]; > > +/* Quick check if preparatory work is necessary */ > +#define PMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL) I'm still waiting for other __predict_ugly() macro invocations to be removed. The 2 new ones here even less effect than most. I couldn't measure the effect on makeworld of removing the PMC_HOOKS completely. Removing KTRACE long ago also seemed to have no effect. Unfortunately, it is impossible to remove procctl and other bloat that has grown in the syscall path, and is easy to measure slowdowns from this. The above one is an even better obfuscation than most. It is only invoked once, and it is context-dependent whether to false branch is the unusual case. > Modified: head/sys/vm/vm_mmap.c > ============================================================================== > --- head/sys/vm/vm_mmap.c Tue Jan 24 21:48:57 2017 (r312723) > +++ head/sys/vm/vm_mmap.c Tue Jan 24 22:00:16 2017 (r312724) > @@ -526,6 +526,7 @@ sys_munmap(td, uap) > #ifdef HWPMC_HOOKS > struct pmckern_map_out pkm; > vm_map_entry_t entry; > + bool pmc_handled; > #endif > vm_offset_t addr; > vm_size_t size, pageoff; > @@ -551,20 +552,24 @@ sys_munmap(td, uap) > return (EINVAL); > vm_map_lock(map); > #ifdef HWPMC_HOOKS > - /* > - * Inform hwpmc if the address range being unmapped contains > - * an executable region. > - */ > - pkm.pm_address = (uintptr_t) NULL; > - if (vm_map_lookup_entry(map, addr, &entry)) { > - for (; > - entry != &map->header && entry->start < addr + size; > - entry = entry->next) { > - if (vm_map_check_protection(map, entry->start, > - entry->end, VM_PROT_EXECUTE) == TRUE) { > - pkm.pm_address = (uintptr_t) addr; > - pkm.pm_size = (size_t) size; > - break; > + pmc_handled = false; > + if (PMC_HOOK_INSTALLED(PMC_FN_MUNMAP)) { > + pmc_handled = true; > + /* > + * Inform hwpmc if the address range being unmapped contains > + * an executable region. > + */ > + pkm.pm_address = (uintptr_t) NULL; > + if (vm_map_lookup_entry(map, addr, &entry)) { > + for (; > + entry != &map->header && entry->start < addr + size; > + entry = entry->next) { > + if (vm_map_check_protection(map, entry->start, > + entry->end, VM_PROT_EXECUTE) == TRUE) { > + pkm.pm_address = (uintptr_t) addr; > + pkm.pm_size = (size_t) size; > + break; > + } > } > } > } Predictions could also be implemented in a more hard-coded way using 'goto slowcase' and moving the slow case out of the way (assuming that that the hardware predicts forward branches as not taken and the compiler doesn't reorder the code anyway). This would be uglier, but not much more invasive than re-indenting the code after adding a test for the slow case. Bruce From owner-svn-src-all@freebsd.org Wed Jan 25 05:10: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 7201FCB2E24; Wed, 25 Jan 2017 05:10:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::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 15E50EB7; Wed, 25 Jan 2017 05:10:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id r144so39847876wme.0; Tue, 24 Jan 2017 21:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=N9DhOorOK61U1dhB27I5ESpqew3OmafsU+SOFkxUzIU=; b=qLO4ZIj6NerEsmfwcq3bSjWpI/sOzVvpiorvx1+Grchu+EUlUg287eqGkV2JdTaUt9 qt2DWs8p7/pszOz6MFArUnIUpoutFghmCu5SG5e//OtkVaOXV+IDDi+J3acDu7x5JuXX a08zSgK6+RpBHnN5CCxmZ6JFekxyCipyMTDr7Gx4uTzEmI6qHT75T9kvUpxNLQD6thOw GrcNJoLi2mqqCIcO3BOKqMRGbFBlZdcsgO0XDeRjVcHOAocbVkMklbD4F4PQekA3BNQf nMntxEMr6qMul6sqTCeon5nFmTKTpwni5n6mPYsNoRKte6cph6vUA0Nv5X8MjsPfEmNq 6ULQ== 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=N9DhOorOK61U1dhB27I5ESpqew3OmafsU+SOFkxUzIU=; b=WIqX8znOgSGA7WKpVLs+qkl0WukTrRuMIW/yLBdp6PoRsTqllegoE7zsir+rLRibWd PBtWT3gAarVRCy8/RpUUANe8KD3bGlawdB9smzdu90ly0Vcj+Ic58YRNAOBMEILMJVl8 wGlwLE3f66TohV7gJS6Em3eurmiG1n17zgjVjbDhtHX3htgfMpTF4hDXNVQkn/NCJLQz Y9mp8Vx+9qfh19l5uoViGqKYlvjnyR1XpErJeXULN7+UGm+oHL0DC9g+gqbk3R+gCglR Zi6caOu3xaDp6G1qn4HYMh2rnBXluI8vIzMXBns9gNlFxzyhPk1Yipiffepssim6gaNv aWtg== X-Gm-Message-State: AIkVDXLvz59OW69xY/F7FpV+R8qlXYtQVuqbM2D9Cop2a50ulZrwz149hgaEbskCwtOFvw== X-Received: by 10.28.184.133 with SMTP id i127mr19425043wmf.49.1485321057397; Tue, 24 Jan 2017 21:10:57 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id l37sm18661297wrc.41.2017.01.24.21.10.55 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 24 Jan 2017 21:10:56 -0800 (PST) Date: Wed, 25 Jan 2017 06:10:53 +0100 From: Mateusz Guzik To: Bruce Evans Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312724 - in head/sys: sys vm Message-ID: <20170125051052.GA9675@dft-labs.eu> References: <201701242200.v0OM0GRO042084@repo.freebsd.org> <20170125130904.Q857@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170125130904.Q857@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 05:10:59 -0000 On Wed, Jan 25, 2017 at 01:29:21PM +1100, Bruce Evans wrote: > On Tue, 24 Jan 2017, Mateusz Guzik wrote: > > >Log: > > hwpmc: partially depessimize munmap handling if the module is not loaded > > > > HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the > > common (module not loaded) case. > >... > >Modified: head/sys/sys/pmckern.h > >============================================================================== > >--- head/sys/sys/pmckern.h Tue Jan 24 21:48:57 2017 (r312723) > >+++ head/sys/sys/pmckern.h Tue Jan 24 22:00:16 2017 (r312724) > >@@ -174,6 +174,9 @@ extern const int pmc_kernel_version; > >/* PMC soft per cpu trapframe */ > >extern struct trapframe pmc_tf[MAXCPU]; > > > >+/* Quick check if preparatory work is necessary */ > >+#define PMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL) > > I'm still waiting for other __predict_ugly() macro invocations to be > removed. > Actually pmc was already using the annotation, so this fits the local style. > The 2 new ones here even less effect than most. I couldn't measure the > effect on makeworld of removing the PMC_HOOKS completely. Removing KTRACE > long ago also seemed to have no effect. Unfortunately, it is impossible > to remove procctl and other bloat that has grown in the syscall path, and > is easy to measure slowdowns from this. > The kernel has a lot of systematic single- and multi-threaded slowness and it is unlikely that some branch removals/predictions in isolation will make a measurable difference in a macrobenchmark. Most of the slow down is caused by avoidable atomic ops, which arguably trump spurious branches even if the target cacheline is not ping-ponged around. However, when a spurious branch/mostly false branch shows up, I don't see why not plug it. There is work done on proper hotpatching support which will hopefully make plenty of branches go away. syscall handling is slowed down by a lot of branches which are typically false. However, here the solution is to group them under one condition which if true takes the kernel to the slow (current) path. That is ktrace, ptrace, capsicum and whatever else would set a ->td_specialhandling (or whatever) flag/bitfield along with whatever it sets now. There is an additional slowness of packing/unpacking all arguments, but I don't know if this is worth changing. For non-static syscalls, their handling can be postponed. Instead of putting such syscalls directly into the table, they can be using a proxy method which would handle the reference counting. That is, the knowledge of such syscalls would be removed from the common path completely. There is only a matter of finding a nice way to get back the syscall number. I am *NOT* working on this though. For the vfs layer, slowness includes: - vget grabs both hold and usecount, which gives 2 atomic ops. then they have to be released and that's another 2. I had patch which made it so that a usecount implies holdcnt, but it rotted and is only a part of the real fix - dropping references to vnodes too easily causes them to be reshuffled on the free list, which adds single-threaded slowness due to more work and a lock contention point. I don't have a good solution, but a total hack I came up with so far boils down to grabbing and extra reference in vget and letting the syncer drop it some time later - similarly, vputx relocks the vnode in exclusive mode to call the inactive routine. Said routine very often does nothing and/or gets away with a mere interlock. I have a hack which extends the interface so that the filesystem can be asked whether it wants to do inactive. - VOP_* routines have arguments packed which the target fs has to unpack before use. Wrappers have several avoidable and mostly false branches. I would argue a new interface is needed. - the main lockmgr routine takes 8 arguments, 2 more than what's passable in registers on amd64 with sysv abi. Then it proceeds to perform several branches. I have a patch introducing a fast path which avoids it all and falls back to the original lockmgr if there are issues getting the lock uncontested. this gave me +4% more ops in a single-threaded stat benchmark. there is a LOCK_PROFILING bug somewhere in there I have to fix before committing - lockmgr locks are not adaptive. the facility itself does support the feature, but the code is disabled and no fs annotates its vnodes to use it if present - closing a vnode performs vn_start_write + vnode lock + VOP_CLOSE. the latter almost always has nothing to do so, thus making the above work unnecessary. In a spirit similar to inactive handling, we can ask the fs what it wants to do. Or better yet, revamp the interface so that the fs calls relevant helpers to do the locking it needs. and so on. tl;dr the main point of this patch was to not lock pmc_sx if it can be helped. I presume you don't have objections here. The annotations and shifting the work around was done to combat part of the systematic slowness. Unclear if you claim that such actions have no effect in general, or just happen to not be measurable in isolation. They are not easily visible as there is plenty of other slowness in significantly more used places. > The above one is an even better obfuscation than most. It is only invoked > once, and it is context-dependent whether to false branch is the unusual > case. > The HWPMC_HOOKS option is present in the default kernel. I highly doubt majority of users load the hwpmc module to take advantage of it. Things like this tend to be hotpatched which will not be any faster than the current branch if it has to be taken. > >+ pkm.pm_address = (uintptr_t) NULL; > >+ if (vm_map_lookup_entry(map, addr, &entry)) { > >+ for (; > >+ entry != &map->header && entry->start < addr + size; > >+ entry = entry->next) { > >+ if (vm_map_check_protection(map, entry->start, > >+ entry->end, VM_PROT_EXECUTE) == TRUE) { > >+ pkm.pm_address = (uintptr_t) addr; > >+ pkm.pm_size = (size_t) size; > >+ break; > >+ } > > } > > } > > } > > Predictions could also be implemented in a more hard-coded way using > 'goto slowcase' and moving the slow case out of the way (assuming that > that the hardware predicts forward branches as not taken and the > compiler doesn't reorder the code anyway). This would be uglier, but > not much more invasive than re-indenting the code after adding a test > for the slow case. > I tried that. clang folds the slow case back in if the hint is not provided. That said, it still can be done to reduce indentation level. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Wed Jan 25 06:08: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 C77CDCBE0E8; Wed, 25 Jan 2017 06:08:11 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A20AB96F; Wed, 25 Jan 2017 06:08:11 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P68AoS043021; Wed, 25 Jan 2017 06:08:10 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P68Awb043019; Wed, 25 Jan 2017 06:08:10 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701250608.v0P68Awb043019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 06:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312739 - in head/sys/arm/mv: armada armada38x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 06:08:11 -0000 Author: wma Date: Wed Jan 25 06:08:10 2017 New Revision: 312739 URL: https://svnweb.freebsd.org/changeset/base/312739 Log: Introduce armada_thermal driver for Armada family platforms * Currently supports only Armada38X family but other Marvell SoC's can be added if needed. * Provides temperature is C deg. * To print the temperature one can use: sysctl dev.armada_thermal.0.temperature Submitted by: Zbigniew Bodek Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D9217 Added: head/sys/arm/mv/armada/ head/sys/arm/mv/armada/thermal.c (contents, props changed) Modified: head/sys/arm/mv/armada38x/files.armada38x Added: head/sys/arm/mv/armada/thermal.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/armada/thermal.c Wed Jan 25 06:08:10 2017 (r312739) @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2017 Semihalf. + * Copyright (c) 2017 Stormshield. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define READOUT_TO_C(temp) ((temp) / 1000) + +#define STAT_RID 0 +#define CTRL_RID 1 + +#define TSEN_STAT_READOUT_VALID 0x1 + +#define A380_TSEN_CTRL_RESET (1 << 8) + +struct armada_thermal_softc; + +typedef struct armada_thermal_data { + /* Initialize the sensor */ + void (*tsen_init)(struct armada_thermal_softc *); + + /* Test for a valid sensor value */ + boolean_t (*is_valid)(struct armada_thermal_softc *); + + /* Formula coefficients: temp = (b + m * reg) / div */ + u_long coef_b; + u_long coef_m; + u_long coef_div; + + boolean_t inverted; + + /* Shift and mask to access the sensor temperature */ + u_int temp_shift; + u_int temp_mask; + u_int is_valid_shift; +} armada_tdata_t; + +static boolean_t armada_tsen_readout_valid(struct armada_thermal_softc *); +static int armada_tsen_get_temp(struct armada_thermal_softc *, u_long *); +static void armada380_tsen_init(struct armada_thermal_softc *); +static void armada_temp_update(void *); + +static const armada_tdata_t armada380_tdata = { + .tsen_init = armada380_tsen_init, + .is_valid = armada_tsen_readout_valid, + .is_valid_shift = 10, + .temp_shift = 0, + .temp_mask = 0x3ff, + .coef_b = 1172499100UL, + .coef_m = 2000096UL, + .coef_div = 4201, + .inverted = TRUE, +}; + +static int armada_thermal_probe(device_t); +static int armada_thermal_attach(device_t); +static int armada_thermal_detach(device_t); + +static device_method_t armada_thermal_methods[] = { + DEVMETHOD(device_probe, armada_thermal_probe), + DEVMETHOD(device_attach, armada_thermal_attach), + DEVMETHOD(device_detach, armada_thermal_detach), + + DEVMETHOD_END +}; + +struct armada_thermal_softc { + device_t dev; + + struct resource *stat_res; + struct resource *ctrl_res; + + struct callout temp_upd; + struct mtx temp_upd_mtx; + + const armada_tdata_t *tdata; + + u_long chip_temperature; +}; + +static driver_t armada_thermal_driver = { + "armada_thermal", + armada_thermal_methods, + sizeof(struct armada_thermal_softc) +}; + +static devclass_t armada_thermal_devclass; + +DRIVER_MODULE(armada_thermal, simplebus, armada_thermal_driver, + armada_thermal_devclass, 0, 0); +DRIVER_MODULE(armada_thermal, ofwbus, armada_thermal_driver, + armada_thermal_devclass, 0, 0); + +static int +armada_thermal_probe(device_t dev) +{ + struct armada_thermal_softc *sc; + + sc = device_get_softc(dev); + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_is_compatible(dev, "marvell,armada380-thermal")) { + device_set_desc(dev, "Armada380 Thermal Control"); + sc->tdata = &armada380_tdata; + + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +armada_thermal_attach(device_t dev) +{ + struct armada_thermal_softc *sc; + const armada_tdata_t *tdata; + struct sysctl_ctx_list *sctx; + struct sysctl_oid_list *schildren; + int timeout; + int rid; + + sc = device_get_softc(dev); + + /* Allocate CTRL and STAT register spaces */ + rid = STAT_RID; + sc->stat_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->stat_res == NULL) { + device_printf(dev, + "Could not allocate memory for the status register\n"); + return (ENXIO); + } + + rid = CTRL_RID; + sc->ctrl_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->ctrl_res == NULL) { + device_printf(dev, + "Could not allocate memory for the control register\n"); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->stat_res), sc->stat_res); + sc->stat_res = NULL; + return (ENXIO); + } + + /* Now initialize the sensor */ + tdata = sc->tdata; + tdata->tsen_init(sc); + /* Set initial temperature value */ + for (timeout = 1000; timeout > 0; timeout--) { + if (armada_tsen_get_temp(sc, &sc->chip_temperature) == 0) + break; + DELAY(10); + } + if (timeout <= 0) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->stat_res), sc->stat_res); + sc->stat_res = NULL; + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->ctrl_res), sc->ctrl_res); + sc->ctrl_res = NULL; + return (ENXIO); + } + /* Initialize mutex */ + mtx_init(&sc->temp_upd_mtx, "Armada Thermal", NULL, MTX_DEF); + /* Set up the temperature update callout */ + callout_init_mtx(&sc->temp_upd, &sc->temp_upd_mtx, 0); + /* Schedule callout */ + callout_reset(&sc->temp_upd, hz, armada_temp_update, sc); + + sctx = device_get_sysctl_ctx(dev); + schildren = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_LONG(sctx, schildren, OID_AUTO, "temperature", + CTLFLAG_RD, &sc->chip_temperature, "SoC temperature"); + + return (0); +} + +static int +armada_thermal_detach(device_t dev) +{ + struct armada_thermal_softc *sc; + + sc = device_get_softc(dev); + + if (!device_is_attached(dev)) + return (0); + + callout_drain(&sc->temp_upd); + + sc->chip_temperature = 0; + + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->stat_res), sc->stat_res); + sc->stat_res = NULL; + + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->ctrl_res), sc->ctrl_res); + sc->ctrl_res = NULL; + + return (0); +} + +static boolean_t +armada_tsen_readout_valid(struct armada_thermal_softc *sc) +{ + const armada_tdata_t *tdata; + uint32_t tsen_stat; + boolean_t is_valid; + + tdata = sc->tdata; + tsen_stat = bus_read_4(sc->stat_res, 0); + + tsen_stat >>= tdata->is_valid_shift; + is_valid = ((tsen_stat & TSEN_STAT_READOUT_VALID) != 0); + + return (is_valid); +} + +static int +armada_tsen_get_temp(struct armada_thermal_softc *sc, u_long *temp) +{ + const armada_tdata_t *tdata; + uint32_t reg; + u_long tmp; + u_long m, b, div; + + tdata = sc->tdata; + /* Check if the readout is valid */ + if ((tdata->is_valid != NULL) && !tdata->is_valid(sc)) + return (EIO); + + reg = bus_read_4(sc->stat_res, 0); + reg = (reg >> tdata->temp_shift) & tdata->temp_mask; + + /* Get formula coefficients */ + b = tdata->coef_b; + m = tdata->coef_m; + div = tdata->coef_div; + + if (tdata->inverted) + tmp = ((m * reg) - b) / div; + else + tmp = (b - (m * reg)) / div; + + *temp = READOUT_TO_C(tmp); + + return (0); +} + +static void +armada380_tsen_init(struct armada_thermal_softc *sc) +{ + uint32_t tsen_ctrl; + + tsen_ctrl = bus_read_4(sc->ctrl_res, 0); + if ((tsen_ctrl & A380_TSEN_CTRL_RESET) == 0) { + tsen_ctrl |= A380_TSEN_CTRL_RESET; + bus_write_4(sc->ctrl_res, 0, tsen_ctrl); + DELAY(10000); + } +} + +static void +armada_temp_update(void *arg) +{ + struct armada_thermal_softc *sc; + + sc = arg; + /* Update temperature value, keel old if the readout is not valid */ + (void)armada_tsen_get_temp(sc, &sc->chip_temperature); + + callout_reset(&sc->temp_upd, hz, armada_temp_update, sc); +} Modified: head/sys/arm/mv/armada38x/files.armada38x ============================================================================== --- head/sys/arm/mv/armada38x/files.armada38x Wed Jan 25 04:35:57 2017 (r312738) +++ head/sys/arm/mv/armada38x/files.armada38x Wed Jan 25 06:08:10 2017 (r312739) @@ -1,6 +1,8 @@ # $FreeBSD$ arm/mv/mpic.c standard +arm/mv/armada/thermal.c optional fdt + arm/mv/armada38x/armada38x.c standard arm/mv/armada38x/armada38x_mp.c optional smp arm/mv/armada38x/pmsu.c standard From owner-svn-src-all@freebsd.org Wed Jan 25 06:11: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 A8562CBE21F; Wed, 25 Jan 2017 06:11:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A591CA7; Wed, 25 Jan 2017 06:11:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0P6B7FK043849; Wed, 25 Jan 2017 06:11:07 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P6B7db043837; Wed, 25 Jan 2017 06:11:07 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701250611.v0P6B7db043837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 06:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312740 - head/sys/dev/cesa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 06:11:08 -0000 Author: wma Date: Wed Jan 25 06:11:07 2017 New Revision: 312740 URL: https://svnweb.freebsd.org/changeset/base/312740 Log: Add misssing Armada38x ID's in CESA attach Marvell Armada 38x is supported in 3 variants, so take all into consideration in crypto driver attach routine. Submitted by: Marcin Wojtas Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9248 Modified: head/sys/dev/cesa/cesa.c Modified: head/sys/dev/cesa/cesa.c ============================================================================== --- head/sys/dev/cesa/cesa.c Wed Jan 25 06:08:10 2017 (r312739) +++ head/sys/dev/cesa/cesa.c Wed Jan 25 06:11:07 2017 (r312740) @@ -1045,6 +1045,8 @@ cesa_attach(device_t dev) case MV_DEV_88F6281: case MV_DEV_88F6282: case MV_DEV_88F6828: + case MV_DEV_88F6820: + case MV_DEV_88F6810: sc->sc_tperr = 0; break; case MV_DEV_MV78100: From owner-svn-src-all@freebsd.org Wed Jan 25 07:51: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 327D7CC0AE6; Wed, 25 Jan 2017 07:51: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 EEEC9A1F; Wed, 25 Jan 2017 07:51: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 v0P7pKM4083810; Wed, 25 Jan 2017 07:51:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P7pKA3083809; Wed, 25 Jan 2017 07:51:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701250751.v0P7pKA3083809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 07:51: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: r312741 - stable/11/sys/dev/ntb/if_ntb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 07:51:21 -0000 Author: mav Date: Wed Jan 25 07:51:19 2017 New Revision: 312741 URL: https://svnweb.freebsd.org/changeset/base/312741 Log: MFC r311935: Pretend we support some IOCTLs to not scary upper layers. Modified: stable/11/sys/dev/ntb/if_ntb/if_ntb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- stable/11/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 06:11:07 2017 (r312740) +++ stable/11/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:19 2017 (r312741) @@ -237,6 +237,11 @@ ntb_ioctl(if_t ifp, u_long command, cadd int error = 0; switch (command) { + case SIOCSIFFLAGS: + case SIOCADDMULTI: + case SIOCDELMULTI: + break; + case SIOCSIFMTU: { if (ifr->ifr_mtu > sc->mtu - ETHER_HDR_LEN) { From owner-svn-src-all@freebsd.org Wed Jan 25 07:51: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 63681CC0BA3; Wed, 25 Jan 2017 07:51: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 32C91BD5; Wed, 25 Jan 2017 07:51: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 v0P7prHS083883; Wed, 25 Jan 2017 07:51:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0P7prei083882; Wed, 25 Jan 2017 07:51:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701250751.v0P7prei083882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 07:51:53 +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: r312742 - stable/10/sys/dev/ntb/if_ntb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 07:51:54 -0000 Author: mav Date: Wed Jan 25 07:51:53 2017 New Revision: 312742 URL: https://svnweb.freebsd.org/changeset/base/312742 Log: MFC r311935: Pretend we support some IOCTLs to not scary upper layers. Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- stable/10/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:19 2017 (r312741) +++ stable/10/sys/dev/ntb/if_ntb/if_ntb.c Wed Jan 25 07:51:53 2017 (r312742) @@ -237,6 +237,11 @@ ntb_ioctl(struct ifnet *ifp, u_long comm int error = 0; switch (command) { + case SIOCSIFFLAGS: + case SIOCADDMULTI: + case SIOCDELMULTI: + break; + case SIOCSIFMTU: { if (ifr->ifr_mtu > sc->mtu - ETHER_HDR_LEN) { From owner-svn-src-all@freebsd.org Wed Jan 25 10:22: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 B2453CBF0CE; Wed, 25 Jan 2017 10:22:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CB03143F; Wed, 25 Jan 2017 10:22:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PAM7rV046191; Wed, 25 Jan 2017 10:22:07 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PAM70M046189; Wed, 25 Jan 2017 10:22:07 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251022.v0PAM70M046189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312743 - head/sys/dev/cesa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:22:08 -0000 Author: wma Date: Wed Jan 25 10:22:07 2017 New Revision: 312743 URL: https://svnweb.freebsd.org/changeset/base/312743 Log: Use SoC ID - based detection in CESA This commit introduces following changes in order to get rid of ifdef's from all around the driver. * Introduce sc_soc_id field in cesa_softc structure - this value is obtained in cesa_attach() anyway, so make use of it. * Replace ifdefs with SoC ID checks. * Perform PM control status only for relevant SoC's. Submitted by: Marcin Wojtas Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9247 Modified: head/sys/dev/cesa/cesa.c head/sys/dev/cesa/cesa.h Modified: head/sys/dev/cesa/cesa.c ============================================================================== --- head/sys/dev/cesa/cesa.c Wed Jan 25 07:51:53 2017 (r312742) +++ head/sys/dev/cesa/cesa.c Wed Jan 25 10:22:07 2017 (r312743) @@ -953,11 +953,13 @@ cesa_execute(struct cesa_softc *sc) ctd = STAILQ_FIRST(&cr->cr_tdesc); CESA_TDMA_WRITE(sc, CESA_TDMA_ND, ctd->ctd_cthd_paddr); -#if defined (SOC_MV_ARMADA38X) - CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2); -#else - CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE); -#endif + + if (sc->sc_soc_id == MV_DEV_88F6828 || + sc->sc_soc_id == MV_DEV_88F6820 || + sc->sc_soc_id == MV_DEV_88F6810) + CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2); + else + CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE); CESA_UNLOCK(sc, requests); } @@ -968,6 +970,7 @@ cesa_setup_sram(struct cesa_softc *sc) phandle_t sram_node; ihandle_t sram_ihandle; pcell_t sram_handle, sram_reg[2]; + void *sram_va; int rv; rv = OF_getencprop(ofw_bus_get_node(sc->sc_dev), "sram-handle", @@ -986,15 +989,17 @@ cesa_setup_sram(struct cesa_softc *sc) /* Store SRAM size to be able to unmap in detach() */ sc->sc_sram_size = sram_reg[1]; -#if defined(SOC_MV_ARMADA38X) - void *sram_va; + if (sc->sc_soc_id != MV_DEV_88F6828 && + sc->sc_soc_id != MV_DEV_88F6820 && + sc->sc_soc_id != MV_DEV_88F6810) + return (0); /* SRAM memory was not mapped in platform_sram_devmap(), map it now */ sram_va = pmap_mapdev(sc->sc_sram_base_pa, sc->sc_sram_size); if (sram_va == NULL) return (ENOMEM); sc->sc_sram_base_va = (vm_offset_t)sram_va; -#endif + return (0); } @@ -1018,7 +1023,7 @@ static int cesa_attach(device_t dev) { struct cesa_softc *sc; - uint32_t d, r; + uint32_t d, r, val; int error; int i; @@ -1027,23 +1032,19 @@ cesa_attach(device_t dev) sc->sc_error = 0; sc->sc_dev = dev; - /* Check if CESA peripheral device has power turned on */ -#if defined(SOC_MV_KIRKWOOD) - if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) == CPU_PM_CTRL_CRYPTO) { - device_printf(dev, "not powered on\n"); - return (ENXIO); - } -#else - if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != CPU_PM_CTRL_CRYPTO) { - device_printf(dev, "not powered on\n"); - return (ENXIO); - } -#endif soc_id(&d, &r); switch (d) { case MV_DEV_88F6281: case MV_DEV_88F6282: + /* Check if CESA peripheral device has power turned on */ + if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) == + CPU_PM_CTRL_CRYPTO) { + device_printf(dev, "not powered on\n"); + return (ENXIO); + } + sc->sc_tperr = 0; + break; case MV_DEV_88F6828: case MV_DEV_88F6820: case MV_DEV_88F6810: @@ -1051,12 +1052,20 @@ cesa_attach(device_t dev) break; case MV_DEV_MV78100: case MV_DEV_MV78100_Z0: + /* Check if CESA peripheral device has power turned on */ + if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != + CPU_PM_CTRL_CRYPTO) { + device_printf(dev, "not powered on\n"); + return (ENXIO); + } sc->sc_tperr = CESA_ICR_TPERR; break; default: return (ENXIO); } + sc->sc_soc_id = d; + /* Initialize mutexes */ mtx_init(&sc->sc_sc_lock, device_get_nameunit(dev), "CESA Shared Data", MTX_DEF); @@ -1191,12 +1200,15 @@ cesa_attach(device_t dev) * - Outstanding reads enabled, * - No byte-swap. */ - CESA_TDMA_WRITE(sc, CESA_TDMA_CR, CESA_TDMA_CR_DBL128 | - CESA_TDMA_CR_SBL128 | CESA_TDMA_CR_ORDEN | CESA_TDMA_CR_NBS | -#if defined (SOC_MV_ARMADA38X) - CESA_TDMA_NUM_OUTSTAND | -#endif - CESA_TDMA_CR_ENABLE); + val = CESA_TDMA_CR_DBL128 | CESA_TDMA_CR_SBL128 | + CESA_TDMA_CR_ORDEN | CESA_TDMA_CR_NBS | CESA_TDMA_CR_ENABLE; + + if (sc->sc_soc_id == MV_DEV_88F6828 || + sc->sc_soc_id == MV_DEV_88F6820 || + sc->sc_soc_id == MV_DEV_88F6810) + val |= CESA_TDMA_NUM_OUTSTAND; + + CESA_TDMA_WRITE(sc, CESA_TDMA_CR, val); /* * Initialize SA: @@ -1248,9 +1260,10 @@ err4: err3: bus_teardown_intr(dev, sc->sc_res[RES_CESA_IRQ], sc->sc_icookie); err2: -#if defined(SOC_MV_ARMADA38X) - pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); -#endif + if (sc->sc_soc_id == MV_DEV_88F6828 || + sc->sc_soc_id == MV_DEV_88F6820 || + sc->sc_soc_id == MV_DEV_88F6810) + pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); err1: bus_release_resources(dev, cesa_res_spec, sc->sc_res); err0: @@ -1298,10 +1311,12 @@ cesa_detach(device_t dev) /* Relase I/O and IRQ resources */ bus_release_resources(dev, cesa_res_spec, sc->sc_res); -#if defined(SOC_MV_ARMADA38X) /* Unmap SRAM memory */ - pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); -#endif + if (sc->sc_soc_id == MV_DEV_88F6828 || + sc->sc_soc_id == MV_DEV_88F6820 || + sc->sc_soc_id == MV_DEV_88F6810) + pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); + /* Destroy mutexes */ mtx_destroy(&sc->sc_sessions_lock); mtx_destroy(&sc->sc_requests_lock); Modified: head/sys/dev/cesa/cesa.h ============================================================================== --- head/sys/dev/cesa/cesa.h Wed Jan 25 07:51:53 2017 (r312742) +++ head/sys/dev/cesa/cesa.h Wed Jan 25 10:22:07 2017 (r312743) @@ -231,6 +231,7 @@ struct cesa_packet { struct cesa_softc { device_t sc_dev; int32_t sc_cid; + uint32_t sc_soc_id; struct resource *sc_res[RES_CESA_NUM]; void *sc_icookie; bus_dma_tag_t sc_data_dtag; From owner-svn-src-all@freebsd.org Wed Jan 25 10:26: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 977D0CBF27D; Wed, 25 Jan 2017 10:26:00 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 649FB192D; Wed, 25 Jan 2017 10:26:00 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PAPxlr047025; Wed, 25 Jan 2017 10:25:59 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PAPxQi047024; Wed, 25 Jan 2017 10:25:59 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251025.v0PAPxQi047024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312744 - head/sys/dev/cesa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:26:00 -0000 Author: wma Date: Wed Jan 25 10:25:59 2017 New Revision: 312744 URL: https://svnweb.freebsd.org/changeset/base/312744 Log: Fix SHA256 usage on older CESA versions Adding SHA256 support to Marvell crypto driver resulted in regression for older SoC's, not capable of handling this mode in hardware. Submitted by: Emeric Poupon Obtained from: Stormshield Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9215 Modified: head/sys/dev/cesa/cesa.c Modified: head/sys/dev/cesa/cesa.c ============================================================================== --- head/sys/dev/cesa/cesa.c Wed Jan 25 10:22:07 2017 (r312743) +++ head/sys/dev/cesa/cesa.c Wed Jan 25 10:25:59 2017 (r312744) @@ -1242,7 +1242,10 @@ cesa_attach(device_t dev) crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0); crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0); crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0); - crypto_register(sc->sc_cid, CRYPTO_SHA2_256_HMAC, 0, 0); + if (sc->sc_soc_id == MV_DEV_88F6828 || + sc->sc_soc_id == MV_DEV_88F6820 || + sc->sc_soc_id == MV_DEV_88F6810) + crypto_register(sc->sc_cid, CRYPTO_SHA2_256_HMAC, 0, 0); return (0); err8: From owner-svn-src-all@freebsd.org Wed Jan 25 10:28: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 D4764CBF50E; Wed, 25 Jan 2017 10:28:22 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A4871D4F; Wed, 25 Jan 2017 10:28:22 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PASLdC047150; Wed, 25 Jan 2017 10:28:21 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PASLcf047148; Wed, 25 Jan 2017 10:28:21 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251028.v0PASLcf047148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312745 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:28:22 -0000 Author: wma Date: Wed Jan 25 10:28:21 2017 New Revision: 312745 URL: https://svnweb.freebsd.org/changeset/base/312745 Log: Expand OpenFirmware API with ofw_bus_node_status_okay method Method could be used before we can access device_t structure. As per simple phandle_t handle we can access FDT to check if specified node has been enabled. It will be used in Marvell's common configuration code. Submitted by: Konrad Adamczyk Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb, meloun-miracle-cz Differential revision: https://reviews.freebsd.org/D9218 Modified: head/sys/dev/ofw/ofw_bus_subr.c head/sys/dev/ofw/ofw_bus_subr.h Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Wed Jan 25 10:25:59 2017 (r312744) +++ head/sys/dev/ofw/ofw_bus_subr.c Wed Jan 25 10:28:21 2017 (r312745) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" #define OFW_COMPAT_LEN 255 +#define OFW_STATUS_LEN 16 int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *obd, phandle_t node) @@ -179,6 +180,24 @@ ofw_bus_status_okay(device_t dev) return (0); } +int +ofw_bus_node_status_okay(phandle_t node) +{ + char status[OFW_STATUS_LEN]; + int len; + + len = OF_getproplen(node, "status"); + if (len <= 0) + return (1); + + OF_getprop(node, "status", status, OFW_STATUS_LEN); + if ((len == 5 && (bcmp(status, "okay", len) == 0)) || + (len == 3 && (bcmp(status, "ok", len)))) + return (1); + + return (0); +} + static int ofw_bus_node_is_compatible_int(const char *compat, int len, const char *onecompat) Modified: head/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.h Wed Jan 25 10:25:59 2017 (r312744) +++ head/sys/dev/ofw/ofw_bus_subr.h Wed Jan 25 10:28:21 2017 (r312745) @@ -100,6 +100,7 @@ int ofw_bus_intr_by_rid(device_t, phandl /* Helper to get device status property */ const char *ofw_bus_get_status(device_t dev); int ofw_bus_status_okay(device_t dev); +int ofw_bus_node_status_okay(phandle_t node); /* Helper to get node's interrupt parent */ phandle_t ofw_bus_find_iparent(phandle_t); From owner-svn-src-all@freebsd.org Wed Jan 25 10:29: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 34199CBF5A6; Wed, 25 Jan 2017 10:29:48 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03EBB1EF5; Wed, 25 Jan 2017 10:29:47 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PATlPe047236; Wed, 25 Jan 2017 10:29:47 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PATleq047235; Wed, 25 Jan 2017 10:29:47 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251029.v0PATleq047235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312746 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:29:48 -0000 Author: wma Date: Wed Jan 25 10:29:46 2017 New Revision: 312746 URL: https://svnweb.freebsd.org/changeset/base/312746 Log: Fix node detection for MBUS windows configuration Configure decoding windows only for devices with enabled nodes in FDT. Submitted by: Konrad Adamczyk Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9219 Modified: head/sys/arm/mv/mv_common.c Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Wed Jan 25 10:28:21 2017 (r312745) +++ head/sys/arm/mv/mv_common.c Wed Jan 25 10:29:46 2017 (r312746) @@ -2172,6 +2172,10 @@ fdt_win_setup(void) soc_node = &soc_nodes[i]; + /* Setup only for enabled devices */ + if (ofw_bus_node_status_okay(child) == 0) + continue; + if (!ofw_bus_node_is_compatible(child,soc_node->compat)) continue; From owner-svn-src-all@freebsd.org Wed Jan 25 10:31: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 07664CBF6F7; Wed, 25 Jan 2017 10:31:18 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D64CE622; Wed, 25 Jan 2017 10:31:17 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PAVGNf050107; Wed, 25 Jan 2017 10:31:16 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PAVGlM050105; Wed, 25 Jan 2017 10:31:16 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251031.v0PAVGlM050105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312747 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:31:18 -0000 Author: wma Date: Wed Jan 25 10:31:16 2017 New Revision: 312747 URL: https://svnweb.freebsd.org/changeset/base/312747 Log: Setup decoding windows for ARMADA38X It is necesarry to open memory windows on internal bus for AHCI driver to work correctly. Submitted by: Konrad Adamczyk Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9220 Modified: head/sys/arm/mv/mv_common.c head/sys/arm/mv/mvwin.h Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Wed Jan 25 10:29:46 2017 (r312746) +++ head/sys/arm/mv/mv_common.c Wed Jan 25 10:31:16 2017 (r312747) @@ -98,6 +98,7 @@ static void decode_win_usb_setup(u_long) static void decode_win_usb3_setup(u_long); static void decode_win_eth_setup(u_long); static void decode_win_sata_setup(u_long); +static void decode_win_ahci_setup(u_long); static void decode_win_idma_setup(u_long); static void decode_win_xor_setup(u_long); @@ -107,6 +108,7 @@ static void decode_win_usb3_dump(u_long) static void decode_win_eth_dump(u_long base); static void decode_win_idma_dump(u_long base); static void decode_win_xor_dump(u_long base); +static void decode_win_sata_dump(u_long base); static int fdt_get_ranges(const char *, void *, int, int *, int *); #ifdef SOC_MV_ARMADA38X @@ -139,6 +141,7 @@ static struct soc_node_spec soc_nodes[] { "mrvl,ge", &decode_win_eth_setup, &decode_win_eth_dump }, { "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump }, { "marvell,armada-380-xhci", &decode_win_usb3_setup, &decode_win_usb3_dump }, + { "marvell,armada-380-ahci", &decode_win_ahci_setup, &decode_win_sata_dump }, { "mrvl,sata", &decode_win_sata_setup, NULL }, { "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump }, { "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump }, @@ -660,6 +663,11 @@ WIN_REG_BASE_IDX_RD(win_sata, cr, MV_WIN WIN_REG_BASE_IDX_RD(win_sata, br, MV_WIN_SATA_BASE); WIN_REG_BASE_IDX_WR(win_sata, cr, MV_WIN_SATA_CTRL); WIN_REG_BASE_IDX_WR(win_sata, br, MV_WIN_SATA_BASE); +#if defined(SOC_MV_ARMADA38X) +WIN_REG_BASE_IDX_RD(win_sata, sz, MV_WIN_SATA_SIZE); +WIN_REG_BASE_IDX_WR(win_sata, sz, MV_WIN_SATA_SIZE); +#endif + #ifndef SOC_MV_DOVE WIN_REG_IDX_RD(ddr, br, MV_WIN_DDR_BASE, MV_DDR_CADR_BASE) WIN_REG_IDX_RD(ddr, sz, MV_WIN_DDR_SIZE, MV_DDR_CADR_BASE) @@ -1999,6 +2007,55 @@ decode_win_sata_setup(u_long base) } } +static void +decode_win_ahci_setup(u_long base) +{ + uint32_t br, cr, sz; + int i, j; + + for (i = 0; i < MV_WIN_SATA_MAX; i++) { + win_sata_cr_write(base, i, 0); + win_sata_br_write(base, i, 0); + win_sata_sz_write(base, i, 0); + } + + for (i = 0; i < MV_WIN_DDR_MAX; i++) { + if (ddr_is_active(i)) { + cr = (ddr_attr(i) << IO_WIN_ATTR_SHIFT) | + (ddr_target(i) << IO_WIN_TGT_SHIFT) | + IO_WIN_ENA_MASK; + br = ddr_base(i); + sz = (ddr_size(i) - 1) & + (IO_WIN_SIZE_MASK << IO_WIN_SIZE_SHIFT); + + /* Use first available SATA window */ + for (j = 0; j < MV_WIN_SATA_MAX; j++) { + if (win_sata_cr_read(base, j) & IO_WIN_ENA_MASK) + continue; + + /* BASE is set to DRAM base (0x00000000) */ + win_sata_br_write(base, j, br); + /* CTRL targets DRAM ctrl with 0x0E or 0x0D */ + win_sata_cr_write(base, j, cr); + /* SIZE is set to 16MB - max value */ + win_sata_sz_write(base, j, sz); + break; + } + } + } +} + +static void +decode_win_sata_dump(u_long base) +{ + int i; + + for (i = 0; i < MV_WIN_SATA_MAX; i++) + printf("SATA window#%d: cr 0x%08x, br 0x%08x, sz 0x%08x\n", i, + win_sata_cr_read(base, i), win_sata_br_read(base, i), + win_sata_sz_read(base,i)); +} + static int decode_win_sata_valid(void) { Modified: head/sys/arm/mv/mvwin.h ============================================================================== --- head/sys/arm/mv/mvwin.h Wed Jan 25 10:29:46 2017 (r312746) +++ head/sys/arm/mv/mvwin.h Wed Jan 25 10:31:16 2017 (r312747) @@ -324,9 +324,16 @@ #define MV_PCIE_CONTROL (0x1a00) #define MV_PCIE_ROOT_CMPLX (1 << 1) +#if defined(SOC_MV_ARMADA38X) +#define MV_WIN_SATA_CTRL(n) (0x10 * (n) + 0x60) +#define MV_WIN_SATA_BASE(n) (0x10 * (n) + 0x64) +#define MV_WIN_SATA_SIZE(n) (0x10 * (n) + 0x68) +#define MV_WIN_SATA_MAX 4 +#else #define MV_WIN_SATA_CTRL(n) (0x10 * (n) + 0x30) #define MV_WIN_SATA_BASE(n) (0x10 * (n) + 0x34) #define MV_WIN_SATA_MAX 4 +#endif #if defined(SOC_MV_ARMADA38X) #define MV_BOOTROM_MEM_ADDR 0xFFF00000 From owner-svn-src-all@freebsd.org Wed Jan 25 10:32: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 BC19BCBF900; Wed, 25 Jan 2017 10:32:58 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BCA6950; Wed, 25 Jan 2017 10:32:58 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PAWvfX050930; Wed, 25 Jan 2017 10:32:57 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PAWvSH050928; Wed, 25 Jan 2017 10:32:57 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251032.v0PAWvSH050928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312748 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:32:58 -0000 Author: wma Date: Wed Jan 25 10:32:57 2017 New Revision: 312748 URL: https://svnweb.freebsd.org/changeset/base/312748 Log: Enable optional soft reset in AHCI It occurred that some Marvell integrated controllers require additional time after soft reset to work properly. Introduce new quirk (AHCI_Q_MRVL_SR_DEL), that enable such operation. Submitted by: Konrad Adamczyk Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: mav Differential revision: https://reviews.freebsd.org/D9221 Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Jan 25 10:31:16 2017 (r312747) +++ head/sys/dev/ahci/ahci.c Wed Jan 25 10:32:57 2017 (r312748) @@ -1598,6 +1598,14 @@ ahci_execute_transaction(struct ahci_slo } /* + * Some Marvell controllers require additional time + * after soft reset to work properly. Setup delay + * to 50ms after soft reset. + */ + if (ch->quirks & AHCI_Q_MRVL_SR_DEL) + DELAY(50000); + + /* * Marvell HBAs with non-RAID firmware do not wait for * readiness after soft reset, so we have to wait here. * Marvell RAIDs do not have this problem, but instead Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Jan 25 10:31:16 2017 (r312747) +++ head/sys/dev/ahci/ahci.h Wed Jan 25 10:32:57 2017 (r312748) @@ -598,6 +598,7 @@ enum ahci_err_type { #define AHCI_Q_FORCE_PI 0x00040000 #define AHCI_Q_RESTORE_CAP 0x00080000 #define AHCI_Q_NOMSIX 0x00100000 +#define AHCI_Q_MRVL_SR_DEL 0x00200000 #define AHCI_Q_BIT_STRING \ "\020" \ From owner-svn-src-all@freebsd.org Wed Jan 25 10:34: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 D71EBCBFA04; Wed, 25 Jan 2017 10:34:38 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B181AB9F; Wed, 25 Jan 2017 10:34:38 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PAYbln051052; Wed, 25 Jan 2017 10:34:37 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PAYb5h051049; Wed, 25 Jan 2017 10:34:37 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251034.v0PAYb5h051049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 10:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312749 - in head/sys: arm/conf arm/mv dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 10:34:38 -0000 Author: wma Date: Wed Jan 25 10:34:37 2017 New Revision: 312749 URL: https://svnweb.freebsd.org/changeset/base/312749 Log: Add support for AHCI on ARMADA38X This file provides support for AHCI mode on Armada38x and adds new optional AHCI device to arm/mv/files.mv. Submitted by: Konrad Adamczyk Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9222 Added: head/sys/dev/ahci/ahci_mv_fdt.c (contents, props changed) Modified: head/sys/arm/conf/ARMADA38X head/sys/arm/mv/files.mv Modified: head/sys/arm/conf/ARMADA38X ============================================================================== --- head/sys/arm/conf/ARMADA38X Wed Jan 25 10:32:57 2017 (r312748) +++ head/sys/arm/conf/ARMADA38X Wed Jan 25 10:34:37 2017 (r312749) @@ -60,6 +60,9 @@ device scbus device pass device da +# SATA +device ahci + # I2C device iic device iicbus Modified: head/sys/arm/mv/files.mv ============================================================================== --- head/sys/arm/mv/files.mv Wed Jan 25 10:32:57 2017 (r312748) +++ head/sys/arm/mv/files.mv Wed Jan 25 10:34:37 2017 (r312749) @@ -29,5 +29,6 @@ dev/uart/uart_dev_ns8250.c optional uart dev/uart/uart_dev_snps.c optional uart dev/usb/controller/ehci_mv.c optional ehci dev/usb/controller/xhci_mv.c optional xhci +dev/ahci/ahci_mv_fdt.c optional ahci kern/kern_clocksource.c standard Added: head/sys/dev/ahci/ahci_mv_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ahci/ahci_mv_fdt.c Wed Jan 25 10:34:37 2017 (r312749) @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2017 Semihalf. + * Copyright (c) 2017 Stormshield. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#define AHCI_VENDOR_SPECIFIC_0_ADDR 0xa0 +#define AHCI_VENDOR_SPECIFIC_0_DATA 0xa4 + +#define AHCI_HC_DEVSTR "Marvell AHCI Controller" +#define AHCI_HC_VENDOR "Marvell" + +static device_attach_t ahci_mv_fdt_attach; + +static struct ofw_compat_data compatible_data[] = { + {"marvell,armada-380-ahci", true}, + {NULL, false} +}; + +static void +ahci_mv_regret_config(struct ahci_controller *ctlr) +{ + + /* + * Enable the regret bit to allow the SATA unit to regret + * a request that didn't receive an acknowledge + * and a avoid deadlock + */ + ATA_OUTL(ctlr->r_mem, AHCI_VENDOR_SPECIFIC_0_ADDR, 0x4); + ATA_OUTL(ctlr->r_mem, AHCI_VENDOR_SPECIFIC_0_DATA, 0x80); +} + +static int +ahci_mv_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compatible_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, AHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static int +ahci_mv_fdt_attach(device_t dev) +{ + struct ahci_controller *ctlr; + int rc; + + ctlr = device_get_softc(dev); + ctlr->dev = dev; + ctlr->r_rid = 0; + ctlr->quirks = AHCI_Q_2CH; + ctlr->numirqs = 1; + + if (ofw_bus_is_compatible(dev, "marvell,armada-380-ahci")) + ctlr->quirks |= AHCI_Q_MRVL_SR_DEL; + + /* Allocate memory for controller */ + ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &ctlr->r_rid, RF_ACTIVE | RF_SHAREABLE); + if (ctlr->r_mem == NULL) { + device_printf(dev, "Failed to alloc memory for controller\n"); + return (ENOMEM); + } + + /* Reset controller */ + rc = ahci_ctlr_reset(dev); + if (rc != 0) { + device_printf(dev, "Failed to reset controller\n"); + bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); + return (ENXIO); + } + + ahci_mv_regret_config(ctlr); + + rc = ahci_attach(dev); + if (rc != 0) { + device_printf(dev, "Failed to initialize AHCI, with error %d\n", rc); + return (ENXIO); + } + + return (0); +} + +static device_method_t ahci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ahci_mv_fdt_probe), + DEVMETHOD(device_attach, ahci_mv_fdt_attach), + DEVMETHOD(device_detach, ahci_detach), + DEVMETHOD(bus_alloc_resource, ahci_alloc_resource), + DEVMETHOD(bus_release_resource, ahci_release_resource), + DEVMETHOD(bus_setup_intr, ahci_setup_intr), + DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), + DEVMETHOD(bus_print_child, ahci_print_child), + DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), + DEVMETHOD_END +}; + +static devclass_t ahci_devclass; +static driver_t ahci_driver = { + "ahci", + ahci_methods, + sizeof(struct ahci_controller) +}; + +DRIVER_MODULE(ahci, simplebus, ahci_driver, ahci_devclass, NULL, NULL); +DRIVER_MODULE(ahci, ofwbus, ahci_driver, ahci_devclass, NULL, NULL); From owner-svn-src-all@freebsd.org Wed Jan 25 11:47: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 5D44DCBF05A; Wed, 25 Jan 2017 11:47:17 +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 2D202EDF; Wed, 25 Jan 2017 11:47:17 +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 v0PBlGCx079110; Wed, 25 Jan 2017 11:47:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PBlGd0079109; Wed, 25 Jan 2017 11:47:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701251147.v0PBlGd0079109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 11:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312750 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 11:47:17 -0000 Author: mav Date: Wed Jan 25 11:47:16 2017 New Revision: 312750 URL: https://svnweb.freebsd.org/changeset/base/312750 Log: Add Timeout and Protect mode page description from MMC-6. MFC after: 2 weeks Modified: head/share/misc/scsi_modes Modified: head/share/misc/scsi_modes ============================================================================== --- head/share/misc/scsi_modes Wed Jan 25 10:34:37 2017 (r312749) +++ head/share/misc/scsi_modes Wed Jan 25 11:47:16 2017 (r312750) @@ -478,4 +478,17 @@ {Current Write Speed Supported (kBps)} i2 }; +0x1d "Timeout and Protect" { + {Reserved} *i2 + {Reserved} *t4 + {G3Enable} t1 + {TMOE} t1 + {DISP} t1 + {SWPP} t1 + {Reserved} *i1 + {Group 1 Minimum Timeout} i2 + {Group 2 Minimum Timeout} i2 + {Group 3 Timeout} i2 +}; + 0x00 "Vendor-Specific"; From owner-svn-src-all@freebsd.org Wed Jan 25 12:18: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 9FA3BCC066C; Wed, 25 Jan 2017 12:18:22 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F76D173B; Wed, 25 Jan 2017 12:18:22 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PCILKB091301; Wed, 25 Jan 2017 12:18:21 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PCILVp091300; Wed, 25 Jan 2017 12:18:21 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701251218.v0PCILVp091300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 25 Jan 2017 12:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312751 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 12:18:22 -0000 Author: wma Date: Wed Jan 25 12:18:21 2017 New Revision: 312751 URL: https://svnweb.freebsd.org/changeset/base/312751 Log: Extend AHCI_Q_BIT_STRING after adding new quirk for soft reset delay Adding new quirk (AHCI_Q_MRVL_SR_DEL) requires according extention of AHCI_Q_BIT_STRING. Submitted by: Marcin Wojtas Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: wma Modified: head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Jan 25 11:47:16 2017 (r312750) +++ head/sys/dev/ahci/ahci.h Wed Jan 25 12:18:21 2017 (r312751) @@ -622,7 +622,8 @@ enum ahci_err_type { "\0221MSI" \ "\023FORCE_PI" \ "\024RESTORE_CAP" \ - "\025NOMSIX" + "\025NOMSIX" \ + "\026MRVL_SR_DEL" int ahci_attach(device_t dev); int ahci_detach(device_t dev); From owner-svn-src-all@freebsd.org Wed Jan 25 14:37: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 BCF58CC1145; Wed, 25 Jan 2017 14:37:06 +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 729A533C; Wed, 25 Jan 2017 14:37:06 +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 v0PEb5kn047774; Wed, 25 Jan 2017 14:37:05 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PEb5D7047773; Wed, 25 Jan 2017 14:37:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701251437.v0PEb5D7047773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 25 Jan 2017 14:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312755 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 14:37:06 -0000 Author: sbruno Date: Wed Jan 25 14:37:05 2017 New Revision: 312755 URL: https://svnweb.freebsd.org/changeset/base/312755 Log: Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns success and a good value. Only then try to use it and set the MSIX_ENABLE bit. With the current em(4) driver we have observed failures in this case in a specific environment when pci_find_cap() would not return the assumed value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID) which is read-only. PR: 216456 Submitted by: bz Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Jan 25 13:42:38 2017 (r312754) +++ head/sys/net/iflib.c Wed Jan 25 14:37:05 2017 (r312755) @@ -3733,6 +3733,10 @@ iflib_device_register(device_t dev, void if (sctx->isc_flags & IFLIB_SKIP_MSIX) { msix = scctx->isc_vectors; } else if (scctx->isc_msix_bar != 0) + /* + * The simple fact that isc_msix_bar is not 0 does not mean we + * we have a good value there that is known to work. + */ msix = iflib_msix_init(ctx); else { scctx->isc_vectors = 1; @@ -4779,15 +4783,20 @@ iflib_msix_init(if_ctx_t ctx) uint16_t pci_cmd_word; int msix_ctrl, rid; - rid = 0; pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); pci_cmd_word |= PCIM_CMD_BUSMASTEREN; pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2); - pci_find_cap(dev, PCIY_MSIX, &rid); - rid += PCIR_MSIX_CTRL; - msix_ctrl = pci_read_config(dev, rid, 2); - msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE; - pci_write_config(dev, rid, msix_ctrl, 2); + rid = 0; + if (pci_find_cap(dev, PCIY_MSIX, &rid) == 0 && rid != 0) { + rid += PCIR_MSIX_CTRL; + msix_ctrl = pci_read_config(dev, rid, 2); + msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE; + pci_write_config(dev, rid, msix_ctrl, 2); + } else { + device_printf(dev, "PCIY_MSIX capability not found; " + "or rid %d == 0.\n", rid); + goto msi; + } } /* From owner-svn-src-all@freebsd.org Wed Jan 25 14:49: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 9ED22CC1647; Wed, 25 Jan 2017 14:49:43 +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 5F66BD02; Wed, 25 Jan 2017 14:49:43 +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 v0PEngY6051941; Wed, 25 Jan 2017 14:49:42 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PEngmo051939; Wed, 25 Jan 2017 14:49:42 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251449.v0PEngmo051939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 14:49:42 +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: r312756 - in stable/11/sys: boot/fdt/dts/arm modules/dtb/am335x X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 14:49:43 -0000 Author: loos Date: Wed Jan 25 14:49:42 2017 New Revision: 312756 URL: https://svnweb.freebsd.org/changeset/base/312756 Log: MFC r308458, r311157 and r312347: Add the DTS for the Netgate SG-1000 (micro-Firewall). Remove a GPL licensed DTS. The micro-Firewall DTS is now a single BSD licensed file. The write-protect is not wired on uFW, disable it to allow writes to SD card. Obtained from: pfSense Sponsored by: Rubicon Communications, LLC (Netgate) Added: stable/11/sys/boot/fdt/dts/arm/ufw.dts - copied, changed from r308458, head/sys/boot/fdt/dts/arm/ufw.dts Modified: stable/11/sys/modules/dtb/am335x/Makefile Directory Properties: stable/11/ (props changed) Copied and modified: stable/11/sys/boot/fdt/dts/arm/ufw.dts (from r308458, head/sys/boot/fdt/dts/arm/ufw.dts) ============================================================================== --- head/sys/boot/fdt/dts/arm/ufw.dts Wed Nov 9 04:07:15 2016 (r308458, copy source) +++ stable/11/sys/boot/fdt/dts/arm/ufw.dts Wed Jan 25 14:49:42 2017 (r312756) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2016, 2017 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,11 +29,247 @@ /dts-v1/; #include "am33xx.dtsi" -#include "ubmc.dtsi" / { model = "AM335x uFW"; compatible = "ti,am335x-ufw", "ti,am335x-ubmc", "ti,am33xx"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; /* 256 MB */ + }; + + vmmcsd_fixed: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vmmcsd_fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; +}; + +&am33xx_pinmux { + pinctrl-names = "default"; + pinctrl-0 = <&clkout2_pin>; + + i2c0_pins: pinmux_i2c0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ + AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ + >; + }; + + i2c1_pins: pinmux_i2c1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_ctsn.i2c1_sda */ + AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_rtsn.i2c1_scl */ + >; + }; + + uart0_pins: pinmux_uart0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ + >; + }; + + clkout2_pin: pinmux_clkout2_pin { + pinctrl-single,pins = < + AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ + >; + }; + + cpsw_default: cpsw_default { + pinctrl-single,pins = < + /* Slave 1 */ + AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii_1_txen */ + AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxdv.rgmii_1_rxdv */ + AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii_1_txd3 */ + AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii_1_txd2 */ + AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii_1_txd1 */ + AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii_1_txd0 */ + AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii_1_txclk */ + AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxclk.rgmii_1_rxclk */ + AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd3.rgmii_1_rxd3 */ + AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd2.rgmii_1_rxd2 */ + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd1.rgmii_1_rxd1 */ + AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2) /* mii1_rxd0.rgmii_1_rxd0 */ + + /* Slave 2 */ + AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a0.rgmii_2_txen */ + AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a1.rgmii_2_rxdv */ + AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a2.rgmii_2_txd3 */ + AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a3.rgmii_2_txd2 */ + AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a4.rgmii_2_txd1 */ + AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a5.rgmii_2_txd0 */ + AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gmpc_a6.rgmii_2_txclk */ + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a7.rgmii_2_rxclk */ + AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a8.rgmii_2_rxd3 */ + AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a9.rgmii_2_rxd2 */ + AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a10.rgmii_2_rxd1 */ + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE2) /* gmpc_a11.rgmii_2_rxd0 */ + >; + }; + + cpsw_sleep: cpsw_sleep { + pinctrl-single,pins = < + /* Slave 1 reset value */ + AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7) + + /* Slave 2 reset value */ + AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + davinci_mdio_default: davinci_mdio_default { + pinctrl-single,pins = < + /* MDIO */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */ + AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */ + >; + }; + + davinci_mdio_sleep: davinci_mdio_sleep { + pinctrl-single,pins = < + /* MDIO reset value */ + AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7) + >; + }; + + mmc1_pins: pinmux_mmc1_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */ + AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */ + AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */ + AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */ + AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */ + AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */ + AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE5) /* spi0_cs1.mmc0_cd */ + >; + }; + + emmc_pins: pinmux_emmc_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x994, PIN_INPUT_PULLUP | MUX_MODE4) /* mcasp0_fsx.mmc1_cd */ + AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */ + AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */ + AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */ + AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */ + AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */ + AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */ + AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */ + AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */ + AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */ + AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */ + >; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_ctrl_mod { + status = "okay"; +}; + +&usb0_phy { + status = "okay"; +}; + +&usb1_phy { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; + +&usb1 { + status = "okay"; + dr_mode = "host"; +}; + +&cppi41dma { + status = "okay"; +}; + +&cpsw_emac0 { + phy_id = <&davinci_mdio>, <1>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <4071>; +}; + +&cpsw_emac1 { + phy_id = <&davinci_mdio>, <2>; + phy-mode = "rgmii"; + dual_emac_res_vlan = <4072>; +}; + +&mac { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&cpsw_default>; + pinctrl-1 = <&cpsw_sleep>; + active_slave = <1>; + status = "okay"; + dual_emac; + txen-skew-ps = <0>; + rxdv-skew-ps = <1400>; + rxd0-skew-ps = <1400>; + rxd1-skew-ps = <1400>; + rxd2-skew-ps = <1400>; + rxd3-skew-ps = <1400>; + txd0-skew-ps = <0>; + txd1-skew-ps = <0>; + txd2-skew-ps = <0>; + txd3-skew-ps = <0>; + rxc-skew-ps = <4400>; + txc-skew-ps = <6200>; +}; + +&davinci_mdio { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&davinci_mdio_default>; + pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; +}; + +&aes { + status = "okay"; +}; + +&sham { + status = "okay"; }; &mmc1 { @@ -42,6 +278,7 @@ pinctrl-0 = <&mmc1_pins>; bus-width = <4>; non-removable; + wp-disable; status = "okay"; }; @@ -60,6 +297,18 @@ pinctrl-0 = <&i2c0_pins>; status = "okay"; + clock-frequency = <400000>; + + baseboard_eeprom: baseboard_eeprom@50 { + compatible = "atmel,24c02"; + reg = <0x50>; + + #address-cells = <1>; + #size-cells = <1>; + baseboard_data: baseboard_data@0 { + reg = <0 0x100>; + }; + }; }; &i2c1 { Modified: stable/11/sys/modules/dtb/am335x/Makefile ============================================================================== --- stable/11/sys/modules/dtb/am335x/Makefile Wed Jan 25 14:37:05 2017 (r312755) +++ stable/11/sys/modules/dtb/am335x/Makefile Wed Jan 25 14:49:42 2017 (r312756) @@ -2,6 +2,7 @@ # All the dts files for am335x systems we support. DTS= \ beaglebone.dts \ - beaglebone-black.dts + beaglebone-black.dts \ + ufw.dts .include From owner-svn-src-all@freebsd.org Wed Jan 25 15:27: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 0DA2CCC00D0; Wed, 25 Jan 2017 15:27:07 +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 B898C7B0; Wed, 25 Jan 2017 15:27:06 +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 v0PFR5V4068088; Wed, 25 Jan 2017 15:27:05 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PFR5tw068087; Wed, 25 Jan 2017 15:27:05 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251527.v0PFR5tw068087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 15:27: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: r312757 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 15:27:07 -0000 Author: loos Date: Wed Jan 25 15:27:05 2017 New Revision: 312757 URL: https://svnweb.freebsd.org/changeset/base/312757 Log: MFC r312408: The port number and the to_port_en flag are valid only on SOP descriptor. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 14:49:42 2017 (r312756) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 15:27:05 2017 (r312757) @@ -1801,13 +1801,8 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) struct cpsw_cpdma_bd bd; struct cpsw_slot *first_new_slot, *last, *last_old_slot, *next, *slot; struct mbuf *m0; - int error, flags, nsegs, seg, added = 0, padlen; + int error, nsegs, seg, added = 0, padlen; - flags = 0; - if (sc->swsc->dualemac) { - flags = CPDMA_BD_TO_PORT | - ((sc->unit + 1) & CPDMA_BD_PORT_MASK); - } /* Pull pending packets from IF queue and prep them for DMA. */ last = NULL; first_new_slot = NULL; @@ -1885,7 +1880,11 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = segs[0].ds_len; bd.pktlen = m_length(slot->mbuf, NULL) + padlen; - bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER; + if (sc->swsc->dualemac) { + bd.flags |= CPDMA_BD_TO_PORT; + bd.flags |= ((sc->unit + 1) & CPDMA_BD_PORT_MASK); + } for (seg = 1; seg < nsegs; ++seg) { /* Save the previous buffer (which isn't EOP) */ cpsw_cpdma_write_bd(sc->swsc, slot, &bd); @@ -1903,7 +1902,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = segs[seg].ds_len; bd.pktlen = 0; - bd.flags = CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_OWNER; } /* Save the final buffer. */ if (padlen <= 0) @@ -1925,7 +1924,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufoff = 0; bd.buflen = padlen; bd.pktlen = 0; - bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER | flags; + bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER; cpsw_cpdma_write_bd(sc->swsc, slot, &bd); ++nsegs; From owner-svn-src-all@freebsd.org Wed Jan 25 15:42: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 77500CC0431; Wed, 25 Jan 2017 15:42: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 2EB4DEE3; Wed, 25 Jan 2017 15:42:30 +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 v0PFgTjl075301; Wed, 25 Jan 2017 15:42:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PFgTLx075300; Wed, 25 Jan 2017 15:42:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701251542.v0PFgTLx075300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 15:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312758 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 15:42:30 -0000 Author: emaste Date: Wed Jan 25 15:42:29 2017 New Revision: 312758 URL: https://svnweb.freebsd.org/changeset/base/312758 Log: Add sys/capability.h deprecation warning In r263232 sys/capability.h was renamed to sys/capsicum.h, to avoid conflicts with a capability.h header found on other operating systems. Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/capability.h Modified: head/sys/sys/capability.h ============================================================================== --- head/sys/sys/capability.h Wed Jan 25 15:27:05 2017 (r312757) +++ head/sys/sys/capability.h Wed Jan 25 15:42:29 2017 (r312758) @@ -38,6 +38,7 @@ #ifndef _SYS_CAPABILITY_H_ #define _SYS_CAPABILITY_H_ +#warning this file includes which is deprecated #include #endif /* !_SYS_CAPABILITY_H_ */ From owner-svn-src-all@freebsd.org Wed Jan 25 15:52: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 C989ACC08E6; Wed, 25 Jan 2017 15:52:04 +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 9958817C4; Wed, 25 Jan 2017 15:52:04 +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 v0PFq38Z079064; Wed, 25 Jan 2017 15:52:03 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PFq3m9079063; Wed, 25 Jan 2017 15:52:03 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701251552.v0PFq3m9079063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 25 Jan 2017 15:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312759 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 15:52:04 -0000 Author: sbruno Date: Wed Jan 25 15:52:03 2017 New Revision: 312759 URL: https://svnweb.freebsd.org/changeset/base/312759 Log: Resolve a non-fatal syntax warning left in by a trailing ; Submitted by: bde Modified: head/sys/sys/gtaskqueue.h Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Wed Jan 25 15:42:29 2017 (r312758) +++ head/sys/sys/gtaskqueue.h Wed Jan 25 15:52:03 2017 (r312759) @@ -94,7 +94,7 @@ taskqgroup_define_##name(void *arg) } \ \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ - taskqgroup_define_##name, NULL) + taskqgroup_define_##name, NULL) \ #else /* !EARLY_AP_STARTUP */ #define TASKQGROUP_DEFINE(name, cnt, stride) \ @@ -117,7 +117,7 @@ taskqgroup_adjust_##name(void *arg) } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ - taskqgroup_adjust_##name, NULL); \ + taskqgroup_adjust_##name, NULL) \ #endif /* EARLY_AP_STARTUP */ From owner-svn-src-all@freebsd.org Wed Jan 25 15:54: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 89BA2CC0BF3; Wed, 25 Jan 2017 15:54:45 +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 596BF1C19; Wed, 25 Jan 2017 15:54:45 +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 v0PFsin8080794; Wed, 25 Jan 2017 15:54:44 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PFsiwe080793; Wed, 25 Jan 2017 15:54:44 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701251554.v0PFsiwe080793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 25 Jan 2017 15:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312760 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 15:54:45 -0000 Author: sbruno Date: Wed Jan 25 15:54:44 2017 New Revision: 312760 URL: https://svnweb.freebsd.org/changeset/base/312760 Log: Replace overlooked smp_started checks and variable use in a print with the now used tqg_smp_started. Submitted by: bde Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Wed Jan 25 15:52:03 2017 (r312759) +++ head/sys/kern/subr_gtaskqueue.c Wed Jan 25 15:54:44 2017 (r312760) @@ -740,7 +740,7 @@ taskqgroup_attach_cpu(struct taskqgroup CPU_ZERO(&mask); CPU_SET(cpu, &mask); - if (irq != -1 && (smp_started || mp_ncpus == 1)) + if (irq != -1 && tqg_smp_started) intr_setaffinity(irq, &mask); return (0); } @@ -849,8 +849,8 @@ _taskqgroup_adjust(struct taskqgroup *qg if (cnt < 1 || cnt * stride > mp_ncpus || !tqg_smp_started) { printf("%s: failed cnt: %d stride: %d " - "mp_ncpus: %d smp_started: %d\n", - __func__, cnt, stride, mp_ncpus, smp_started); + "mp_ncpus: %d tqg_smp_started: %d\n", + __func__, cnt, stride, mp_ncpus, tqg_smp_started); return (EINVAL); } if (qgroup->tqg_adjusting) { From owner-svn-src-all@freebsd.org Wed Jan 25 16:10: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 19E0ACC10F5; Wed, 25 Jan 2017 16:10:37 +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 CEC017E7; Wed, 25 Jan 2017 16:10:36 +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 v0PGAZiB085454; Wed, 25 Jan 2017 16:10:35 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PGAZeb085452; Wed, 25 Jan 2017 16:10:35 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251610.v0PGAZeb085452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 16:10:35 +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: r312761 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 16:10:37 -0000 Author: loos Date: Wed Jan 25 16:10:35 2017 New Revision: 312761 URL: https://svnweb.freebsd.org/changeset/base/312761 Log: MFC r312411: Handle the set capabilities ioctl, letting the hardware checksum be disabled (Hi netmap!). Only remove the CRC bytes from packets when the hardware tell us to do so. Fixes the 'discard frame w/o leading ethernet header' issues. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c stable/11/sys/arm/ti/cpsw/if_cpswreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 15:54:44 2017 (r312760) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:10:35 2017 (r312761) @@ -1396,6 +1396,16 @@ cpswp_ioctl(struct ifnet *ifp, u_long co ifr = (struct ifreq *)data; switch (command) { + case SIOCSIFCAP: + changed = ifp->if_capenable ^ ifr->ifr_reqcap; + if (changed & IFCAP_HWCSUM) { + if ((ifr->ifr_reqcap & changed) & IFCAP_HWCSUM) + ifp->if_capenable |= IFCAP_HWCSUM; + else + ifp->if_capenable &= ~IFCAP_HWCSUM; + } + error = 0; + break; case SIOCSIFFLAGS: CPSW_PORT_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -1633,15 +1643,22 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) /* TODO: track SOP/EOP bits to assemble a full mbuf out of received fragments. */ slot->mbuf->m_data += bd.bufoff; - slot->mbuf->m_len = bd.pktlen - 4; - slot->mbuf->m_pkthdr.len = bd.pktlen - 4; - slot->mbuf->m_flags |= M_PKTHDR; - slot->mbuf->m_pkthdr.rcvif = psc->ifp; + slot->mbuf->m_len = bd.buflen; + if (bd.flags & CPDMA_BD_SOP) { + slot->mbuf->m_pkthdr.len = bd.pktlen; + slot->mbuf->m_pkthdr.rcvif = psc->ifp; + slot->mbuf->m_flags |= M_PKTHDR; + } + slot->mbuf->m_next = NULL; slot->mbuf->m_nextpkt = NULL; + if (bd.flags & CPDMA_BD_PASS_CRC) + m_adj(slot->mbuf, -ETHER_CRC_LEN); if ((psc->ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ - if ((bd.flags & CPDMA_BD_PKT_ERR_MASK) == 0) { + if ((bd.flags & + (CPDMA_BD_SOP | CPDMA_BD_PKT_ERR_MASK)) == + CPDMA_BD_SOP) { slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; slot->mbuf->m_pkthdr.csum_data = 0xffff; Modified: stable/11/sys/arm/ti/cpsw/if_cpswreg.h ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpswreg.h Wed Jan 25 15:54:44 2017 (r312760) +++ stable/11/sys/arm/ti/cpsw/if_cpswreg.h Wed Jan 25 16:10:35 2017 (r312761) @@ -191,6 +191,7 @@ #define CPDMA_BD_OWNER (1 << 13) #define CPDMA_BD_EOQ (1 << 12) #define CPDMA_BD_TDOWNCMPLT (1 << 11) +#define CPDMA_BD_PASS_CRC (1 << 10) #define CPDMA_BD_PKT_ERR_MASK (3 << 4) #define CPDMA_BD_TO_PORT (1 << 4) #define CPDMA_BD_PORT_MASK 3 From owner-svn-src-all@freebsd.org Wed Jan 25 16:18: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 7D437CC149A; Wed, 25 Jan 2017 16:18:41 +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 57D351056; Wed, 25 Jan 2017 16:18:41 +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 v0PGIe7n090032; Wed, 25 Jan 2017 16:18:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PGIeYH090030; Wed, 25 Jan 2017 16:18:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251618.v0PGIeYH090030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 16:18: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: r312762 - stable/11/sys/arm/ti/cpsw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 16:18:41 -0000 Author: loos Date: Wed Jan 25 16:18:40 2017 New Revision: 312762 URL: https://svnweb.freebsd.org/changeset/base/312762 Log: MFC r312604 and r312605: Simplify the handling of small packets padding in cpsw: - Pad small packets to 60 bytes and not 64 (exclude the CRC bytes); - Pad the packet using m_append(9), if the packet has enough space for padding, which is usually true, it will not be necessary append a newly allocated mbuf to the chain. Suggested by: yongari MFC r312608: Handle the rx queue stall while reading the packets from NIC (when the descriptor state will not change anymore). This seems to eliminate the race where we can miss a stalled queue under high load. While here remove the unnecessary curly brackets. Reported by: Konstantin Kormashev MFC r312636: Properly assemble an mbuf chain out of received fragments. Remove the rx_batch hack, it makes no difference now that most of bugs have been sorted out. MFC r312637: Be a little more pedantic here, the TRM says the hardware is supposed to only clean the OWNER bit on SOP descriptors. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c stable/11/sys/arm/ti/cpsw/if_cpswvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:10:35 2017 (r312761) +++ stable/11/sys/arm/ti/cpsw/if_cpsw.c Wed Jan 25 16:18:40 2017 (r312762) @@ -784,8 +784,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, static int cpsw_attach(device_t dev) { - bus_dma_segment_t segs[1]; - int error, i, nsegs; + int error, i; struct cpsw_softc *sc; uint32_t reg; @@ -860,15 +859,8 @@ cpsw_attach(device_t dev) return (error); } - /* Allocate the null mbuf and pre-sync it. */ - sc->null_mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - memset(sc->null_mbuf->m_data, 0, sc->null_mbuf->m_ext.ext_size); - bus_dmamap_create(sc->mbuf_dtag, 0, &sc->null_mbuf_dmamap); - bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->null_mbuf_dmamap, - sc->null_mbuf, segs, &nsegs, BUS_DMA_NOWAIT); - bus_dmamap_sync(sc->mbuf_dtag, sc->null_mbuf_dmamap, - BUS_DMASYNC_PREWRITE); - sc->null_mbuf_paddr = segs[0].ds_addr; + /* Allocate a NULL buffer for padding. */ + sc->nullpad = malloc(ETHER_MIN_LEN, M_DEVBUF, M_WAITOK | M_ZERO); cpsw_init_slots(sc); @@ -947,13 +939,9 @@ cpsw_detach(device_t dev) for (i = 0; i < nitems(sc->_slots); ++i) cpsw_free_slot(sc, &sc->_slots[i]); - /* Free null mbuf. */ - if (sc->null_mbuf_dmamap) { - bus_dmamap_unload(sc->mbuf_dtag, sc->null_mbuf_dmamap); - error = bus_dmamap_destroy(sc->mbuf_dtag, sc->null_mbuf_dmamap); - KASSERT(error == 0, ("Mapping still active")); - m_freem(sc->null_mbuf); - } + /* Free null padding buffer. */ + if (sc->nullpad) + free(sc->nullpad, M_DEVBUF); /* Free DMA tag */ if (sc->mbuf_dtag) { @@ -1595,14 +1583,19 @@ cpsw_intr_rx(void *arg) static struct mbuf * cpsw_rx_dequeue(struct cpsw_softc *sc) { + int nsegs, port, removed; struct cpsw_cpdma_bd bd; struct cpsw_slot *last, *slot; struct cpswp_softc *psc; - struct mbuf *mb_head, *mb_tail; - int port, removed = 0; + struct mbuf *m, *m0, *mb_head, *mb_tail; + uint16_t m0_flags; + nsegs = 0; + m0 = NULL; last = NULL; - mb_head = mb_tail = NULL; + mb_head = NULL; + mb_tail = NULL; + removed = 0; /* Pull completed packets off hardware RX queue. */ while ((slot = STAILQ_FIRST(&sc->rx.active)) != NULL) { @@ -1625,10 +1618,12 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); + m = slot->mbuf; + slot->mbuf = NULL; + if (bd.flags & CPDMA_BD_TDOWNCMPLT) { CPSW_DEBUGF(sc, ("RX teardown is complete")); - m_freem(slot->mbuf); - slot->mbuf = NULL; + m_freem(m); sc->rx.running = 0; sc->rx.teardown = 0; break; @@ -1640,41 +1635,63 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) psc = device_get_softc(sc->port[port].dev); /* Set up mbuf */ - /* TODO: track SOP/EOP bits to assemble a full mbuf - out of received fragments. */ - slot->mbuf->m_data += bd.bufoff; - slot->mbuf->m_len = bd.buflen; + m->m_data += bd.bufoff; + m->m_len = bd.buflen; if (bd.flags & CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.len = bd.pktlen; - slot->mbuf->m_pkthdr.rcvif = psc->ifp; - slot->mbuf->m_flags |= M_PKTHDR; - } - slot->mbuf->m_next = NULL; - slot->mbuf->m_nextpkt = NULL; - if (bd.flags & CPDMA_BD_PASS_CRC) - m_adj(slot->mbuf, -ETHER_CRC_LEN); + m->m_pkthdr.len = bd.pktlen; + m->m_pkthdr.rcvif = psc->ifp; + m->m_flags |= M_PKTHDR; + m0_flags = bd.flags; + m0 = m; + } + nsegs++; + m->m_next = NULL; + m->m_nextpkt = NULL; + if (bd.flags & CPDMA_BD_EOP && m0 != NULL) { + if (m0_flags & CPDMA_BD_PASS_CRC) + m_adj(m0, -ETHER_CRC_LEN); + m0_flags = 0; + m0 = NULL; + if (nsegs > sc->rx.longest_chain) + sc->rx.longest_chain = nsegs; + nsegs = 0; + } if ((psc->ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ if ((bd.flags & (CPDMA_BD_SOP | CPDMA_BD_PKT_ERR_MASK)) == CPDMA_BD_SOP) { - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; - slot->mbuf->m_pkthdr.csum_data = 0xffff; + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + m->m_pkthdr.csum_data = 0xffff; } } + if (STAILQ_FIRST(&sc->rx.active) != NULL && + (bd.flags & (CPDMA_BD_EOP | CPDMA_BD_EOQ)) == + (CPDMA_BD_EOP | CPDMA_BD_EOQ)) { + cpsw_write_hdp_slot(sc, &sc->rx, + STAILQ_FIRST(&sc->rx.active)); + sc->rx.queue_restart++; + } + /* Add mbuf to packet list to be returned. */ - if (mb_tail) { - mb_tail->m_nextpkt = slot->mbuf; + if (mb_tail != NULL && (bd.flags & CPDMA_BD_SOP)) { + mb_tail->m_nextpkt = m; + } else if (mb_tail != NULL) { + mb_tail->m_next = m; + } else if (mb_tail == NULL && (bd.flags & CPDMA_BD_SOP) == 0) { + if (bootverbose) + printf( + "%s: %s: discanding fragment packet w/o header\n", + __func__, psc->ifp->if_xname); + m_freem(m); + continue; } else { - mb_head = slot->mbuf; + mb_head = m; } - mb_tail = slot->mbuf; - slot->mbuf = NULL; - if (sc->rx_batch > 0 && sc->rx_batch == removed) - break; + mb_tail = m; } if (removed != 0) { @@ -1697,7 +1714,6 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) struct cpsw_cpdma_bd bd; struct cpsw_slot *first_new_slot, *last_old_slot, *next, *slot; int error, nsegs, added = 0; - uint32_t flags; /* Register new mbufs with hardware. */ first_new_slot = NULL; @@ -1763,22 +1779,13 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) } else { /* Add buffers to end of current queue. */ cpsw_cpdma_write_bd_next(sc, last_old_slot, first_new_slot); - /* If underrun, restart queue. */ - if ((flags = cpsw_cpdma_read_bd_flags(sc, last_old_slot)) & - CPDMA_BD_EOQ) { - flags &= ~CPDMA_BD_EOQ; - cpsw_cpdma_write_bd_flags(sc, last_old_slot, flags); - cpsw_write_hdp_slot(sc, &sc->rx, first_new_slot); - sc->rx.queue_restart++; - } } sc->rx.queue_adds += added; sc->rx.avail_queue_len -= added; sc->rx.active_queue_len += added; cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), added); - if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) { + if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) sc->rx.max_active_queue_len = sc->rx.active_queue_len; - } } static void @@ -1830,21 +1837,19 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) break; slot->mbuf = m0; - padlen = ETHER_MIN_LEN - slot->mbuf->m_pkthdr.len; + padlen = ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; if (padlen < 0) padlen = 0; + else if (padlen > 0) + m_append(slot->mbuf, padlen, sc->swsc->nullpad); /* Create mapping in DMA memory */ error = bus_dmamap_load_mbuf_sg(sc->swsc->mbuf_dtag, slot->dmamap, slot->mbuf, segs, &nsegs, BUS_DMA_NOWAIT); /* If the packet is too fragmented, try to simplify. */ if (error == EFBIG || - (error == 0 && - nsegs + (padlen > 0 ? 1 : 0) > sc->swsc->tx.avail_queue_len)) { + (error == 0 && nsegs > sc->swsc->tx.avail_queue_len)) { bus_dmamap_unload(sc->swsc->mbuf_dtag, slot->dmamap); - if (padlen > 0) /* May as well add padding. */ - m_append(slot->mbuf, padlen, - sc->swsc->null_mbuf->m_data); m0 = m_defrag(slot->mbuf, M_NOWAIT); if (m0 == NULL) { device_printf(sc->dev, @@ -1896,7 +1901,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufptr = segs[0].ds_addr; bd.bufoff = 0; bd.buflen = segs[0].ds_len; - bd.pktlen = m_length(slot->mbuf, NULL) + padlen; + bd.pktlen = m_length(slot->mbuf, NULL); bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER; if (sc->swsc->dualemac) { bd.flags |= CPDMA_BD_TO_PORT; @@ -1921,42 +1926,18 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.pktlen = 0; bd.flags = CPDMA_BD_OWNER; } + /* Save the final buffer. */ - if (padlen <= 0) - bd.flags |= CPDMA_BD_EOP; - else { - next = STAILQ_NEXT(slot, next); - bd.next = cpsw_cpdma_bd_paddr(sc->swsc, next); - } + bd.flags |= CPDMA_BD_EOP; cpsw_cpdma_write_bd(sc->swsc, slot, &bd); STAILQ_REMOVE_HEAD(&sc->swsc->tx.avail, next); STAILQ_INSERT_TAIL(&sc->swsc->tx.active, slot, next); - if (padlen > 0) { - slot = STAILQ_FIRST(&sc->swsc->tx.avail); - - /* Setup buffer of null pad bytes (definitely EOP). */ - bd.next = 0; - bd.bufptr = sc->swsc->null_mbuf_paddr; - bd.bufoff = 0; - bd.buflen = padlen; - bd.pktlen = 0; - bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER; - cpsw_cpdma_write_bd(sc->swsc, slot, &bd); - ++nsegs; - - STAILQ_REMOVE_HEAD(&sc->swsc->tx.avail, next); - STAILQ_INSERT_TAIL(&sc->swsc->tx.active, slot, next); - } - last = slot; - added += nsegs; if (nsegs > sc->swsc->tx.longest_chain) sc->swsc->tx.longest_chain = nsegs; - // TODO: Should we defer the BPF tap until - // after all packets are queued? BPF_MTAP(sc->ifp, m0); } @@ -2001,7 +1982,8 @@ cpsw_tx_dequeue(struct cpsw_softc *sc) sc->tx.teardown = 1; } - if ((flags & CPDMA_BD_OWNER) != 0 && sc->tx.teardown == 0) + if ((flags & (CPDMA_BD_SOP | CPDMA_BD_OWNER)) == + (CPDMA_BD_SOP | CPDMA_BD_OWNER) && sc->tx.teardown == 0) break; /* Hardware is still using this packet. */ bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTWRITE); @@ -2727,9 +2709,6 @@ cpsw_add_sysctls(struct cpsw_softc *sc) SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "Enable switch debug messages"); - SYSCTL_ADD_INT(ctx, parent, OID_AUTO, "rx_batch", - CTLFLAG_RW, &sc->rx_batch, 0, "Set the rx batch size"); - SYSCTL_ADD_PROC(ctx, parent, OID_AUTO, "attachedSecs", CTLTYPE_UINT | CTLFLAG_RD, sc, 0, cpsw_stat_attached, "IU", "Time since driver attach"); Modified: stable/11/sys/arm/ti/cpsw/if_cpswvar.h ============================================================================== --- stable/11/sys/arm/ti/cpsw/if_cpswvar.h Wed Jan 25 16:10:35 2017 (r312761) +++ stable/11/sys/arm/ti/cpsw/if_cpswvar.h Wed Jan 25 16:18:40 2017 (r312762) @@ -89,7 +89,6 @@ struct cpsw_softc { int active_slave; int debug; int dualemac; - int rx_batch; phandle_t node; struct bintime attach_uptime; /* system uptime when attach happened. */ struct cpsw_port port[2]; @@ -104,10 +103,8 @@ struct cpsw_softc { struct resource *irq_res[CPSW_INTR_COUNT]; void *ih_cookie[CPSW_INTR_COUNT]; - /* An mbuf full of nulls for TX padding. */ - bus_dmamap_t null_mbuf_dmamap; - struct mbuf *null_mbuf; - bus_addr_t null_mbuf_paddr; + /* A buffer full of nulls for TX padding. */ + void *nullpad; bus_dma_tag_t mbuf_dtag; From owner-svn-src-all@freebsd.org Wed Jan 25 16:35: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 653E9CC1BB7; Wed, 25 Jan 2017 16:35:58 +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 34BCCB59; Wed, 25 Jan 2017 16:35:58 +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 v0PGZvnR000318; Wed, 25 Jan 2017 16:35:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PGZvGE000317; Wed, 25 Jan 2017 16:35:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201701251635.v0PGZvGE000317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 25 Jan 2017 16:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312763 - head/sys/cddl/dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 16:35:58 -0000 Author: markj Date: Wed Jan 25 16:35:57 2017 New Revision: 312763 URL: https://svnweb.freebsd.org/changeset/base/312763 Log: Fix initialization of "p" after r312658. CID: 1369410 Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_ioctl.c Wed Jan 25 16:18:40 2017 (r312762) +++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c Wed Jan 25 16:35:57 2017 (r312763) @@ -44,8 +44,8 @@ dtrace_ioctl_helper(struct cdev *dev, u_ case DTRACEHIOC_ADDDOF: dhp = (dof_helper_t *)addr; addr = (caddr_t)(uintptr_t)dhp->dofhp_dof; + p = curproc; if (p->p_pid == dhp->dofhp_pid) { - p = curproc; dof = dtrace_dof_copyin((uintptr_t)addr, &rval); } else { p = pfind(dhp->dofhp_pid); From owner-svn-src-all@freebsd.org Wed Jan 25 17:35: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 700AFCC1CAB; Wed, 25 Jan 2017 17:35: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 1FF7CC7A; Wed, 25 Jan 2017 17:35:12 +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 v0PHZBk4024365; Wed, 25 Jan 2017 17:35:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PHZBLd024364; Wed, 25 Jan 2017 17:35:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201701251735.v0PHZBLd024364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 25 Jan 2017 17:35:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312764 - head/libexec/rtld-elf/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 17:35:12 -0000 Author: andrew Date: Wed Jan 25 17:35:11 2017 New Revision: 312764 URL: https://svnweb.freebsd.org/changeset/base/312764 Log: Pull the R_AARCH64_TLSDESC code out into a common function and use them in both the plt and non-plt case. This fixes an issue where libraries built with LLD can fail with "Unhandled relocation 1031" PR: 214971 Obtained from: 1 week Sponsored by: DARPA, AFRL Modified: head/libexec/rtld-elf/aarch64/reloc.c Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Wed Jan 25 16:35:57 2017 (r312763) +++ head/libexec/rtld-elf/aarch64/reloc.c Wed Jan 25 17:35:11 2017 (r312764) @@ -184,6 +184,18 @@ rtld_tlsdesc_handle(struct tls_data *tls return (tlsdesc->index); } +static void +reloc_tlsdesc(Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where) +{ + if (ELF_R_SYM(rela->r_info) == 0) { + where[0] = (Elf_Addr)_rtld_tlsdesc; + where[1] = obj->tlsoffset + rela->r_addend; + } else { + where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic; + where[1] = (Elf_Addr)reloc_tlsdesc_alloc(obj, rela); + } +} + /* * Process the PLT relocations. */ @@ -204,14 +216,7 @@ reloc_plt(Obj_Entry *obj) *where += (Elf_Addr)obj->relocbase; break; case R_AARCH64_TLSDESC: - if (ELF_R_SYM(rela->r_info) == 0) { - where[0] = (Elf_Addr)_rtld_tlsdesc; - where[1] = obj->tlsoffset + rela->r_addend; - } else { - where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic; - where[1] = (Elf_Addr)reloc_tlsdesc_alloc(obj, - rela); - } + reloc_tlsdesc(obj, rela, where); break; default: _rtld_error("Unknown relocation type %u in PLT", @@ -362,6 +367,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry return (-1); } break; + case R_AARCH64_TLSDESC: + reloc_tlsdesc(obj, rela, where); + break; case R_AARCH64_TLS_TPREL64: def = find_symdef(symnum, obj, &defobj, flags, cache, lockstate); From owner-svn-src-all@freebsd.org Wed Jan 25 17:41: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 75B17CC1FC7; Wed, 25 Jan 2017 17:41:25 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 475A21080; Wed, 25 Jan 2017 17:41:24 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-144.nat-2.net.cam.ac.uk [131.111.5.144]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id C5428D8506; Wed, 25 Jan 2017 17:36:48 +0000 (UTC) Date: Wed, 25 Jan 2017 17:41:22 +0000 From: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312764 - head/libexec/rtld-elf/aarch64 Message-ID: <20170125174122.13a7000e@zapp> In-Reply-To: <201701251735.v0PHZBLd024364@repo.freebsd.org> References: <201701251735.v0PHZBLd024364@repo.freebsd.org> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 17:41:25 -0000 On Wed, 25 Jan 2017 17:35:11 +0000 (UTC) Andrew Turner wrote: > Author: andrew > Date: Wed Jan 25 17:35:11 2017 > New Revision: 312764 > URL: https://svnweb.freebsd.org/changeset/base/312764 > > Log: > Pull the R_AARCH64_TLSDESC code out into a common function and use > them in both the plt and non-plt case. > > This fixes an issue where libraries built with LLD can fail with > "Unhandled relocation 1031" > > PR: 214971 > Obtained from: 1 week Should be "MFC after: 1 week" Andrew From owner-svn-src-all@freebsd.org Wed Jan 25 17:59: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 DEEF5CC1291; Wed, 25 Jan 2017 17:59: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 A26A61900; Wed, 25 Jan 2017 17:59: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 v0PHxM1B032525; Wed, 25 Jan 2017 17:59:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PHxMWN032521; Wed, 25 Jan 2017 17:59:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251759.v0PHxMWN032521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 17:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312765 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 17:59:24 -0000 Author: dim Date: Wed Jan 25 17:59:22 2017 New Revision: 312765 URL: https://svnweb.freebsd.org/changeset/base/312765 Log: Pull in r276136 from upstream llvm trunk (by Wei Mi): Use ValueOffsetPair to enhance value reuse during SCEV expansion. In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion. However, const folding and sext/zext distribution can make the reuse still difficult. A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and S1 = S2 + C_a S3 = S2 + C_b where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused by the fact that S3 is generated from S1 after const folding. In order to do that, we represent ExprValueMap as a mapping from SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. Differential Revision: https://reviews.llvm.org/D21313 This should fix assertion failures when building OpenCV >= 3.1. PR: 215649 MFC after: 3 days Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Wed Jan 25 17:35:11 2017 (r312764) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Wed Jan 25 17:59:22 2017 (r312765) @@ -495,10 +495,29 @@ namespace llvm { /// The typedef for ExprValueMap. /// - typedef DenseMap> ExprValueMapType; + typedef std::pair ValueOffsetPair; + typedef DenseMap> ExprValueMapType; /// ExprValueMap -- This map records the original values from which /// the SCEV expr is generated from. + /// + /// We want to represent the mapping as SCEV -> ValueOffsetPair instead + /// of SCEV -> Value: + /// Suppose we know S1 expands to V1, and + /// S1 = S2 + C_a + /// S3 = S2 + C_b + /// where C_a and C_b are different SCEVConstants. Then we'd like to + /// expand S3 as V1 - C_a + C_b instead of expanding S2 literally. + /// It is helpful when S2 is a complex SCEV expr. + /// + /// In order to do that, we represent ExprValueMap as a mapping from + /// SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and + /// S2->{V1, C_a} into the map when we create SCEV for V1. When S3 + /// is expanded, it will first expand S2 to V1 - C_a because of + /// S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. + /// + /// Note: S->{V, Offset} in the ExprValueMap means S can be expanded + /// to V - Offset. ExprValueMapType ExprValueMap; /// The typedef for ValueExprMap. @@ -1181,7 +1200,7 @@ namespace llvm { bool containsAddRecurrence(const SCEV *S); /// Return the Value set from which the SCEV expr is generated. - SetVector *getSCEVValues(const SCEV *S); + SetVector *getSCEVValues(const SCEV *S); /// Erase Value from ValueExprMap and ExprValueMap. void eraseValueFromMap(Value *V); Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Wed Jan 25 17:35:11 2017 (r312764) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Wed Jan 25 17:59:22 2017 (r312765) @@ -325,7 +325,8 @@ namespace llvm { PointerType *PTy, Type *Ty, Value *V); /// \brief Find a previous Value in ExprValueMap for expand. - Value *FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); + ScalarEvolution::ValueOffsetPair + FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); Value *expand(const SCEV *S); Modified: head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Wed Jan 25 17:35:11 2017 (r312764) +++ head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Wed Jan 25 17:59:22 2017 (r312765) @@ -3378,8 +3378,28 @@ bool ScalarEvolution::containsAddRecurre return F.FoundOne; } -/// Return the Value set from S. -SetVector *ScalarEvolution::getSCEVValues(const SCEV *S) { +/// Try to split a SCEVAddExpr into a pair of {SCEV, ConstantInt}. +/// If \p S is a SCEVAddExpr and is composed of a sub SCEV S' and an +/// offset I, then return {S', I}, else return {\p S, nullptr}. +static std::pair splitAddExpr(const SCEV *S) { + const auto *Add = dyn_cast(S); + if (!Add) + return {S, nullptr}; + + if (Add->getNumOperands() != 2) + return {S, nullptr}; + + auto *ConstOp = dyn_cast(Add->getOperand(0)); + if (!ConstOp) + return {S, nullptr}; + + return {Add->getOperand(1), ConstOp->getValue()}; +} + +/// Return the ValueOffsetPair set for \p S. \p S can be represented +/// by the value and offset from any ValueOffsetPair in the set. +SetVector * +ScalarEvolution::getSCEVValues(const SCEV *S) { ExprValueMapType::iterator SI = ExprValueMap.find_as(S); if (SI == ExprValueMap.end()) return nullptr; @@ -3387,24 +3407,31 @@ SetVector *ScalarEvolution::get if (VerifySCEVMap) { // Check there is no dangling Value in the set returned. for (const auto &VE : SI->second) - assert(ValueExprMap.count(VE)); + assert(ValueExprMap.count(VE.first)); } #endif return &SI->second; } -/// Erase Value from ValueExprMap and ExprValueMap. If ValueExprMap.erase(V) is -/// not used together with forgetMemoizedResults(S), eraseValueFromMap should be -/// used instead to ensure whenever V->S is removed from ValueExprMap, V is also -/// removed from the set of ExprValueMap[S]. +/// Erase Value from ValueExprMap and ExprValueMap. ValueExprMap.erase(V) +/// cannot be used separately. eraseValueFromMap should be used to remove +/// V from ValueExprMap and ExprValueMap at the same time. void ScalarEvolution::eraseValueFromMap(Value *V) { ValueExprMapType::iterator I = ValueExprMap.find_as(V); if (I != ValueExprMap.end()) { const SCEV *S = I->second; - SetVector *SV = getSCEVValues(S); - // Remove V from the set of ExprValueMap[S] - if (SV) - SV->remove(V); + // Remove {V, 0} from the set of ExprValueMap[S] + if (SetVector *SV = getSCEVValues(S)) + SV->remove({V, nullptr}); + + // Remove {V, Offset} from the set of ExprValueMap[Stripped] + const SCEV *Stripped; + ConstantInt *Offset; + std::tie(Stripped, Offset) = splitAddExpr(S); + if (Offset != nullptr) { + if (SetVector *SV = getSCEVValues(Stripped)) + SV->remove({V, Offset}); + } ValueExprMap.erase(V); } } @@ -3419,11 +3446,26 @@ const SCEV *ScalarEvolution::getSCEV(Val S = createSCEV(V); // During PHI resolution, it is possible to create two SCEVs for the same // V, so it is needed to double check whether V->S is inserted into - // ValueExprMap before insert S->V into ExprValueMap. + // ValueExprMap before insert S->{V, 0} into ExprValueMap. std::pair Pair = ValueExprMap.insert({SCEVCallbackVH(V, this), S}); - if (Pair.second) - ExprValueMap[S].insert(V); + if (Pair.second) { + ExprValueMap[S].insert({V, nullptr}); + + // If S == Stripped + Offset, add Stripped -> {V, Offset} into + // ExprValueMap. + const SCEV *Stripped = S; + ConstantInt *Offset = nullptr; + std::tie(Stripped, Offset) = splitAddExpr(S); + // If stripped is SCEVUnknown, don't bother to save + // Stripped -> {V, offset}. It doesn't simplify and sometimes even + // increase the complexity of the expansion code. + // If V is GetElementPtrInst, don't save Stripped -> {V, offset} + // because it may generate add/sub instead of GEP in SCEV expansion. + if (Offset != nullptr && !isa(Stripped) && + !isa(V)) + ExprValueMap[Stripped].insert({V, Offset}); + } } return S; } @@ -3436,8 +3478,8 @@ const SCEV *ScalarEvolution::getExisting const SCEV *S = I->second; if (checkValidity(S)) return S; + eraseValueFromMap(V); forgetMemoizedResults(S); - ValueExprMap.erase(I); } return nullptr; } @@ -3675,8 +3717,8 @@ void ScalarEvolution::forgetSymbolicName if (!isa(I) || !isa(Old) || (I != PN && Old == SymName)) { + eraseValueFromMap(It->first); forgetMemoizedResults(Old); - ValueExprMap.erase(It); } } @@ -4055,7 +4097,7 @@ const SCEV *ScalarEvolution::createAddRe // to create an AddRecExpr for this PHI node. We can not keep this temporary // as it will prevent later (possibly simpler) SCEV expressions to be added // to the ValueExprMap. - ValueExprMap.erase(PN); + eraseValueFromMap(PN); } return nullptr; @@ -5435,8 +5477,8 @@ ScalarEvolution::getBackedgeTakenInfo(co // case, createNodeForPHI will perform the necessary updates on its // own when it gets to that point. if (!isa(I) || !isa(Old)) { + eraseValueFromMap(It->first); forgetMemoizedResults(Old); - ValueExprMap.erase(It); } if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); @@ -5481,8 +5523,8 @@ void ScalarEvolution::forgetLoop(const L ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { + eraseValueFromMap(It->first); forgetMemoizedResults(It->second); - ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } @@ -5515,8 +5557,8 @@ void ScalarEvolution::forgetValue(Value ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { + eraseValueFromMap(It->first); forgetMemoizedResults(It->second); - ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } Modified: head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Wed Jan 25 17:35:11 2017 (r312764) +++ head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Wed Jan 25 17:59:22 2017 (r312765) @@ -1625,9 +1625,10 @@ Value *SCEVExpander::expandCodeFor(const return V; } -Value *SCEVExpander::FindValueInExprValueMap(const SCEV *S, - const Instruction *InsertPt) { - SetVector *Set = SE.getSCEVValues(S); +ScalarEvolution::ValueOffsetPair +SCEVExpander::FindValueInExprValueMap(const SCEV *S, + const Instruction *InsertPt) { + SetVector *Set = SE.getSCEVValues(S); // If the expansion is not in CanonicalMode, and the SCEV contains any // sub scAddRecExpr type SCEV, it is required to expand the SCEV literally. if (CanonicalMode || !SE.containsAddRecurrence(S)) { @@ -1636,21 +1637,21 @@ Value *SCEVExpander::FindValueInExprValu // Choose a Value from the set which dominates the insertPt. // insertPt should be inside the Value's parent loop so as not to break // the LCSSA form. - for (auto const &Ent : *Set) { + for (auto const &VOPair : *Set) { + Value *V = VOPair.first; + ConstantInt *Offset = VOPair.second; Instruction *EntInst = nullptr; - if (Ent && isa(Ent) && - (EntInst = cast(Ent)) && - S->getType() == Ent->getType() && + if (V && isa(V) && (EntInst = cast(V)) && + S->getType() == V->getType() && EntInst->getFunction() == InsertPt->getFunction() && SE.DT.dominates(EntInst, InsertPt) && (SE.LI.getLoopFor(EntInst->getParent()) == nullptr || - SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) { - return Ent; - } + SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) + return {V, Offset}; } } } - return nullptr; + return {nullptr, nullptr}; } // The expansion of SCEV will either reuse a previous Value in ExprValueMap, @@ -1698,10 +1699,14 @@ Value *SCEVExpander::expand(const SCEV * Builder.SetInsertPoint(InsertPt); // Expand the expression into instructions. - Value *V = FindValueInExprValueMap(S, InsertPt); + ScalarEvolution::ValueOffsetPair VO = FindValueInExprValueMap(S, InsertPt); + Value *V = VO.first; if (!V) V = visit(S); + else if (VO.second) { + V = Builder.CreateSub(V, VO.second); + } // Remember the expanded value for this SCEV at this location. // @@ -1914,7 +1919,7 @@ Value *SCEVExpander::findExistingExpansi // Use expand's logic which is used for reusing a previous Value in // ExprValueMap. - if (Value *Val = FindValueInExprValueMap(S, At)) + if (Value *Val = FindValueInExprValueMap(S, At).first) return Val; // There is potential to make this significantly smarter, but this simple From owner-svn-src-all@freebsd.org Wed Jan 25 18:07: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 09AD4CC1659; Wed, 25 Jan 2017 18:07: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 D82E5DD; Wed, 25 Jan 2017 18:07:28 +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 v0PI7Ra1036457; Wed, 25 Jan 2017 18:07:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PI7Rsp036456; Wed, 25 Jan 2017 18:07:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251807.v0PI7Rsp036456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:07: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: r312766 - stable/11/tools/build/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 18:07:29 -0000 Author: dim Date: Wed Jan 25 18:07:27 2017 New Revision: 312766 URL: https://svnweb.freebsd.org/changeset/base/312766 Log: MFC r311807: Add recently added libc++ headers to OptionalObsoleteFiles.inc. Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 25 17:59:22 2017 (r312765) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jan 25 18:07:27 2017 (r312766) @@ -4390,6 +4390,8 @@ OLD_FILES+=usr/lib/libcxxrt.a OLD_FILES+=usr/lib/libcxxrt.so OLD_FILES+=usr/lib/libcxxrt_p.a OLD_FILES+=usr/include/c++/v1/__bit_reference +OLD_FILES+=usr/include/c++/v1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/__config OLD_FILES+=usr/include/c++/v1/__debug OLD_FILES+=usr/include/c++/v1/__functional_03 @@ -4398,10 +4400,12 @@ OLD_FILES+=usr/include/c++/v1/__function OLD_FILES+=usr/include/c++/v1/__hash_table OLD_FILES+=usr/include/c++/v1/__locale OLD_FILES+=usr/include/c++/v1/__mutex_base +OLD_FILES+=usr/include/c++/v1/__nullptr OLD_FILES+=usr/include/c++/v1/__refstring OLD_FILES+=usr/include/c++/v1/__split_buffer OLD_FILES+=usr/include/c++/v1/__sso_allocator OLD_FILES+=usr/include/c++/v1/__std_stream +OLD_FILES+=usr/include/c++/v1/__threading_support OLD_FILES+=usr/include/c++/v1/__tree OLD_FILES+=usr/include/c++/v1/__tuple OLD_FILES+=usr/include/c++/v1/__undef___deallocate @@ -4437,30 +4441,51 @@ OLD_FILES+=usr/include/c++/v1/cstdlib OLD_FILES+=usr/include/c++/v1/cstring OLD_FILES+=usr/include/c++/v1/ctgmath OLD_FILES+=usr/include/c++/v1/ctime +OLD_FILES+=usr/include/c++/v1/ctype.h OLD_FILES+=usr/include/c++/v1/cwchar OLD_FILES+=usr/include/c++/v1/cwctype OLD_FILES+=usr/include/c++/v1/cxxabi.h OLD_FILES+=usr/include/c++/v1/deque +OLD_FILES+=usr/include/c++/v1/errno.h OLD_FILES+=usr/include/c++/v1/exception OLD_FILES+=usr/include/c++/v1/experimental/__config +OLD_FILES+=usr/include/c++/v1/experimental/__memory +OLD_FILES+=usr/include/c++/v1/experimental/algorithm +OLD_FILES+=usr/include/c++/v1/experimental/any OLD_FILES+=usr/include/c++/v1/experimental/chrono +OLD_FILES+=usr/include/c++/v1/experimental/deque OLD_FILES+=usr/include/c++/v1/experimental/dynarray -OLD_FILES+=usr/include/c++/v1/experimental/dynarray +OLD_FILES+=usr/include/c++/v1/experimental/filesystem +OLD_FILES+=usr/include/c++/v1/experimental/forward_list +OLD_FILES+=usr/include/c++/v1/experimental/functional +OLD_FILES+=usr/include/c++/v1/experimental/iterator +OLD_FILES+=usr/include/c++/v1/experimental/list +OLD_FILES+=usr/include/c++/v1/experimental/map +OLD_FILES+=usr/include/c++/v1/experimental/memory_resource OLD_FILES+=usr/include/c++/v1/experimental/optional +OLD_FILES+=usr/include/c++/v1/experimental/propagate_const OLD_FILES+=usr/include/c++/v1/experimental/ratio +OLD_FILES+=usr/include/c++/v1/experimental/regex +OLD_FILES+=usr/include/c++/v1/experimental/set +OLD_FILES+=usr/include/c++/v1/experimental/string OLD_FILES+=usr/include/c++/v1/experimental/string_view OLD_FILES+=usr/include/c++/v1/experimental/system_error OLD_FILES+=usr/include/c++/v1/experimental/tuple OLD_FILES+=usr/include/c++/v1/experimental/type_traits +OLD_FILES+=usr/include/c++/v1/experimental/unordered_map +OLD_FILES+=usr/include/c++/v1/experimental/unordered_set OLD_FILES+=usr/include/c++/v1/experimental/utility +OLD_FILES+=usr/include/c++/v1/experimental/vector OLD_FILES+=usr/include/c++/v1/ext/__hash OLD_FILES+=usr/include/c++/v1/ext/hash_map OLD_FILES+=usr/include/c++/v1/ext/hash_set +OLD_FILES+=usr/include/c++/v1/float.h OLD_FILES+=usr/include/c++/v1/forward_list OLD_FILES+=usr/include/c++/v1/fstream OLD_FILES+=usr/include/c++/v1/functional OLD_FILES+=usr/include/c++/v1/future OLD_FILES+=usr/include/c++/v1/initializer_list +OLD_FILES+=usr/include/c++/v1/inttypes.h OLD_FILES+=usr/include/c++/v1/iomanip OLD_FILES+=usr/include/c++/v1/ios OLD_FILES+=usr/include/c++/v1/iosfwd @@ -4471,6 +4496,7 @@ OLD_FILES+=usr/include/c++/v1/limits OLD_FILES+=usr/include/c++/v1/list OLD_FILES+=usr/include/c++/v1/locale OLD_FILES+=usr/include/c++/v1/map +OLD_FILES+=usr/include/c++/v1/math.h OLD_FILES+=usr/include/c++/v1/memory OLD_FILES+=usr/include/c++/v1/mutex OLD_FILES+=usr/include/c++/v1/new @@ -4482,17 +4508,25 @@ OLD_FILES+=usr/include/c++/v1/ratio OLD_FILES+=usr/include/c++/v1/regex OLD_FILES+=usr/include/c++/v1/scoped_allocator OLD_FILES+=usr/include/c++/v1/set +OLD_FILES+=usr/include/c++/v1/setjmp.h OLD_FILES+=usr/include/c++/v1/shared_mutex OLD_FILES+=usr/include/c++/v1/sstream OLD_FILES+=usr/include/c++/v1/stack +OLD_FILES+=usr/include/c++/v1/stdbool.h +OLD_FILES+=usr/include/c++/v1/stddef.h OLD_FILES+=usr/include/c++/v1/stdexcept +OLD_FILES+=usr/include/c++/v1/stdio.h +OLD_FILES+=usr/include/c++/v1/stdlib.h OLD_FILES+=usr/include/c++/v1/streambuf OLD_FILES+=usr/include/c++/v1/string +OLD_FILES+=usr/include/c++/v1/string.h OLD_FILES+=usr/include/c++/v1/strstream OLD_FILES+=usr/include/c++/v1/system_error OLD_FILES+=usr/include/c++/v1/tgmath.h OLD_FILES+=usr/include/c++/v1/thread OLD_FILES+=usr/include/c++/v1/tr1/__bit_reference +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/tr1/__config OLD_FILES+=usr/include/c++/v1/tr1/__debug OLD_FILES+=usr/include/c++/v1/tr1/__functional_03 @@ -4501,13 +4535,15 @@ OLD_FILES+=usr/include/c++/v1/tr1/__func OLD_FILES+=usr/include/c++/v1/tr1/__hash_table OLD_FILES+=usr/include/c++/v1/tr1/__locale OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base +OLD_FILES+=usr/include/c++/v1/tr1/__nullptr OLD_FILES+=usr/include/c++/v1/tr1/__refstring OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator OLD_FILES+=usr/include/c++/v1/tr1/__std_stream +OLD_FILES+=usr/include/c++/v1/tr1/__threading_support OLD_FILES+=usr/include/c++/v1/tr1/__tree OLD_FILES+=usr/include/c++/v1/tr1/__tuple -OLD_FILES+=usr/include/c++/v1/tr1/__tuple_03 +OLD_FILES+=usr/include/c++/v1/tr1/__undef___deallocate OLD_FILES+=usr/include/c++/v1/tr1/__undef_min_max OLD_FILES+=usr/include/c++/v1/tr1/algorithm OLD_FILES+=usr/include/c++/v1/tr1/array @@ -4540,15 +4576,19 @@ OLD_FILES+=usr/include/c++/v1/tr1/cstdli OLD_FILES+=usr/include/c++/v1/tr1/cstring OLD_FILES+=usr/include/c++/v1/tr1/ctgmath OLD_FILES+=usr/include/c++/v1/tr1/ctime +OLD_FILES+=usr/include/c++/v1/tr1/ctype.h OLD_FILES+=usr/include/c++/v1/tr1/cwchar OLD_FILES+=usr/include/c++/v1/tr1/cwctype OLD_FILES+=usr/include/c++/v1/tr1/deque +OLD_FILES+=usr/include/c++/v1/tr1/errno.h OLD_FILES+=usr/include/c++/v1/tr1/exception +OLD_FILES+=usr/include/c++/v1/tr1/float.h OLD_FILES+=usr/include/c++/v1/tr1/forward_list OLD_FILES+=usr/include/c++/v1/tr1/fstream OLD_FILES+=usr/include/c++/v1/tr1/functional OLD_FILES+=usr/include/c++/v1/tr1/future OLD_FILES+=usr/include/c++/v1/tr1/initializer_list +OLD_FILES+=usr/include/c++/v1/tr1/inttypes.h OLD_FILES+=usr/include/c++/v1/tr1/iomanip OLD_FILES+=usr/include/c++/v1/tr1/ios OLD_FILES+=usr/include/c++/v1/tr1/iosfwd @@ -4559,6 +4599,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/limits OLD_FILES+=usr/include/c++/v1/tr1/list OLD_FILES+=usr/include/c++/v1/tr1/locale OLD_FILES+=usr/include/c++/v1/tr1/map +OLD_FILES+=usr/include/c++/v1/tr1/math.h OLD_FILES+=usr/include/c++/v1/tr1/memory OLD_FILES+=usr/include/c++/v1/tr1/mutex OLD_FILES+=usr/include/c++/v1/tr1/new @@ -4570,12 +4611,18 @@ OLD_FILES+=usr/include/c++/v1/tr1/ratio OLD_FILES+=usr/include/c++/v1/tr1/regex OLD_FILES+=usr/include/c++/v1/tr1/scoped_allocator OLD_FILES+=usr/include/c++/v1/tr1/set +OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h OLD_FILES+=usr/include/c++/v1/tr1/shared_mutex OLD_FILES+=usr/include/c++/v1/tr1/sstream OLD_FILES+=usr/include/c++/v1/tr1/stack +OLD_FILES+=usr/include/c++/v1/tr1/stdbool.h +OLD_FILES+=usr/include/c++/v1/tr1/stddef.h OLD_FILES+=usr/include/c++/v1/tr1/stdexcept +OLD_FILES+=usr/include/c++/v1/tr1/stdio.h +OLD_FILES+=usr/include/c++/v1/tr1/stdlib.h OLD_FILES+=usr/include/c++/v1/tr1/streambuf OLD_FILES+=usr/include/c++/v1/tr1/string +OLD_FILES+=usr/include/c++/v1/tr1/string.h OLD_FILES+=usr/include/c++/v1/tr1/strstream OLD_FILES+=usr/include/c++/v1/tr1/system_error OLD_FILES+=usr/include/c++/v1/tr1/tgmath.h @@ -4589,6 +4636,8 @@ OLD_FILES+=usr/include/c++/v1/tr1/unorde OLD_FILES+=usr/include/c++/v1/tr1/utility OLD_FILES+=usr/include/c++/v1/tr1/valarray OLD_FILES+=usr/include/c++/v1/tr1/vector +OLD_FILES+=usr/include/c++/v1/tr1/wchar.h +OLD_FILES+=usr/include/c++/v1/tr1/wctype.h OLD_FILES+=usr/include/c++/v1/tuple OLD_FILES+=usr/include/c++/v1/type_traits OLD_FILES+=usr/include/c++/v1/typeindex @@ -4601,6 +4650,8 @@ OLD_FILES+=usr/include/c++/v1/unwind.h OLD_FILES+=usr/include/c++/v1/utility OLD_FILES+=usr/include/c++/v1/valarray OLD_FILES+=usr/include/c++/v1/vector +OLD_FILES+=usr/include/c++/v1/wchar.h +OLD_FILES+=usr/include/c++/v1/wctype.h OLD_FILES+=usr/lib32/libc++.a OLD_FILES+=usr/lib32/libc++.so OLD_LIBS+=usr/lib32/libc++.so.1 From owner-svn-src-all@freebsd.org Wed Jan 25 18:16: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 BEB60CC1BA6; Wed, 25 Jan 2017 18:16: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 938A79DB; Wed, 25 Jan 2017 18:16: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 v0PIGHHW040832; Wed, 25 Jan 2017 18:16:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PIGHcO040829; Wed, 25 Jan 2017 18:16:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701251816.v0PIGHcO040829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Jan 2017 18:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312767 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 18:16:18 -0000 Author: mav Date: Wed Jan 25 18:16:17 2017 New Revision: 312767 URL: https://svnweb.freebsd.org/changeset/base/312767 Log: Partially workaround ASMedia HBA error recovery. Taking closer look on my ASM1062 I found that it has bunch of issues around error recovery: reported wrong CCS, failed commands reported as completed, READ LOG EXT times out after NCQ error. This patch workarounds first two problems, that were making ATAPI devices close to unusable on these HBAs. MFC after: 2 weeks Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Jan 25 18:07:27 2017 (r312766) +++ head/sys/dev/ahci/ahci.c Wed Jan 25 18:16:17 2017 (r312767) @@ -758,7 +758,7 @@ ahci_ch_attach(device_t dev) /* Construct SIM entry */ ch->sim = cam_sim_alloc(ahciaction, ahcipoll, "ahcich", ch, device_get_unit(dev), (struct mtx *)&ch->mtx, - min(2, ch->numslots), + (ch->quirks & AHCI_Q_NOCCS) ? 1 : min(2, ch->numslots), (ch->caps & AHCI_CAP_SNCQ) ? ch->numslots : 0, devq); if (ch->sim == NULL) { @@ -1271,8 +1271,19 @@ ahci_ch_intr_main(struct ahci_channel *c /* Process command errors */ if (istatus & (AHCI_P_IX_OF | AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) { - ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) - >> AHCI_P_CMD_CCS_SHIFT; + if (ch->quirks & AHCI_Q_NOCCS) { + /* + * ASMedia chips sometimes report failed commands as + * completed. Count all running commands as failed. + */ + cstatus |= ch->rslots; + + /* They also report wrong CCS, so try to guess one. */ + ccs = powerof2(cstatus) ? ffs(cstatus) - 1 : -1; + } else { + ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & + AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; + } //device_printf(dev, "%s ERROR is %08x cs %08x ss %08x rs %08x tfd %02x serr %08x fbs %08x ccs %d\n", // __func__, istatus, cstatus, sstatus, ch->rslots, ATA_INL(ch->r_mem, AHCI_P_TFD), // serr, ATA_INL(ch->r_mem, AHCI_P_FBS), ccs); Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Jan 25 18:07:27 2017 (r312766) +++ head/sys/dev/ahci/ahci.h Wed Jan 25 18:16:17 2017 (r312767) @@ -599,6 +599,7 @@ enum ahci_err_type { #define AHCI_Q_RESTORE_CAP 0x00080000 #define AHCI_Q_NOMSIX 0x00100000 #define AHCI_Q_MRVL_SR_DEL 0x00200000 +#define AHCI_Q_NOCCS 0x00400000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -623,7 +624,8 @@ enum ahci_err_type { "\023FORCE_PI" \ "\024RESTORE_CAP" \ "\025NOMSIX" \ - "\026MRVL_SR_DEL" + "\026MRVL_SR_DEL" \ + "\027NOCCS" int ahci_attach(device_t dev); int ahci_detach(device_t dev); Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Jan 25 18:07:27 2017 (r312766) +++ head/sys/dev/ahci/ahci_pci.c Wed Jan 25 18:16:17 2017 (r312767) @@ -73,15 +73,15 @@ static const struct { {0x78021022, 0x00, "AMD Hudson-2", 0}, {0x78031022, 0x00, "AMD Hudson-2", 0}, {0x78041022, 0x00, "AMD Hudson-2", 0}, - {0x06011b21, 0x00, "ASMedia ASM1060", 0}, - {0x06021b21, 0x00, "ASMedia ASM1060", 0}, - {0x06111b21, 0x00, "ASMedia ASM1061", 0}, - {0x06121b21, 0x00, "ASMedia ASM1062", 0}, - {0x06201b21, 0x00, "ASMedia ASM106x", 0}, - {0x06211b21, 0x00, "ASMedia ASM106x", 0}, - {0x06221b21, 0x00, "ASMedia ASM106x", 0}, - {0x06241b21, 0x00, "ASMedia ASM106x", 0}, - {0x06251b21, 0x00, "ASMedia ASM106x", 0}, + {0x06011b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, + {0x06021b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, + {0x06111b21, 0x00, "ASMedia ASM1061", AHCI_Q_NOCCS}, + {0x06121b21, 0x00, "ASMedia ASM1062", AHCI_Q_NOCCS}, + {0x06201b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06211b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06221b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06241b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06251b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, {0x26528086, 0x00, "Intel ICH6", AHCI_Q_NOFORCE}, {0x26538086, 0x00, "Intel ICH6M", AHCI_Q_NOFORCE}, {0x26818086, 0x00, "Intel ESB2", 0}, From owner-svn-src-all@freebsd.org Wed Jan 25 18:21: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 C1F8FCC1C4D; Wed, 25 Jan 2017 18:21:50 +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 89454D9F; Wed, 25 Jan 2017 18:21:50 +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 v0PILngn044566; Wed, 25 Jan 2017 18:21:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PILnqE044565; Wed, 25 Jan 2017 18:21:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251821.v0PILnqE044565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:21: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: r312768 - stable/11/usr.sbin/mfiutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 18:21:50 -0000 Author: dim Date: Wed Jan 25 18:21:49 2017 New Revision: 312768 URL: https://svnweb.freebsd.org/changeset/base/312768 Log: MFC r311811: Avoid taking the address of a packed struct member in mfiutil Fix a clang 4.0.0 warning about taking the address of a packed member of struct mfi_evt in mfiutil: usr.sbin/mfiutil/mfi_evt.c:583:30: error: taking address of packed member 'members' of class or structure 'mfi_evt' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] if (parse_locale(optarg, &filter.members.locale) < 0) { ^~~~~~~~~~~~~~~~~~~~~ Use a local variable instead, and copy that into the struct. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D9069 Modified: stable/11/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/11/usr.sbin/mfiutil/mfi_evt.c Wed Jan 25 18:16:17 2017 (r312767) +++ stable/11/usr.sbin/mfiutil/mfi_evt.c Wed Jan 25 18:21:49 2017 (r312768) @@ -540,6 +540,7 @@ show_events(int ac, char **av) char *cp; ssize_t size; uint32_t seq, start, stop; + uint16_t locale; uint8_t status; int ch, error, fd, num_events, verbose; u_int i; @@ -580,12 +581,13 @@ show_events(int ac, char **av) } break; case 'l': - if (parse_locale(optarg, &filter.members.locale) < 0) { + if (parse_locale(optarg, &locale) < 0) { error = errno; warn("Error parsing event locale"); close(fd); return (error); } + filter.members.locale = locale; break; case 'n': val = strtol(optarg, &cp, 0); From owner-svn-src-all@freebsd.org Wed Jan 25 18: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 47192CBC27C; Wed, 25 Jan 2017 18: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 E4617A9D; Wed, 25 Jan 2017 18:31:52 +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 v0PIVqfS048629; Wed, 25 Jan 2017 18:31:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PIVqXE048628; Wed, 25 Jan 2017 18:31:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251831.v0PIVqXE048628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 18:31: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: r312769 - stable/11/sys/boot/efi/boot1 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 18:31:53 -0000 Author: dim Date: Wed Jan 25 18:31:51 2017 New Revision: 312769 URL: https://svnweb.freebsd.org/changeset/base/312769 Log: MFC r311933: Use proper prototypes in struct boot_module_t With clang 4.0.0, we are getting the following warnings about struct boot_module_t in efi's boot_module.h: In file included from sys/boot/efi/boot1/ufs_module.c:41: sys/boot/efi/boot1/boot_module.h:67:14: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*init)(); ^ void sys/boot/efi/boot1/boot_module.h:92:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*status)(); ^ void sys/boot/efi/boot1/boot_module.h:95:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] dev_info_t *(*devices)(); ^ void 3 errors generated. Fix this by adding 'void' to the parameter lists. No functional change. Reviewed by: emaste, imp, smh Differential Revision: https://reviews.freebsd.org/D9144 Modified: stable/11/sys/boot/efi/boot1/boot_module.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/boot1/boot_module.h ============================================================================== --- stable/11/sys/boot/efi/boot1/boot_module.h Wed Jan 25 18:21:49 2017 (r312768) +++ stable/11/sys/boot/efi/boot1/boot_module.h Wed Jan 25 18:31:51 2017 (r312769) @@ -64,7 +64,7 @@ typedef struct boot_module_t const char *name; /* init is the optional initialiser for the module. */ - void (*init)(); + void (*init)(void); /* * probe checks to see if the module can handle dev. @@ -89,10 +89,10 @@ typedef struct boot_module_t void **buf, size_t *bufsize); /* status outputs information about the probed devices. */ - void (*status)(); + void (*status)(void); /* valid devices as found by probe. */ - dev_info_t *(*devices)(); + dev_info_t *(*devices)(void); } boot_module_t; /* Standard boot modules. */ From owner-svn-src-all@freebsd.org Wed Jan 25 19: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 7624BCBCEFB; Wed, 25 Jan 2017 19:04:10 +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 50BEC22E; Wed, 25 Jan 2017 19:04:10 +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 v0PJ496O061433; Wed, 25 Jan 2017 19:04:09 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJ48YF061428; Wed, 25 Jan 2017 19:04:08 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701251904.v0PJ48YF061428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 19:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312770 - in head/sys: net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 19:04:10 -0000 Author: loos Date: Wed Jan 25 19:04:08 2017 New Revision: 312770 URL: https://svnweb.freebsd.org/changeset/base/312770 Log: After the in_control() changes in r257692, an existing address is (intentionally) deleted first and then completely added again (so all the events, announces and hooks are given a chance to run). This cause an issue with CARP where the existing CARP data structure is removed together with the last address for a given VHID, which will cause a subsequent fail when the address is later re-added. This change fixes this issue by adding a new flag to keep the CARP data structure when an address is not being removed. There was an additional issue with IPv6 CARP addresses, where the CARP data structure would never be removed after a change and lead to VHIDs which cannot be destroyed. Reviewed by: glebius Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/net/if.c head/sys/netinet/in.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_carp.h head/sys/netinet6/in6.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Jan 25 18:31:51 2017 (r312769) +++ head/sys/net/if.c Wed Jan 25 19:04:08 2017 (r312770) @@ -145,7 +145,7 @@ int (*carp_output_p)(struct ifnet *ifp, const struct sockaddr *sa); int (*carp_ioctl_p)(struct ifreq *, u_long, struct thread *); int (*carp_attach_p)(struct ifaddr *, int); -void (*carp_detach_p)(struct ifaddr *); +void (*carp_detach_p)(struct ifaddr *, bool); #endif #ifdef INET int (*carp_iamatch_p)(struct ifaddr *, uint8_t **); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Jan 25 18:31:51 2017 (r312769) +++ head/sys/netinet/in.c Wed Jan 25 19:04:08 2017 (r312770) @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); #include static int in_aifaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); -static int in_difaddr_ioctl(caddr_t, struct ifnet *, struct thread *); +static int in_difaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); static void in_socktrim(struct sockaddr_in *); static void in_purgemaddrs(struct ifnet *); @@ -245,7 +245,7 @@ in_control(struct socket *so, u_long cmd break; case SIOCDIFADDR: sx_xlock(&in_control_sx); - error = in_difaddr_ioctl(data, ifp, td); + error = in_difaddr_ioctl(cmd, data, ifp, td); sx_xunlock(&in_control_sx); return (error); case OSIOCAIFADDR: /* 9.x compat */ @@ -390,7 +390,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat IF_ADDR_RUNLOCK(ifp); if (ia != NULL) - (void )in_difaddr_ioctl(data, ifp, td); + (void )in_difaddr_ioctl(cmd, data, ifp, td); ifa = ifa_alloc(sizeof(struct in_ifaddr), M_WAITOK); ia = (struct in_ifaddr *)ifa; @@ -528,7 +528,7 @@ fail2: fail1: if (ia->ia_ifa.ifa_carp) - (*carp_detach_p)(&ia->ia_ifa); + (*carp_detach_p)(&ia->ia_ifa, false); IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); @@ -545,7 +545,7 @@ fail1: } static int -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) { const struct ifreq *ifr = (struct ifreq *)data; const struct sockaddr_in *addr = (const struct sockaddr_in *) @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if in_ifadown(&ia->ia_ifa, 1); if (ia->ia_ifa.ifa_carp) - (*carp_detach_p)(&ia->ia_ifa); + (*carp_detach_p)(&ia->ia_ifa, + (cmd == SIOCDIFADDR) ? false : true); /* * If this is the last IPv4 address configured on this Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Jan 25 18:31:51 2017 (r312769) +++ head/sys/netinet/ip_carp.c Wed Jan 25 19:04:08 2017 (r312770) @@ -1969,7 +1969,7 @@ carp_attach(struct ifaddr *ifa, int vhid } void -carp_detach(struct ifaddr *ifa) +carp_detach(struct ifaddr *ifa, bool keep_cif) { struct ifnet *ifp = ifa->ifa_ifp; struct carp_if *cif = ifp->if_carp; @@ -2015,12 +2015,13 @@ carp_detach(struct ifaddr *ifa) carp_hmac_prepare(sc); carp_sc_state(sc); - if (sc->sc_naddrs == 0 && sc->sc_naddrs6 == 0) + if (!keep_cif && sc->sc_naddrs == 0 && sc->sc_naddrs6 == 0) carp_destroy(sc); else CARP_UNLOCK(sc); - CIF_FREE(cif); + if (!keep_cif) + CIF_FREE(cif); sx_xunlock(&carp_sx); } Modified: head/sys/netinet/ip_carp.h ============================================================================== --- head/sys/netinet/ip_carp.h Wed Jan 25 18:31:51 2017 (r312769) +++ head/sys/netinet/ip_carp.h Wed Jan 25 19:04:08 2017 (r312770) @@ -138,7 +138,7 @@ struct carpreq { #ifdef _KERNEL int carp_ioctl(struct ifreq *, u_long, struct thread *); int carp_attach(struct ifaddr *, int); -void carp_detach(struct ifaddr *); +void carp_detach(struct ifaddr *, bool); void carp_carpdev_state(struct ifnet *); int carp_input(struct mbuf **, int *, int); int carp6_input (struct mbuf **, int *, int); @@ -154,7 +154,7 @@ int carp_forus(struct ifnet *, u_char * /* net/if.c */ extern int (*carp_ioctl_p)(struct ifreq *, u_long, struct thread *); extern int (*carp_attach_p)(struct ifaddr *, int); -extern void (*carp_detach_p)(struct ifaddr *); +extern void (*carp_detach_p)(struct ifaddr *, bool); extern void (*carp_linkstate_p)(struct ifnet *); extern void (*carp_demote_adj_p)(int, char *); extern int (*carp_master_p)(struct ifaddr *); Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Jan 25 18:31:51 2017 (r312769) +++ head/sys/netinet6/in6.c Wed Jan 25 19:04:08 2017 (r312770) @@ -554,8 +554,11 @@ in6_control(struct socket *so, u_long cm */ if ((error = in6_update_ifa(ifp, ifra, ia, 0)) != 0) goto out; - if (ia != NULL) + if (ia != NULL) { + if (ia->ia_ifa.ifa_carp) + (*carp_detach_p)(&ia->ia_ifa, true); ifa_free(&ia->ia_ifa); + } if ((ia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr)) == NULL) { /* @@ -622,7 +625,7 @@ in6_control(struct socket *so, u_long cm */ if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0) { if (carp_attached) - (*carp_detach_p)(&ia->ia_ifa); + (*carp_detach_p)(&ia->ia_ifa, false); goto out; } } @@ -1243,7 +1246,7 @@ in6_purgeaddr(struct ifaddr *ifa) int plen, error; if (ifa->ifa_carp) - (*carp_detach_p)(ifa); + (*carp_detach_p)(ifa, false); /* * Remove the loopback route to the interface address. From owner-svn-src-all@freebsd.org Wed Jan 25 19:16: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 5887ACC0346; Wed, 25 Jan 2017 19:16: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 27925BC3; Wed, 25 Jan 2017 19:16: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 v0PJGPJ3065564; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJGPpP065563; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251916.v0PJGPpP065563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:16:25 +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: r312771 - in stable: 10/sys/boot/common 11/sys/boot/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 19:16:26 -0000 Author: dim Date: Wed Jan 25 19:16:24 2017 New Revision: 312771 URL: https://svnweb.freebsd.org/changeset/base/312771 Log: MFC r311929: Don't include in reloc_elf.c, as it includes just after it, which has a conflicting definition of errno. This leads to the following warning with clang 4.0.0: In file included from sys/boot/common/reloc_elf32.c:6: In file included from sys/boot/common/reloc_elf.c:37: /usr/obj/usr/src/tmp/usr/include/stand.h:155:12: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int errno; ^ sys/sys/errno.h:46:26: note: expanded from macro 'errno' #define errno (* __error()) ^ Modified: stable/10/sys/boot/common/reloc_elf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/boot/common/reloc_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/boot/common/reloc_elf.c ============================================================================== --- stable/10/sys/boot/common/reloc_elf.c Wed Jan 25 19:04:08 2017 (r312770) +++ stable/10/sys/boot/common/reloc_elf.c Wed Jan 25 19:16:24 2017 (r312771) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #define FREEBSD_ELF From owner-svn-src-all@freebsd.org Wed Jan 25 19:16: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 23227CC0340; Wed, 25 Jan 2017 19:16: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 E5E4CBC2; Wed, 25 Jan 2017 19:16:25 +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 v0PJGPDo065558; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJGPMf065557; Wed, 25 Jan 2017 19:16:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251916.v0PJGPMf065557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:16: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: r312771 - in stable: 10/sys/boot/common 11/sys/boot/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 19:16:26 -0000 Author: dim Date: Wed Jan 25 19:16:24 2017 New Revision: 312771 URL: https://svnweb.freebsd.org/changeset/base/312771 Log: MFC r311929: Don't include in reloc_elf.c, as it includes just after it, which has a conflicting definition of errno. This leads to the following warning with clang 4.0.0: In file included from sys/boot/common/reloc_elf32.c:6: In file included from sys/boot/common/reloc_elf.c:37: /usr/obj/usr/src/tmp/usr/include/stand.h:155:12: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] extern int errno; ^ sys/sys/errno.h:46:26: note: expanded from macro 'errno' #define errno (* __error()) ^ Modified: stable/11/sys/boot/common/reloc_elf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/boot/common/reloc_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/boot/common/reloc_elf.c ============================================================================== --- stable/11/sys/boot/common/reloc_elf.c Wed Jan 25 19:04:08 2017 (r312770) +++ stable/11/sys/boot/common/reloc_elf.c Wed Jan 25 19:16:24 2017 (r312771) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #define FREEBSD_ELF From owner-svn-src-all@freebsd.org Wed Jan 25 19:55: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 5DE44CC11B6; Wed, 25 Jan 2017 19:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CCA1A; Wed, 25 Jan 2017 19:55:37 +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 v0PJtawD081697; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJtaYU081696; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251955.v0PJtaYU081696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:55:36 +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: r312772 - in stable: 10/sys/boot/efi/include 11/sys/boot/efi/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 19:55:37 -0000 Author: dim Date: Wed Jan 25 19:55:35 2017 New Revision: 312772 URL: https://svnweb.freebsd.org/changeset/base/312772 Log: MFC r311932: Make EFI_RESERVED_SERVICE a proper prototype With clang 4.0.0, the EFI API header causes the following warning: In file included from sys/boot/efi/loader/bootinfo.c:43: In file included from sys/boot/efi/loader/../include/efi.h:52: sys/boot/efi/include/efiapi.h:534:32: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] (EFIAPI *EFI_RESERVED_SERVICE) ( ^ Add VOID to make it into a real prototype. Reviewed by: imp, emaste, tsoome Differential Revision: https://reviews.freebsd.org/D9132 Modified: stable/10/sys/boot/efi/include/efiapi.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/boot/efi/include/efiapi.h Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/boot/efi/include/efiapi.h ============================================================================== --- stable/10/sys/boot/efi/include/efiapi.h Wed Jan 25 19:16:24 2017 (r312771) +++ stable/10/sys/boot/efi/include/efiapi.h Wed Jan 25 19:55:35 2017 (r312772) @@ -536,6 +536,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EFI_RESERVED_SERVICE) ( + VOID ); typedef From owner-svn-src-all@freebsd.org Wed Jan 25 19:55: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 27655CC11B2; Wed, 25 Jan 2017 19:55:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA63F9; Wed, 25 Jan 2017 19:55:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PJta1W081691; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PJtacZ081690; Wed, 25 Jan 2017 19:55:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701251955.v0PJtacZ081690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 19:55: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: r312772 - in stable: 10/sys/boot/efi/include 11/sys/boot/efi/include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 19:55:37 -0000 Author: dim Date: Wed Jan 25 19:55:35 2017 New Revision: 312772 URL: https://svnweb.freebsd.org/changeset/base/312772 Log: MFC r311932: Make EFI_RESERVED_SERVICE a proper prototype With clang 4.0.0, the EFI API header causes the following warning: In file included from sys/boot/efi/loader/bootinfo.c:43: In file included from sys/boot/efi/loader/../include/efi.h:52: sys/boot/efi/include/efiapi.h:534:32: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] (EFIAPI *EFI_RESERVED_SERVICE) ( ^ Add VOID to make it into a real prototype. Reviewed by: imp, emaste, tsoome Differential Revision: https://reviews.freebsd.org/D9132 Modified: stable/11/sys/boot/efi/include/efiapi.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/boot/efi/include/efiapi.h Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/boot/efi/include/efiapi.h ============================================================================== --- stable/11/sys/boot/efi/include/efiapi.h Wed Jan 25 19:16:24 2017 (r312771) +++ stable/11/sys/boot/efi/include/efiapi.h Wed Jan 25 19:55:35 2017 (r312772) @@ -532,6 +532,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *EFI_RESERVED_SERVICE) ( + VOID ); typedef From owner-svn-src-all@freebsd.org Wed Jan 25 20:12: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 BEDDDCC15FD; Wed, 25 Jan 2017 20:12:08 +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 6F521C84; Wed, 25 Jan 2017 20:12:08 +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 v0PKC7Sk089774; Wed, 25 Jan 2017 20:12:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKC7kl089773; Wed, 25 Jan 2017 20:12:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701252012.v0PKC7kl089773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 25 Jan 2017 20:12:07 +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: r312773 - stable/10/sys/boot/efi/boot1 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:12:08 -0000 Author: dim Date: Wed Jan 25 20:12:07 2017 New Revision: 312773 URL: https://svnweb.freebsd.org/changeset/base/312773 Log: MFC r311933: Use proper prototypes in struct boot_module_t With clang 4.0.0, we are getting the following warnings about struct boot_module_t in efi's boot_module.h: In file included from sys/boot/efi/boot1/ufs_module.c:41: sys/boot/efi/boot1/boot_module.h:67:14: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*init)(); ^ void sys/boot/efi/boot1/boot_module.h:92:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] void (*status)(); ^ void sys/boot/efi/boot1/boot_module.h:95:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] dev_info_t *(*devices)(); ^ void 3 errors generated. Fix this by adding 'void' to the parameter lists. No functional change. Reviewed by: emaste, imp, smh Differential Revision: https://reviews.freebsd.org/D9144 Modified: stable/10/sys/boot/efi/boot1/boot_module.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/efi/boot1/boot_module.h ============================================================================== --- stable/10/sys/boot/efi/boot1/boot_module.h Wed Jan 25 19:55:35 2017 (r312772) +++ stable/10/sys/boot/efi/boot1/boot_module.h Wed Jan 25 20:12:07 2017 (r312773) @@ -64,7 +64,7 @@ typedef struct boot_module_t const char *name; /* init is the optional initialiser for the module. */ - void (*init)(); + void (*init)(void); /* * probe checks to see if the module can handle dev. @@ -89,10 +89,10 @@ typedef struct boot_module_t void **buf, size_t *bufsize); /* status outputs information about the probed devices. */ - void (*status)(); + void (*status)(void); /* valid devices as found by probe. */ - dev_info_t *(*devices)(); + dev_info_t *(*devices)(void); } boot_module_t; /* Standard boot modules. */ From owner-svn-src-all@freebsd.org Wed Jan 25 20:19: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 43E0BCC1780; Wed, 25 Jan 2017 20:19:50 +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 137CAF70; Wed, 25 Jan 2017 20:19: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 v0PKJn8O090064; Wed, 25 Jan 2017 20:19:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKJnvV090063; Wed, 25 Jan 2017 20:19:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701252019.v0PKJnvV090063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 20:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312774 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:19:50 -0000 Author: emaste Date: Wed Jan 25 20:19:48 2017 New Revision: 312774 URL: https://svnweb.freebsd.org/changeset/base/312774 Log: libthr: coalesce repeated #if blocks Modified: head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Wed Jan 25 20:12:07 2017 (r312773) +++ head/lib/libthr/thread/thr_exit.c Wed Jan 25 20:19:48 2017 (r312774) @@ -240,9 +240,6 @@ _pthread_exit_mask(void *status, sigset_ #ifdef PIC thread_uw_init(); -#endif /* PIC */ - -#ifdef PIC if (uwl_forcedunwind != NULL) { #else if (_Unwind_ForcedUnwind != NULL) { From owner-svn-src-all@freebsd.org Wed Jan 25 20: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 99197CC1936; Wed, 25 Jan 2017 20:22:33 +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 690941399; Wed, 25 Jan 2017 20:22:33 +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 v0PKMWjX093715; Wed, 25 Jan 2017 20:22:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKMWPt093714; Wed, 25 Jan 2017 20:22:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701252022.v0PKMWPt093714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 20:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312775 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:22:33 -0000 Author: emaste Date: Wed Jan 25 20:22:32 2017 New Revision: 312775 URL: https://svnweb.freebsd.org/changeset/base/312775 Log: ANSIfy kern_ntptime.c Modified: head/sys/kern/kern_ntptime.c Modified: head/sys/kern/kern_ntptime.c ============================================================================== --- head/sys/kern/kern_ntptime.c Wed Jan 25 20:19:48 2017 (r312774) +++ head/sys/kern/kern_ntptime.c Wed Jan 25 20:22:32 2017 (r312775) @@ -750,11 +750,12 @@ hardupdate(offset) * Therefore, the variables used are distinct from the hardclock() * variables, except for the actual time and frequency variables, which * are determined by this routine and updated atomically. + * + * tsp - time at PPS + * nsec - hardware counter at PPS */ void -hardpps(tsp, nsec) - struct timespec *tsp; /* time at PPS */ - long nsec; /* hardware counter at PPS */ +hardpps(struct timespec *tsp, long nsec) { long u_sec, u_nsec, v_nsec; /* temps */ l_fp ftemp; From owner-svn-src-all@freebsd.org Wed Jan 25 20:41: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 401C4CC1118; Wed, 25 Jan 2017 20:41:18 +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 0FCA01E2A; Wed, 25 Jan 2017 20:41:17 +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 v0PKfHBH098357; Wed, 25 Jan 2017 20:41:17 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKfHBW098356; Wed, 25 Jan 2017 20:41:17 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201701252041.v0PKfHBW098356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 25 Jan 2017 20:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312777 - head/contrib/ipfilter/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:41:18 -0000 Author: cy Date: Wed Jan 25 20:41:16 2017 New Revision: 312777 URL: https://svnweb.freebsd.org/changeset/base/312777 Log: Issue an error message when an incorrect flush argument is encountered.` MFC after: 2 weeks Modified: head/contrib/ipfilter/tools/ipf.c Modified: head/contrib/ipfilter/tools/ipf.c ============================================================================== --- head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:33:31 2017 (r312776) +++ head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:41:16 2017 (r312777) @@ -410,12 +410,16 @@ static void flushfilter(arg, filter) return; } - if (strchr(arg, 'i') || strchr(arg, 'I')) + else if (strchr(arg, 'i') || strchr(arg, 'I')) fl = FR_INQUE; - if (strchr(arg, 'o') || strchr(arg, 'O')) + else if (strchr(arg, 'o') || strchr(arg, 'O')) fl = FR_OUTQUE; - if (strchr(arg, 'a') || strchr(arg, 'A')) + else if (strchr(arg, 'a') || strchr(arg, 'A')) fl = FR_OUTQUE|FR_INQUE; + else { + fprintf(stderr, "Incorrect flush argument: %s\n", arg); + usage(); + } if (opts & OPT_INACTIVE) fl |= FR_INACTIVE; rem = fl; From owner-svn-src-all@freebsd.org Wed Jan 25 20:44: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 9CB20CC1283; Wed, 25 Jan 2017 20:44:58 +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 6BF4D368; Wed, 25 Jan 2017 20:44:58 +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 v0PKiv79002235; Wed, 25 Jan 2017 20:44:57 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKivDY002234; Wed, 25 Jan 2017 20:44:57 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201701252044.v0PKivDY002234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 25 Jan 2017 20:44: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: r312778 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:44:58 -0000 Author: avos Date: Wed Jan 25 20:44:57 2017 New Revision: 312778 URL: https://svnweb.freebsd.org/changeset/base/312778 Log: MFC r312560: ifconfig(8): fix '-stbc' parameter name. Modified: stable/11/sbin/ifconfig/ifieee80211.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/11/sbin/ifconfig/ifieee80211.c Wed Jan 25 20:41:16 2017 (r312777) +++ stable/11/sbin/ifconfig/ifieee80211.c Wed Jan 25 20:44:57 2017 (r312778) @@ -5405,7 +5405,7 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("stbctx", 1, set80211stbc), DEF_CMD("-stbctx", -1, set80211stbc), DEF_CMD("stbc", 3, set80211stbc), /* NB: tx+rx */ - DEF_CMD("-ampdu", -3, set80211stbc), + DEF_CMD("-stbc", -3, set80211stbc), DEF_CMD("puren", 1, set80211puren), DEF_CMD("-puren", 0, set80211puren), DEF_CMD("doth", 1, set80211doth), From owner-svn-src-all@freebsd.org Wed Jan 25 20:59: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 7B724CC1500; Wed, 25 Jan 2017 20:59:07 +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 42D12AA2; Wed, 25 Jan 2017 20:59:07 +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 v0PKx6qD006250; Wed, 25 Jan 2017 20:59:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKx6Sf006249; Wed, 25 Jan 2017 20:59:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701252059.v0PKx6Sf006249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 25 Jan 2017 20:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312779 - head/contrib/elftoolchain/strings X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:59:07 -0000 Author: emaste Date: Wed Jan 25 20:59:06 2017 New Revision: 312779 URL: https://svnweb.freebsd.org/changeset/base/312779 Log: strings: avoid unnecessary trip through handle_file for stdin Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Wed Jan 25 20:44:57 2017 (r312778) +++ head/contrib/elftoolchain/strings/strings.c Wed Jan 25 20:59:06 2017 (r312779) @@ -189,7 +189,7 @@ main(int argc, char **argv) if (!min_len) min_len = 4; if (!*argv) - rc = handle_file("{standard input}"); + rc = find_strings("{standard input}", 0, 0); else while (*argv) { if (handle_file(*argv) != 0) rc = 1; @@ -205,13 +205,9 @@ handle_file(const char *name) if (name == NULL) return (1); - if (strcmp("{standard input}", name) != 0) { - if (freopen(name, "rb", stdin) == NULL) { - warnx("'%s': %s", name, strerror(errno)); - return (1); - } - } else { - return (find_strings(name, (off_t)0, (off_t)0)); + if (freopen(name, "rb", stdin) == NULL) { + warnx("'%s': %s", name, strerror(errno)); + return (1); } fd = fileno(stdin); From owner-svn-src-all@freebsd.org Wed Jan 25 20:59: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 128B8CC1539; Wed, 25 Jan 2017 20:59:25 +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 D6893BE6; Wed, 25 Jan 2017 20:59:24 +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 v0PKxNt2006303; Wed, 25 Jan 2017 20:59:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PKxNsJ006302; Wed, 25 Jan 2017 20:59:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201701252059.v0PKxNsJ006302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 25 Jan 2017 20:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312780 - head/contrib/ipfilter/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 20:59:25 -0000 Author: cy Date: Wed Jan 25 20:59:23 2017 New Revision: 312780 URL: https://svnweb.freebsd.org/changeset/base/312780 Log: Remove extraneous blank line. MFC after: 2 weeks X-MFC with: r312777 Modified: head/contrib/ipfilter/tools/ipf.c Modified: head/contrib/ipfilter/tools/ipf.c ============================================================================== --- head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:06 2017 (r312779) +++ head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:23 2017 (r312780) @@ -409,7 +409,6 @@ static void flushfilter(arg, filter) closedevice(); return; } - else if (strchr(arg, 'i') || strchr(arg, 'I')) fl = FR_INQUE; else if (strchr(arg, 'o') || strchr(arg, 'O')) From owner-svn-src-all@freebsd.org Wed Jan 25 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 9D188CC1B02; Wed, 25 Jan 2017 21:25:27 +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 5335E1CCC; Wed, 25 Jan 2017 21:25:27 +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 v0PLPQAI018471; Wed, 25 Jan 2017 21:25:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PLPQXV018469; Wed, 25 Jan 2017 21:25:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201701252125.v0PLPQXV018469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 25 Jan 2017 21:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312782 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 21:25:27 -0000 Author: kp Date: Wed Jan 25 21:25:26 2017 New Revision: 312782 URL: https://svnweb.freebsd.org/changeset/base/312782 Log: bridge: Release the bridge lock when calling bridge_set_ifcap() This calls ioctl() handlers for the different interfaces in the bridge. These handlers expect to get called in an ioctl context where it's safe for them to sleep. We may not sleep with the bridge lock held. However, we still need to protect the interface list, to ensure it doesn't get changed while we iterate over it. Use BRIDGE_XLOCK(), which prevents bridge members from being removed. Adding bridge members is safe, because it uses LIST_INSERT_HEAD(). This caused panics when adding xen interfaces to a bridge. PR: 216304 Reviewed by: ae MFC after: 1 week Sponsored by: RootBSD Differential Revision: https://reviews.freebsd.org/D9290 Modified: head/sys/net/if_bridge.c head/sys/net/if_bridgevar.h Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Jan 25 21:05:48 2017 (r312781) +++ head/sys/net/if_bridge.c Wed Jan 25 21:25:26 2017 (r312782) @@ -909,14 +909,18 @@ bridge_mutecaps(struct bridge_softc *sc) mask &= bif->bif_savedcaps; } + BRIDGE_XLOCK(sc); LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { enabled = bif->bif_ifp->if_capenable; enabled &= ~BRIDGE_IFCAPS_STRIP; /* strip off mask bits and enable them again if allowed */ enabled &= ~BRIDGE_IFCAPS_MASK; enabled |= mask; + BRIDGE_UNLOCK(sc); bridge_set_ifcap(sc, bif, enabled); + BRIDGE_LOCK(sc); } + BRIDGE_XDROP(sc); } @@ -927,6 +931,8 @@ bridge_set_ifcap(struct bridge_softc *sc struct ifreq ifr; int error; + BRIDGE_UNLOCK_ASSERT(sc); + bzero(&ifr, sizeof(ifr)); ifr.ifr_reqcap = set; Modified: head/sys/net/if_bridgevar.h ============================================================================== --- head/sys/net/if_bridgevar.h Wed Jan 25 21:05:48 2017 (r312781) +++ head/sys/net/if_bridgevar.h Wed Jan 25 21:25:26 2017 (r312782) @@ -280,6 +280,7 @@ struct ifbpstpconf { #define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define BRIDGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) +#define BRIDGE_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) #define BRIDGE_LOCK2REF(_sc, _err) do { \ mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ if ((_sc)->sc_iflist_xcnt > 0) \ From owner-svn-src-all@freebsd.org Wed Jan 25 21:35: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 CB827CC104C; Wed, 25 Jan 2017 21:35:16 +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 8BE9286A; Wed, 25 Jan 2017 21:35:16 +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 v0PLZFFD022347; Wed, 25 Jan 2017 21:35:15 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PLZFcJ022343; Wed, 25 Jan 2017 21:35:15 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201701252135.v0PLZFcJ022343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 25 Jan 2017 21:35: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: r312783 - stable/11/sys/dev/netmap X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 21:35:16 -0000 Author: loos Date: Wed Jan 25 21:35:15 2017 New Revision: 312783 URL: https://svnweb.freebsd.org/changeset/base/312783 Log: Fix a crash in netmap when using the emulated mode. This is a direct commit to stable/11 as the -head version was already fixed by a recent import of a new netmap version. Submitted by: Vincenzo Maffione Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/dev/netmap/netmap_freebsd.c stable/11/sys/dev/netmap/netmap_generic.c stable/11/sys/dev/netmap/netmap_kern.h Modified: stable/11/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_freebsd.c Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_freebsd.c Wed Jan 25 21:35:15 2017 (r312783) @@ -218,30 +218,16 @@ generic_xmit_frame(struct ifnet *ifp, st { int ret; - /* - * The mbuf should be a cluster from our special pool, - * so we do not need to do an m_copyback but just copy - * (and eventually, just reference the netmap buffer) - */ + /* Link the external storage to the netmap buffer, so that + * no copy is necessary. */ + m->m_ext.ext_buf = m->m_data = addr; + m->m_ext.ext_size = len; - if (GET_MBUF_REFCNT(m) != 1) { - D("invalid refcnt %d for %p", - GET_MBUF_REFCNT(m), m); - panic("in generic_xmit_frame"); - } - // XXX the ext_size check is unnecessary if we link the netmap buf - if (m->m_ext.ext_size < len) { - RD(5, "size %d < len %d", m->m_ext.ext_size, len); - len = m->m_ext.ext_size; - } - if (0) { /* XXX seems to have negligible benefits */ - m->m_ext.ext_buf = m->m_data = addr; - } else { - bcopy(addr, m->m_data, len); - } m->m_len = m->m_pkthdr.len = len; - // inc refcount. All ours, we could skip the atomic - atomic_fetchadd_int(PNT_MBUF_REFCNT(m), 1); + + /* mbuf refcnt is not contended, no need to use atomic + * (a memory barrier is enough). */ + SET_MBUF_REFCNT(m, 2); M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); m->m_pkthdr.flowid = ring_nr; m->m_pkthdr.rcvif = ifp; /* used for tx notification */ Modified: stable/11/sys/dev/netmap/netmap_generic.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_generic.c Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_generic.c Wed Jan 25 21:35:15 2017 (r312783) @@ -90,53 +90,40 @@ __FBSDID("$FreeBSD$"); /* * FreeBSD mbuf allocator/deallocator in emulation mode: * - * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE - * so that the destructor, if invoked, will not free the packet. - * In principle we should set the destructor only on demand, - * but since there might be a race we better do it on allocation. - * As a consequence, we also need to set the destructor or we - * would leak buffers. - */ - -/* - * mbuf wrappers + * We allocate mbufs with m_gethdr(), since the mbuf header is needed + * by the driver. We also attach a customly-provided external storage, + * which in this case is a netmap buffer. When calling m_extadd(), however + * we pass a NULL address, since the real address (and length) will be + * filled in by nm_os_generic_xmit_frame() right before calling + * if_transmit(). + * + * The dtor function does nothing, however we need it since mb_free_ext() + * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -/* mbuf destructor, also need to change the type to EXT_EXTREF, - * add an M_NOFREE flag, and then clear the flag and - * chain into uma_zfree(zone_pack, mf) - * (or reinstall the buffer ?) - */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (0) +static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } -static void -netmap_default_mbuf_destructor(struct mbuf *m) +static inline void +SET_MBUF_DESTRUCTOR(struct mbuf *m, void *fn) { - /* restore original mbuf */ - m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1; - m->m_ext.ext_arg1 = NULL; - m->m_ext.ext_type = EXT_PACKET; - m->m_ext.ext_free = NULL; - if (GET_MBUF_REFCNT(m) == 0) - SET_MBUF_REFCNT(m, 1); - uma_zfree(zone_pack, m); + m->m_ext.ext_free = fn ? fn : (void *)void_mbuf_dtor; } static inline struct mbuf * netmap_get_mbuf(int len) { struct mbuf *m; - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (m) { - m->m_flags |= M_NOFREE; /* XXXNP: Almost certainly incorrect. */ - m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save - m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor; - m->m_ext.ext_type = EXT_EXTREF; - ND(5, "create m %p refcnt %d", m, GET_MBUF_REFCNT(m)); + + (void)len; + + m = m_gethdr(M_NOWAIT, MT_DATA); + if (m == NULL) { + return m; } + + m_extadd(m, NULL /* buf */, 0 /* size */, void_mbuf_dtor, + NULL, NULL, 0, EXT_NET_DRV); + return m; } @@ -412,11 +399,6 @@ static void generic_mbuf_destructor(struct mbuf *m) { netmap_generic_irq(MBUF_IFP(m), MBUF_TXQ(m), NULL); -#ifdef __FreeBSD__ - if (netmap_verbose) - RD(5, "Tx irq (%p) queue %d index %d" , m, MBUF_TXQ(m), (int)(uintptr_t)m->m_ext.ext_arg1); - netmap_default_mbuf_destructor(m); -#endif /* __FreeBSD__ */ IFRATE(rate_ctx.new.txirq++); } @@ -447,7 +429,7 @@ generic_netmap_tx_clean(struct netmap_kr // XXX how do we proceed ? break ? return -ENOMEM; } - } else if (GET_MBUF_REFCNT(m) != 1) { + } else if (MBUF_REFCNT(m) != 1) { break; /* This mbuf is still busy: its refcnt is 2. */ } n++; @@ -476,62 +458,39 @@ generic_netmap_tx_clean(struct netmap_kr return n; } - -/* - * We have pending packets in the driver between nr_hwtail +1 and hwcur. - * Compute a position in the middle, to be used to generate - * a notification. - */ -static inline u_int -generic_tx_event_middle(struct netmap_kring *kring, u_int hwcur) -{ - u_int n = kring->nkr_num_slots; - u_int ntc = nm_next(kring->nr_hwtail, n-1); - u_int e; - - if (hwcur >= ntc) { - e = (hwcur + ntc) / 2; - } else { /* wrap around */ - e = (hwcur + n + ntc) / 2; - if (e >= n) { - e -= n; - } - } - - if (unlikely(e >= n)) { - D("This cannot happen"); - e = 0; - } - - return e; -} - -/* - * We have pending packets in the driver between nr_hwtail+1 and hwcur. - * Schedule a notification approximately in the middle of the two. - * There is a race but this is only called within txsync which does - * a double check. - */ static void generic_set_tx_event(struct netmap_kring *kring, u_int hwcur) { + u_int lim = kring->nkr_num_slots - 1; struct mbuf *m; u_int e; + u_int ntc = nm_next(kring->nr_hwtail, lim); /* next to clean */ - if (nm_next(kring->nr_hwtail, kring->nkr_num_slots -1) == hwcur) { + if (ntc == hwcur) { return; /* all buffers are free */ } - e = generic_tx_event_middle(kring, hwcur); + + /* + * We have pending packets in the driver between hwtail+1 + * and hwcur, and we have to chose one of these slot to + * generate a notification. + * There is a race but this is only called within txsync which + * does a double check. + */ + + /* Choose the first pending slot, to be safe against driver + * reordering mbuf transmissions. */ + e = ntc; m = kring->tx_pool[e]; - ND(5, "Request Event at %d mbuf %p refcnt %d", e, m, m ? GET_MBUF_REFCNT(m) : -2 ); + ND(5, "Request Event at %d mbuf %p refcnt %d", e, m, m ? MBUF_REFCNT(m) : -2 ); if (m == NULL) { /* This can happen if there is already an event on the netmap slot 'e': There is nothing to do. */ return; } kring->tx_pool[e] = NULL; - SET_MBUF_DESTRUCTOR(m, generic_mbuf_destructor); + SET_MBUF_DESTRUCTOR(m, (void *)generic_mbuf_destructor); // XXX wmb() ? /* Decrement the refcount an free it if we have the last one. */ Modified: stable/11/sys/dev/netmap/netmap_kern.h ============================================================================== --- stable/11/sys/dev/netmap/netmap_kern.h Wed Jan 25 21:25:26 2017 (r312782) +++ stable/11/sys/dev/netmap/netmap_kern.h Wed Jan 25 21:35:15 2017 (r312783) @@ -97,13 +97,11 @@ struct netmap_adapter *netmap_getna(if_t #endif #if __FreeBSD_version >= 1100027 -#define GET_MBUF_REFCNT(m) ((m)->m_ext.ext_cnt ? *((m)->m_ext.ext_cnt) : -1) -#define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ext_cnt) = x -#define PNT_MBUF_REFCNT(m) ((m)->m_ext.ext_cnt) +#define MBUF_REFCNT(m) ((m)->m_ext.ext_count) +#define SET_MBUF_REFCNT(m, x) (m)->m_ext.ext_count = x #else -#define GET_MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) +#define MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) #define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ref_cnt) = x -#define PNT_MBUF_REFCNT(m) ((m)->m_ext.ref_cnt) #endif MALLOC_DECLARE(M_NETMAP); From owner-svn-src-all@freebsd.org Wed Jan 25 22: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 8963FCC1E26; Wed, 25 Jan 2017 22:20:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 71ED3123E; Wed, 25 Jan 2017 22:20:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v0PMK7Rh022235 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 25 Jan 2017 14:20:07 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v0PMK67A022234; Wed, 25 Jan 2017 14:20:06 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 25 Jan 2017 14:20:06 -0800 From: Gleb Smirnoff To: Luiz Otavio O Souza Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 Message-ID: <20170125222006.GH2611@FreeBSD.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201701251904.v0PJ48YF061428@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 22:20:08 -0000 Thanks, Luiz! One stylistic nit that I missed in review: L> static int L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) L> { L> const struct ifreq *ifr = (struct ifreq *)data; L> const struct sockaddr_in *addr = (const struct sockaddr_in *) L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if L> in_ifadown(&ia->ia_ifa, 1); L> L> if (ia->ia_ifa.ifa_carp) L> - (*carp_detach_p)(&ia->ia_ifa); L> + (*carp_detach_p)(&ia->ia_ifa, L> + (cmd == SIOCDIFADDR) ? false : true); Can we change the very last line to: (cmd == SIOCAIFADDR) ? true : false); I think that would be more straightforward. Do you agree? Sorry for not noticing that before. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Jan 25 22:26: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 E698CCC1FFB; Wed, 25 Jan 2017 22:26:38 +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 597301712; Wed, 25 Jan 2017 22:26:38 +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 v0PMQXd8023785 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 Jan 2017 00:26:33 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0PMQXd8023785 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0PMQW1V023784; Thu, 26 Jan 2017 00:26:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 26 Jan 2017 00:26:32 +0200 From: Konstantin Belousov To: Gleb Smirnoff Cc: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 Message-ID: <20170125222632.GQ2349@kib.kiev.ua> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170125222006.GH2611@FreeBSD.org> User-Agent: Mutt/1.7.2 (2016-11-26) 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, 25 Jan 2017 22:26:39 -0000 On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: > Thanks, Luiz! > > One stylistic nit that I missed in review: > > L> static int > L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) > L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) > L> { > L> const struct ifreq *ifr = (struct ifreq *)data; > L> const struct sockaddr_in *addr = (const struct sockaddr_in *) > L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if > L> in_ifadown(&ia->ia_ifa, 1); > L> > L> if (ia->ia_ifa.ifa_carp) > L> - (*carp_detach_p)(&ia->ia_ifa); > L> + (*carp_detach_p)(&ia->ia_ifa, > L> + (cmd == SIOCDIFADDR) ? false : true); > > Can we change the very last line to: > > (cmd == SIOCAIFADDR) ? true : false); This is just 'cmd == SIOCAIFADDR'. > > I think that would be more straightforward. Do you agree? Sorry for not > noticing that before. > > -- > Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Jan 25 22:26: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 96000CC1023; Wed, 25 Jan 2017 22:26:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D471175E; Wed, 25 Jan 2017 22:26:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0PMQjQ3043198; Wed, 25 Jan 2017 22:26:45 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PMQjJr043197; Wed, 25 Jan 2017 22:26:45 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201701252226.v0PMQjJr043197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 25 Jan 2017 22:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312784 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 22:26:46 -0000 Author: glebius Date: Wed Jan 25 22:26:45 2017 New Revision: 312784 URL: https://svnweb.freebsd.org/changeset/base/312784 Log: For non-listening AF_UNIX sockets return error code EOPNOTSUPP to match documentation and SUS. Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Wed Jan 25 21:35:15 2017 (r312783) +++ head/sys/kern/uipc_usrreq.c Wed Jan 25 22:26:45 2017 (r312784) @@ -743,6 +743,9 @@ uipc_listen(struct socket *so, int backl struct unpcb *unp; int error; + if (so->so_type != SOCK_STREAM && so->so_type != SOCK_SEQPACKET) + return (EOPNOTSUPP); + unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_listen: unp == NULL")); From owner-svn-src-all@freebsd.org Wed Jan 25 22:27: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 45E3CCC10AA; Wed, 25 Jan 2017 22:27:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 292771A27; Wed, 25 Jan 2017 22:27:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v0PMRcP0022292 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 25 Jan 2017 14:27:38 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v0PMRciB022291; Wed, 25 Jan 2017 14:27:38 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 25 Jan 2017 14:27:38 -0800 From: Gleb Smirnoff To: Konstantin Belousov Cc: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 Message-ID: <20170125222738.GI2611@FreeBSD.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> <20170125222632.GQ2349@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170125222632.GQ2349@kib.kiev.ua> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 22:27:39 -0000 On Thu, Jan 26, 2017 at 12:26:32AM +0200, Konstantin Belousov wrote: K> On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: K> > Thanks, Luiz! K> > K> > One stylistic nit that I missed in review: K> > K> > L> static int K> > L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) K> > L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) K> > L> { K> > L> const struct ifreq *ifr = (struct ifreq *)data; K> > L> const struct sockaddr_in *addr = (const struct sockaddr_in *) K> > L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if K> > L> in_ifadown(&ia->ia_ifa, 1); K> > L> K> > L> if (ia->ia_ifa.ifa_carp) K> > L> - (*carp_detach_p)(&ia->ia_ifa); K> > L> + (*carp_detach_p)(&ia->ia_ifa, K> > L> + (cmd == SIOCDIFADDR) ? false : true); K> > K> > Can we change the very last line to: K> > K> > (cmd == SIOCAIFADDR) ? true : false); K> This is just 'cmd == SIOCAIFADDR'. Right. Would be even better :) -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Jan 25 22:52: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 6DA6ACC1908; Wed, 25 Jan 2017 22:52:59 +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 2DE799BB; Wed, 25 Jan 2017 22:52:59 +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 v0PMqw5N054742; Wed, 25 Jan 2017 22:52:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PMqvZU054738; Wed, 25 Jan 2017 22:52:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201701252252.v0PMqvZU054738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 25 Jan 2017 22:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312785 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 22:52:59 -0000 Author: trasz Date: Wed Jan 25 22:52:57 2017 New Revision: 312785 URL: https://svnweb.freebsd.org/changeset/base/312785 Log: Bring the ctl headers a bit closer to style(9). No functional changes. Modified: head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_ioctl.h head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Wed Jan 25 22:26:45 2017 (r312784) +++ head/sys/cam/ctl/ctl.h Wed Jan 25 22:52:57 2017 (r312785) @@ -73,10 +73,10 @@ struct ctl_port_entry { }; struct ctl_modepage_header { - uint8_t page_code; - uint8_t subpage; - uint16_t len_used; - uint16_t len_left; + uint8_t page_code; + uint8_t subpage; + uint16_t len_used; + uint16_t len_left; }; union ctl_modepage_info { Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Wed Jan 25 22:26:45 2017 (r312784) +++ head/sys/cam/ctl/ctl_io.h Wed Jan 25 22:52:57 2017 (r312785) @@ -137,9 +137,9 @@ struct ctl_lba_len_flags { }; struct ctl_ptr_len_flags { - uint8_t *ptr; - uint32_t len; - uint32_t flags; + uint8_t *ptr; + uint32_t len; + uint32_t flags; }; union ctl_priv { @@ -405,10 +405,10 @@ typedef enum { * structure. */ struct ctl_pr_info { - ctl_pr_action action; - uint8_t sa_res_key[8]; - uint8_t res_type; - uint32_t residx; + ctl_pr_action action; + uint8_t sa_res_key[8]; + uint8_t res_type; + uint32_t residx; }; struct ctl_ha_msg_hdr { @@ -569,15 +569,15 @@ union ctl_ha_msg { }; struct ctl_prio { - struct ctl_io_hdr io_hdr; - struct ctl_ha_msg_pr pr_msg; + struct ctl_io_hdr io_hdr; + struct ctl_ha_msg_pr pr_msg; }; union ctl_io { - struct ctl_io_hdr io_hdr; /* common to all I/O types */ - struct ctl_scsiio scsiio; /* Normal SCSI commands */ - struct ctl_taskio taskio; /* SCSI task management/reset */ - struct ctl_prio presio; /* update per. res info on other SC */ + struct ctl_io_hdr io_hdr; /* common to all I/O types */ + struct ctl_scsiio scsiio; /* Normal SCSI commands */ + struct ctl_taskio taskio; /* SCSI task management/reset */ + struct ctl_prio presio; /* update per. res info on other SC */ }; #ifdef _KERNEL Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Wed Jan 25 22:26:45 2017 (r312784) +++ head/sys/cam/ctl/ctl_ioctl.h Wed Jan 25 22:52:57 2017 (r312785) @@ -358,8 +358,8 @@ struct ctl_be_arg { unsigned int vallen; void *value; - char *kname; - void *kvalue; + char *kname; + void *kvalue; }; typedef enum { @@ -591,7 +591,7 @@ typedef enum { struct ctl_lun_list { char backend[CTL_BE_NAME_LEN]; /* passed to kernel*/ uint32_t alloc_len; /* passed to kernel */ - char *lun_xml; /* filled in kernel */ + char *lun_xml; /* filled in kernel */ uint32_t fill_len; /* passed to userland */ ctl_lun_list_status status; /* passed to userland */ char error_str[CTL_ERROR_STR_LEN]; @@ -753,42 +753,42 @@ struct ctl_iscsi_limits_params { #ifdef ICL_KERNEL_PROXY struct ctl_iscsi_listen_params { - int iser; - int domain; - int socktype; - int protocol; - struct sockaddr *addr; - socklen_t addrlen; - int portal_id; - int spare[4]; + int iser; + int domain; + int socktype; + int protocol; + struct sockaddr *addr; + socklen_t addrlen; + int portal_id; + int spare[4]; }; struct ctl_iscsi_accept_params { - int connection_id; - int portal_id; - struct sockaddr *initiator_addr; - socklen_t initiator_addrlen; - int spare[4]; + int connection_id; + int portal_id; + struct sockaddr *initiator_addr; + socklen_t initiator_addrlen; + int spare[4]; }; struct ctl_iscsi_send_params { - int connection_id; - void *bhs; - size_t spare; - void *spare2; - size_t data_segment_len; - void *data_segment; - int spare3[4]; + int connection_id; + void *bhs; + size_t spare; + void *spare2; + size_t data_segment_len; + void *data_segment; + int spare3[4]; }; struct ctl_iscsi_receive_params { - int connection_id; - void *bhs; - size_t spare; - void *spare2; - size_t data_segment_len; - void *data_segment; - int spare3[4]; + int connection_id; + void *bhs; + size_t spare; + void *spare2; + size_t data_segment_len; + void *data_segment; + int spare3[4]; }; #endif /* ICL_KERNEL_PROXY */ Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Wed Jan 25 22:26:45 2017 (r312784) +++ head/sys/cam/ctl/ctl_private.h Wed Jan 25 22:52:57 2017 (r312785) @@ -56,10 +56,10 @@ #define CTL_POOL_ENTRIES_OTHER_SC 200 struct ctl_io_pool { - char name[64]; - uint32_t id; - struct ctl_softc *ctl_softc; - struct uma_zone *zone; + char name[64]; + uint32_t id; + struct ctl_softc *ctl_softc; + struct uma_zone *zone; }; typedef enum { @@ -439,44 +439,44 @@ struct ctl_thread { struct tpc_token; struct ctl_softc { - struct mtx ctl_lock; - struct cdev *dev; - int num_luns; - ctl_gen_flags flags; - ctl_ha_mode ha_mode; - int ha_id; - int is_single; - ctl_ha_link_state ha_link; - int port_min; - int port_max; - int port_cnt; - int init_min; - int init_max; - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - void *othersc_pool; - struct proc *ctl_proc; - uint32_t ctl_lun_mask[(CTL_MAX_LUNS + 31) / 32]; - struct ctl_lun *ctl_luns[CTL_MAX_LUNS]; - uint32_t ctl_port_mask[(CTL_MAX_PORTS + 31) / 32]; - STAILQ_HEAD(, ctl_lun) lun_list; - STAILQ_HEAD(, ctl_be_lun) pending_lun_queue; - uint32_t num_frontends; - STAILQ_HEAD(, ctl_frontend) fe_list; - uint32_t num_ports; - STAILQ_HEAD(, ctl_port) port_list; - struct ctl_port *ctl_ports[CTL_MAX_PORTS]; - uint32_t num_backends; - STAILQ_HEAD(, ctl_backend_driver) be_list; - struct uma_zone *io_zone; - uint32_t cur_pool_id; - int shutdown; - struct ctl_thread threads[CTL_MAX_THREADS]; - struct thread *lun_thread; - struct thread *thresh_thread; - TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens; - struct callout tpc_timeout; - struct mtx tpc_lock; + struct mtx ctl_lock; + struct cdev *dev; + int num_luns; + ctl_gen_flags flags; + ctl_ha_mode ha_mode; + int ha_id; + int is_single; + ctl_ha_link_state ha_link; + int port_min; + int port_max; + int port_cnt; + int init_min; + int init_max; + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; + void *othersc_pool; + struct proc *ctl_proc; + uint32_t ctl_lun_mask[(CTL_MAX_LUNS + 31) / 32]; + struct ctl_lun *ctl_luns[CTL_MAX_LUNS]; + uint32_t ctl_port_mask[(CTL_MAX_PORTS + 31) / 32]; + STAILQ_HEAD(, ctl_lun) lun_list; + STAILQ_HEAD(, ctl_be_lun) pending_lun_queue; + uint32_t num_frontends; + STAILQ_HEAD(, ctl_frontend) fe_list; + uint32_t num_ports; + STAILQ_HEAD(, ctl_port) port_list; + struct ctl_port *ctl_ports[CTL_MAX_PORTS]; + uint32_t num_backends; + STAILQ_HEAD(, ctl_backend_driver) be_list; + struct uma_zone *io_zone; + uint32_t cur_pool_id; + int shutdown; + struct ctl_thread threads[CTL_MAX_THREADS]; + struct thread *lun_thread; + struct thread *thresh_thread; + TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens; + struct callout tpc_timeout; + struct mtx tpc_lock; }; #ifdef _KERNEL From owner-svn-src-all@freebsd.org Wed Jan 25 23:12: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 8D45ECC1C70; Wed, 25 Jan 2017 23:12:04 +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 462AA197; Wed, 25 Jan 2017 23:12:04 +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 v0PNC3Vh062965; Wed, 25 Jan 2017 23:12:03 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0PNC3H5062964; Wed, 25 Jan 2017 23:12:03 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701252312.v0PNC3H5062964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 25 Jan 2017 23:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312786 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 25 Jan 2017 23:12:04 -0000 Author: sbruno Date: Wed Jan 25 23:12:03 2017 New Revision: 312786 URL: https://svnweb.freebsd.org/changeset/base/312786 Log: Implement RSS queue tagging for em(4) class devices from a copy and massage of functions from igb(4). This enables 2 queue routing on 82574L class devices again. Modified: head/sys/dev/e1000/em_txrx.c Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Wed Jan 25 22:52:57 2017 (r312785) +++ head/sys/dev/e1000/em_txrx.c Wed Jan 25 23:12:03 2017 (r312786) @@ -62,6 +62,7 @@ static int lem_isc_rxd_pkt_get(void *arg static void lem_receive_checksum(int status, int errors, if_rxd_info_t ri); static void em_receive_checksum(uint32_t status, if_rxd_info_t ri); +static int em_determine_rsstype(u32 pkt_info); extern int em_intr(void *arg); struct if_txrx em_txrx = { @@ -645,6 +646,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf union e1000_rx_desc_extended *rxd; u16 len; + u32 pkt_info; u32 staterr = 0; bool eop; int i, cidx, vtag; @@ -655,6 +657,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf do { rxd = &rxr->rx_base[cidx]; staterr = le32toh(rxd->wb.upper.status_error); + pkt_info = le32toh(rxd->wb.lower.mrq); /* Error Checking then decrement count */ MPASS ((staterr & E1000_RXD_STAT_DD) != 0); @@ -690,10 +693,14 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf } ri->iri_vtag = vtag; - ri->iri_nfrags = i; if (vtag) ri->iri_flags |= M_VLANTAG; + ri->iri_flowid = + le32toh(rxd->wb.lower.hi_dword.rss); + ri->iri_rsstype = em_determine_rsstype(pkt_info); + + ri->iri_nfrags = i; return (0); } @@ -721,6 +728,31 @@ lem_receive_checksum(int status, int err } } +/******************************************************************** + * + * Parse the packet type to determine the appropriate hash + * + ******************************************************************/ +static int +em_determine_rsstype(u32 pkt_info) +{ + switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { + case E1000_RXDADV_RSSTYPE_IPV4_TCP: + return M_HASHTYPE_RSS_TCP_IPV4; + case E1000_RXDADV_RSSTYPE_IPV4: + return M_HASHTYPE_RSS_IPV4; + case E1000_RXDADV_RSSTYPE_IPV6_TCP: + return M_HASHTYPE_RSS_TCP_IPV6; + case E1000_RXDADV_RSSTYPE_IPV6_EX: + return M_HASHTYPE_RSS_IPV6_EX; + case E1000_RXDADV_RSSTYPE_IPV6: + return M_HASHTYPE_RSS_IPV6; + case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX: + return M_HASHTYPE_RSS_TCP_IPV6_EX; + default: + return M_HASHTYPE_OPAQUE; + } +} static void em_receive_checksum(uint32_t status, if_rxd_info_t ri) { From owner-svn-src-all@freebsd.org Thu Jan 26 01:24: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 CE029CC1B9E; Thu, 26 Jan 2017 01:24:06 +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 A87C9A2F; Thu, 26 Jan 2017 01:24:06 +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 v0Q1O5L8015104; Thu, 26 Jan 2017 01:24:05 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q1O5Bc015101; Thu, 26 Jan 2017 01:24:05 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201701260124.v0Q1O5Bc015101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 26 Jan 2017 01:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312787 - in head: contrib/ipfilter/lib sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 01:24:06 -0000 Author: cy Date: Thu Jan 26 01:24:05 2017 New Revision: 312787 URL: https://svnweb.freebsd.org/changeset/base/312787 Log: Currently the fragment info is placed at the top of the linked list under a shared read lock. This patch attempts to upgrade the lock to an exclusive write lock. If the exclusive write lock fails to be obtained, the current fragment is not placed at the head of the list. This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which effectively removed the section of code that performed the reordering). The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c. The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch by emulating the mutex in userspace when exercised by ipftest(1). Inspired by: NetBSD ip_frag.c r1.4 MFC after: 1 month Modified: head/contrib/ipfilter/lib/rwlock_emul.c head/sys/contrib/ipfilter/netinet/ip_compat.h head/sys/contrib/ipfilter/netinet/ip_frag.c Modified: head/contrib/ipfilter/lib/rwlock_emul.c ============================================================================== --- head/contrib/ipfilter/lib/rwlock_emul.c Wed Jan 25 23:12:03 2017 (r312786) +++ head/contrib/ipfilter/lib/rwlock_emul.c Thu Jan 26 01:24:05 2017 (r312787) @@ -56,6 +56,27 @@ void eMrwlock_write_enter(rw, file, line } +void eMrwlock_try_upgrade(rw, file, line) + eMrwlock_t *rw; + char *file; + int line; +{ + if (rw->eMrw_magic != EMM_MAGIC) { + fprintf(stderr, "%s:eMrwlock_write_enter(%p): bad magic: %#x\n", + rw->eMrw_owner, rw, rw->eMrw_magic); + abort(); + } + if (rw->eMrw_read != 0 || rw->eMrw_write != 0) { + fprintf(stderr, + "%s:eMrwlock_try_upgrade(%p): already locked: %d/%d\n", + rw->eMrw_owner, rw, rw->eMrw_read, rw->eMrw_write); + abort(); + } + rw->eMrw_write++; + rw->eMrw_heldin = file; + rw->eMrw_heldat = line; +} + void eMrwlock_downgrade(rw, file, line) eMrwlock_t *rw; char *file; Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Wed Jan 25 23:12:03 2017 (r312786) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 26 01:24:05 2017 (r312787) @@ -165,6 +165,7 @@ struct ether_addr { # define READ_ENTER(x) rw_rlock(&(x)->ipf_lk) # define WRITE_ENTER(x) rw_wlock(&(x)->ipf_lk) # define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk) +# define MUTEX_TRY_UPGRADE(x) rw_try_upgrade(&(x)->ipf_lk) # define RWLOCK_INIT(x,y) rw_init(&(x)->ipf_lk, (y)) # define RW_DESTROY(x) rw_destroy(&(x)->ipf_lk) # define RWLOCK_EXIT(x) do { \ @@ -421,6 +422,8 @@ extern void freembt __P((mb_t *)); # define MUTEX_DOWNGRADE(x) eMrwlock_downgrade(&(x)->ipf_emu, \ __FILE__, __LINE__) +# define MUTEX_TRY_UPGRADE(x) eMrwlock_try_upgrade(&(x)->ipf_emu, \ + __FILE__, __LINE__) # define READ_ENTER(x) eMrwlock_read_enter(&(x)->ipf_emu, \ __FILE__, __LINE__) # define RWLOCK_INIT(x, y) eMrwlock_init(&(x)->ipf_emu, y) @@ -671,6 +674,7 @@ extern char *ipf_getifname __P((struct i # define READ_ENTER(x) ; # define WRITE_ENTER(x) ; # define MUTEX_DOWNGRADE(x) ; +# define MUTEX_TRY_UPGRADE(x) ; # define RWLOCK_INIT(x, y) ; # define RWLOCK_EXIT(x) ; # define RW_DESTROY(x) ; Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_frag.c Wed Jan 25 23:12:03 2017 (r312786) +++ head/sys/contrib/ipfilter/netinet/ip_frag.c Thu Jan 26 01:24:05 2017 (r312787) @@ -745,7 +745,7 @@ ipf_frag_lookup(softc, softf, fin, table } else if (off == 0) f->ipfr_seen0 = 1; - if (f != table[idx]) { + if (f != table[idx] && MUTEX_TRY_UPGRADE(lock)) { ipfr_t **fp; /* @@ -763,6 +763,7 @@ ipf_frag_lookup(softc, softf, fin, table table[idx]->ipfr_hprev = &f->ipfr_hnext; f->ipfr_hprev = table + idx; table[idx] = f; + MUTEX_DOWNGRADE(lock); } /* From owner-svn-src-all@freebsd.org Thu Jan 26 01:56: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 89736CC1D7B; Thu, 26 Jan 2017 01:56:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::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 49D05E6C; Thu, 26 Jan 2017 01:56:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x243.google.com with SMTP id m98so3828566iod.2; Wed, 25 Jan 2017 17:56:22 -0800 (PST) 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=kz3iAF2v04yFZuEGsknrE5hTPerNFotWr/p0QXp6/L0=; b=GqsJoEJbHjrV57Rs+uS2yr6bKcOnzrCNlyF7mo5KO2R1kiNrhnI5RdsWGbebs/w2DT gIaBnapr4YRcvPwUXl0VbMZs8tR9rlart4aFXXph1Q43FeZMTZzzGsfukIUiZPXX5haA +UWgwoyaG8A1fKuCMvwLi6oUi8iUKLBEFYY8ye4ndW4tlSVA3wp8SZndtfvs5l5spQ0s 9u6VVBBlyw8fuikB57x/CDMpiqyFtS0gilA08IimwzdpbiVXZqEskFhU5nB78Q0gtYZq CDTG71+rhfSfvLKbOfph8HX0Kve6kmDwx51t+TR7zUsYtTKfMLeHZm3qRsZiXCXL/yg/ /TMg== 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=kz3iAF2v04yFZuEGsknrE5hTPerNFotWr/p0QXp6/L0=; b=GltDK2Y4L9jfG69flcS02jq/XsxOVekJZsBjBU5DTifljP9wzhkcNlG1AFtbdtGsK8 YNCofvtg1np8Y996/sQrrP9d8xOSxUsXlH7Nwo+kbI9+fVR8UoYHTaTnzUy4yAY2PwoJ Yoy7dZVPXhABsO7Iz5QY339T7cC0ajfvAbMDleCSW3oUDsYnvtWID1B2rUcU40OXFqBT LN0yuemJEeTCe1oszJsWF/upopseMejsPoaN7afthX9ipWaf9JxkL4uAzTQwxyavgmvk EBDgTCqJLvbjEd8cDvz/0OV65JkqNBISn8nKRHoYeNUVsa5mOnRbh4B/NCjEA9PBj+hY 0eQQ== X-Gm-Message-State: AIkVDXJYHZgI0uQ40Aoo9JJtEl4xfU36b7jBTQ8CSEdayd3T4xOlZrdypmeFL14K71aWDEtZiS3U6h8Diu7SRQ== X-Received: by 10.107.23.69 with SMTP id 66mr677952iox.162.1485395781484; Wed, 25 Jan 2017 17:56:21 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.159 with HTTP; Wed, 25 Jan 2017 17:56:00 -0800 (PST) In-Reply-To: <201701251031.v0PAVGlM050105@repo.freebsd.org> References: <201701251031.v0PAVGlM050105@repo.freebsd.org> From: Ed Maste Date: Wed, 25 Jan 2017 20:56:00 -0500 X-Google-Sender-Auth: GaQ1FmetR7pltgo8HH6par-k_EA Message-ID: Subject: Re: svn commit: r312747 - head/sys/arm/mv To: Wojciech Macek 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: Thu, 26 Jan 2017 01:56:22 -0000 On 25 January 2017 at 05:31, Wojciech Macek wrote: > Author: wma > Date: Wed Jan 25 10:31:16 2017 > New Revision: 312747 > URL: https://svnweb.freebsd.org/changeset/base/312747 > > Log: > Setup decoding windows for ARMADA38X > > It is necesarry to open memory windows on internal bus for > AHCI driver to work correctly. Build broken with: /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2019:3: error: implicit declaration of function 'win_sata_sz_write' is invalid in C99 [-Werror,-Wimplicit-function-declaration] win_sata_sz_write(base, i, 0); ^ /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2024:25: error: use of undeclared identifier 'IO_WIN_ATTR_SHIFT' cr = (ddr_attr(i) << IO_WIN_ATTR_SHIFT) | ^ ... From owner-svn-src-all@freebsd.org Thu Jan 26 03:03: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 388F8CC2BD4; Thu, 26 Jan 2017 03:03:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id EB233AA5; Thu, 26 Jan 2017 03:03:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 0C4CB1A5AD0; Thu, 26 Jan 2017 14:03:06 +1100 (AEDT) Date: Thu, 26 Jan 2017 14:03:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Gleb Smirnoff , Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 In-Reply-To: <20170125222632.GQ2349@kib.kiev.ua> Message-ID: <20170126133341.V1087@besplex.bde.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> <20170125222632.GQ2349@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=c+HbeV1l c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=0C_iaZuvqwC4Gjh4FIsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 03:03:14 -0000 On Thu, 26 Jan 2017, Konstantin Belousov wrote: > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: >> Thanks, Luiz! >> >> One stylistic nit that I missed in review: >> >> L> static int >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) >> L> { >> L> const struct ifreq *ifr = (struct ifreq *)data; >> L> const struct sockaddr_in *addr = (const struct sockaddr_in *) >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if >> L> in_ifadown(&ia->ia_ifa, 1); >> L> >> L> if (ia->ia_ifa.ifa_carp) >> L> - (*carp_detach_p)(&ia->ia_ifa); >> L> + (*carp_detach_p)(&ia->ia_ifa, >> L> + (cmd == SIOCDIFADDR) ? false : true); >> >> Can we change the very last line to: >> >> (cmd == SIOCAIFADDR) ? true : false); That is not stylistic, but invert the result. Perhaps you meant to reverse the test to avoid negative logic for the result. > This is just 'cmd == SIOCAIFADDR'. Not quite. The result of a relational operator is 1 or 0 (and thus has type int), not true or false (and thus would have type bool). Unfortunately, carp has a bool infestation (the declaration of carp_attach_p() is 1 of 21 lines in netinet with bool), so int is the wrong type. It is automatically converted to bool by the prototype. 12 of the 21 lines with bools are actually mispelling of 'boolean' for IP options in in.h. 'bool' is a C type. IP options are never bools. Some of them are booleans represented as ints (never as bool since get/setsockopt() only uses int). A meta-comment in in.h describes this "bool is stored as int". Fixing the style bugs on 1 line gives another style bug -- line splitting which was to make space for the verbose spelling of a logical value. The inversion could also be written less verbosely and more clearly using the ! operator !(cmd == SIOCAIFADDR) but since the expression is so simple the ! operator can be distributed in it almost as clearly, giving !=. Then remove the parentheses. Bruce From owner-svn-src-all@freebsd.org Thu Jan 26 03:05: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 9F6EFCC2CFE; Thu, 26 Jan 2017 03:05:28 +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 548CADB7; Thu, 26 Jan 2017 03:05:28 +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 v0Q35Rdu056151; Thu, 26 Jan 2017 03:05:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q35RkZ056149; Thu, 26 Jan 2017 03:05:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701260305.v0Q35RkZ056149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Jan 2017 03:05: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: r312789 - stable/11/libexec/rtld-elf/amd64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 03:05:28 -0000 Author: emaste Date: Thu Jan 26 03:05:27 2017 New Revision: 312789 URL: https://svnweb.freebsd.org/changeset/base/312789 Log: MFC r312288: rtld: do not rely on a populated GOT on amd64 On rela architectures GNU BFD ld and gold store the relocation addend in GOT entries (in addition to the relocation's r_addend field). rtld previously relied on this to access its own _DYNAMIC symbol in order to apply its own relocations. However, recording addends in the GOT is not specified by the ABI, and some versions of LLVM's LLD linker leave the GOT uninitialized on rela architectures. BFD ld does not populate the GOT on sparc64, and sparc64 rtld has a machine-dependent rtld_dynamic_addr() function that returns the _DYNAMIC address. Use the same approach on amd64, obtaining the %rip- relative _DYNAMIC address following a suggestion from Rafael Espíndola. Architectures other than amd64 should be addressed in future work. Modified: stable/11/libexec/rtld-elf/amd64/rtld_machdep.h stable/11/libexec/rtld-elf/amd64/rtld_start.S Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/amd64/rtld_machdep.h ============================================================================== --- stable/11/libexec/rtld-elf/amd64/rtld_machdep.h Thu Jan 26 02:22:23 2017 (r312788) +++ stable/11/libexec/rtld-elf/amd64/rtld_machdep.h Thu Jan 26 03:05:27 2017 (r312789) @@ -35,8 +35,8 @@ struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ -#define rtld_dynamic(obj) \ - ((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC)) +Elf_Dyn *rtld_dynamic_addr(void); +#define rtld_dynamic(obj) rtld_dynamic_addr() /* Fixup the jump slot at "where" to transfer control to "target". */ static inline Elf_Addr Modified: stable/11/libexec/rtld-elf/amd64/rtld_start.S ============================================================================== --- stable/11/libexec/rtld-elf/amd64/rtld_start.S Thu Jan 26 02:22:23 2017 (r312788) +++ stable/11/libexec/rtld-elf/amd64/rtld_start.S Thu Jan 26 03:05:27 2017 (r312789) @@ -156,4 +156,16 @@ _rtld_bind_start: .cfi_endproc .size _rtld_bind_start, . - _rtld_bind_start + .align 4 + .globl rtld_dynamic_addr + .type rtld_dynamic_addr,@function +rtld_dynamic_addr: + .cfi_startproc + .weak _DYNAMIC + .hidden _DYNAMIC + lea _DYNAMIC(%rip),%rax + ret + .cfi_endproc + .size rtld_dynamic_addr, . - rtld_dynamic_addr + .section .note.GNU-stack,"",%progbits From owner-svn-src-all@freebsd.org Thu Jan 26 03:50: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 89549CC2FDA; Thu, 26 Jan 2017 03:50:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4B120199C; Thu, 26 Jan 2017 03:50:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 6D25C3C389A; Thu, 26 Jan 2017 14:50:48 +1100 (AEDT) Date: Thu, 26 Jan 2017 14:50:47 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312780 - head/contrib/ipfilter/tools In-Reply-To: <201701252059.v0PKxNsJ006302@repo.freebsd.org> Message-ID: <20170126144726.U1265@besplex.bde.org> References: <201701252059.v0PKxNsJ006302@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=H7qr+6Qi c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=uwsuDJgEXNybzttD0q4A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 03:50:51 -0000 On Wed, 25 Jan 2017, Cy Schubert wrote: > Log: > Remove extraneous blank line. > > MFC after: 2 weeks > X-MFC with: r312777 > > Modified: > head/contrib/ipfilter/tools/ipf.c > > Modified: head/contrib/ipfilter/tools/ipf.c > ============================================================================== > --- head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:06 2017 (r312779) > +++ head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:23 2017 (r312780) > @@ -409,7 +409,6 @@ static void flushfilter(arg, filter) > closedevice(); > return; > } > - > else if (strchr(arg, 'i') || strchr(arg, 'I')) > fl = FR_INQUE; > else if (strchr(arg, 'o') || strchr(arg, 'O')) Now it has 1 extra instead of 2 extra. Most code in ipfilter, and all in the old version of this file, uses the normal KNF style of cuddling elses. Bruce From owner-svn-src-all@freebsd.org Thu Jan 26 03:55: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 BF282CC13BE; Thu, 26 Jan 2017 03:55:23 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 751C71EA9; Thu, 26 Jan 2017 03:55:23 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id Wb9WcuUqhsa1kWb9Xci28v; Wed, 25 Jan 2017 20:55:16 -0700 X-Authority-Analysis: v=2.2 cv=W+NIbVek c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=JzwRw_2MAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=c2z9mWv897AVS-nBUf8A:9 a=CjuIK1q_8ugA:10 a=_bBvcJC8wCc67rcU61zu:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 587C015B1; Wed, 25 Jan 2017 19:55:14 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0Q3tEhF092816; Wed, 25 Jan 2017 19:55:14 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701260355.v0Q3tEhF092816@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bruce Evans cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312780 - head/contrib/ipfilter/tools In-Reply-To: Message from Bruce Evans of "Thu, 26 Jan 2017 14:50:47 +1100." <20170126144726.U1265@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 25 Jan 2017 19:55:14 -0800 X-CMAE-Envelope: MS4wfG0C7oAfos8465steEpORf7VURWsV84CzUvdQeJjrbQz7DuDMyjTkuHCrvDwuBTi4PcGGO14/5Ad7UK+JAYoDYdU8EKHoQ7LsWszB6rgGIVnYfUyG7Xc juWY3Tkbv6daB35VYcRKwuJ5y2/e/gKDk3jAewcMwVNYJZZ3BXD0VqWejW8OD0lqjt2jxvjcqi1ZymMayLHGSj9gSWE9+T7KhsIJvLsGgx+ES17+XDRC6r6o AA2Hy0g9WZX98NsfwpanE0SOE0nWpl0jcchuPo3wn5AoZPhKRziCzsuhulFgCR769cpqhiysDgRfL0m68nnJzg== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 03:55:23 -0000 In message <20170126144726.U1265@besplex.bde.org>, Bruce Evans writes: > On Wed, 25 Jan 2017, Cy Schubert wrote: > > > Log: > > Remove extraneous blank line. > > > > MFC after: 2 weeks > > X-MFC with: r312777 > > > > Modified: > > head/contrib/ipfilter/tools/ipf.c > > > > Modified: head/contrib/ipfilter/tools/ipf.c > > =========================================================================== > === > > --- head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:06 2017 > (r312779) > > +++ head/contrib/ipfilter/tools/ipf.c Wed Jan 25 20:59:23 2017 > (r312780) > > @@ -409,7 +409,6 @@ static void flushfilter(arg, filter) > > closedevice(); > > return; > > } > > - > > else if (strchr(arg, 'i') || strchr(arg, 'I')) > > fl = FR_INQUE; > > else if (strchr(arg, 'o') || strchr(arg, 'O')) > > Now it has 1 extra instead of 2 extra. > > Most code in ipfilter, and all in the old version of this file, uses the > normal KNF style of cuddling elses. I suppose I should compress it one more. I'll do that after the change window I'm working on tonight (if it's not too late and I'm not too tired). Thanks for your input Bruce. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Jan 26 04:44: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 8F522CC24FE; Thu, 26 Jan 2017 04:44:19 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44969895; Thu, 26 Jan 2017 04:44:19 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q4iIEu096112; Thu, 26 Jan 2017 04:44:18 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q4iIaE096111; Thu, 26 Jan 2017 04:44:18 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201701260444.v0Q4iIaE096111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 26 Jan 2017 04:44: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: r312790 - stable/11/release/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 04:44:19 -0000 Author: cperciva Date: Thu Jan 26 04:44:18 2017 New Revision: 312790 URL: https://svnweb.freebsd.org/changeset/base/312790 Log: MFC r312214: Enable IPv6 on EC2 AMIs. Modified: stable/11/release/tools/ec2.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/release/tools/ec2.conf ============================================================================== --- stable/11/release/tools/ec2.conf Thu Jan 26 03:05:27 2017 (r312789) +++ stable/11/release/tools/ec2.conf Thu Jan 26 04:44:18 2017 (r312790) @@ -6,7 +6,7 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap ec2_loghostkey firstboot_freebsd_update firstboot_pkgs" @@ -39,8 +39,9 @@ vm_extra_pre_umount() { # time; expand our filesystem to fill the disk. echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf - # EC2 instances use DHCP to get their network configuration. - echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf + # EC2 instances use DHCP to get their network configuration. IPv6 + # requires accept_rtadv. + echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> ${DESTDIR}/etc/rc.conf # Unless the system has been configured via EC2 user-data, the user # will need to SSH in to do anything. @@ -51,6 +52,10 @@ vm_extra_pre_umount() { # via EC2 user-data. echo 'firstboot_pkgs_list="awscli"' >> ${DESTDIR}/etc/rc.conf + # Enable IPv6 on all interfaces, and use DHCP on both IPv4 and IPv6. + echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'dhclient_program="/usr/local/sbin/dual-dhclient"' >> ${DESTDIR}/etc/rc.conf + # The EC2 console is output-only, so while printing a backtrace can # be useful, there's no point dropping into a debugger or waiting # for a keypress. From owner-svn-src-all@freebsd.org Thu Jan 26 04:51: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 857ACCC27C2; Thu, 26 Jan 2017 04:51:49 +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 4E4C1BE4; Thu, 26 Jan 2017 04:51:49 +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 v0Q4pm0t099408; Thu, 26 Jan 2017 04:51:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q4pmib099407; Thu, 26 Jan 2017 04:51:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201701260451.v0Q4pmib099407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 26 Jan 2017 04:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312791 - head/contrib/ipfilter/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 04:51:49 -0000 Author: cy Date: Thu Jan 26 04:51:48 2017 New Revision: 312791 URL: https://svnweb.freebsd.org/changeset/base/312791 Log: Use normal KNF cuddling of elses. Reported by: bde MFC after: 2 weeks X-MFC with: r312777 Modified: head/contrib/ipfilter/tools/ipf.c Modified: head/contrib/ipfilter/tools/ipf.c ============================================================================== --- head/contrib/ipfilter/tools/ipf.c Thu Jan 26 04:44:18 2017 (r312790) +++ head/contrib/ipfilter/tools/ipf.c Thu Jan 26 04:51:48 2017 (r312791) @@ -408,8 +408,7 @@ static void flushfilter(arg, filter) } closedevice(); return; - } - else if (strchr(arg, 'i') || strchr(arg, 'I')) + } else if (strchr(arg, 'i') || strchr(arg, 'I')) fl = FR_INQUE; else if (strchr(arg, 'o') || strchr(arg, 'O')) fl = FR_OUTQUE; From owner-svn-src-all@freebsd.org Thu Jan 26 05:23: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 99BDBCC2EFE; Thu, 26 Jan 2017 05:23:34 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C4AC68; Thu, 26 Jan 2017 05:23:34 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q5NX6a012136; Thu, 26 Jan 2017 05:23:33 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q5NXOo012134; Thu, 26 Jan 2017 05:23:33 GMT (envelope-from jah@FreeBSD.org) Message-Id: <201701260523.v0Q5NXOo012134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Thu, 26 Jan 2017 05:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312792 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 05:23:34 -0000 Author: jah Date: Thu Jan 26 05:23:33 2017 New Revision: 312792 URL: https://svnweb.freebsd.org/changeset/base/312792 Log: Further cleanup of per-CPU armv6 pmap data: - Replace pcpu_find(curcpu) with get_pcpu(), which is much more direct. - Remove armv4 pcpu fields which I added in r286296 but never needed to use. - armv6 pc_qmap_addr was leftover from the old armv6 pmap implementation. Rename it and put it to use in the new one. Noted by: skra Reviewed by: skra MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9312 Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Thu Jan 26 04:51:48 2017 (r312791) +++ head/sys/arm/arm/pmap-v6.c Thu Jan 26 05:23:33 2017 (r312792) @@ -1160,11 +1160,11 @@ pmap_bootstrap(vm_offset_t firstaddr) * Local CMAP1/CMAP2 are used for zeroing and copying pages. * Local CMAP2 is also used for data cache cleaning. */ - pc = pcpu_find(curcpu); + pc = get_pcpu(); mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); SYSMAP(caddr_t, pc->pc_cmap1_pte2p, pc->pc_cmap1_addr, 1); SYSMAP(caddr_t, pc->pc_cmap2_pte2p, pc->pc_cmap2_addr, 1); - SYSMAP(vm_offset_t, unused, pc->pc_qmap_addr, 1); + SYSMAP(vm_offset_t, pc->pc_qmap_pte2p, pc->pc_qmap_addr, 1); /* * Crashdump maps. @@ -1217,6 +1217,7 @@ pmap_init_reserved_pages(void) panic("%s: unable to allocate KVA", __func__); pc->pc_cmap1_pte2p = pt2map_entry(pages); pc->pc_cmap2_pte2p = pt2map_entry(pages + PAGE_SIZE); + pc->pc_qmap_pte2p = pt2map_entry(pages + (PAGE_SIZE * 2)); pc->pc_cmap1_addr = (caddr_t)pages; pc->pc_cmap2_addr = (caddr_t)(pages + PAGE_SIZE); pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); @@ -1584,7 +1585,7 @@ pmap_pt2pg_zero(vm_page_t m) * to sync it even if the sync is only DSB. */ sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) @@ -5661,7 +5662,7 @@ pmap_page_set_memattr(vm_page_t m, vm_me if (ma != oma) { pa = VM_PAGE_TO_PHYS(m); sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) @@ -5754,7 +5755,7 @@ pmap_zero_page(vm_page_t m) struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) @@ -5781,7 +5782,7 @@ pmap_zero_page_area(vm_page_t m, int off struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) @@ -5811,7 +5812,7 @@ pmap_copy_page(vm_page_t src, vm_page_t struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap1_pte2p = pc->pc_cmap1_pte2p; cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); @@ -5846,7 +5847,7 @@ pmap_copy_pages(vm_page_t ma[], vm_offse int cnt; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap1_pte2p = pc->pc_cmap1_pte2p; cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); @@ -5885,34 +5886,34 @@ pmap_copy_pages(vm_page_t ma[], vm_offse vm_offset_t pmap_quick_enter_page(vm_page_t m) { + struct pcpu *pc; pt2_entry_t *pte2p; - vm_offset_t qmap_addr; critical_enter(); - qmap_addr = PCPU_GET(qmap_addr); - pte2p = pt2map_entry(qmap_addr); + pc = get_pcpu(); + pte2p = pc->pc_qmap_pte2p; KASSERT(pte2_load(pte2p) == 0, ("%s: PTE2 busy", __func__)); pte2_store(pte2p, PTE2_KERN_NG(VM_PAGE_TO_PHYS(m), PTE2_AP_KRW, vm_page_pte2_attr(m))); - return (qmap_addr); + return (pc->pc_qmap_addr); } void pmap_quick_remove_page(vm_offset_t addr) { + struct pcpu *pc; pt2_entry_t *pte2p; - vm_offset_t qmap_addr; - qmap_addr = PCPU_GET(qmap_addr); - pte2p = pt2map_entry(qmap_addr); + pc = get_pcpu(); + pte2p = pc->pc_qmap_pte2p; - KASSERT(addr == qmap_addr, ("%s: invalid address", __func__)); + KASSERT(addr == pc->pc_qmap_addr, ("%s: invalid address", __func__)); KASSERT(pte2_load(pte2p) != 0, ("%s: PTE2 not in use", __func__)); pte2_clear(pte2p); - tlb_flush(qmap_addr); + tlb_flush(pc->pc_qmap_addr); critical_exit(); } @@ -6212,7 +6213,7 @@ pmap_dcache_wb_pou(vm_paddr_t pa, vm_siz ("%s: not on single page", __func__)); sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) @@ -6477,7 +6478,7 @@ pmap_zero_page_check(vm_page_t m) struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap2_pte2p = pc->pc_cmap2_pte2p; mtx_lock(&pc->pc_cmap_lock); if (pte2_load(cmap2_pte2p) != 0) Modified: head/sys/arm/include/pcpu.h ============================================================================== --- head/sys/arm/include/pcpu.h Thu Jan 26 04:51:48 2017 (r312791) +++ head/sys/arm/include/pcpu.h Thu Jan 26 05:23:33 2017 (r312792) @@ -54,15 +54,13 @@ struct vmspace; caddr_t pc_cmap1_addr; \ caddr_t pc_cmap2_addr; \ vm_offset_t pc_qmap_addr; \ - void *pc_qmap_pte; \ + void *pc_qmap_pte2p; \ unsigned int pc_dbreg[32]; \ int pc_dbreg_cmd; \ char __pad[27] #else #define PCPU_MD_FIELDS \ - vm_offset_t qmap_addr; \ - void *pc_qmap_pte; \ - char __pad[149] + char __pad[157] #endif #ifdef _KERNEL From owner-svn-src-all@freebsd.org Thu Jan 26 05:26: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 12525CC20DD; Thu, 26 Jan 2017 05:26:14 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0108.outbound.protection.outlook.com [104.47.37.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5475F09; Thu, 26 Jan 2017 05:26:13 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=oYRwh3gkea0Hn2Ibl05HQaiMOi1brURNDMZVfssgl5Q=; b=ABJGsgyCUqUoQT8KgxrLa3zVX7Y0BSQxdwI9pLJ+wqFB0Cw6t2hmkxiwW7eLIgOYikKsAKxGZITI37OlcSJc+jjBryLQbD03ZNB3/lZMwBQV1wpdofH+FrgZf2L2oVWNxdE6vbYr35KEUyoTCsxHwSgk9sHRAfkolkykIVbMNlk= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2671.namprd03.prod.outlook.com (10.168.207.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Thu, 26 Jan 2017 05:26:10 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0860.021; Thu, 26 Jan 2017 05:26:10 +0000 From: Dexuan Cui To: Gleb Smirnoff , Dexuan Cui CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r312687 - in head/sys: net sys Thread-Topic: svn commit: r312687 - in head/sys: net sys Thread-Index: AQHSdnftoCXmn3KP+kO3oJR5DjhMrKFIMlEwgAIJ2SA= Date: Thu, 26 Jan 2017 05:26:10 +0000 Message-ID: References: <201701240919.v0O9JlM7021007@repo.freebsd.org> <20170124192725.GX2611@FreeBSD.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [167.220.255.8] x-ms-office365-filtering-correlation-id: ff4a9341-b1d4-41d1-fc4d-08d445abd67d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401071); SRVR:MWHPR03MB2671; x-microsoft-exchange-diagnostics: 1; MWHPR03MB2671; 7:5CPnrLwAyfmERBJuVP500bAnFtBRdiynfoY1r+ueBhDychk+HikcpRBQ7y4qU4ecRi28XlSoAsOkILAJ0j8BAyA1+fJSG5I4WK/CE1ZAp8BQkyBnLNYT2XKSHIbmsAW8qRFd9SHh7a6JTvp2Syg40qrXTxfjkvziGQAY80BvDS9sOUGz86zXhkDa1Cpc4bL/Mn5lMMrxVQd9PCR60rmTB53lZLTcmc4tVvyl1B5SqCk6nNRP4nRxBxVKDYuqe1tj9Vh3mctbyR5GAMvMjPvAymxEkO1aidNSgM2WYRbaR227xuKb1i4DfXPMl4TSCHgfDR17Da8W7tDfKAVTm+UeNMJHuo86QOV13DqrmCOU1Lkb4FO4vtVml4CPByL0f8doz4z/5qwXemxbV1h2szjHHCln3PUGgZeCl86ErLilBRunTEJwyMt6hNQc3PB/GembAxOTF9Ekp7TLZGDcxSenIE047gM0iUYEsbbRmeVMCug= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123558021)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6047074)(6072148); SRVR:MWHPR03MB2671; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2671; x-forefront-prvs: 019919A9E4 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39850400002)(39410400002)(39840400002)(39450400003)(39860400002)(189002)(199003)(24454002)(68736007)(345774005)(10090500001)(6436002)(8676002)(122556002)(81166006)(4326007)(8936002)(38730400001)(101416001)(81156014)(229853002)(5660300001)(77096006)(74316002)(2906002)(3280700002)(3846002)(102836003)(6506006)(6116002)(25786008)(7736002)(54356999)(76176999)(92566002)(8990500004)(5005710100001)(6306002)(3660700001)(50986999)(305945005)(10290500002)(450100001)(2900100001)(106116001)(54906002)(66066001)(97736004)(189998001)(5001770100001)(55016002)(7696004)(86612001)(106356001)(2950100002)(105586002)(33656002)(53936002)(9686003)(99286003)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2671; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2017 05:26:10.4085 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2671 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 05:26:14 -0000 > From: Dexuan Cui [mailto:decui@microsoft.com] > Sent: Wednesday, January 25, 2017 06:21 > To: Gleb Smirnoff ; Dexuan Cui > Cc: src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src- > head@freebsd.org > Subject: RE: svn commit: r312687 - in head/sys: net sys >=20 > > From: Gleb Smirnoff [mailto:glebius@FreeBSD.org] > > Dexuan, > > > > On Tue, Jan 24, 2017 at 09:19:47AM +0000, Dexuan Cui wrote: > > D> --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017 > > (r312686) > > D> +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017 > > (r312687) > > D> @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc > > D> EVENTHANDLER_DECLARE(swapon, swapon_fn); > > D> EVENTHANDLER_DECLARE(swapoff, swapoff_fn); > > D> > > D> +/* ifup/ifdown events */ > > D> +#define IFNET_EVENT_UP 0 > > D> +#define IFNET_EVENT_DOWN 1 > > D> +struct ifnet; > > D> +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event= ); > > D> +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); > > D> + > > D> #endif /* _SYS_EVENTHANDLER_H_ */ > > > > The network stuff shall not be added to sys/eventhandler.h. > > > > All these declarations should go to net/if_var.h. There is already > > a block of event(9) defines there. Please move it there. > > > > -- > > Totus tuus, Glebius. >=20 > Hi Gleb, > Sorry, I didn't realize this... I'll move it as you suggested. >=20 > Thank you for the reminder! >=20 > -- Dexuan I posted https://reviews.freebsd.org/D9345 for this. Please review it. Thanks, -- Dexuan From owner-svn-src-all@freebsd.org Thu Jan 26 05:53: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 AA2F2CC27A9; Thu, 26 Jan 2017 05:53:25 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-oi0-x22d.google.com (mail-oi0-x22d.google.com [IPv6:2607:f8b0:4003:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ED781B37; Thu, 26 Jan 2017 05:53:25 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-oi0-x22d.google.com with SMTP id m124so130728788oif.1; Wed, 25 Jan 2017 21:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=920pSNtZGKMRab0UTath8IiTj59KHI/TjurmlLKiO8o=; b=QV5GAf1GWViwXJD+DRMQLpZ2mXzsqa/FcxCvZq4BB0MAJ0almMpFQRXQbFgTS2Mt8K S6dHkViY1z/hy91hlvc/GX+H10IJN7xnRfi4C90mYCo/rD9b84XUGe+xnBwkFEju/O1L js/p/DHZwEV501apTKSsQZa5VfrKX/Fgqpcjhn+9fuJYh0wko5k2SVxPUJdJOb62FFLj Gd47Q3iuvW0N/gNt2TdVdBVdQQnAUvGdn/7sgh5yOXUC220stLmQG8IJc4LTPTdMuyYn s2jEBBPZY4D6YhE09zPt7NjNQ78DpqDWDhyFE6UW3seP4TLf6Vkc9Ce11yFJ1VhV9XQn 1aPQ== 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=920pSNtZGKMRab0UTath8IiTj59KHI/TjurmlLKiO8o=; b=O5KILZaG6vDgv3YtxUtna9QwwnPkHL2VgMZjYoPyoo3HeZpbc+fdy565qCPzdS+ADI 4fKaTnYQxlNgutLLvjeje/FKkIXMrYbF8n75CJ9dv9+s1J2LlUqB/fbSAFFf9D3ONokX vybkJDVvCP9Inds6+FlAr5QLKi3Y4GS6yQA6JUpZ0gLYA/BtHIIyywkgPecSuC4iozvJ 0J+AsQ6dff16/iK6SoUJ4bxM4Yp+LDCuSD/D4zA0N48uft3ruqpyEr4KTwJF3jfNKSnT 4Wb7WmbwwQ173T5ANRZ3sn8LLGVIp2Xc7i135trwC/OCKCQn+/I+hphM7QVnLnnJRERx JE2g== X-Gm-Message-State: AIkVDXL0c0RsZPAqfTJ8e91keRMbvEQP+IAPD+4Iz37XcP4KC5WcvMIBvp5UdG+eEMr8fpr6tbD1PjkTCtTzng== X-Received: by 10.202.169.82 with SMTP id s79mr531391oie.125.1485410004594; Wed, 25 Jan 2017 21:53:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.51.7 with HTTP; Wed, 25 Jan 2017 21:53:24 -0800 (PST) In-Reply-To: <201701260523.v0Q5NXOo012134@repo.freebsd.org> References: <201701260523.v0Q5NXOo012134@repo.freebsd.org> From: Jason Harmening Date: Wed, 25 Jan 2017 21:53:24 -0800 Message-ID: Subject: Re: svn commit: r312792 - in head/sys/arm: arm include To: "Jason A. Harmening" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.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: Thu, 26 Jan 2017 05:53:25 -0000 On Wed, Jan 25, 2017 at 9:23 PM, Jason A. Harmening wrote: > Author: jah > Date: Thu Jan 26 05:23:33 2017 > New Revision: 312792 > URL: https://svnweb.freebsd.org/changeset/base/312792 > > Log: > Further cleanup of per-CPU armv6 pmap data: > > - Replace pcpu_find(curcpu) with get_pcpu(), which is much > more direct. > > - Remove armv4 pcpu fields which I added in r286296 but never > needed to use. > > - armv6 pc_qmap_addr was leftover from the old armv6 pmap > implementation. Rename it and put it to use in the new one. > pc_qmap_addr -> pc_qmap_pte From owner-svn-src-all@freebsd.org Thu Jan 26 06:32: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 893A5CC2095; Thu, 26 Jan 2017 06:32:50 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-it0-x244.google.com (mail-it0-x244.google.com [IPv6:2607:f8b0:4001:c0b::244]) (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 4A026F0D; Thu, 26 Jan 2017 06:32:50 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-it0-x244.google.com with SMTP id o185so4369494itb.1; Wed, 25 Jan 2017 22:32:50 -0800 (PST) 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=K7m6eQB7xQAWquPPBRBVWCryS3Ut/wUUGZx5LPtPmzM=; b=bLkjdDvdJceuApONJa5Wm9Onw8Wr0urFczZNUCNbvnyDvb7Stzh3MDXYW/cEMLrizh c1xUCPyLTjqdfHIDq1aJFii3vj9ugvIifPWCR7zcFhhv+SFpJs4zMZ7jO138nh1IWPuI q1OhLNhk2EASNzGdA5oGc4zleBagcM8WbsWTslUm/UJDyvPV1rZbK2oY6g2U2kS/mENJ EkydZg1bvIsRcKNg5nBPh7Mqjkket/uSrVaNc10qyFq+9/QdiBK//x3AE8k//khTZbqE E9kIL+jiL+MQT6CScmlbSxTjnPuabFHCSMoehp99lz1WclLYz/B1BQWUy/C8X8phrO+G e53w== 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=K7m6eQB7xQAWquPPBRBVWCryS3Ut/wUUGZx5LPtPmzM=; b=WPLzn2nrz+ajA38UoRy4eDKZ2MnXfSiDNRK7LwB6HXD2DNW/9VikORU6HVC7DlCgSU r4tBPCZevTva9wNRZIj5fTltv9OJl1JP1sWGK1+yvckN6mtBUuVT9WdSeK0rKbOkydVe xL+XNewxO+f6uKLJABZPOxIEAvKVZUnP7+Uam4YqJqVBm6PMTfhFN2oijNPA8D5HFPG5 a2S16V1YCxiSJP2U9FnBlfICJHsu93M7j0h3uyvj/OgCtxjGsmZSJOPU4lA/mncPas5+ 22gKdOsoOSwflRsru2JjbPybGeIEM0mERaR3F+FpMbc0fIqYN+Nm8ZXdh6dyuBiT9P5H lg9A== X-Gm-Message-State: AIkVDXLv6ov+Ul/Bj+t035d3f8NOdveosGjyL21O/1M5xC8Xf+kzvti/n9YPpZY8Oi7fLtK0PIfLEzwGWHPRmg== X-Received: by 10.36.76.205 with SMTP id a196mr1503295itb.52.1485412369294; Wed, 25 Jan 2017 22:32:49 -0800 (PST) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.205.142 with HTTP; Wed, 25 Jan 2017 22:32:48 -0800 (PST) In-Reply-To: <201701251759.v0PHxMWN032521@repo.freebsd.org> References: <201701251759.v0PHxMWN032521@repo.freebsd.org> From: Antoine Brodin Date: Thu, 26 Jan 2017 07:32:48 +0100 X-Google-Sender-Auth: CW_9XsYLF2NelmIyas1gJd3-XJA Message-ID: Subject: Re: svn commit: r312765 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 06:32:50 -0000 On Wed, Jan 25, 2017 at 6:59 PM, Dimitry Andric wrote: > Author: dim > Date: Wed Jan 25 17:59:22 2017 > New Revision: 312765 > URL: https://svnweb.freebsd.org/changeset/base/312765 > > Log: > Pull in r276136 from upstream llvm trunk (by Wei Mi): > > Use ValueOffsetPair to enhance value reuse during SCEV expansion. > > In D12090, the ExprValueMap was added to reuse existing value during > SCEV expansion. However, const folding and sext/zext distribution can > make the reuse still difficult. > > A simplified case is: suppose we know S1 expands to V1 in > ExprValueMap, and > S1 = S2 + C_a > S3 = S2 + C_b > where C_a and C_b are different SCEVConstants. Then we'd like to > expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is > helpful when S2 is a complex SCEV expr and S2 has no entry in > ExprValueMap, which is usually caused by the fact that S3 is > generated from S1 after const folding. > > In order to do that, we represent ExprValueMap as a mapping from SCEV > to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} > into the ExprValueMap when we create SCEV for V1. When S3 is > expanded, it will first expand S2 to V1 - C_a because of S2->{V1, > C_a} in the map, then expand S3 to V1 - C_a + C_b. > > Differential Revision: https://reviews.llvm.org/D21313 > > This should fix assertion failures when building OpenCV >= 3.1. > > PR: 215649 > MFC after: 3 days Hi, I don't know if it's this commit, but there is now an assertion failure when trying to build lang/spidermonkey24 (It was building fine with base/head@312672) http://beefy12.nyi.freebsd.org/data/head-amd64-default/p432463_s312786/logs/errors/spidermonkey24-24.2.0_4.log Cheers, Antoine From owner-svn-src-all@freebsd.org Thu Jan 26 07:07: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 AC65DCC290E; Thu, 26 Jan 2017 07:07:10 +0000 (UTC) (envelope-from rezny@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 798CB1CBE; Thu, 26 Jan 2017 07:07:10 +0000 (UTC) (envelope-from rezny@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q779mt052984; Thu, 26 Jan 2017 07:07:09 GMT (envelope-from rezny@FreeBSD.org) Received: (from rezny@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q779NM052983; Thu, 26 Jan 2017 07:07:09 GMT (envelope-from rezny@FreeBSD.org) Message-Id: <201701260707.v0Q779NM052983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rezny set sender to rezny@FreeBSD.org using -f From: Matthew Rezny Date: Thu, 26 Jan 2017 07:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312793 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 07:07:10 -0000 Author: rezny (ports committer) Date: Thu Jan 26 07:07:09 2017 New Revision: 312793 URL: https://svnweb.freebsd.org/changeset/base/312793 Log: Update the mentor/mentee relationships to add myself. Reviewed by: swills Approved by: swills (mentor) Differential Revision: https://reviews.freebsd.org/D9343 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Thu Jan 26 05:23:33 2017 (r312792) +++ head/share/misc/committers-ports.dot Thu Jan 26 07:07:09 2017 (r312793) @@ -195,6 +195,7 @@ philip [label="Philip Paeps\nphilip@Free rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2006/06/23"] rakuco [label="Raphael Kubo da Costa\nrakuco@FreeBSD.org\n2011/08/22"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2010/04/11"] +rezny [label="Matthew Rezny\nrezny@FreeBSD.org\n2017/01/09"] riggs [label="Thomas Zander\nriggs@FreeBSD.org\n2014/01/09"] rm [label="Ruslan Makhmatkhanov\nrm@FreeBSD.org\n2011/11/06"] rnoland [label="Robert Noland\nrnoland@FreeBSD.org\n2008/07/21"] @@ -370,6 +371,7 @@ erwin -> simon feld -> brnrd feld -> junovitch +feld -> rezny fjoe -> danfe fjoe -> flo @@ -595,6 +597,7 @@ swills -> feld swills -> jrm swills -> milki swills -> pclin +swills -> rezny swills -> robak swills -> rpaulo swills -> tz From owner-svn-src-all@freebsd.org Thu Jan 26 08:38: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 8C579CC2F79; Thu, 26 Jan 2017 08:38:20 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::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 49AD89E2; Thu, 26 Jan 2017 08:38:20 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: by mail-io0-x243.google.com with SMTP id m98so4488045iod.2; Thu, 26 Jan 2017 00:38:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=++vpfjPvvDVeBCXt6vsImHeUTvxsQKa6JWwY3ioKfi4=; b=oyCeN3Ot1vILGGPN5yXrCqldJXisaT9fo4Spbr2hy0H3zhDtNx4eoDYMqK090Yf3z5 x1uzOM+LqoAoYnnxCi5azIwyBpTG7S/uaZunv0Es5wDS1HoYuou7YHRCj6489EjnsKX3 fSyrV4NuYc0i12yk9FnruYrfo2ZuWHZixTOvdro9//0iwKK1q58+y8qgSxJOyR9Am9IU O2EaQp8ErT0z7IusvT3/6KuARzdW5HYK5PyfIv6xXheZ8Q7kEneZuH2Z6ypNYmwWWF+x wk7R6mFfwQDyLucnJho3XSZ7vzsiGS37m9kJQboBd4N2BOIMIH7vATyNlkVIVAq3dlp6 3tYQ== 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=++vpfjPvvDVeBCXt6vsImHeUTvxsQKa6JWwY3ioKfi4=; b=poJSgoNAHBaiLM1MsI7V367/Du1avg/6cTitv80iPXJq4n3nCj/ysjiP6VDxEYjzWx njXcw19yV4ZI3N4Y743bjkzYQdUGn7puMggRnXrjXkFXLNwbs45i2F/HabMKTcNXBfYU AotaAVdySLS7o2JDd081mMU7fBvwp5+x/rMPh1aCkamyeT8NGUrfSaOHdIuns7+gV4L9 Od41soTzbb2cC8RsuTehAi50oBB21lQrWE6rZGJ+Z23KglDG1Jj+rXKmqV2975CjsJmj wNJN4KI7EErQdlHuqO6vb22HVXssXDsEI5U1adEMl3n2sF2uSEQyRBREH6yTuSl0Yo0T Ke3Q== X-Gm-Message-State: AIkVDXJmaryZJtBL60Pu9rHS+te9IBrxHUUygV9sWrCS5rV6s9i44WBDmgf0ArLNrNMXEHh0j7PDlDHpwkZJwQ== X-Received: by 10.107.162.134 with SMTP id l128mr1774515ioe.128.1485419899492; Thu, 26 Jan 2017 00:38:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.101.194 with HTTP; Thu, 26 Jan 2017 00:38:19 -0800 (PST) In-Reply-To: <201701260523.v0Q5NXOo012134@repo.freebsd.org> References: <201701260523.v0Q5NXOo012134@repo.freebsd.org> From: Svatopluk Kraus Date: Thu, 26 Jan 2017 09:38:19 +0100 Message-ID: Subject: Re: svn commit: r312792 - in head/sys/arm: arm include To: "Jason A. Harmening" 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: Thu, 26 Jan 2017 08:38:20 -0000 Thank you. On Thu, Jan 26, 2017 at 6:23 AM, Jason A. Harmening wrote: > Author: jah > Date: Thu Jan 26 05:23:33 2017 > New Revision: 312792 > URL: https://svnweb.freebsd.org/changeset/base/312792 > > Log: > Further cleanup of per-CPU armv6 pmap data: > > - Replace pcpu_find(curcpu) with get_pcpu(), which is much > more direct. > > - Remove armv4 pcpu fields which I added in r286296 but never > needed to use. > > - armv6 pc_qmap_addr was leftover from the old armv6 pmap > implementation. Rename it and put it to use in the new one. > > Noted by: skra > Reviewed by: skra > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D9312 > > Modified: > head/sys/arm/arm/pmap-v6.c > head/sys/arm/include/pcpu.h > [snip] From owner-svn-src-all@freebsd.org Thu Jan 26 09:46: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 92C80CBFB7A; Thu, 26 Jan 2017 09:46:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 511D466E; Thu, 26 Jan 2017 09:46:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0Q9kYIo021337; Thu, 26 Jan 2017 09:46:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0Q9kYet021336; Thu, 26 Jan 2017 09:46:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701260946.v0Q9kYet021336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 26 Jan 2017 09:46: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: r312794 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 09:46:35 -0000 Author: avg Date: Thu Jan 26 09:46:34 2017 New Revision: 312794 URL: https://svnweb.freebsd.org/changeset/base/312794 Log: MFC r312532: don't abort writing of a core dump after EFAULT Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Thu Jan 26 07:07:09 2017 (r312793) +++ stable/11/sys/kern/imgact_elf.c Thu Jan 26 09:46:34 2017 (r312794) @@ -1160,7 +1160,7 @@ struct coredump_params { static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); -static int core_write(struct coredump_params *, void *, size_t, off_t, +static int core_write(struct coredump_params *, const void *, size_t, off_t, enum uio_seg); static void each_writable_segment(struct thread *, segment_callback, void *); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, @@ -1202,7 +1202,14 @@ compress_chunk(struct coredump_params *p while (len > 0) { chunk_len = MIN(len, CORE_BUF_SIZE); - copyin(base, buf, chunk_len); + + /* + * We can get EFAULT error here. + * In that case zero out the current chunk of the segment. + */ + error = copyin(base, buf, chunk_len); + if (error != 0) + bzero(buf, chunk_len); error = gzio_write(p->gzs, buf, chunk_len); if (error != 0) break; @@ -1222,12 +1229,12 @@ core_gz_write(void *base, size_t len, of #endif /* GZIO */ static int -core_write(struct coredump_params *p, void *base, size_t len, off_t offset, - enum uio_seg seg) +core_write(struct coredump_params *p, const void *base, size_t len, + off_t offset, enum uio_seg seg) { - return (vn_rdwr_inchunks(UIO_WRITE, p->vp, base, len, offset, - seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, + return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base), + len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED, p->active_cred, p->file_cred, NULL, p->td)); } @@ -1235,12 +1242,32 @@ static int core_output(void *base, size_t len, off_t offset, struct coredump_params *p, void *tmpbuf) { + int error; #ifdef GZIO if (p->gzs != NULL) return (compress_chunk(p, base, tmpbuf, len)); #endif - return (core_write(p, base, len, offset, UIO_USERSPACE)); + /* + * EFAULT is a non-fatal error that we can get, for example, + * if the segment is backed by a file but extends beyond its + * end. + */ + error = core_write(p, base, len, offset, UIO_USERSPACE); + if (error == EFAULT) { + log(LOG_WARNING, "Failed to fully fault in a core file segment " + "at VA %p with size 0x%zx to be written at offset 0x%jx " + "for process %s\n", base, len, offset, curproc->p_comm); + + /* + * Write a "real" zero byte at the end of the target region + * in the case this is the last segment. + * The intermediate space will be implicitly zero-filled. + */ + error = core_write(p, zero_region, 1, offset + len - 1, + UIO_SYSSPACE); + } + return (error); } /* From owner-svn-src-all@freebsd.org Thu Jan 26 10:15: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 90961CC0797; Thu, 26 Jan 2017 10:15: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 5CCA5A3A; Thu, 26 Jan 2017 10:15: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 v0QAFfXv033648; Thu, 26 Jan 2017 10:15:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAFfHa033647; Thu, 26 Jan 2017 10:15:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261015.v0QAFfHa033647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:15: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: r312795 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:15:42 -0000 Author: kib Date: Thu Jan 26 10:15:41 2017 New Revision: 312795 URL: https://svnweb.freebsd.org/changeset/base/312795 Log: MFC r311531 (by mjg): Perform a lockless check in tmpfs_itimes. Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 09:46:34 2017 (r312794) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:15:41 2017 (r312795) @@ -1743,19 +1743,22 @@ tmpfs_set_status(struct tmpfs_node *node } /* Sync timestamps */ -static void -tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc, +void +tmpfs_itimes(struct vnode *vp, const struct timespec *acc, const struct timespec *mod) { + struct tmpfs_node *node; struct timespec now; - TMPFS_ASSERT_LOCKED(node); + ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); + node = VP_TO_TMPFS_NODE(vp); if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) == 0) return; vfs_timestamp(&now); + TMPFS_NODE_LOCK(node); if (node->tn_status & TMPFS_NODE_ACCESSED) { if (acc == NULL) acc = &now; @@ -1770,19 +1773,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n node->tn_ctime = now; node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); -} - -void -tmpfs_itimes(struct vnode *vp, const struct timespec *acc, - const struct timespec *mod) -{ - struct tmpfs_node *node; - - ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); - node = VP_TO_TMPFS_NODE(vp); - - TMPFS_NODE_LOCK(node); - tmpfs_itimes_locked(node, acc, mod); TMPFS_NODE_UNLOCK(node); /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */ From owner-svn-src-all@freebsd.org Thu Jan 26 10:18: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 195F8CC084F; Thu, 26 Jan 2017 10:18:02 +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 DA555BD0; Thu, 26 Jan 2017 10:18:01 +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 v0QAI03c033777; Thu, 26 Jan 2017 10:18:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAI0cs033776; Thu, 26 Jan 2017 10:18:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261018.v0QAI0cs033776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:18: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: r312796 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:18:02 -0000 Author: kib Date: Thu Jan 26 10:18:00 2017 New Revision: 312796 URL: https://svnweb.freebsd.org/changeset/base/312796 Log: MFC r311526 (by mjg): tmpfs: enable MNTK_EXTENDED_SHARED. Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:15:41 2017 (r312795) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:18:00 2017 (r312796) @@ -257,7 +257,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); mp->mnt_data = tmp; From owner-svn-src-all@freebsd.org Thu Jan 26 10:19: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 356CACC0949; Thu, 26 Jan 2017 10:19:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9B4BD5B; Thu, 26 Jan 2017 10:19:54 +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 v0QAJsdV033889; Thu, 26 Jan 2017 10:19:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAJrBa033886; Thu, 26 Jan 2017 10:19:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261019.v0QAJrBa033886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:19: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: r312797 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:19:55 -0000 Author: kib Date: Thu Jan 26 10:19:53 2017 New Revision: 312797 URL: https://svnweb.freebsd.org/changeset/base/312797 Log: MFC r312124 (by mjg): tmpfs: manage tm_pages_used with atomics. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:19:53 2017 (r312797) @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017 (r312797) @@ -130,7 +130,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -328,9 +328,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1413,9 +1411,7 @@ retry: uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:18:00 2017 (r312796) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:19:53 2017 (r312797) @@ -397,7 +397,7 @@ tmpfs_statfs(struct mount *mp, struct st sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); From owner-svn-src-all@freebsd.org Thu Jan 26 10:29: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 31BDDCC0DA3; Thu, 26 Jan 2017 10:29:25 +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 F27BF625; Thu, 26 Jan 2017 10:29:24 +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 v0QATO95037869; Thu, 26 Jan 2017 10:29:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QATOpY037868; Thu, 26 Jan 2017 10:29:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261029.v0QATOpY037868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:29: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: r312798 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:29:25 -0000 Author: kib Date: Thu Jan 26 10:29:23 2017 New Revision: 312798 URL: https://svnweb.freebsd.org/changeset/base/312798 Log: MFC r311531 (by mjg): Perform a lockless check in tmpfs_itimes. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:19:53 2017 (r312797) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017 (r312798) @@ -1745,19 +1745,22 @@ tmpfs_set_status(struct tmpfs_node *node } /* Sync timestamps */ -static void -tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc, +void +tmpfs_itimes(struct vnode *vp, const struct timespec *acc, const struct timespec *mod) { + struct tmpfs_node *node; struct timespec now; - TMPFS_ASSERT_LOCKED(node); + ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); + node = VP_TO_TMPFS_NODE(vp); if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) == 0) return; vfs_timestamp(&now); + TMPFS_NODE_LOCK(node); if (node->tn_status & TMPFS_NODE_ACCESSED) { if (acc == NULL) acc = &now; @@ -1772,19 +1775,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n node->tn_ctime = now; node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); -} - -void -tmpfs_itimes(struct vnode *vp, const struct timespec *acc, - const struct timespec *mod) -{ - struct tmpfs_node *node; - - ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); - node = VP_TO_TMPFS_NODE(vp); - - TMPFS_NODE_LOCK(node); - tmpfs_itimes_locked(node, acc, mod); TMPFS_NODE_UNLOCK(node); } From owner-svn-src-all@freebsd.org Thu Jan 26 10:35: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 492D5CC10C7; Thu, 26 Jan 2017 10:35: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 0899BB8F; Thu, 26 Jan 2017 10:35:05 +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 v0QAZ5h3041628; Thu, 26 Jan 2017 10:35:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAZ4N9041625; Thu, 26 Jan 2017 10:35:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261035.v0QAZ4N9041625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:35:04 +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: r312799 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:35:06 -0000 Author: kib Date: Thu Jan 26 10:35:04 2017 New Revision: 312799 URL: https://svnweb.freebsd.org/changeset/base/312799 Log: MFC r312124 (by mjg): tmpfs: manage tm_pages_used with atomics. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:35:04 2017 (r312799) @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:35:04 2017 (r312799) @@ -129,7 +129,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -327,9 +327,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1413,9 +1411,7 @@ retry: uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:29:23 2017 (r312798) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:35:04 2017 (r312799) @@ -395,7 +395,7 @@ tmpfs_statfs(struct mount *mp, struct st sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); From owner-svn-src-all@freebsd.org Thu Jan 26 10:41: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 EB665CC134A; Thu, 26 Jan 2017 10:41:57 +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 B1326F84; Thu, 26 Jan 2017 10:41:57 +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 v0QAfuDp045463; Thu, 26 Jan 2017 10:41:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAfu8w045462; Thu, 26 Jan 2017 10:41:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261041.v0QAfu8w045462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:41: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: r312800 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:41:58 -0000 Author: kib Date: Thu Jan 26 10:41:56 2017 New Revision: 312800 URL: https://svnweb.freebsd.org/changeset/base/312800 Log: MFC r312407: Remove unused union member, fifos on tmpfs are implemented in common code. Modified: stable/11/sys/fs/tmpfs/tmpfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:35:04 2017 (r312799) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:41:56 2017 (r312800) @@ -259,12 +259,6 @@ struct tmpfs_node { vm_object_t tn_aobj; }tn_reg; - - /* Valid when tn_type = VFIFO */ - struct tn_fifo { - fo_rdwr_t *tn_fo_read; - fo_rdwr_t *tn_fo_write; - }tn_fifo; }tn_spec; }; LIST_HEAD(tmpfs_node_list, tmpfs_node); From owner-svn-src-all@freebsd.org Thu Jan 26 10:43: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 1BD50CC1439; Thu, 26 Jan 2017 10:43:38 +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 DCCCE1198; Thu, 26 Jan 2017 10:43:37 +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 v0QAhaii045597; Thu, 26 Jan 2017 10:43:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAhag8045596; Thu, 26 Jan 2017 10:43:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261043.v0QAhag8045596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:43:36 +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: r312801 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:43:38 -0000 Author: kib Date: Thu Jan 26 10:43:36 2017 New Revision: 312801 URL: https://svnweb.freebsd.org/changeset/base/312801 Log: MFC r312407: Remove unused union member, fifos on tmpfs are implemented in common code. Modified: stable/10/sys/fs/tmpfs/tmpfs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:41:56 2017 (r312800) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:43:36 2017 (r312801) @@ -259,12 +259,6 @@ struct tmpfs_node { vm_object_t tn_aobj; }tn_reg; - - /* Valid when tn_type = VFIFO */ - struct tn_fifo { - fo_rdwr_t *tn_fo_read; - fo_rdwr_t *tn_fo_write; - }tn_fifo; }tn_spec; }; LIST_HEAD(tmpfs_node_list, tmpfs_node); From owner-svn-src-all@freebsd.org Thu Jan 26 10:47: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 D5E3ECC16D3; Thu, 26 Jan 2017 10:47: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 99EC814AD; Thu, 26 Jan 2017 10:47: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 v0QAl55l045804; Thu, 26 Jan 2017 10:47:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAl5AA045799; Thu, 26 Jan 2017 10:47:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261047.v0QAl5AA045799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:47: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: r312802 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:47:06 -0000 Author: kib Date: Thu Jan 26 10:47:05 2017 New Revision: 312802 URL: https://svnweb.freebsd.org/changeset/base/312802 Log: MFC r312409: Style fixes and comment updates. MFC r312435: Remove mistakenly merged field. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vfsops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:47:05 2017 (r312802) @@ -80,8 +80,10 @@ struct tmpfs_dirent { uint32_t td_hash; u_int td_namelen; - /* Pointer to the node this entry refers to. In case this field - * is NULL, the node is a whiteout. */ + /* + * Pointer to the node this entry refers to. In case this field + * is NULL, the node is a whiteout. + */ struct tmpfs_node * td_node; union { @@ -94,21 +96,24 @@ struct tmpfs_dirent { } ud; }; -/* A directory in tmpfs holds a list of directory entries, which in - * turn point to other files (which can be directories themselves). +/* + * A directory in tmpfs holds a collection of directory entries, which + * in turn point to other files (which can be directories themselves). * - * In tmpfs, this list is managed by a RB-Tree, whose head is defined by - * the struct tmpfs_dir type. + * In tmpfs, this collection is managed by a RB-Tree, whose head is + * defined by the struct tmpfs_dir type. * * It is important to notice that directories do not have entries for . and * .. as other file systems do. These can be generated when requested * based on information available by other means, such as the pointer to * the node itself in the former case or the pointer to the parent directory * in the latter case. This is done to simplify tmpfs's code and, more - * importantly, to remove redundancy. */ + * importantly, to remove redundancy. + */ RB_HEAD(tmpfs_dir, tmpfs_dirent); -/* Each entry in a directory has a cookie that identifies it. Cookies +/* + * Each entry in a directory has a cookie that identifies it. Cookies * supersede offsets within directories because, given how tmpfs stores * directories in memory, there is no such thing as an offset. * @@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * a particular type. The code must be careful to only access those * attributes that are actually allowed by the node's type. * - * * Below is the key of locks used to protected the fields in the following * structures. - * + * (v) vnode lock in exclusive mode + * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and + * tn_interlock + * (i) tn_interlock + * (m) tmpfs_mount allnode_lock + * (c) stable after creation */ struct tmpfs_node { - /* Doubly-linked list entry which links all existing nodes for a - * single file system. This is provided to ease the removal of - * all nodes during the unmount operation. */ - LIST_ENTRY(tmpfs_node) tn_entries; + /* + * Doubly-linked list entry which links all existing nodes for + * a single file system. This is provided to ease the removal + * of all nodes during the unmount operation, and to support + * the implementation of VOP_VNTOCNP(). + */ + LIST_ENTRY(tmpfs_node) tn_entries; /* (m) */ - /* The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', + /* + * The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', * 'VLNK', 'VREG' and 'VSOCK' is allowed. The usage of vnode * types instead of a custom enumeration is to make things simpler - * and faster, as we do not need to convert between two types. */ - enum vtype tn_type; + * and faster, as we do not need to convert between two types. + */ + enum vtype tn_type; /* (c) */ /* Node identifier. */ - ino_t tn_id; + ino_t tn_id; /* (c) */ - /* Node's internal status. This is used by several file system + /* + * Node's internal status. This is used by several file system * operations to do modifications to the node in a delayed - * fashion. */ - int tn_status; + * fashion. + */ + int tn_status; /* (vi) */ #define TMPFS_NODE_ACCESSED (1 << 1) #define TMPFS_NODE_MODIFIED (1 << 2) #define TMPFS_NODE_CHANGED (1 << 3) - /* The node size. It does not necessarily match the real amount - * of memory consumed by it. */ - off_t tn_size; + /* + * The node size. It does not necessarily match the real amount + * of memory consumed by it. + */ + off_t tn_size; /* (v) */ /* Generic node attributes. */ - uid_t tn_uid; - gid_t tn_gid; - mode_t tn_mode; - u_long tn_flags; - nlink_t tn_links; - struct timespec tn_atime; - struct timespec tn_mtime; - struct timespec tn_ctime; - struct timespec tn_birthtime; - unsigned long tn_gen; + uid_t tn_uid; /* (v) */ + gid_t tn_gid; /* (v) */ + mode_t tn_mode; /* (v) */ + u_long tn_flags; /* (v) */ + nlink_t tn_links; /* (v) */ + struct timespec tn_atime; /* (vi) */ + struct timespec tn_mtime; /* (vi) */ + struct timespec tn_ctime; /* (vi) */ + struct timespec tn_birthtime; /* (v) */ + unsigned long tn_gen; /* (c) */ - /* As there is a single vnode for each active file within the + /* + * As there is a single vnode for each active file within the * system, care has to be taken to avoid allocating more than one * vnode per file. In order to do this, a bidirectional association * is kept between vnodes and nodes. @@ -196,70 +215,81 @@ struct tmpfs_node { * tn_vnode. * * May be NULL when the node is unused (that is, no vnode has been - * allocated for it or it has been reclaimed). */ - struct vnode * tn_vnode; + * allocated for it or it has been reclaimed). + */ + struct vnode * tn_vnode; /* (i) */ - /* Interlock to protect tn_vpstate, and tn_status under shared + /* + * Interlock to protect tn_vpstate, and tn_status under shared * vnode lock. */ struct mtx tn_interlock; - /* Identify if current node has vnode assiocate with + /* + * Identify if current node has vnode assiocate with * or allocating vnode. */ - int tn_vpstate; + int tn_vpstate; /* (i) */ /* misc data field for different tn_type node */ union { /* Valid when tn_type == VBLK || tn_type == VCHR. */ - dev_t tn_rdev; + dev_t tn_rdev; /* (c) */ /* Valid when tn_type == VDIR. */ struct tn_dir { - /* Pointer to the parent directory. The root + /* + * Pointer to the parent directory. The root * directory has a pointer to itself in this field; - * this property identifies the root node. */ + * this property identifies the root node. + */ struct tmpfs_node * tn_parent; - /* Head of a tree that links the contents of - * the directory together. */ + /* + * Head of a tree that links the contents of + * the directory together. + */ struct tmpfs_dir tn_dirhead; - /* Head of a list the contains fake directory entries + /* + * Head of a list the contains fake directory entries * heads, i.e. entries with TMPFS_DIRCOOKIE_DUPHEAD - * flag. */ + * flag. + */ struct tmpfs_dir_duphead tn_dupindex; - /* Number and pointer of the first directory entry + /* + * Number and pointer of the first directory entry * returned by the readdir operation if it were * called again to continue reading data from the * same directory as before. This is used to speed * up reads of long directories, assuming that no * more than one read is in progress at a given time. - * Otherwise, these values are discarded. */ + * Otherwise, these values are discarded. + */ off_t tn_readdir_lastn; struct tmpfs_dirent * tn_readdir_lastp; } tn_dir; /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; + char * tn_link; /* (c) */ /* Valid when tn_type == VREG. */ struct tn_reg { - /* The contents of regular files stored in a tmpfs - * file system are represented by a single anonymous - * memory object (aobj, for short). The aobj provides - * direct access to any position within the file, - * because its contents are always mapped in a - * contiguous region of virtual memory. It is a task - * of the memory management subsystem (see uvm(9)) to - * issue the required page ins or page outs whenever - * a position within the file is accessed. */ - vm_object_t tn_aobj; - - }tn_reg; - }tn_spec; + /* + * The contents of regular files stored in a + * tmpfs file system are represented by a + * single anonymous memory object (aobj, for + * short). The aobj provides direct access to + * any position within the file. It is a task + * of the memory management subsystem to issue + * the required page ins or page outs whenever + * a position within the file is accessed. + */ + vm_object_t tn_aobj; /* (c) */ + } tn_reg; + } tn_spec; /* (v) */ }; LIST_HEAD(tmpfs_node_list, tmpfs_node); @@ -303,26 +333,32 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); * Internal representation of a tmpfs mount point. */ struct tmpfs_mount { - /* Maximum number of memory pages available for use by the file + /* + * Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of * free memory; in the extreme case, it will hold the ULONG_MAX - * value. */ + * value. + */ u_long tm_pages_max; /* Number of pages in use by the file system. */ u_long tm_pages_used; - /* Pointer to the node representing the root directory of this - * file system. */ + /* + * Pointer to the node representing the root directory of this + * file system. + */ struct tmpfs_node * tm_root; - /* Maximum number of possible nodes for this file system; set + /* + * Maximum number of possible nodes for this file system; set * during mount time. We need a hard limit on the maximum number * of nodes to avoid allocating too much of them; their objects * cannot be released until the file system is unmounted. * Otherwise, we could easily run out of memory by creating lots - * of empty files and then simply removing them. */ + * of empty files and then simply removing them. + */ ino_t tm_nodes_max; /* unrhdr used to allocate inode numbers */ @@ -334,27 +370,16 @@ struct tmpfs_mount { /* maximum representable file size */ u_int64_t tm_maxfilesize; - /* Nodes are organized in two different lists. The used list - * contains all nodes that are currently used by the file system; - * i.e., they refer to existing files. The available list contains - * all nodes that are currently available for use by new files. - * Nodes must be kept in this list (instead of deleting them) - * because we need to keep track of their generation number (tn_gen - * field). - * - * Note that nodes are lazily allocated: if the available list is - * empty and we have enough space to create more nodes, they will be - * created and inserted in the used list. Once these are released, - * they will go into the available list, remaining alive until the - * file system is unmounted. */ + /* + * The used list contains all nodes that are currently used by + * the file system; i.e., they refer to existing files. + */ struct tmpfs_node_list tm_nodes_used; - /* All node lock to protect the node list and tmp_pages_used */ + /* All node lock to protect the node list and tmp_pages_used. */ struct mtx allnode_lock; - /* Pools used to store file system meta data. These are not shared - * across several instances of tmpfs for the reasons described in - * tmpfs_pool.c. */ + /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; @@ -444,10 +469,6 @@ int tmpfs_truncate(struct vnode *, off_t } while (0) /* - * Memory management stuff. - */ - -/* * Amount of memory pages to reserve for the system (e.g., to not use by * tmpfs). */ @@ -464,37 +485,34 @@ size_t tmpfs_pages_used(struct tmpfs_mou * specific ones. */ -static inline -struct tmpfs_mount * +static inline struct tmpfs_mount * VFS_TO_TMPFS(struct mount *mp) { struct tmpfs_mount *tmp; - MPASS((mp) != NULL && (mp)->mnt_data != NULL); - tmp = (struct tmpfs_mount *)(mp)->mnt_data; - return tmp; + MPASS(mp != NULL && mp->mnt_data != NULL); + tmp = (struct tmpfs_mount *)mp->mnt_data; + return (tmp); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_NODE(struct vnode *vp) { struct tmpfs_node *node; - MPASS((vp) != NULL && (vp)->v_data != NULL); + MPASS(vp != NULL && vp->v_data != NULL); node = (struct tmpfs_node *)vp->v_data; - return node; + return (node); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_DIR(struct vnode *vp) { struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); TMPFS_VALIDATE_DIR(node); - return node; + return (node); } #endif /* _FS_TMPFS_TMPFS_H_ */ Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:47:05 2017 (r312802) @@ -199,8 +199,8 @@ tmpfs_alloc_node(struct mount *mp, struc return (EBUSY); } - nnode = (struct tmpfs_node *)uma_zalloc_arg( - tmp->tm_node_pool, tmp, M_WAITOK); + nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, + M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -258,7 +258,8 @@ tmpfs_alloc_node(struct mount *mp, struc break; default: - panic("tmpfs_alloc_node: type %p %d", nnode, (int)nnode->tn_type); + panic("tmpfs_alloc_node: type %p %d", nnode, + (int)nnode->tn_type); } TMPFS_LOCK(tmp); @@ -267,25 +268,12 @@ tmpfs_alloc_node(struct mount *mp, struc TMPFS_UNLOCK(tmp); *node = nnode; - return 0; + return (0); } /* * Destroys the node pointed to by node from the file system 'tmp'. - * If the node does not belong to the given mount point, the results are - * unpredicted. - * - * If the node references a directory; no entries are allowed because - * their removal could need a recursive algorithm, something forbidden in - * kernel space. Furthermore, there is not need to provide such - * functionality (recursive removal) because the only primitives offered - * to the user are the removal of empty directories and the deletion of - * individual files. - * - * Note that nodes are not really deleted; in fact, when a node has been - * allocated, it cannot be deleted during the whole life of the file - * system. Instead, they are moved to the available list and remain there - * until reused. + * If the node references a directory, no entries are allowed. */ void tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) @@ -610,7 +598,7 @@ loop1: VN_LOCK_ASHARE(vp); error = insmntque1(vp, mp, tmpfs_insmntque_dtr, NULL); - if (error) + if (error != 0) vp = NULL; unlock: @@ -639,7 +627,7 @@ out: } #endif - return error; + return (error); } /* @@ -707,8 +695,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru /* Allocate a node that represents the new file. */ error = tmpfs_alloc_node(dvp->v_mount, tmp, vap->va_type, - cnp->cn_cred->cr_uid, - dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); + cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, + target, vap->va_rdev, &node); if (error != 0) return (error); @@ -1116,9 +1104,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) { + if (node->tn_dir.tn_parent == NULL) return (ENOENT); - } TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:47:05 2017 (r312802) @@ -190,7 +190,7 @@ tmpfs_mount(struct mount *mp) /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ if (tmpfs_mem_avail() < TMPFS_PAGES_MINRESERVED) - return ENOSPC; + return (ENOSPC); /* Get the maximum number of memory pages this file system is * allowed to use, based on the maximum size the user passed in @@ -229,27 +229,23 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_used = 0; tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), - NULL, NULL, NULL, NULL, + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), - tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, - UMA_ALIGN_PTR, 0); + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ - error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, - root_gid, root_mode & ALLPERMS, NULL, NULL, - VNOVAL, &root); + error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid, + root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); - delete_unrhdr(tmp->tm_ino_unr); - free(tmp, M_TMPFSMNT); - return error; + uma_zdestroy(tmp->tm_node_pool); + uma_zdestroy(tmp->tm_dirent_pool); + delete_unrhdr(tmp->tm_ino_unr); + free(tmp, M_TMPFSMNT); + return (error); } KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); @@ -340,12 +336,11 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); - if (!error) + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); + if (error == 0) (*vpp)->v_vflag |= VV_ROOT; - - return error; + return (error); } static int Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:43:36 2017 (r312801) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:47:05 2017 (r312802) @@ -117,10 +117,12 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (de != NULL && de->td_node == NULL) cnp->cn_flags |= ISWHITEOUT; if (de == NULL || de->td_node == NULL) { - /* The entry was not found in the directory. + /* + * The entry was not found in the directory. * This is OK if we are creating or renaming an * entry and are working on the last component of - * the path name. */ + * the path name. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == CREATE || \ cnp->cn_nameiop == RENAME || @@ -132,8 +134,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (error != 0) goto out; - /* Keep the component name in the buffer for - * future uses. */ + /* + * Keep the component name in the buffer for + * future uses. + */ cnp->cn_flags |= SAVENAME; error = EJUSTRETURN; @@ -142,14 +146,18 @@ tmpfs_lookup(struct vop_cachedlookup_arg } else { struct tmpfs_node *tnode; - /* The entry was found, so get its associated - * tmpfs_node. */ + /* + * The entry was found, so get its associated + * tmpfs_node. + */ tnode = de->td_node; - /* If we are not at the last path component and + /* + * If we are not at the last path component and * found a non-directory or non-link entry (which * may itself be pointing to a directory), raise - * an error. */ + * an error. + */ if ((tnode->tn_type != VDIR && tnode->tn_type != VLNK) && !(cnp->cn_flags & ISLASTCN)) { @@ -157,9 +165,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; } - /* If we are deleting or renaming the entry, keep + /* + * If we are deleting or renaming the entry, keep * track of its tmpfs_dirent so that it can be - * easily deleted later. */ + * easily deleted later. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { @@ -175,8 +185,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; if ((dnode->tn_mode & S_ISTXT) && - VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, cnp->cn_thread) && - VOP_ACCESS(*vpp, VADMIN, cnp->cn_cred, cnp->cn_thread)) { + VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, + cnp->cn_thread) && VOP_ACCESS(*vpp, VADMIN, + cnp->cn_cred, cnp->cn_thread)) { error = EPERM; vput(*vpp); *vpp = NULL; @@ -192,18 +203,22 @@ tmpfs_lookup(struct vop_cachedlookup_arg } } - /* Store the result of this lookup in the cache. Avoid this if the + /* + * Store the result of this lookup in the cache. Avoid this if the * request was for creation, as it does not improve timings on - * emprical tests. */ + * emprical tests. + */ if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); out: - /* If there were no errors, *vpp cannot be null and it must be - * locked. */ + /* + * If there were no errors, *vpp cannot be null and it must be + * locked. + */ MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); - return error; + return (error); } static int @@ -1390,7 +1405,7 @@ tmpfs_whiteout(struct vop_whiteout_args } /* - * vnode operations vector used for files stored in a tmpfs file system. + * Vnode operations vector used for files stored in a tmpfs file system. */ struct vop_vector tmpfs_vnodeop_entries = { .vop_default = &default_vnodeops, From owner-svn-src-all@freebsd.org Thu Jan 26 10:49: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 D8C39CC17DB; Thu, 26 Jan 2017 10:49:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4EE1755; Thu, 26 Jan 2017 10:49:46 +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 v0QAnjcs046082; Thu, 26 Jan 2017 10:49:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAnj4p046078; Thu, 26 Jan 2017 10:49:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261049.v0QAnj4p046078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:49: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: r312803 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:49:47 -0000 Author: kib Date: Thu Jan 26 10:49:45 2017 New Revision: 312803 URL: https://svnweb.freebsd.org/changeset/base/312803 Log: MFC r312409: Style fixes and comment updates. MFC r312435: Remove mistakenly merged field. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:49:45 2017 (r312803) @@ -80,8 +80,10 @@ struct tmpfs_dirent { uint32_t td_hash; u_int td_namelen; - /* Pointer to the node this entry refers to. In case this field - * is NULL, the node is a whiteout. */ + /* + * Pointer to the node this entry refers to. In case this field + * is NULL, the node is a whiteout. + */ struct tmpfs_node * td_node; union { @@ -94,21 +96,24 @@ struct tmpfs_dirent { } ud; }; -/* A directory in tmpfs holds a list of directory entries, which in - * turn point to other files (which can be directories themselves). +/* + * A directory in tmpfs holds a collection of directory entries, which + * in turn point to other files (which can be directories themselves). * - * In tmpfs, this list is managed by a RB-Tree, whose head is defined by - * the struct tmpfs_dir type. + * In tmpfs, this collection is managed by a RB-Tree, whose head is + * defined by the struct tmpfs_dir type. * * It is important to notice that directories do not have entries for . and * .. as other file systems do. These can be generated when requested * based on information available by other means, such as the pointer to * the node itself in the former case or the pointer to the parent directory * in the latter case. This is done to simplify tmpfs's code and, more - * importantly, to remove redundancy. */ + * importantly, to remove redundancy. + */ RB_HEAD(tmpfs_dir, tmpfs_dirent); -/* Each entry in a directory has a cookie that identifies it. Cookies +/* + * Each entry in a directory has a cookie that identifies it. Cookies * supersede offsets within directories because, given how tmpfs stores * directories in memory, there is no such thing as an offset. * @@ -139,51 +144,65 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * a particular type. The code must be careful to only access those * attributes that are actually allowed by the node's type. * - * * Below is the key of locks used to protected the fields in the following * structures. - * + * (v) vnode lock in exclusive mode + * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and + * tn_interlock + * (i) tn_interlock + * (m) tmpfs_mount allnode_lock + * (c) stable after creation */ struct tmpfs_node { - /* Doubly-linked list entry which links all existing nodes for a - * single file system. This is provided to ease the removal of - * all nodes during the unmount operation. */ - LIST_ENTRY(tmpfs_node) tn_entries; + /* + * Doubly-linked list entry which links all existing nodes for + * a single file system. This is provided to ease the removal + * of all nodes during the unmount operation, and to support + * the implementation of VOP_VNTOCNP(). + */ + LIST_ENTRY(tmpfs_node) tn_entries; /* (m) */ - /* The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', + /* + * The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', * 'VLNK', 'VREG' and 'VSOCK' is allowed. The usage of vnode * types instead of a custom enumeration is to make things simpler - * and faster, as we do not need to convert between two types. */ - enum vtype tn_type; + * and faster, as we do not need to convert between two types. + */ + enum vtype tn_type; /* (c) */ /* Node identifier. */ - ino_t tn_id; + ino_t tn_id; /* (c) */ - /* Node's internal status. This is used by several file system + /* + * Node's internal status. This is used by several file system * operations to do modifications to the node in a delayed - * fashion. */ - int tn_status; + * fashion. + */ + int tn_status; /* (vi) */ #define TMPFS_NODE_ACCESSED (1 << 1) #define TMPFS_NODE_MODIFIED (1 << 2) #define TMPFS_NODE_CHANGED (1 << 3) - /* The node size. It does not necessarily match the real amount - * of memory consumed by it. */ - off_t tn_size; + /* + * The node size. It does not necessarily match the real amount + * of memory consumed by it. + */ + off_t tn_size; /* (v) */ /* Generic node attributes. */ - uid_t tn_uid; - gid_t tn_gid; - mode_t tn_mode; - u_long tn_flags; - nlink_t tn_links; - struct timespec tn_atime; - struct timespec tn_mtime; - struct timespec tn_ctime; - struct timespec tn_birthtime; - unsigned long tn_gen; + uid_t tn_uid; /* (v) */ + gid_t tn_gid; /* (v) */ + mode_t tn_mode; /* (v) */ + u_long tn_flags; /* (v) */ + nlink_t tn_links; /* (v) */ + struct timespec tn_atime; /* (vi) */ + struct timespec tn_mtime; /* (vi) */ + struct timespec tn_ctime; /* (vi) */ + struct timespec tn_birthtime; /* (v) */ + unsigned long tn_gen; /* (c) */ - /* As there is a single vnode for each active file within the + /* + * As there is a single vnode for each active file within the * system, care has to be taken to avoid allocating more than one * vnode per file. In order to do this, a bidirectional association * is kept between vnodes and nodes. @@ -196,70 +215,81 @@ struct tmpfs_node { * tn_vnode. * * May be NULL when the node is unused (that is, no vnode has been - * allocated for it or it has been reclaimed). */ - struct vnode * tn_vnode; + * allocated for it or it has been reclaimed). + */ + struct vnode * tn_vnode; /* (i) */ - /* Interlock to protect tn_vpstate, and tn_status under shared + /* + * Interlock to protect tn_vpstate, and tn_status under shared * vnode lock. */ struct mtx tn_interlock; - /* Identify if current node has vnode assiocate with + /* + * Identify if current node has vnode assiocate with * or allocating vnode. */ - int tn_vpstate; + int tn_vpstate; /* (i) */ /* misc data field for different tn_type node */ union { /* Valid when tn_type == VBLK || tn_type == VCHR. */ - dev_t tn_rdev; + dev_t tn_rdev; /* (c) */ /* Valid when tn_type == VDIR. */ struct tn_dir { - /* Pointer to the parent directory. The root + /* + * Pointer to the parent directory. The root * directory has a pointer to itself in this field; - * this property identifies the root node. */ + * this property identifies the root node. + */ struct tmpfs_node * tn_parent; - /* Head of a tree that links the contents of - * the directory together. */ + /* + * Head of a tree that links the contents of + * the directory together. + */ struct tmpfs_dir tn_dirhead; - /* Head of a list the contains fake directory entries + /* + * Head of a list the contains fake directory entries * heads, i.e. entries with TMPFS_DIRCOOKIE_DUPHEAD - * flag. */ + * flag. + */ struct tmpfs_dir_duphead tn_dupindex; - /* Number and pointer of the first directory entry + /* + * Number and pointer of the first directory entry * returned by the readdir operation if it were * called again to continue reading data from the * same directory as before. This is used to speed * up reads of long directories, assuming that no * more than one read is in progress at a given time. - * Otherwise, these values are discarded. */ + * Otherwise, these values are discarded. + */ off_t tn_readdir_lastn; struct tmpfs_dirent * tn_readdir_lastp; } tn_dir; /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; + char * tn_link; /* (c) */ /* Valid when tn_type == VREG. */ struct tn_reg { - /* The contents of regular files stored in a tmpfs - * file system are represented by a single anonymous - * memory object (aobj, for short). The aobj provides - * direct access to any position within the file, - * because its contents are always mapped in a - * contiguous region of virtual memory. It is a task - * of the memory management subsystem (see uvm(9)) to - * issue the required page ins or page outs whenever - * a position within the file is accessed. */ - vm_object_t tn_aobj; - - }tn_reg; - }tn_spec; + /* + * The contents of regular files stored in a + * tmpfs file system are represented by a + * single anonymous memory object (aobj, for + * short). The aobj provides direct access to + * any position within the file. It is a task + * of the memory management subsystem to issue + * the required page ins or page outs whenever + * a position within the file is accessed. + */ + vm_object_t tn_aobj; /* (c) */ + } tn_reg; + } tn_spec; /* (v) */ }; LIST_HEAD(tmpfs_node_list, tmpfs_node); @@ -303,26 +333,32 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); * Internal representation of a tmpfs mount point. */ struct tmpfs_mount { - /* Maximum number of memory pages available for use by the file + /* + * Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of * free memory; in the extreme case, it will hold the ULONG_MAX - * value. */ + * value. + */ u_long tm_pages_max; /* Number of pages in use by the file system. */ u_long tm_pages_used; - /* Pointer to the node representing the root directory of this - * file system. */ + /* + * Pointer to the node representing the root directory of this + * file system. + */ struct tmpfs_node * tm_root; - /* Maximum number of possible nodes for this file system; set + /* + * Maximum number of possible nodes for this file system; set * during mount time. We need a hard limit on the maximum number * of nodes to avoid allocating too much of them; their objects * cannot be released until the file system is unmounted. * Otherwise, we could easily run out of memory by creating lots - * of empty files and then simply removing them. */ + * of empty files and then simply removing them. + */ ino_t tm_nodes_max; /* unrhdr used to allocate inode numbers */ @@ -334,27 +370,16 @@ struct tmpfs_mount { /* maximum representable file size */ u_int64_t tm_maxfilesize; - /* Nodes are organized in two different lists. The used list - * contains all nodes that are currently used by the file system; - * i.e., they refer to existing files. The available list contains - * all nodes that are currently available for use by new files. - * Nodes must be kept in this list (instead of deleting them) - * because we need to keep track of their generation number (tn_gen - * field). - * - * Note that nodes are lazily allocated: if the available list is - * empty and we have enough space to create more nodes, they will be - * created and inserted in the used list. Once these are released, - * they will go into the available list, remaining alive until the - * file system is unmounted. */ + /* + * The used list contains all nodes that are currently used by + * the file system; i.e., they refer to existing files. + */ struct tmpfs_node_list tm_nodes_used; - /* All node lock to protect the node list and tmp_pages_used */ + /* All node lock to protect the node list and tmp_pages_used. */ struct mtx allnode_lock; - /* Pools used to store file system meta data. These are not shared - * across several instances of tmpfs for the reasons described in - * tmpfs_pool.c. */ + /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; @@ -444,10 +469,6 @@ int tmpfs_truncate(struct vnode *, off_t } while (0) /* - * Memory management stuff. - */ - -/* * Amount of memory pages to reserve for the system (e.g., to not use by * tmpfs). */ @@ -464,37 +485,34 @@ size_t tmpfs_pages_used(struct tmpfs_mou * specific ones. */ -static inline -struct tmpfs_mount * +static inline struct tmpfs_mount * VFS_TO_TMPFS(struct mount *mp) { struct tmpfs_mount *tmp; - MPASS((mp) != NULL && (mp)->mnt_data != NULL); - tmp = (struct tmpfs_mount *)(mp)->mnt_data; - return tmp; + MPASS(mp != NULL && mp->mnt_data != NULL); + tmp = (struct tmpfs_mount *)mp->mnt_data; + return (tmp); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_NODE(struct vnode *vp) { struct tmpfs_node *node; - MPASS((vp) != NULL && (vp)->v_data != NULL); + MPASS(vp != NULL && vp->v_data != NULL); node = (struct tmpfs_node *)vp->v_data; - return node; + return (node); } -static inline -struct tmpfs_node * +static inline struct tmpfs_node * VP_TO_TMPFS_DIR(struct vnode *vp) { struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(vp); TMPFS_VALIDATE_DIR(node); - return node; + return (node); } #endif /* _FS_TMPFS_TMPFS_H_ */ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:49:45 2017 (r312803) @@ -198,8 +198,8 @@ tmpfs_alloc_node(struct mount *mp, struc return (EBUSY); } - nnode = (struct tmpfs_node *)uma_zalloc_arg( - tmp->tm_node_pool, tmp, M_WAITOK); + nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, + M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -257,7 +257,8 @@ tmpfs_alloc_node(struct mount *mp, struc break; default: - panic("tmpfs_alloc_node: type %p %d", nnode, (int)nnode->tn_type); + panic("tmpfs_alloc_node: type %p %d", nnode, + (int)nnode->tn_type); } TMPFS_LOCK(tmp); @@ -266,25 +267,12 @@ tmpfs_alloc_node(struct mount *mp, struc TMPFS_UNLOCK(tmp); *node = nnode; - return 0; + return (0); } /* * Destroys the node pointed to by node from the file system 'tmp'. - * If the node does not belong to the given mount point, the results are - * unpredicted. - * - * If the node references a directory; no entries are allowed because - * their removal could need a recursive algorithm, something forbidden in - * kernel space. Furthermore, there is not need to provide such - * functionality (recursive removal) because the only primitives offered - * to the user are the removal of empty directories and the deletion of - * individual files. - * - * Note that nodes are not really deleted; in fact, when a node has been - * allocated, it cannot be deleted during the whole life of the file - * system. Instead, they are moved to the available list and remain there - * until reused. + * If the node references a directory, no entries are allowed. */ void tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) @@ -609,7 +597,7 @@ loop1: VN_LOCK_ASHARE(vp); error = insmntque1(vp, mp, tmpfs_insmntque_dtr, NULL); - if (error) + if (error != 0) vp = NULL; unlock: @@ -638,7 +626,7 @@ out: } #endif - return error; + return (error); } /* @@ -706,8 +694,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru /* Allocate a node that represents the new file. */ error = tmpfs_alloc_node(dvp->v_mount, tmp, vap->va_type, - cnp->cn_cred->cr_uid, - dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); + cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, + target, vap->va_rdev, &node); if (error != 0) return (error); @@ -1115,9 +1103,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) { + if (node->tn_dir.tn_parent == NULL) return (ENOENT); - } TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:49:45 2017 (r312803) @@ -189,7 +189,7 @@ tmpfs_mount(struct mount *mp) /* Do not allow mounts if we do not have enough memory to preserve * the minimum reserved pages. */ if (tmpfs_mem_avail() < TMPFS_PAGES_MINRESERVED) - return ENOSPC; + return (ENOSPC); /* Get the maximum number of memory pages this file system is * allowed to use, based on the maximum size the user passed in @@ -228,27 +228,23 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_used = 0; tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), - NULL, NULL, NULL, NULL, + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), - tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, - UMA_ALIGN_PTR, 0); + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ - error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, - root_gid, root_mode & ALLPERMS, NULL, NULL, - VNOVAL, &root); + error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid, + root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); - delete_unrhdr(tmp->tm_ino_unr); - free(tmp, M_TMPFSMNT); - return error; + uma_zdestroy(tmp->tm_node_pool); + uma_zdestroy(tmp->tm_dirent_pool); + delete_unrhdr(tmp->tm_ino_unr); + free(tmp, M_TMPFSMNT); + return (error); } KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); @@ -338,12 +334,11 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); - if (!error) + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); + if (error == 0) (*vpp)->v_vflag |= VV_ROOT; - - return error; + return (error); } static int Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:47:05 2017 (r312802) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:49:45 2017 (r312803) @@ -117,10 +117,12 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (de != NULL && de->td_node == NULL) cnp->cn_flags |= ISWHITEOUT; if (de == NULL || de->td_node == NULL) { - /* The entry was not found in the directory. + /* + * The entry was not found in the directory. * This is OK if we are creating or renaming an * entry and are working on the last component of - * the path name. */ + * the path name. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == CREATE || \ cnp->cn_nameiop == RENAME || @@ -132,8 +134,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg if (error != 0) goto out; - /* Keep the component name in the buffer for - * future uses. */ + /* + * Keep the component name in the buffer for + * future uses. + */ cnp->cn_flags |= SAVENAME; error = EJUSTRETURN; @@ -142,14 +146,18 @@ tmpfs_lookup(struct vop_cachedlookup_arg } else { struct tmpfs_node *tnode; - /* The entry was found, so get its associated - * tmpfs_node. */ + /* + * The entry was found, so get its associated + * tmpfs_node. + */ tnode = de->td_node; - /* If we are not at the last path component and + /* + * If we are not at the last path component and * found a non-directory or non-link entry (which * may itself be pointing to a directory), raise - * an error. */ + * an error. + */ if ((tnode->tn_type != VDIR && tnode->tn_type != VLNK) && !(cnp->cn_flags & ISLASTCN)) { @@ -157,9 +165,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; } - /* If we are deleting or renaming the entry, keep + /* + * If we are deleting or renaming the entry, keep * track of its tmpfs_dirent so that it can be - * easily deleted later. */ + * easily deleted later. + */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { @@ -175,8 +185,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; if ((dnode->tn_mode & S_ISTXT) && - VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, cnp->cn_thread) && - VOP_ACCESS(*vpp, VADMIN, cnp->cn_cred, cnp->cn_thread)) { + VOP_ACCESS(dvp, VADMIN, cnp->cn_cred, + cnp->cn_thread) && VOP_ACCESS(*vpp, VADMIN, + cnp->cn_cred, cnp->cn_thread)) { error = EPERM; vput(*vpp); *vpp = NULL; @@ -192,18 +203,22 @@ tmpfs_lookup(struct vop_cachedlookup_arg } } - /* Store the result of this lookup in the cache. Avoid this if the + /* + * Store the result of this lookup in the cache. Avoid this if the * request was for creation, as it does not improve timings on - * emprical tests. */ + * emprical tests. + */ if ((cnp->cn_flags & MAKEENTRY) != 0) cache_enter(dvp, *vpp, cnp); out: - /* If there were no errors, *vpp cannot be null and it must be - * locked. */ + /* + * If there were no errors, *vpp cannot be null and it must be + * locked. + */ MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); - return error; + return (error); } static int @@ -1386,7 +1401,7 @@ tmpfs_whiteout(struct vop_whiteout_args } /* - * vnode operations vector used for files stored in a tmpfs file system. + * Vnode operations vector used for files stored in a tmpfs file system. */ struct vop_vector tmpfs_vnodeop_entries = { .vop_default = &default_vnodeops, From owner-svn-src-all@freebsd.org Thu Jan 26 10:53: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 D08E0CC1A61; Thu, 26 Jan 2017 10:53: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 8E9E71C0F; Thu, 26 Jan 2017 10:53: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 v0QAr5gg050139; Thu, 26 Jan 2017 10:53:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAr5WU050136; Thu, 26 Jan 2017 10:53:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261053.v0QAr5WU050136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:53: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: r312804 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:53:06 -0000 Author: kib Date: Thu Jan 26 10:53:05 2017 New Revision: 312804 URL: https://svnweb.freebsd.org/changeset/base/312804 Log: MFC r312410: Rework some tmpfs lock assertions. MFC r312412: Protect macro argument. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:53:05 2017 (r312804) @@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #ifdef INVARIANTS #define TMPFS_ASSERT_LOCKED(node) do { \ - MPASS(node != NULL); \ - MPASS(node->tn_vnode != NULL); \ - if (!VOP_ISLOCKED(node->tn_vnode) && \ - !mtx_owned(TMPFS_NODE_MTX(node))) \ - panic("tmpfs: node is not locked: %p", node); \ - } while (0) -#define TMPFS_ASSERT_ELOCKED(node) do { \ MPASS((node) != NULL); \ MPASS((node)->tn_vnode != NULL); \ - mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ - ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert"); \ } while (0) #else #define TMPFS_ASSERT_LOCKED(node) (void)0 -#define TMPFS_ASSERT_ELOCKED(node) (void)0 #endif #define TMPFS_VNODE_ALLOCATING 1 Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017 (r312804) @@ -670,7 +670,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru struct tmpfs_node *node; struct tmpfs_node *parent; - MPASS(VOP_ISLOCKED(dvp)); + ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file"); MPASS(cnp->cn_flags & HASBUF); tmp = VFS_TO_TMPFS(dvp->v_mount); Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:49:45 2017 (r312803) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:53:05 2017 (r312804) @@ -1111,7 +1111,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* No vnode should be allocated for this entry from this point */ TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); node->tn_links--; node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | @@ -1120,7 +1119,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) TMPFS_NODE_UNLOCK(node); TMPFS_NODE_LOCK(dnode); - TMPFS_ASSERT_ELOCKED(dnode); dnode->tn_links--; dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; @@ -1274,7 +1272,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v cache_purge(vp); TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, From owner-svn-src-all@freebsd.org Thu Jan 26 10:55: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 7C623CC1B39; Thu, 26 Jan 2017 10:55:58 +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 3A8481D85; Thu, 26 Jan 2017 10:55:58 +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 v0QAtvee050308; Thu, 26 Jan 2017 10:55:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAtvNp050305; Thu, 26 Jan 2017 10:55:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261055.v0QAtvNp050305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:55: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: r312805 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:55:58 -0000 Author: kib Date: Thu Jan 26 10:55:56 2017 New Revision: 312805 URL: https://svnweb.freebsd.org/changeset/base/312805 Log: MFC r312410: Rework some tmpfs lock assertions. MFC r312412: Protect macro argument. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:55:56 2017 (r312805) @@ -307,21 +307,12 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #ifdef INVARIANTS #define TMPFS_ASSERT_LOCKED(node) do { \ - MPASS(node != NULL); \ - MPASS(node->tn_vnode != NULL); \ - if (!VOP_ISLOCKED(node->tn_vnode) && \ - !mtx_owned(TMPFS_NODE_MTX(node))) \ - panic("tmpfs: node is not locked: %p", node); \ - } while (0) -#define TMPFS_ASSERT_ELOCKED(node) do { \ MPASS((node) != NULL); \ MPASS((node)->tn_vnode != NULL); \ - mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ - ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs assert"); \ } while (0) #else #define TMPFS_ASSERT_LOCKED(node) (void)0 -#define TMPFS_ASSERT_ELOCKED(node) (void)0 #endif #define TMPFS_VNODE_ALLOCATING 1 Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 10:55:56 2017 (r312805) @@ -669,7 +669,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru struct tmpfs_node *node; struct tmpfs_node *parent; - MPASS(VOP_ISLOCKED(dvp)); + ASSERT_VOP_ELOCKED(dvp, "tmpfs_alloc_file"); MPASS(cnp->cn_flags & HASBUF); tmp = VFS_TO_TMPFS(dvp->v_mount); Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:53:05 2017 (r312804) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 26 10:55:56 2017 (r312805) @@ -1107,7 +1107,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* No vnode should be allocated for this entry from this point */ TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); node->tn_links--; node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | @@ -1116,7 +1115,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) TMPFS_NODE_UNLOCK(node); TMPFS_NODE_LOCK(dnode); - TMPFS_ASSERT_ELOCKED(dnode); dnode->tn_links--; dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; @@ -1270,7 +1268,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v cache_purge(vp); TMPFS_NODE_LOCK(node); - TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, From owner-svn-src-all@freebsd.org Thu Jan 26 10:58: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 5E437CC1BE1; Thu, 26 Jan 2017 10:58:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C4811EFC; Thu, 26 Jan 2017 10:58:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QAwD4e050439; Thu, 26 Jan 2017 10:58:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QAwDFK050437; Thu, 26 Jan 2017 10:58:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261058.v0QAwDFK050437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 10:58: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: r312806 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 10:58:14 -0000 Author: kib Date: Thu Jan 26 10:58:12 2017 New Revision: 312806 URL: https://svnweb.freebsd.org/changeset/base/312806 Log: MFC r312414: Rename tmpfs_mount member allnode_lock to include namespace prefix. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:55:56 2017 (r312805) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:58:12 2017 (r312806) @@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and * tn_interlock * (i) tn_interlock - * (m) tmpfs_mount allnode_lock + * (m) tmpfs_mount tm_allnode_lock * (c) stable after creation */ struct tmpfs_node { @@ -368,7 +368,7 @@ struct tmpfs_mount { struct tmpfs_node_list tm_nodes_used; /* All node lock to protect the node list and tmp_pages_used. */ - struct mtx allnode_lock; + struct mtx tm_allnode_lock; /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; @@ -377,8 +377,9 @@ struct tmpfs_mount { /* Read-only status. */ int tm_ronly; }; -#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) -#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) +#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) +#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) +#define TMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, MA_OWNED) /* * This structure maps a file identifier to a tmpfs node. Used by the Modified: stable/11/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:55:56 2017 (r312805) +++ stable/11/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:58:12 2017 (r312806) @@ -219,7 +219,7 @@ tmpfs_mount(struct mount *mp) tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount), M_TMPFSMNT, M_WAITOK | M_ZERO); - mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); + mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); tmp->tm_nodes_max = nodes_max; tmp->tm_nodes_inuse = 0; tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX; @@ -227,7 +227,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; - tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); + tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -316,7 +316,7 @@ tmpfs_unmount(struct mount *mp, int mntf uma_zdestroy(tmp->tm_node_pool); delete_unrhdr(tmp->tm_ino_unr); - mtx_destroy(&tmp->allnode_lock); + mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); From owner-svn-src-all@freebsd.org Thu Jan 26 11:00: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 90B7BCC1D11; Thu, 26 Jan 2017 11:00:58 +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 4F1FB24D; Thu, 26 Jan 2017 11:00:58 +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 v0QB0vm0050797; Thu, 26 Jan 2017 11:00:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB0vfv050795; Thu, 26 Jan 2017 11:00:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261100.v0QB0vfv050795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:00: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: r312807 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:00:58 -0000 Author: kib Date: Thu Jan 26 11:00:57 2017 New Revision: 312807 URL: https://svnweb.freebsd.org/changeset/base/312807 Log: MFC r312414: Rename tmpfs_mount member allnode_lock to include namespace prefix. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 10:58:12 2017 (r312806) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:00:57 2017 (r312807) @@ -150,7 +150,7 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); * (vi) vnode lock in exclusive mode, or vnode lock in shared vnode and * tn_interlock * (i) tn_interlock - * (m) tmpfs_mount allnode_lock + * (m) tmpfs_mount tm_allnode_lock * (c) stable after creation */ struct tmpfs_node { @@ -368,7 +368,7 @@ struct tmpfs_mount { struct tmpfs_node_list tm_nodes_used; /* All node lock to protect the node list and tmp_pages_used. */ - struct mtx allnode_lock; + struct mtx tm_allnode_lock; /* Zones used to store file system meta data, per tmpfs mount. */ uma_zone_t tm_dirent_pool; @@ -377,8 +377,9 @@ struct tmpfs_mount { /* Read-only status. */ int tm_ronly; }; -#define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) -#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) +#define TMPFS_LOCK(tm) mtx_lock(&(tm)->tm_allnode_lock) +#define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->tm_allnode_lock) +#define TMPFS_MP_ASSERT_LOCKED(tm) mtx_assert(&(tm)->tm_allnode_lock, MA_OWNED) /* * This structure maps a file identifier to a tmpfs node. Used by the Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 10:58:12 2017 (r312806) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Thu Jan 26 11:00:57 2017 (r312807) @@ -218,7 +218,7 @@ tmpfs_mount(struct mount *mp) tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount), M_TMPFSMNT, M_WAITOK | M_ZERO); - mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); + mtx_init(&tmp->tm_allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF); tmp->tm_nodes_max = nodes_max; tmp->tm_nodes_inuse = 0; tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX; @@ -226,7 +226,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; - tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock); + tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock); tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -314,7 +314,7 @@ tmpfs_unmount(struct mount *mp, int mntf uma_zdestroy(tmp->tm_node_pool); delete_unrhdr(tmp->tm_ino_unr); - mtx_destroy(&tmp->allnode_lock); + mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); From owner-svn-src-all@freebsd.org Thu Jan 26 11:03: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 8E3F5CC1ED0; Thu, 26 Jan 2017 11:03:21 +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 3EE90882; Thu, 26 Jan 2017 11:03:21 +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 v0QB3KHd054513; Thu, 26 Jan 2017 11:03:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB3Kih054511; Thu, 26 Jan 2017 11:03:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261103.v0QB3Kih054511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:03: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: r312808 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:03:21 -0000 Author: kib Date: Thu Jan 26 11:03:19 2017 New Revision: 312808 URL: https://svnweb.freebsd.org/changeset/base/312808 Log: MFC r312425: Make tmpfs directory cursor available outside tmpfs_subr.c. Modified: stable/11/sys/fs/tmpfs/tmpfs.h stable/11/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:00:57 2017 (r312807) +++ stable/11/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:03:19 2017 (r312808) @@ -392,6 +392,11 @@ struct tmpfs_fid { unsigned long tf_gen; }; +struct tmpfs_dir_cursor { + struct tmpfs_dirent *tdc_current; + struct tmpfs_dirent *tdc_tree; +}; + #ifdef _KERNEL /* * Prototypes for tmpfs_subr.c. @@ -436,6 +441,10 @@ void tmpfs_itimes(struct vnode *, const void tmpfs_set_status(struct tmpfs_node *node, int status); void tmpfs_update(struct vnode *); int tmpfs_truncate(struct vnode *, off_t); +struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); +struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); /* * Convenience macros to simplify some logical expressions. Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:00:57 2017 (r312807) +++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017 (r312808) @@ -62,11 +62,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct tmpfs_dir_cursor { - struct tmpfs_dirent *tdc_current; - struct tmpfs_dirent *tdc_tree; -}; - SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; @@ -725,7 +720,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru return (0); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; @@ -739,7 +734,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode return (dc->tdc_current); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; From owner-svn-src-all@freebsd.org Thu Jan 26 11:04: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 BFDEACC1F51; Thu, 26 Jan 2017 11:04:28 +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 72C7A9D5; Thu, 26 Jan 2017 11:04: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 v0QB4RRE054605; Thu, 26 Jan 2017 11:04:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB4RYA054603; Thu, 26 Jan 2017 11:04:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261104.v0QB4RYA054603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:04: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: r312809 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:04:28 -0000 Author: kib Date: Thu Jan 26 11:04:27 2017 New Revision: 312809 URL: https://svnweb.freebsd.org/changeset/base/312809 Log: MFC r312425: Make tmpfs directory cursor available outside tmpfs_subr.c. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:03:19 2017 (r312808) +++ stable/10/sys/fs/tmpfs/tmpfs.h Thu Jan 26 11:04:27 2017 (r312809) @@ -392,6 +392,11 @@ struct tmpfs_fid { unsigned long tf_gen; }; +struct tmpfs_dir_cursor { + struct tmpfs_dirent *tdc_current; + struct tmpfs_dirent *tdc_tree; +}; + #ifdef _KERNEL /* * Prototypes for tmpfs_subr.c. @@ -436,6 +441,10 @@ void tmpfs_itimes(struct vnode *, const void tmpfs_set_status(struct tmpfs_node *node, int status); void tmpfs_update(struct vnode *); int tmpfs_truncate(struct vnode *, off_t); +struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); +struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node *dnode, + struct tmpfs_dir_cursor *dc); /* * Convenience macros to simplify some logical expressions. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:03:19 2017 (r312808) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 26 11:04:27 2017 (r312809) @@ -61,11 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct tmpfs_dir_cursor { - struct tmpfs_dirent *tdc_current; - struct tmpfs_dirent *tdc_tree; -}; - SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; @@ -724,7 +719,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru return (0); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; @@ -738,7 +733,7 @@ tmpfs_dir_first(struct tmpfs_node *dnode return (dc->tdc_current); } -static struct tmpfs_dirent * +struct tmpfs_dirent * tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { struct tmpfs_dirent *de; From owner-svn-src-all@freebsd.org Thu Jan 26 11:06: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 68119CC203A; Thu, 26 Jan 2017 11:06:40 +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 4008FB65; Thu, 26 Jan 2017 11:06:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QB6dRd054733; Thu, 26 Jan 2017 11:06:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB6dVW054732; Thu, 26 Jan 2017 11:06:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261106.v0QB6dVW054732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:06: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: r312810 - stable/11/share/man/man5 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:06:40 -0000 Author: kib Date: Thu Jan 26 11:06:39 2017 New Revision: 312810 URL: https://svnweb.freebsd.org/changeset/base/312810 Log: MFC r312423: Refresh tmpfs(5) man page. MFC r312648: Editing and clarifications for tmpfs(5). Modified: stable/11/share/man/man5/tmpfs.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/tmpfs.5 ============================================================================== --- stable/11/share/man/man5/tmpfs.5 Thu Jan 26 11:04:27 2017 (r312809) +++ stable/11/share/man/man5/tmpfs.5 Thu Jan 26 11:06:39 2017 (r312810) @@ -1,7 +1,12 @@ .\"- .\" Copyright (c) 2007 Xin LI +.\" Copyright (c) 2017 The FreeBSD Foundation, Inc. .\" All rights reserved. .\" +.\" Part of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -49,12 +54,12 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2012 +.Dd January 17, 2017 .Dt TMPFS 5 .Os .Sh NAME .Nm tmpfs -.Nd "efficient memory file system" +.Nd "in-memory file system" .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -72,17 +77,40 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver will permit the -.Fx -kernel to access +driver implements an in-memory, or .Tn tmpfs -file systems. +file system. +The filesystem stores both file metadata and data in main memory. +This allows very fast and low latency accesses to the data. +The data is volatile. +An umount or system reboot invalidates it. +These properties make the filesystem's mounts suitable for fast +scratch storage, like +.Pa /tmp . +.Pp +If the system becomes low on memory and swap is configured (see +.Xr swapon 8 ), +the system can transfer file data to swap space, freeing memory +for other needs. +Metadata, including the directory content, is never swapped out by the +current implementation. +Keep this in mind when planning the mount limits, especially when expecting +to place many small files on a tmpfs mount. +.Pp +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of +the file data. +This quirk causes process inspection tools, like +.Xr procstat 1 , +to report anonymous memory mappings instead of file mappings. .Sh OPTIONS The following options are available when mounting .Nm file systems: -.Bl -tag -width indent +.Bl -tag -width "It Cm maxfilesize" .It Cm gid Specifies the group ID of the root inode of the file system. Defaults to the mount point's GID. @@ -114,11 +142,15 @@ memory file system: .Pp .Dl "mount -t tmpfs tmpfs /tmp" .Sh SEE ALSO +.Xr procstat 1 , .Xr nmount 2 , +.Xr mmap 2 , .Xr unmount 2 , .Xr fstab 5 , .Xr mdmfs 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr swapinfo 8 , +.Xr swapon 8 .Sh HISTORY The .Nm @@ -130,7 +162,7 @@ The .Nm kernel implementation was written by .An Julio M. Merino Vidal Aq Mt jmmv@NetBSD.org -as a Google SoC project. +as a Google Summer of Code project. .Pp .An Rohit Jalan and others ported it from @@ -140,5 +172,3 @@ to .Pp This manual page was written by .An Xin LI Aq Mt delphij@FreeBSD.org . -.Sh BUGS -Some file system mount time options may not be well-supported. From owner-svn-src-all@freebsd.org Thu Jan 26 11:07: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 F1016CC20DB; Thu, 26 Jan 2017 11:07:37 +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 C9015CBE; Thu, 26 Jan 2017 11:07:37 +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 v0QB7aBC054824; Thu, 26 Jan 2017 11:07:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QB7aQO054823; Thu, 26 Jan 2017 11:07:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201701261107.v0QB7aQO054823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Jan 2017 11:07:36 +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: r312811 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:07:38 -0000 Author: kib Date: Thu Jan 26 11:07:36 2017 New Revision: 312811 URL: https://svnweb.freebsd.org/changeset/base/312811 Log: MFC r312423: Refresh tmpfs(5) man page. MFC r312648: Editing and clarifications for tmpfs(5). Modified: stable/10/share/man/man5/tmpfs.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man5/tmpfs.5 ============================================================================== --- stable/10/share/man/man5/tmpfs.5 Thu Jan 26 11:06:39 2017 (r312810) +++ stable/10/share/man/man5/tmpfs.5 Thu Jan 26 11:07:36 2017 (r312811) @@ -1,7 +1,12 @@ .\"- .\" Copyright (c) 2007 Xin LI +.\" Copyright (c) 2017 The FreeBSD Foundation, Inc. .\" All rights reserved. .\" +.\" Part of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -49,12 +54,12 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2012 +.Dd January 17, 2017 .Dt TMPFS 5 .Os .Sh NAME .Nm tmpfs -.Nd "efficient memory file system" +.Nd "in-memory file system" .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -72,17 +77,40 @@ tmpfs_load="YES" .Sh DESCRIPTION The .Nm -driver will permit the -.Fx -kernel to access +driver implements an in-memory, or .Tn tmpfs -file systems. +file system. +The filesystem stores both file metadata and data in main memory. +This allows very fast and low latency accesses to the data. +The data is volatile. +An umount or system reboot invalidates it. +These properties make the filesystem's mounts suitable for fast +scratch storage, like +.Pa /tmp . +.Pp +If the system becomes low on memory and swap is configured (see +.Xr swapon 8 ), +the system can transfer file data to swap space, freeing memory +for other needs. +Metadata, including the directory content, is never swapped out by the +current implementation. +Keep this in mind when planning the mount limits, especially when expecting +to place many small files on a tmpfs mount. +.Pp +When +.Xr mmap 2 +is used on a file from a tmpfs mount, the swap VM object managing the +file pages is used to implement mapping and avoid double-copying of +the file data. +This quirk causes process inspection tools, like +.Xr procstat 1 , +to report anonymous memory mappings instead of file mappings. .Sh OPTIONS The following options are available when mounting .Nm file systems: -.Bl -tag -width indent +.Bl -tag -width "It Cm maxfilesize" .It Cm gid Specifies the group ID of the root inode of the file system. Defaults to the mount point's GID. @@ -114,11 +142,15 @@ memory file system: .Pp .Dl "mount -t tmpfs tmpfs /tmp" .Sh SEE ALSO +.Xr procstat 1 , .Xr nmount 2 , +.Xr mmap 2 , .Xr unmount 2 , .Xr fstab 5 , .Xr mdmfs 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr swapinfo 8 , +.Xr swapon 8 .Sh HISTORY The .Nm @@ -130,7 +162,7 @@ The .Nm kernel implementation was written by .An Julio M. Merino Vidal Aq jmmv@NetBSD.org -as a Google SoC project. +as a Google Summer of Code project. .Pp .An Rohit Jalan and others ported it from @@ -140,5 +172,3 @@ to .Pp This manual page was written by .An Xin LI Aq delphij@FreeBSD.org . -.Sh BUGS -Some file system mount time options may not be well-supported. From owner-svn-src-all@freebsd.org Thu Jan 26 11: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 4FD1ACC22E4; Thu, 26 Jan 2017 11:14:25 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0322A185; Thu, 26 Jan 2017 11:14:24 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QBEOkT058597; Thu, 26 Jan 2017 11:14:24 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QBEOLh058596; Thu, 26 Jan 2017 11:14:24 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201701261114.v0QBEOLh058596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 26 Jan 2017 11:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312812 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 11:14:25 -0000 Author: wma Date: Thu Jan 26 11:14:23 2017 New Revision: 312812 URL: https://svnweb.freebsd.org/changeset/base/312812 Log: Add dummy functions for Marvell SoC's not equipped with AHCI Commit r312747 ("Setup decoding windows for ARMADA38X") resulted in build failing for Marvell platforms, which don't have AHCI controller. This patch provides a fix by adding dummy functions for such cases. On the occasion rename register dump routine to decode_win_ahci_dump, in order to avoid confusion. Submitted by: Marcin Wojtas Obtained from: Semihalf Sponsored by: Stormshield Modified: head/sys/arm/mv/mv_common.c Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Thu Jan 26 11:07:36 2017 (r312811) +++ head/sys/arm/mv/mv_common.c Thu Jan 26 11:14:23 2017 (r312812) @@ -108,7 +108,7 @@ static void decode_win_usb3_dump(u_long) static void decode_win_eth_dump(u_long base); static void decode_win_idma_dump(u_long base); static void decode_win_xor_dump(u_long base); -static void decode_win_sata_dump(u_long base); +static void decode_win_ahci_dump(u_long base); static int fdt_get_ranges(const char *, void *, int, int *, int *); #ifdef SOC_MV_ARMADA38X @@ -141,7 +141,7 @@ static struct soc_node_spec soc_nodes[] { "mrvl,ge", &decode_win_eth_setup, &decode_win_eth_dump }, { "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump }, { "marvell,armada-380-xhci", &decode_win_usb3_setup, &decode_win_usb3_dump }, - { "marvell,armada-380-ahci", &decode_win_ahci_setup, &decode_win_sata_dump }, + { "marvell,armada-380-ahci", &decode_win_ahci_setup, &decode_win_ahci_dump }, { "mrvl,sata", &decode_win_sata_setup, NULL }, { "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump }, { "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump }, @@ -2007,6 +2007,10 @@ decode_win_sata_setup(u_long base) } } +#ifdef SOC_MV_ARMADA38X +/* + * Configure AHCI decoding windows + */ static void decode_win_ahci_setup(u_long base) { @@ -2046,7 +2050,7 @@ decode_win_ahci_setup(u_long base) } static void -decode_win_sata_dump(u_long base) +decode_win_ahci_dump(u_long base) { int i; @@ -2056,6 +2060,22 @@ decode_win_sata_dump(u_long base) win_sata_sz_read(base,i)); } +#else +/* + * Provide dummy functions to satisfy the build + * for SoC's not equipped with AHCI controller + */ +static void +decode_win_ahci_setup(u_long base) +{ +} + +static void +decode_win_ahci_dump(u_long base) +{ +} +#endif + static int decode_win_sata_valid(void) { From owner-svn-src-all@freebsd.org Thu Jan 26 11:16: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 E5056CC23E9 for ; Thu, 26 Jan 2017 11:16:10 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EF0837F for ; Thu, 26 Jan 2017 11:16:10 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-qt0-x22e.google.com with SMTP id k15so68683362qtg.3 for ; Thu, 26 Jan 2017 03:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=H/ywi2M8+5I+IcnbecGRvSZf9p65dSHh8quoeBCWyWY=; b=LlHHXw9UPhufxJErwa/KQMD/++p4oliz5lBpCBJ1c1S7oqm2LDc28Trk0VzTw8rcXg No7/PGMZyQMVQJBxjMYpNBhZPARcUwRoHV/q0RS2MaH874xYchHm/GGWo6Oe97qRJ0aS 29/kgaLjHjrsdNtSrrNVuQTE+Q58hIC4ixOOPrQ+6rNEbtNT/vh1LWCqyMguQrpEVuM+ DlsJk6baaAT/cDIUXlJNyLNaEm/Y2no0g0uQbGx8m/oIWT4KwmLu+Gpn676IxkR8Sdm9 Olw0l1fjMtBHVY6QHIoMXHEjxwsgOgiTlG0USFWH9138SDpBA4r/khtzNs5zs/9vUzrZ nFEw== 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=H/ywi2M8+5I+IcnbecGRvSZf9p65dSHh8quoeBCWyWY=; b=iXChWGc8cfhqhrLSsrMMYyhsixNdmszgiJxWw+L+02G5XTBGe1PqGIgT8RFVemhrko pq9dJELIMKBLNL2Rd36++UjLBXR21esQsvr9uk2qqluhr6xWDUMe5z4HT1EufU8/WFVZ b3/2E7uj4C9HtgCcAJuY01YY141SwgMK3qRegSXJbUTdc0etWOIXwa6/cWh4S1mLjBi+ CcjtzKebYc0FmMEj7yrq4G2wk9+/LZ+eQbhD9NpzXoxgp3HgytPuY8dDCvagdcNCM8Oe 5xFudwXezkCqsfZZJ+a8gn17mAExS3jOgk7MC3fNs1heRDpJvO613pdqtjeK44iSW+Rv HROQ== X-Gm-Message-State: AIkVDXKoPw+8qebTPnFm4ELQGN6+UZ/BW2aBGBrTQrTb/5Hqu9au+A9N28ZYwfIJexK60MNC51qcY8QyEZ1j5Q== X-Received: by 10.233.232.8 with SMTP id a8mr2248277qkg.100.1485429369820; Thu, 26 Jan 2017 03:16:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.55.130 with HTTP; Thu, 26 Jan 2017 03:15:49 -0800 (PST) In-Reply-To: References: <201701251031.v0PAVGlM050105@repo.freebsd.org> From: Wojciech Macek Date: Thu, 26 Jan 2017 12:15:49 +0100 Message-ID: Subject: Re: svn commit: r312747 - head/sys/arm/mv To: Ed Maste Cc: Wojciech Macek , "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: Thu, 26 Jan 2017 11:16:11 -0000 Fixed in https://svnweb.freebsd.org/changeset/base/312812 Regards, Wojtek 2017-01-26 2:56 GMT+01:00 Ed Maste : > On 25 January 2017 at 05:31, Wojciech Macek wrote: > > Author: wma > > Date: Wed Jan 25 10:31:16 2017 > > New Revision: 312747 > > URL: https://svnweb.freebsd.org/changeset/base/312747 > > > > Log: > > Setup decoding windows for ARMADA38X > > > > It is necesarry to open memory windows on internal bus for > > AHCI driver to work correctly. > > Build broken with: > > /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2019:3: error: > implicit declaration of function 'win_sata_sz_write' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > win_sata_sz_write(base, i, 0); > ^ > /scratch/tmp/emaste/freebsd/sys/arm/mv/mv_common.c:2024:25: error: use > of undeclared identifier 'IO_WIN_ATTR_SHIFT' > cr = (ddr_attr(i) << IO_WIN_ATTR_SHIFT) | > ^ > ... > From owner-svn-src-all@freebsd.org Thu Jan 26 13:04: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 12536CC1729; Thu, 26 Jan 2017 13:04:16 +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 D5F61FE5; Thu, 26 Jan 2017 13:04:15 +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 v0QD4Ed3003359; Thu, 26 Jan 2017 13:04:14 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QD4Ex3003357; Thu, 26 Jan 2017 13:04:14 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201701261304.v0QD4Ex3003357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 26 Jan 2017 13:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312813 - in head/sys: arm/mv dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 13:04:16 -0000 Author: andrew Date: Thu Jan 26 13:04:14 2017 New Revision: 312813 URL: https://svnweb.freebsd.org/changeset/base/312813 Log: Make fdt_pm_mask_table internal to the Marvell code, it's unued anywhere else. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/mv/mv_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Thu Jan 26 11:14:23 2017 (r312812) +++ head/sys/arm/mv/mv_common.c Thu Jan 26 13:04:14 2017 (r312813) @@ -149,7 +149,12 @@ static struct soc_node_spec soc_nodes[] { NULL, NULL, NULL }, }; -struct fdt_pm_mask_entry fdt_pm_mask_table[] = { +struct fdt_pm_mask_entry { + char *compat; + uint32_t mask; +}; + +static struct fdt_pm_mask_entry fdt_pm_mask_table[] = { { "mrvl,ge", CPU_PM_CTRL_GE(0) }, { "mrvl,ge", CPU_PM_CTRL_GE(1) }, { "mrvl,usb-ehci", CPU_PM_CTRL_USB(0) }, Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Thu Jan 26 11:14:23 2017 (r312812) +++ head/sys/dev/fdt/fdt_common.h Thu Jan 26 13:04:14 2017 (r312813) @@ -71,12 +71,6 @@ extern vm_paddr_t fdt_immr_pa; extern vm_offset_t fdt_immr_va; extern vm_offset_t fdt_immr_size; -struct fdt_pm_mask_entry { - char *compat; - uint32_t mask; -}; -extern struct fdt_pm_mask_entry fdt_pm_mask_table[]; - #if defined(FDT_DTB_STATIC) extern u_char fdt_static_dtb; #endif From owner-svn-src-all@freebsd.org Thu Jan 26 13:46: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 40052CC1482; Thu, 26 Jan 2017 13:46:49 +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 0C95994C; Thu, 26 Jan 2017 13:46: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 v0QDkm6L019459; Thu, 26 Jan 2017 13:46:48 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QDkm2D019458; Thu, 26 Jan 2017 13:46:48 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701261346.v0QDkm2D019458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 26 Jan 2017 13:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312814 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 13:46:49 -0000 Author: sbruno Date: Thu Jan 26 13:46:47 2017 New Revision: 312814 URL: https://svnweb.freebsd.org/changeset/base/312814 Log: Shoot a couple of style bugs down in the macro declarations. Submitted by: bde Modified: head/sys/sys/gtaskqueue.h Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Thu Jan 26 13:04:14 2017 (r312813) +++ head/sys/sys/gtaskqueue.h Thu Jan 26 13:46:47 2017 (r312814) @@ -80,7 +80,6 @@ int taskqgroup_adjust(struct taskqgroup #define TASKQGROUP_DECLARE(name) \ extern struct taskqgroup *qgroup_##name - #ifdef EARLY_AP_STARTUP #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ @@ -94,8 +93,7 @@ taskqgroup_define_##name(void *arg) } \ \ SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ - taskqgroup_define_##name, NULL) \ - + taskqgroup_define_##name, NULL) #else /* !EARLY_AP_STARTUP */ #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ @@ -117,8 +115,7 @@ taskqgroup_adjust_##name(void *arg) } \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ - taskqgroup_adjust_##name, NULL) \ - + taskqgroup_adjust_##name, NULL) #endif /* EARLY_AP_STARTUP */ TASKQGROUP_DECLARE(net); From owner-svn-src-all@freebsd.org Thu Jan 26 13:48: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 F168CCC1505; Thu, 26 Jan 2017 13:48:46 +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 C12A2AD1; Thu, 26 Jan 2017 13:48:46 +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 v0QDmj1o019563; Thu, 26 Jan 2017 13:48:45 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QDmjaV019562; Thu, 26 Jan 2017 13:48:45 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701261348.v0QDmjaV019562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 26 Jan 2017 13:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312815 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 13:48:47 -0000 Author: sbruno Date: Thu Jan 26 13:48:45 2017 New Revision: 312815 URL: https://svnweb.freebsd.org/changeset/base/312815 Log: A few more style bugs lying around in here. Submitted by: bde Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Thu Jan 26 13:46:47 2017 (r312814) +++ head/sys/kern/subr_gtaskqueue.c Thu Jan 26 13:48:45 2017 (r312815) @@ -630,6 +630,7 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } + /* * smp_started is unusable since it is not set for UP kernels or even for * SMP kernels when there is 1 CPU. This is usually handled by adding a @@ -643,6 +644,7 @@ taskqgroup_find(struct taskqgroup *qgrou * SI_ORDER_ANY and unclearly after the CPUs are started. It would be * simpler for adjustment to pass a flag indicating if it is delayed. */ + static int tqg_smp_started; static void @@ -670,7 +672,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && tqg_smp_started ) { + if (irq != -1 && tqg_smp_started) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); From owner-svn-src-all@freebsd.org Thu Jan 26 13:50: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 2817DCC164F; Thu, 26 Jan 2017 13:50:11 +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 E52AFD50; Thu, 26 Jan 2017 13:50:10 +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 v0QDoAlJ019677; Thu, 26 Jan 2017 13:50:10 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QDoAgH019676; Thu, 26 Jan 2017 13:50:10 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701261350.v0QDoAgH019676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 26 Jan 2017 13:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312816 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 13:50:11 -0000 Author: sbruno Date: Thu Jan 26 13:50:09 2017 New Revision: 312816 URL: https://svnweb.freebsd.org/changeset/base/312816 Log: Minor style annoyance. Submitted by: bde Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Jan 26 13:48:45 2017 (r312815) +++ head/sys/net/iflib.c Thu Jan 26 13:50:09 2017 (r312816) @@ -3755,6 +3755,7 @@ iflib_device_register(device_t dev, void device_printf(dev, "qset structure setup failed %d\n", err); goto fail_queues; } + /* * Group taskqueues aren't properly set up until SMP is started, * so we disable interrupts until we can handle them post From owner-svn-src-all@freebsd.org Thu Jan 26 16:36: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 9970ACC31A7; Thu, 26 Jan 2017 16:36:13 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67FE9E9C; Thu, 26 Jan 2017 16:36:13 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QGaCPQ091380; Thu, 26 Jan 2017 16:36:12 GMT (envelope-from obrien@FreeBSD.org) Received: (from obrien@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QGaCN3091379; Thu, 26 Jan 2017 16:36:12 GMT (envelope-from obrien@FreeBSD.org) Message-Id: <201701261636.v0QGaCN3091379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: obrien set sender to obrien@FreeBSD.org using -f From: "David E. O'Brien" Date: Thu, 26 Jan 2017 16:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312818 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 16:36:13 -0000 Author: obrien Date: Thu Jan 26 16:36:12 2017 New Revision: 312818 URL: https://svnweb.freebsd.org/changeset/base/312818 Log: Correct grammar. Modified: head/share/man/man9/printf.9 Modified: head/share/man/man9/printf.9 ============================================================================== --- head/share/man/man9/printf.9 Thu Jan 26 15:37:53 2017 (r312817) +++ head/share/man/man9/printf.9 Thu Jan 26 16:36:12 2017 (r312818) @@ -111,7 +111,7 @@ It requires two arguments: a pointer and a .Vt "char *" string. -The memory pointed to be the pointer is output in hexadecimal one byte at +The memory pointed to by the pointer is output in hexadecimal one byte at a time. The string is used as a delimiter between individual bytes. If present, a width directive will specify the number of bytes to display. From owner-svn-src-all@freebsd.org Thu Jan 26 16: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 2065BCC33B1; Thu, 26 Jan 2017 16:38:55 +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 CA280126D; Thu, 26 Jan 2017 16:38:54 +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 v0QGcrGn091533; Thu, 26 Jan 2017 16:38:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QGcroW091532; Thu, 26 Jan 2017 16:38:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201701261638.v0QGcroW091532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 26 Jan 2017 16:38:53 +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: r312819 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 16:38:55 -0000 Author: avg Date: Thu Jan 26 16:38:53 2017 New Revision: 312819 URL: https://svnweb.freebsd.org/changeset/base/312819 Log: MFC r312532: don't abort writing of a core dump after EFAULT Note that this change substantially differs from the change in head because of an unmerged earlier change that probably can not be merged for POLA reasons. Modified: stable/10/sys/kern/imgact_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/imgact_elf.c ============================================================================== --- stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:36:12 2017 (r312818) +++ stable/10/sys/kern/imgact_elf.c Thu Jan 26 16:38:53 2017 (r312819) @@ -1176,9 +1176,31 @@ core_output(struct vnode *vp, void *base panic("shouldn't be here"); #endif } else { + /* + * EFAULT is a non-fatal error that we can get, for example, + * if the segment is backed by a file but extends beyond its + * end. + */ error = vn_rdwr_inchunks(UIO_WRITE, vp, base, len, offset, UIO_USERSPACE, IO_UNIT | IO_DIRECT, active_cred, file_cred, NULL, td); + if (error == EFAULT) { + log(LOG_WARNING, "Failed to fully fault in a core file " + "segment at VA %p with size 0x%zx to be written at " + "offset 0x%jx for process %s\n", base, len, offset, + curproc->p_comm); + + /* + * Write a "real" zero byte at the end of the target + * region in the case this is the last segment. + * The intermediate space will be implicitly + * zero-filled. + */ + error = vn_rdwr_inchunks(UIO_WRITE, vp, + __DECONST(void *, zero_region), 1, offset + len - 1, + UIO_SYSSPACE, IO_UNIT | IO_DIRECT, active_cred, + file_cred, NULL, td); + } } return (error); } @@ -2309,7 +2331,16 @@ compress_core (gzFile file, char *inbuf, while (len) { if (inbuf != NULL) { chunk_len = (len > CORE_BUF_SIZE) ? CORE_BUF_SIZE : len; - copyin(inbuf, dest_buf, chunk_len); + + /* + * We can get EFAULT error here. In that case zero out + * the current chunk of the segment. + */ + error = copyin(inbuf, dest_buf, chunk_len); + if (error != 0) { + bzero(dest_buf, chunk_len); + error = 0; + } inbuf += chunk_len; } else { chunk_len = len; From owner-svn-src-all@freebsd.org Thu Jan 26 17:07: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 D9F24CC3A38; Thu, 26 Jan 2017 17:07:26 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A686366D; Thu, 26 Jan 2017 17:07:26 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cWnW1-0001Tf-IY; Thu, 26 Jan 2017 18:07:18 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Alexander Kabaev" Subject: Re: svn commit: r311993 - head/sys/dev/nand References: <201701121805.v0CI5CYg090736@repo.freebsd.org> Date: Thu, 26 Jan 2017 18:07:05 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201701121805.v0CI5CYg090736@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 autolearn=disabled version=3.4.0 X-Scan-Signature: 9090f8a1960d7f777b94d17b6f36e747 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 17:07:27 -0000 Should this be merged to 11-stable also? I got a build failure on this with 11/arm. Ronald. On Thu, 12 Jan 2017 19:05:12 +0100, Alexander Kabaev wrote: > Author: kan > Date: Thu Jan 12 18:05:12 2017 > New Revision: 311993 > URL: https://svnweb.freebsd.org/changeset/base/311993 > > Log: > Fix typo in r311971. > Reported by: ohartmann at walstatt.org > > Modified: > head/sys/dev/nand/nand_geom.c > > Modified: head/sys/dev/nand/nand_geom.c > ============================================================================== > --- head/sys/dev/nand/nand_geom.c Thu Jan 12 17:54:55 2017 (r311992) > +++ head/sys/dev/nand/nand_geom.c Thu Jan 12 18:05:12 2017 (r311993) > @@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip) > snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), > "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, > chip->id.dev_id); > - disk->d_rotation_rate = DISK_RR_NON_ROTATING; > + rdisk->d_rotation_rate = DISK_RR_NON_ROTATING; > disk_create(rdisk, DISK_VERSION); > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Thu Jan 26 17: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 94477CC29CF; Thu, 26 Jan 2017 17:59:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61848E97; Thu, 26 Jan 2017 17:59:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QHxsxD024884; Thu, 26 Jan 2017 17:59:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QHxskU024883; Thu, 26 Jan 2017 17:59:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701261759.v0QHxskU024883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Jan 2017 17:59:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312820 - head/sys/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 17:59:55 -0000 Author: emaste Date: Thu Jan 26 17:59:54 2017 New Revision: 312820 URL: https://svnweb.freebsd.org/changeset/base/312820 Log: Disconnect netfpga10g module from the build It only builds with the non-default DEVICE_POLLING option. Approved by: bz Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Jan 26 16:38:53 2017 (r312819) +++ head/sys/modules/Makefile Thu Jan 26 17:59:54 2017 (r312820) @@ -265,7 +265,6 @@ SUBDIR= \ ${_nctgpio} \ ${_ncv} \ ${_ndis} \ - netfpga10g \ ${_netgraph} \ ${_nfe} \ nfscl \ From owner-svn-src-all@freebsd.org Thu Jan 26 18:05: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 09EF5CC2BD8; Thu, 26 Jan 2017 18:05:33 +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 C07201303; Thu, 26 Jan 2017 18:05: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 v0QI5VEo028933; Thu, 26 Jan 2017 18:05:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QI5VoB028931; Thu, 26 Jan 2017 18:05:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701261805.v0QI5VoB028931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Jan 2017 18:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312821 - in head/sys/modules: . usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 18:05:33 -0000 Author: emaste Date: Thu Jan 26 18:05:31 2017 New Revision: 312821 URL: https://svnweb.freebsd.org/changeset/base/312821 Log: mips: exclude modules that fail to build Modified: head/sys/modules/Makefile head/sys/modules/usb/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Jan 26 17:59:54 2017 (r312820) +++ head/sys/modules/Makefile Thu Jan 26 18:05:31 2017 (r312821) @@ -503,13 +503,16 @@ _bce= bce _fatm= fatm _fxp= fxp _ispfw= ispfw +_sf= sf +_ti= ti +_txp= txp + +.if ${MACHINE_CPUARCH} != "mips" _mwlfw= mwlfw _otusfw= otusfw _ralfw= ralfw _rtwnfw= rtwnfw -_sf= sf -_ti= ti -_txp= txp +.endif .endif .if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \ Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Thu Jan 26 17:59:54 2017 (r312820) +++ head/sys/modules/usb/Makefile Thu Jan 26 18:05:31 2017 (r312821) @@ -70,9 +70,12 @@ _uath= uath _zyd= zyd _kue= kue _run= run -_runfw= runfw _rsu= rsu + +.if ${MACHINE_CPUARCH} != "mips" _rsufw= rsufw +_runfw= runfw +.endif .endif .if ${MACHINE_CPUARCH} == "amd64" From owner-svn-src-all@freebsd.org Thu Jan 26 18:18: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 1DF19CC30BB; Thu, 26 Jan 2017 18:18:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEEE31DEF; Thu, 26 Jan 2017 18:18:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QIIZcH033461; Thu, 26 Jan 2017 18:18:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QIIZNn033460; Thu, 26 Jan 2017 18:18:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701261818.v0QIIZNn033460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Jan 2017 18:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312822 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 18:18:37 -0000 Author: emaste Date: Thu Jan 26 18:18:35 2017 New Revision: 312822 URL: https://svnweb.freebsd.org/changeset/base/312822 Log: Enable modules in the MIPS ERL kernel config As reported by cperciva[1], modules are beneficial for typical Edgerouter Lite use cases. [1] http://www.daemonology.net/blog/2016-01-10-FreeBSD-EdgeRouter-Lite.html Modified: head/sys/mips/conf/ERL Modified: head/sys/mips/conf/ERL ============================================================================== --- head/sys/mips/conf/ERL Thu Jan 26 18:05:31 2017 (r312821) +++ head/sys/mips/conf/ERL Thu Jan 26 18:18:35 2017 (r312822) @@ -24,8 +24,6 @@ ident ERL makeoptions ARCH_FLAGS="-march=octeon -mabi=64" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 -# Don't build any modules yet. -makeoptions MODULES_OVERRIDE="" makeoptions KERNLOADADDR=0xffffffff80100000 # We don't need to build a trampolined version of the kernel. From owner-svn-src-all@freebsd.org Thu Jan 26 18:32: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 A6E20CC35F5; Thu, 26 Jan 2017 18:32:16 +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 4500ABA5; Thu, 26 Jan 2017 18:32:16 +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 v0QIWFr0042934; Thu, 26 Jan 2017 18:32:15 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QIWCt1042905; Thu, 26 Jan 2017 18:32:12 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261832.v0QIWCt1042905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 18:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312823 - in vendor-crypto/openssl/dist: . apps crypto crypto/aes/asm crypto/asn1 crypto/bn crypto/bn/asm crypto/cms crypto/dh crypto/dsa crypto/ec crypto/ecdh crypto/err crypto/evp cry... X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 18:32:16 -0000 Author: jkim Date: Thu Jan 26 18:32:12 2017 New Revision: 312823 URL: https://svnweb.freebsd.org/changeset/base/312823 Log: Import OpenSSL 1.0.2k. Modified: vendor-crypto/openssl/dist/CHANGES vendor-crypto/openssl/dist/CONTRIBUTING vendor-crypto/openssl/dist/Configure vendor-crypto/openssl/dist/INSTALL vendor-crypto/openssl/dist/Makefile vendor-crypto/openssl/dist/Makefile.org vendor-crypto/openssl/dist/NEWS vendor-crypto/openssl/dist/README vendor-crypto/openssl/dist/apps/apps.c vendor-crypto/openssl/dist/apps/apps.h vendor-crypto/openssl/dist/apps/ca.c vendor-crypto/openssl/dist/apps/cms.c vendor-crypto/openssl/dist/apps/dgst.c vendor-crypto/openssl/dist/apps/dh.c vendor-crypto/openssl/dist/apps/dhparam.c vendor-crypto/openssl/dist/apps/dsa.c vendor-crypto/openssl/dist/apps/dsaparam.c vendor-crypto/openssl/dist/apps/ec.c vendor-crypto/openssl/dist/apps/ecparam.c vendor-crypto/openssl/dist/apps/enc.c vendor-crypto/openssl/dist/apps/gendh.c vendor-crypto/openssl/dist/apps/gendsa.c vendor-crypto/openssl/dist/apps/genpkey.c vendor-crypto/openssl/dist/apps/genrsa.c vendor-crypto/openssl/dist/apps/pkcs12.c vendor-crypto/openssl/dist/apps/pkcs7.c vendor-crypto/openssl/dist/apps/pkcs8.c vendor-crypto/openssl/dist/apps/pkey.c vendor-crypto/openssl/dist/apps/pkeyparam.c vendor-crypto/openssl/dist/apps/pkeyutl.c vendor-crypto/openssl/dist/apps/prime.c vendor-crypto/openssl/dist/apps/rand.c vendor-crypto/openssl/dist/apps/req.c vendor-crypto/openssl/dist/apps/rsa.c vendor-crypto/openssl/dist/apps/rsautl.c vendor-crypto/openssl/dist/apps/s_cb.c vendor-crypto/openssl/dist/apps/s_client.c vendor-crypto/openssl/dist/apps/s_server.c vendor-crypto/openssl/dist/apps/smime.c vendor-crypto/openssl/dist/apps/speed.c vendor-crypto/openssl/dist/apps/spkac.c vendor-crypto/openssl/dist/apps/srp.c vendor-crypto/openssl/dist/apps/verify.c vendor-crypto/openssl/dist/apps/x509.c vendor-crypto/openssl/dist/crypto/aes/asm/aes-s390x.pl vendor-crypto/openssl/dist/crypto/asn1/p5_pbev2.c vendor-crypto/openssl/dist/crypto/asn1/x_crl.c vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont.pl vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont5.pl vendor-crypto/openssl/dist/crypto/bn/bn_exp.c vendor-crypto/openssl/dist/crypto/bn/bn_mul.c vendor-crypto/openssl/dist/crypto/bn/bn_prime.c vendor-crypto/openssl/dist/crypto/bn/bn_sqr.c vendor-crypto/openssl/dist/crypto/cms/cms_kari.c vendor-crypto/openssl/dist/crypto/dh/dh_key.c vendor-crypto/openssl/dist/crypto/dsa/dsa_pmeth.c vendor-crypto/openssl/dist/crypto/ec/ec2_mult.c vendor-crypto/openssl/dist/crypto/ecdh/ech_ossl.c vendor-crypto/openssl/dist/crypto/err/err.c vendor-crypto/openssl/dist/crypto/evp/e_aes.c vendor-crypto/openssl/dist/crypto/evp/e_rc4_hmac_md5.c vendor-crypto/openssl/dist/crypto/evp/evp.h vendor-crypto/openssl/dist/crypto/evp/evp_err.c vendor-crypto/openssl/dist/crypto/evp/pmeth_fn.c vendor-crypto/openssl/dist/crypto/evp/pmeth_lib.c vendor-crypto/openssl/dist/crypto/modes/ctr128.c vendor-crypto/openssl/dist/crypto/opensslv.h vendor-crypto/openssl/dist/crypto/perlasm/x86_64-xlate.pl vendor-crypto/openssl/dist/crypto/rsa/rsa_gen.c vendor-crypto/openssl/dist/crypto/rsa/rsa_oaep.c vendor-crypto/openssl/dist/crypto/rsa/rsa_pmeth.c vendor-crypto/openssl/dist/crypto/s390xcap.c vendor-crypto/openssl/dist/crypto/ui/ui_lib.c vendor-crypto/openssl/dist/crypto/ui/ui_openssl.c vendor-crypto/openssl/dist/doc/apps/ocsp.pod vendor-crypto/openssl/dist/doc/crypto/EVP_DigestSignInit.pod vendor-crypto/openssl/dist/doc/crypto/EVP_DigestVerifyInit.pod vendor-crypto/openssl/dist/doc/crypto/RSA_generate_key.pod vendor-crypto/openssl/dist/doc/crypto/X509_NAME_get_index_by_NID.pod vendor-crypto/openssl/dist/doc/crypto/X509_NAME_print_ex.pod vendor-crypto/openssl/dist/doc/ssl/SSL_CTX_set_session_cache_mode.pod vendor-crypto/openssl/dist/doc/ssl/SSL_get_error.pod vendor-crypto/openssl/dist/doc/ssl/SSL_read.pod vendor-crypto/openssl/dist/doc/ssl/SSL_write.pod vendor-crypto/openssl/dist/engines/ccgost/Makefile vendor-crypto/openssl/dist/ssl/bad_dtls_test.c vendor-crypto/openssl/dist/ssl/s23_pkt.c vendor-crypto/openssl/dist/ssl/s2_lib.c vendor-crypto/openssl/dist/ssl/s2_pkt.c vendor-crypto/openssl/dist/ssl/s3_clnt.c vendor-crypto/openssl/dist/ssl/s3_pkt.c vendor-crypto/openssl/dist/ssl/s3_srvr.c vendor-crypto/openssl/dist/ssl/ssl_cert.c vendor-crypto/openssl/dist/ssl/ssl_err.c vendor-crypto/openssl/dist/ssl/ssl_lib.c vendor-crypto/openssl/dist/ssl/ssl_locl.h vendor-crypto/openssl/dist/ssl/ssl_sess.c vendor-crypto/openssl/dist/ssl/t1_lib.c vendor-crypto/openssl/dist/util/domd vendor-crypto/openssl/dist/util/mklink.pl Modified: vendor-crypto/openssl/dist/CHANGES ============================================================================== --- vendor-crypto/openssl/dist/CHANGES Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/CHANGES Thu Jan 26 18:32:12 2017 (r312823) @@ -2,6 +2,67 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2j and 1.0.2k [26 Jan 2017] + + *) Truncated packet could crash via OOB read + + If one side of an SSL/TLS path is running on a 32-bit host and a specific + cipher is being used, then a truncated packet can cause that host to + perform an out-of-bounds read, usually resulting in a crash. + + This issue was reported to OpenSSL by Robert Święcki of Google. + (CVE-2017-3731) + [Andy Polyakov] + + *) BN_mod_exp may produce incorrect results on x86_64 + + There is a carry propagating bug in the x86_64 Montgomery squaring + procedure. No EC algorithms are affected. Analysis suggests that attacks + against RSA and DSA as a result of this defect would be very difficult to + perform and are not believed likely. Attacks against DH are considered just + feasible (although very difficult) because most of the work necessary to + deduce information about a private key may be performed offline. The amount + of resources required for such an attack would be very significant and + likely only accessible to a limited number of attackers. An attacker would + additionally need online access to an unpatched system using the target + private key in a scenario with persistent DH parameters and a private + key that is shared between multiple clients. For example this can occur by + default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very + similar to CVE-2015-3193 but must be treated as a separate problem. + + This issue was reported to OpenSSL by the OSS-Fuzz project. + (CVE-2017-3732) + [Andy Polyakov] + + *) Montgomery multiplication may produce incorrect results + + There is a carry propagating bug in the Broadwell-specific Montgomery + multiplication procedure that handles input lengths divisible by, but + longer than 256 bits. Analysis suggests that attacks against RSA, DSA + and DH private keys are impossible. This is because the subroutine in + question is not used in operations with the private key itself and an input + of the attacker's direct choice. Otherwise the bug can manifest itself as + transient authentication and key negotiation failures or reproducible + erroneous outcome of public-key operations with specially crafted input. + Among EC algorithms only Brainpool P-512 curves are affected and one + presumably can attack ECDH key negotiation. Impact was not analyzed in + detail, because pre-requisites for attack are considered unlikely. Namely + multiple clients have to choose the curve in question and the server has to + share the private key among them, neither of which is default behaviour. + Even then only clients that chose the curve will be affected. + + This issue was publicly reported as transient failures and was not + initially recognized as a security issue. Thanks to Richard Morgan for + providing reproducible case. + (CVE-2016-7055) + [Andy Polyakov] + + *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 + or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to + prevent issues where no progress is being made and the peer continually + sends unrecognised record types, using up resources processing them. + [Matt Caswell] + Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check Modified: vendor-crypto/openssl/dist/CONTRIBUTING ============================================================================== --- vendor-crypto/openssl/dist/CONTRIBUTING Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/CONTRIBUTING Thu Jan 26 18:32:12 2017 (r312823) @@ -1,4 +1,4 @@ -HOW TO CONTRIBUTE TO PATCHES OpenSSL +HOW TO CONTRIBUTE PATCHES TO OpenSSL ------------------------------------ (Please visit https://www.openssl.org/community/getting-started.html for @@ -11,34 +11,12 @@ OpenSSL community you might want to disc list first. Someone may be already working on the same thing or there may be a good reason as to why that feature isn't implemented. -The best way to submit a patch is to make a pull request on GitHub. -(It is not necessary to send mail to rt@openssl.org to open a ticket!) -If you think the patch could use feedback from the community, please -start a thread on openssl-dev. - -You can also submit patches by sending it as mail to rt@openssl.org. -Please include the word "PATCH" and an explanation of what the patch -does in the subject line. If you do this, our preferred format is "git -format-patch" output. For example to provide a patch file containing the -last commit in your local git repository use the following command: - - % git format-patch --stdout HEAD^ >mydiffs.patch - -Another method of creating an acceptable patch file without using git is as -follows: - - % cd openssl-work - ...make your changes... - % ./Configure dist; make clean - % cd .. - % diff -ur openssl-orig openssl-work >mydiffs.patch - -Note that pull requests are generally easier for the team, and community, to -work with. Pull requests benefit from all of the standard GitHub features, -including code review tools, simpler integration, and CI build support. +To submit a patch, make a pull request on GitHub. If you think the patch +could use feedback from the community, please start a thread on openssl-dev +to discuss it. -No matter how a patch is submitted, the following items will help make -the acceptance and review process faster: +Having addressed the following items before the PR will help make the +acceptance and review process faster: 1. Anything other than trivial contributions will require a contributor licensing agreement, giving us permission to use your code. See @@ -55,21 +33,22 @@ the acceptance and review process faster in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html - 3. Patches should be as current as possible. When using GitHub, please - expect to have to rebase and update often. Note that we do not accept merge - commits. You will be asked to remove them before a patch is considered - acceptable. + 3. Patches should be as current as possible; expect to have to rebase + often. We do not accept merge commits; You will be asked to remove + them before a patch is considered acceptable. 4. Patches should follow our coding style (see https://www.openssl.org/policies/codingstyle.html) and compile without warnings. Where gcc or clang is availble you should use the --strict-warnings Configure option. OpenSSL compiles on many varied platforms: try to ensure you only use portable features. + Clean builds via Travis and AppVeyor are expected, and done whenever + a PR is created or updated. - 5. When at all possible, patches should include tests. These can either be - added to an existing test, or completely new. Please see test/README - for information on the test framework. - - 6. New features or changed functionality must include documentation. Please - look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of - our style. + 5. When at all possible, patches should include tests. These can + either be added to an existing test, or completely new. Please see + test/README for information on the test framework. + + 6. New features or changed functionality must include + documentation. Please look at the "pod" files in doc/apps, doc/crypto + and doc/ssl for examples of our style. Modified: vendor-crypto/openssl/dist/Configure ============================================================================== --- vendor-crypto/openssl/dist/Configure Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Configure Thu Jan 26 18:32:12 2017 (r312823) @@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}' require 5.000; use strict; +use File::Compare; # see INSTALL for instructions. @@ -57,12 +58,13 @@ my $usage="Usage: Configure [no- # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support -# 386 generate 80386 code # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. -# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 +# 386 generate 80386 code in assembly modules +# no-sse2 disables IA-32 SSE2 code in assembly modules, the above +# mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # @@ -1792,8 +1794,16 @@ while () } close(IN); close(OUT); -rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; -rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; +if ((compare($Makefile, "$Makefile.new")) + or file_newer('Configure', $Makefile) + or file_newer('config', $Makefile) + or file_newer('Makefile.org', $Makefile)) + { + rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; + rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; + } +else + { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; @@ -1985,9 +1995,13 @@ print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); -rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; -rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; - +if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) + { + rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; + rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; + } +else + { unlink("crypto/opensslconf.h.new"); } # Fix the date @@ -2289,3 +2303,9 @@ sub test_sanity print STDERR "No sanity errors detected!\n" if $errorcnt == 0; return $errorcnt; } + +sub file_newer + { + my ($file1, $file2) = @_; + return (stat($file1))[9] > (stat($file2))[9] + } Modified: vendor-crypto/openssl/dist/INSTALL ============================================================================== --- vendor-crypto/openssl/dist/INSTALL Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/INSTALL Thu Jan 26 18:32:12 2017 (r312823) @@ -74,24 +74,26 @@ no-asm Do not use assembler code. - 386 Use the 80386 instruction set only (the default x86 code is - more efficient, but requires at least a 486). Note: Use - compiler flags for any other CPU specific configuration, - e.g. "-m32" to build x86 code on an x64 system. - - no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is - detected at run-time, but the decision whether or not the - machine code will be executed is taken solely on CPU - capability vector. This means that if you happen to run OS - kernel which does not support SSE2 extension on Intel P4 - processor, then your application might be exposed to - "illegal instruction" exception. There might be a way - to enable support in kernel, e.g. FreeBSD kernel can be - compiled with CPU_ENABLE_SSE, and there is a way to - disengage SSE2 code pathes upon application start-up, - but if you aim for wider "audience" running such kernel, - consider no-sse2. Both 386 and no-asm options above imply - no-sse2. + 386 In 32-bit x86 builds, when generating assembly modules, + use the 80386 instruction set only (the default x86 code + is more efficient, but requires at least a 486). Note: + This doesn't affect code generated by compiler, you're + likely to complement configuration command line with + suitable compiler-specific option. + + no-sse2 Exclude SSE2 code paths from 32-bit x86 assembly modules. + Normally SSE2 extension is detected at run-time, but the + decision whether or not the machine code will be executed + is taken solely on CPU capability vector. This means that + if you happen to run OS kernel which does not support SSE2 + extension on Intel P4 processor, then your application + might be exposed to "illegal instruction" exception. + There might be a way to enable support in kernel, e.g. + FreeBSD kernel can be compiled with CPU_ENABLE_SSE, and + there is a way to disengage SSE2 code paths upon application + start-up, but if you aim for wider "audience" running + such kernel, consider no-sse2. Both the 386 and + no-asm options imply no-sse2. no- Build without the specified cipher (bf, cast, des, dh, dsa, hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). @@ -101,7 +103,12 @@ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will be passed through to the compiler to allow you to define preprocessor symbols, specify additional libraries, - library directories or other compiler options. + library directories or other compiler options. It might be + worth noting that some compilers generate code specifically + for processor the compiler currently executes on. This is + not necessarily what you might have in mind, since it might + be unsuitable for execution on other, typically older, + processor. Consult your compiler documentation. -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using BSD. Useful if you are running ocf-linux or something @@ -159,18 +166,18 @@ OpenSSL binary ("openssl"). The libraries will be built in the top-level directory, and the binary will be in the "apps" directory. - If "make" fails, look at the output. There may be reasons for - the failure that aren't problems in OpenSSL itself (like missing - standard headers). If it is a problem with OpenSSL itself, please - report the problem to (note that your - message will be recorded in the request tracker publicly readable - at https://www.openssl.org/community/index.html#bugs and will be - forwarded to a public mailing list). Include the output of "make - report" in your message. Please check out the request tracker. Maybe - the bug was already reported or has already been fixed. + If the build fails, look at the output. There may be reasons + for the failure that aren't problems in OpenSSL itself (like + missing standard headers). If you are having problems you can + get help by sending an email to the openssl-users email list (see + https://www.openssl.org/community/mailinglists.html for details). If + it is a bug with OpenSSL itself, please open an issue on GitHub, at + https://github.com/openssl/openssl/issues. Please review the existing + ones first; maybe the bug was already reported or has already been + fixed. - [If you encounter assembler error messages, try the "no-asm" - configuration option as an immediate fix.] + (If you encounter assembler error messages, try the "no-asm" + configuration option as an immediate fix.) Compiling parts of OpenSSL with gcc and others with the system compiler will result in unresolved symbols on some systems. Modified: vendor-crypto/openssl/dist/Makefile ============================================================================== --- vendor-crypto/openssl/dist/Makefile Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Makefile Thu Jan 26 18:32:12 2017 (r312823) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2j +VERSION=1.0.2k MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -203,7 +203,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: vendor-crypto/openssl/dist/Makefile.org ============================================================================== --- vendor-crypto/openssl/dist/Makefile.org Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Makefile.org Thu Jan 26 18:32:12 2017 (r312823) @@ -201,7 +201,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: vendor-crypto/openssl/dist/NEWS ============================================================================== --- vendor-crypto/openssl/dist/NEWS Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/NEWS Thu Jan 26 18:32:12 2017 (r312823) @@ -5,9 +5,15 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] + + o Truncated packet could crash via OOB read (CVE-2017-3731) + o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) + o Montgomery multiplication may produce incorrect results (CVE-2016-7055) + Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] - o Fix Use After Free for large message sizes (CVE-2016-6309) + o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] Modified: vendor-crypto/openssl/dist/README ============================================================================== --- vendor-crypto/openssl/dist/README Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/README Thu Jan 26 18:32:12 2017 (r312823) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2j 26 Sep 2016 + OpenSSL 1.0.2k 26 Jan 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -66,13 +66,13 @@ If you have any problems with OpenSSL then please take the following steps first: - - Download the current snapshot from ftp://ftp.openssl.org/snapshot/ + - Download the latest version from the repository to see if the problem has already been addressed - - Remove ASM versions of libraries + - Configure with no-asm - Remove compiler optimisation flags - If you wish to report a bug then please include the following information in - any bug report: + If you wish to report a bug then please include the following information + and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' @@ -84,27 +84,9 @@ - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) - Email the report to: - - rt@openssl.org - - In order to avoid spam, this is a moderated mailing list, and it might - take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail - to this address is recorded in the public RT (request tracker) database - (see https://www.openssl.org/community/index.html#bugs for details) and - also forwarded the public openssl-dev mailing list. Confidential mail - may be sent to openssl-security@openssl.org (PGP key available from the - key servers). - - Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. - You can also make GitHub pull requests. If you do this, please also send - mail to rt@openssl.org with a link to the PR so that we can more easily - keep track of it. - HOW TO CONTRIBUTE TO OpenSSL ---------------------------- @@ -113,7 +95,7 @@ LEGALITIES ---------- - A number of nations, in particular the U.S., restrict the use or export - of cryptography. If you are potentially subject to such restrictions - you should seek competent professional legal advice before attempting to - develop or distribute cryptographic code. + A number of nations restrict the use or export of cryptography. If you + are potentially subject to such restrictions you should seek competent + professional legal advice before attempting to develop or distribute + cryptographic code. Modified: vendor-crypto/openssl/dist/apps/apps.c ============================================================================== --- vendor-crypto/openssl/dist/apps/apps.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/apps.c Thu Jan 26 18:32:12 2017 (r312823) @@ -972,7 +972,10 @@ EVP_PKEY *load_key(BIO *err, const char if (!e) BIO_printf(err, "no engine specified\n"); else { - pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (ENGINE_init(e)) { + pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + ENGINE_finish(e); + } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); @@ -1532,11 +1535,13 @@ static ENGINE *try_load_engine(BIO *err, } return e; } +#endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; +#ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); @@ -1561,13 +1566,19 @@ ENGINE *setup_engine(BIO *err, const cha } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); - - /* Free our "structural" reference. */ - ENGINE_free(e); } +#endif return e; } + +void release_engine(ENGINE *e) +{ +#ifndef OPENSSL_NO_ENGINE + if (e != NULL) + /* Free our "structural" reference. */ + ENGINE_free(e); #endif +} int load_config(BIO *err, CONF *cnf) { Modified: vendor-crypto/openssl/dist/apps/apps.h ============================================================================== --- vendor-crypto/openssl/dist/apps/apps.h Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/apps.h Thu Jan 26 18:32:12 2017 (r312823) @@ -259,9 +259,9 @@ STACK_OF(X509_CRL) *load_crls(BIO *err, const char *pass, ENGINE *e, const char *cert_descrip); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); -# ifndef OPENSSL_NO_ENGINE + ENGINE *setup_engine(BIO *err, const char *engine, int debug); -# endif +void release_engine(ENGINE *e); # ifndef OPENSSL_NO_OCSP OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, Modified: vendor-crypto/openssl/dist/apps/ca.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ca.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ca.c Thu Jan 26 18:32:12 2017 (r312823) @@ -319,9 +319,7 @@ int MAIN(int argc, char **argv) #define BSIZE 256 MS_STATIC char buf[3][BSIZE]; char *randfile = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif char *tofree = NULL; DB_ATTR db_attr; @@ -595,9 +593,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, conf)) goto err; -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif /* Lets get the config section we are using */ if (section == NULL) { @@ -1485,6 +1481,7 @@ int MAIN(int argc, char **argv) X509_CRL_free(crl); NCONF_free(conf); NCONF_free(extconf); + release_engine(e); OBJ_cleanup(); apps_shutdown(); OPENSSL_EXIT(ret); @@ -2227,7 +2224,6 @@ static int certify_spkac(X509 **xret, ch sk = CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) { BIO_printf(bio_err, "no name/value pairs found in %s\n", infile); - CONF_free(parms); goto err; } Modified: vendor-crypto/openssl/dist/apps/cms.c ============================================================================== --- vendor-crypto/openssl/dist/apps/cms.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/cms.c Thu Jan 26 18:32:12 2017 (r312823) @@ -143,9 +143,7 @@ int MAIN(int argc, char **argv) const EVP_MD *sign_md = NULL; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif unsigned char *secret_key = NULL, *secret_keyid = NULL; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; size_t secret_keylen = 0, secret_keyidlen = 0; @@ -665,9 +663,7 @@ int MAIN(int argc, char **argv) "cert.pem recipient certificate(s) for encryption\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); @@ -1170,6 +1166,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(key); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); + release_engine(e); BIO_free(rctin); BIO_free(in); BIO_free(indata); Modified: vendor-crypto/openssl/dist/apps/dgst.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dgst.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dgst.c Thu Jan 26 18:32:12 2017 (r312823) @@ -537,6 +537,7 @@ int MAIN(int argc, char **argv) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(err); } Modified: vendor-crypto/openssl/dist/apps/dh.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dh.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dh.c Thu Jan 26 18:32:12 2017 (r312823) @@ -94,9 +94,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif apps_startup(); @@ -107,9 +105,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -183,9 +179,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); Modified: vendor-crypto/openssl/dist/apps/dhparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dhparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dhparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -159,9 +159,8 @@ int MAIN(int argc, char **argv) int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; int num = 0, g = 0; apps_startup(); @@ -270,9 +269,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (g && !num) num = DEFBITS; @@ -512,6 +509,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dh != NULL) DH_free(dh); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/dsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -106,9 +106,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; @@ -124,9 +122,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -239,9 +235,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -358,6 +352,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: vendor-crypto/openssl/dist/apps/dsaparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dsaparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dsaparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -121,9 +121,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog, *inrand = NULL; int numbits = -1, num, genkey = 0; int need_rand = 0; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; # ifdef GENCB_TEST int timebomb = 0; # endif @@ -263,9 +262,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (need_rand) { app_RAND_load_file(NULL, bio_err, (inrand != NULL)); @@ -433,6 +430,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/ec.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ec.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ec.c Thu Jan 26 18:32:12 2017 (r312823) @@ -95,6 +95,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0, param_out = 0; char *infile, *outfile, *prog, *engine; + ENGINE *e = NULL; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; @@ -235,9 +236,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -349,6 +348,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (eckey) EC_KEY_free(eckey); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: vendor-crypto/openssl/dist/apps/ecparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ecparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ecparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -131,6 +131,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; char *engine = NULL; + ENGINE *e = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; @@ -311,9 +312,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (list_curves) { EC_builtin_curve *curves = NULL; @@ -620,12 +619,13 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); + if (group != NULL) + EC_GROUP_free(group); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - if (group != NULL) - EC_GROUP_free(group); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/enc.c ============================================================================== --- vendor-crypto/openssl/dist/apps/enc.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/enc.c Thu Jan 26 18:32:12 2017 (r312823) @@ -126,9 +126,8 @@ int MAIN(int argc, char **argv) NULL, *wbio = NULL; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE + 1]; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; const EVP_MD *dgst = NULL; int non_fips_allow = 0; @@ -322,9 +321,7 @@ int MAIN(int argc, char **argv) argv++; } -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) { BIO_printf(bio_err, @@ -674,6 +671,7 @@ int MAIN(int argc, char **argv) if (bzl != NULL) BIO_free(bzl); #endif + release_engine(e); if (pass) OPENSSL_free(pass); apps_shutdown(); Modified: vendor-crypto/openssl/dist/apps/gendh.c ============================================================================== --- vendor-crypto/openssl/dist/apps/gendh.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/gendh.c Thu Jan 26 18:32:12 2017 (r312823) @@ -96,9 +96,7 @@ int MAIN(int argc, char **argv) int g = 2; char *outfile = NULL; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif BIO *out = NULL; apps_startup(); @@ -162,9 +160,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, " the random number generator\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif out = BIO_new(BIO_s_file()); if (out == NULL) { Modified: vendor-crypto/openssl/dist/apps/gendsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/gendsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/gendsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -85,9 +85,8 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out = NULL, *in = NULL; const EVP_CIPHER *enc = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; apps_startup(); @@ -206,9 +205,7 @@ int MAIN(int argc, char **argv) " - a DSA parameter file as generated by the dsaparam command\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); @@ -273,6 +270,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passout) OPENSSL_free(passout); apps_shutdown(); Modified: vendor-crypto/openssl/dist/apps/genpkey.c ============================================================================== --- vendor-crypto/openssl/dist/apps/genpkey.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/genpkey.c Thu Jan 26 18:32:12 2017 (r312823) @@ -275,9 +275,9 @@ int MAIN(int argc, char **argv) if (out) BIO_free_all(out); BIO_free(in); + release_engine(e); if (pass) OPENSSL_free(pass); - return ret; } Modified: vendor-crypto/openssl/dist/apps/genrsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/genrsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/genrsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -91,9 +91,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -# ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; -# endif int ret = 1; int i, num = DEFBITS; long l; @@ -101,9 +99,7 @@ int MAIN(int argc, char **argv) unsigned long f4 = RSA_F4; char *outfile = NULL; char *passargout = NULL, *passout = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif char *inrand = NULL; BIO *out = NULL; BIGNUM *bn = BN_new(); @@ -240,9 +236,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error getting password\n"); goto err; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); @@ -314,6 +308,7 @@ int MAIN(int argc, char **argv) RSA_free(rsa); if (out) BIO_free_all(out); + release_engine(e); if (passout) OPENSSL_free(passout); if (ret != 0) Modified: vendor-crypto/openssl/dist/apps/pkcs12.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs12.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs12.c Thu Jan 26 18:32:12 2017 (r312823) @@ -129,9 +129,7 @@ int MAIN(int argc, char **argv) char *inrand = NULL; char *macalg = NULL; char *CApath = NULL, *CAfile = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif apps_startup(); @@ -406,9 +404,7 @@ int MAIN(int argc, char **argv) "-LMK Add local machine keyset attribute to private key\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (passarg) { if (export_cert) @@ -756,6 +752,7 @@ int MAIN(int argc, char **argv) # ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); # endif + release_engine(e); BIO_free(in); BIO_free_all(out); if (canames) @@ -1110,4 +1107,6 @@ static int set_pbe(BIO *err, int *ppbe, return 1; } +#else +static void *dummy = &dummy; #endif Modified: vendor-crypto/openssl/dist/apps/pkcs7.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs7.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs7.c Thu Jan 26 18:32:12 2017 (r312823) @@ -90,9 +90,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog; int print_certs = 0, text = 0, noout = 0, p7_print = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; apps_startup(); @@ -175,9 +174,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); @@ -303,6 +300,7 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) Modified: vendor-crypto/openssl/dist/apps/pkcs8.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs8.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs8.c Thu Jan 26 18:32:12 2017 (r312823) @@ -87,9 +87,7 @@ int MAIN(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); @@ -223,9 +221,7 @@ int MAIN(int argc, char **argv) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 18: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 64BC6CC3658; Thu, 26 Jan 2017 18:33:05 +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 1874CD21; Thu, 26 Jan 2017 18:33:05 +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 v0QIX46L043026; Thu, 26 Jan 2017 18:33:04 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QIX4hC043025; Thu, 26 Jan 2017 18:33:04 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261833.v0QIX4hC043025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 18:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312824 - vendor-crypto/openssl/1.0.2k X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 18:33:05 -0000 Author: jkim Date: Thu Jan 26 18:33:03 2017 New Revision: 312824 URL: https://svnweb.freebsd.org/changeset/base/312824 Log: Tag OpenSSL 1.0.2k. Added: vendor-crypto/openssl/1.0.2k/ - copied from r312823, vendor-crypto/openssl/dist/ From owner-svn-src-all@freebsd.org Thu Jan 26 19:10: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 A8181CC3ED7; Thu, 26 Jan 2017 19:10:34 +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 404421FA0; Thu, 26 Jan 2017 19:10:34 +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 v0QJAXB0055779; Thu, 26 Jan 2017 19:10:33 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QJAUtC055750; Thu, 26 Jan 2017 19:10:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261910.v0QJAUtC055750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 19:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312825 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/bn/as... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 19:10:34 -0000 Author: jkim Date: Thu Jan 26 19:10:29 2017 New Revision: 312825 URL: https://svnweb.freebsd.org/changeset/base/312825 Log: Merge OpenSSL 1.0.2k. Modified: head/crypto/openssl/CHANGES head/crypto/openssl/CONTRIBUTING head/crypto/openssl/Configure head/crypto/openssl/INSTALL head/crypto/openssl/Makefile head/crypto/openssl/Makefile.org head/crypto/openssl/NEWS head/crypto/openssl/README head/crypto/openssl/apps/apps.c head/crypto/openssl/apps/apps.h head/crypto/openssl/apps/ca.c head/crypto/openssl/apps/cms.c head/crypto/openssl/apps/dgst.c head/crypto/openssl/apps/dh.c head/crypto/openssl/apps/dhparam.c head/crypto/openssl/apps/dsa.c head/crypto/openssl/apps/dsaparam.c head/crypto/openssl/apps/ec.c head/crypto/openssl/apps/ecparam.c head/crypto/openssl/apps/enc.c head/crypto/openssl/apps/gendh.c head/crypto/openssl/apps/gendsa.c head/crypto/openssl/apps/genpkey.c head/crypto/openssl/apps/genrsa.c head/crypto/openssl/apps/pkcs12.c head/crypto/openssl/apps/pkcs7.c head/crypto/openssl/apps/pkcs8.c head/crypto/openssl/apps/pkey.c head/crypto/openssl/apps/pkeyparam.c head/crypto/openssl/apps/pkeyutl.c head/crypto/openssl/apps/prime.c head/crypto/openssl/apps/rand.c head/crypto/openssl/apps/req.c head/crypto/openssl/apps/rsa.c head/crypto/openssl/apps/rsautl.c head/crypto/openssl/apps/s_cb.c head/crypto/openssl/apps/s_client.c head/crypto/openssl/apps/s_server.c head/crypto/openssl/apps/smime.c head/crypto/openssl/apps/speed.c head/crypto/openssl/apps/spkac.c head/crypto/openssl/apps/srp.c head/crypto/openssl/apps/verify.c head/crypto/openssl/apps/x509.c head/crypto/openssl/crypto/aes/asm/aes-s390x.pl head/crypto/openssl/crypto/asn1/p5_pbev2.c head/crypto/openssl/crypto/asn1/x_crl.c head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl head/crypto/openssl/crypto/bn/bn_exp.c head/crypto/openssl/crypto/bn/bn_mul.c head/crypto/openssl/crypto/bn/bn_prime.c head/crypto/openssl/crypto/bn/bn_sqr.c head/crypto/openssl/crypto/cms/cms_kari.c head/crypto/openssl/crypto/dh/dh_key.c head/crypto/openssl/crypto/dsa/dsa_pmeth.c head/crypto/openssl/crypto/ec/ec2_mult.c head/crypto/openssl/crypto/ecdh/ech_ossl.c head/crypto/openssl/crypto/err/err.c head/crypto/openssl/crypto/evp/e_aes.c head/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c head/crypto/openssl/crypto/evp/evp.h head/crypto/openssl/crypto/evp/evp_err.c head/crypto/openssl/crypto/evp/pmeth_fn.c head/crypto/openssl/crypto/evp/pmeth_lib.c head/crypto/openssl/crypto/modes/ctr128.c head/crypto/openssl/crypto/opensslv.h head/crypto/openssl/crypto/perlasm/x86_64-xlate.pl head/crypto/openssl/crypto/rsa/rsa_gen.c head/crypto/openssl/crypto/rsa/rsa_oaep.c head/crypto/openssl/crypto/rsa/rsa_pmeth.c head/crypto/openssl/crypto/s390xcap.c head/crypto/openssl/crypto/ui/ui_lib.c head/crypto/openssl/crypto/ui/ui_openssl.c head/crypto/openssl/doc/apps/ocsp.pod head/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod head/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod head/crypto/openssl/doc/crypto/RSA_generate_key.pod head/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod head/crypto/openssl/doc/crypto/X509_NAME_print_ex.pod head/crypto/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod head/crypto/openssl/doc/ssl/SSL_get_error.pod head/crypto/openssl/doc/ssl/SSL_read.pod head/crypto/openssl/doc/ssl/SSL_write.pod head/crypto/openssl/engines/ccgost/Makefile head/crypto/openssl/ssl/bad_dtls_test.c head/crypto/openssl/ssl/s23_pkt.c head/crypto/openssl/ssl/s2_lib.c head/crypto/openssl/ssl/s2_pkt.c head/crypto/openssl/ssl/s3_clnt.c head/crypto/openssl/ssl/s3_pkt.c head/crypto/openssl/ssl/s3_srvr.c head/crypto/openssl/ssl/ssl_cert.c head/crypto/openssl/ssl/ssl_err.c head/crypto/openssl/ssl/ssl_lib.c head/crypto/openssl/ssl/ssl_locl.h head/crypto/openssl/ssl/ssl_sess.c head/crypto/openssl/ssl/t1_lib.c head/crypto/openssl/util/domd head/crypto/openssl/util/mklink.pl head/secure/lib/libcrypto/Makefile.inc head/secure/lib/libcrypto/amd64/x86_64-mont.S head/secure/lib/libcrypto/amd64/x86_64-mont5.S head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_length.3 head/secure/lib/libcrypto/man/ASN1_STRING_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 head/secure/lib/libcrypto/man/ASN1_TIME_set.3 head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 head/secure/lib/libcrypto/man/BIO_ctrl.3 head/secure/lib/libcrypto/man/BIO_f_base64.3 head/secure/lib/libcrypto/man/BIO_f_buffer.3 head/secure/lib/libcrypto/man/BIO_f_cipher.3 head/secure/lib/libcrypto/man/BIO_f_md.3 head/secure/lib/libcrypto/man/BIO_f_null.3 head/secure/lib/libcrypto/man/BIO_f_ssl.3 head/secure/lib/libcrypto/man/BIO_find_type.3 head/secure/lib/libcrypto/man/BIO_new.3 head/secure/lib/libcrypto/man/BIO_new_CMS.3 head/secure/lib/libcrypto/man/BIO_push.3 head/secure/lib/libcrypto/man/BIO_read.3 head/secure/lib/libcrypto/man/BIO_s_accept.3 head/secure/lib/libcrypto/man/BIO_s_bio.3 head/secure/lib/libcrypto/man/BIO_s_connect.3 head/secure/lib/libcrypto/man/BIO_s_fd.3 head/secure/lib/libcrypto/man/BIO_s_file.3 head/secure/lib/libcrypto/man/BIO_s_mem.3 head/secure/lib/libcrypto/man/BIO_s_null.3 head/secure/lib/libcrypto/man/BIO_s_socket.3 head/secure/lib/libcrypto/man/BIO_set_callback.3 head/secure/lib/libcrypto/man/BIO_should_retry.3 head/secure/lib/libcrypto/man/BN_BLINDING_new.3 head/secure/lib/libcrypto/man/BN_CTX_new.3 head/secure/lib/libcrypto/man/BN_CTX_start.3 head/secure/lib/libcrypto/man/BN_add.3 head/secure/lib/libcrypto/man/BN_add_word.3 head/secure/lib/libcrypto/man/BN_bn2bin.3 head/secure/lib/libcrypto/man/BN_cmp.3 head/secure/lib/libcrypto/man/BN_copy.3 head/secure/lib/libcrypto/man/BN_generate_prime.3 head/secure/lib/libcrypto/man/BN_mod_inverse.3 head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 head/secure/lib/libcrypto/man/BN_new.3 head/secure/lib/libcrypto/man/BN_num_bytes.3 head/secure/lib/libcrypto/man/BN_rand.3 head/secure/lib/libcrypto/man/BN_set_bit.3 head/secure/lib/libcrypto/man/BN_swap.3 head/secure/lib/libcrypto/man/BN_zero.3 head/secure/lib/libcrypto/man/CMS_add0_cert.3 head/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 head/secure/lib/libcrypto/man/CMS_add1_signer.3 head/secure/lib/libcrypto/man/CMS_compress.3 head/secure/lib/libcrypto/man/CMS_decrypt.3 head/secure/lib/libcrypto/man/CMS_encrypt.3 head/secure/lib/libcrypto/man/CMS_final.3 head/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 head/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 head/secure/lib/libcrypto/man/CMS_get0_type.3 head/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 head/secure/lib/libcrypto/man/CMS_sign.3 head/secure/lib/libcrypto/man/CMS_sign_receipt.3 head/secure/lib/libcrypto/man/CMS_uncompress.3 head/secure/lib/libcrypto/man/CMS_verify.3 head/secure/lib/libcrypto/man/CMS_verify_receipt.3 head/secure/lib/libcrypto/man/CONF_modules_free.3 head/secure/lib/libcrypto/man/CONF_modules_load_file.3 head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 head/secure/lib/libcrypto/man/DH_generate_key.3 head/secure/lib/libcrypto/man/DH_generate_parameters.3 head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 head/secure/lib/libcrypto/man/DH_new.3 head/secure/lib/libcrypto/man/DH_set_method.3 head/secure/lib/libcrypto/man/DH_size.3 head/secure/lib/libcrypto/man/DSA_SIG_new.3 head/secure/lib/libcrypto/man/DSA_do_sign.3 head/secure/lib/libcrypto/man/DSA_dup_DH.3 head/secure/lib/libcrypto/man/DSA_generate_key.3 head/secure/lib/libcrypto/man/DSA_generate_parameters.3 head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 head/secure/lib/libcrypto/man/DSA_new.3 head/secure/lib/libcrypto/man/DSA_set_method.3 head/secure/lib/libcrypto/man/DSA_sign.3 head/secure/lib/libcrypto/man/DSA_size.3 head/secure/lib/libcrypto/man/EC_GFp_simple_method.3 head/secure/lib/libcrypto/man/EC_GROUP_copy.3 head/secure/lib/libcrypto/man/EC_GROUP_new.3 head/secure/lib/libcrypto/man/EC_KEY_new.3 head/secure/lib/libcrypto/man/EC_POINT_add.3 head/secure/lib/libcrypto/man/EC_POINT_new.3 head/secure/lib/libcrypto/man/ERR_GET_LIB.3 head/secure/lib/libcrypto/man/ERR_clear_error.3 head/secure/lib/libcrypto/man/ERR_error_string.3 head/secure/lib/libcrypto/man/ERR_get_error.3 head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 head/secure/lib/libcrypto/man/ERR_load_strings.3 head/secure/lib/libcrypto/man/ERR_print_errors.3 head/secure/lib/libcrypto/man/ERR_put_error.3 head/secure/lib/libcrypto/man/ERR_remove_state.3 head/secure/lib/libcrypto/man/ERR_set_mark.3 head/secure/lib/libcrypto/man/EVP_BytesToKey.3 head/secure/lib/libcrypto/man/EVP_DigestInit.3 head/secure/lib/libcrypto/man/EVP_DigestSignInit.3 head/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 head/secure/lib/libcrypto/man/EVP_EncodeInit.3 head/secure/lib/libcrypto/man/EVP_EncryptInit.3 head/secure/lib/libcrypto/man/EVP_OpenInit.3 head/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 head/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 head/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 head/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 head/secure/lib/libcrypto/man/EVP_PKEY_derive.3 head/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 head/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 head/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 head/secure/lib/libcrypto/man/EVP_PKEY_new.3 head/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 head/secure/lib/libcrypto/man/EVP_PKEY_sign.3 head/secure/lib/libcrypto/man/EVP_PKEY_verify.3 head/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 head/secure/lib/libcrypto/man/EVP_SealInit.3 head/secure/lib/libcrypto/man/EVP_SignInit.3 head/secure/lib/libcrypto/man/EVP_VerifyInit.3 head/secure/lib/libcrypto/man/OBJ_nid2obj.3 head/secure/lib/libcrypto/man/OPENSSL_Applink.3 head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 head/secure/lib/libcrypto/man/OPENSSL_config.3 head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 head/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 head/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 head/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 head/secure/lib/libcrypto/man/PKCS12_create.3 head/secure/lib/libcrypto/man/PKCS12_parse.3 head/secure/lib/libcrypto/man/PKCS7_decrypt.3 head/secure/lib/libcrypto/man/PKCS7_encrypt.3 head/secure/lib/libcrypto/man/PKCS7_sign.3 head/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 head/secure/lib/libcrypto/man/PKCS7_verify.3 head/secure/lib/libcrypto/man/RAND_add.3 head/secure/lib/libcrypto/man/RAND_bytes.3 head/secure/lib/libcrypto/man/RAND_cleanup.3 head/secure/lib/libcrypto/man/RAND_egd.3 head/secure/lib/libcrypto/man/RAND_load_file.3 head/secure/lib/libcrypto/man/RAND_set_rand_method.3 head/secure/lib/libcrypto/man/RSA_blinding_on.3 head/secure/lib/libcrypto/man/RSA_check_key.3 head/secure/lib/libcrypto/man/RSA_generate_key.3 head/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 head/secure/lib/libcrypto/man/RSA_new.3 head/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 head/secure/lib/libcrypto/man/RSA_print.3 head/secure/lib/libcrypto/man/RSA_private_encrypt.3 head/secure/lib/libcrypto/man/RSA_public_encrypt.3 head/secure/lib/libcrypto/man/RSA_set_method.3 head/secure/lib/libcrypto/man/RSA_sign.3 head/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 head/secure/lib/libcrypto/man/RSA_size.3 head/secure/lib/libcrypto/man/SMIME_read_CMS.3 head/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 head/secure/lib/libcrypto/man/SMIME_write_CMS.3 head/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 head/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 head/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 head/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 head/secure/lib/libcrypto/man/X509_NAME_print_ex.3 head/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 head/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 head/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 head/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 head/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 head/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 head/secure/lib/libcrypto/man/X509_check_host.3 head/secure/lib/libcrypto/man/X509_new.3 head/secure/lib/libcrypto/man/X509_verify_cert.3 head/secure/lib/libcrypto/man/bio.3 head/secure/lib/libcrypto/man/blowfish.3 head/secure/lib/libcrypto/man/bn.3 head/secure/lib/libcrypto/man/bn_internal.3 head/secure/lib/libcrypto/man/buffer.3 head/secure/lib/libcrypto/man/crypto.3 head/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 head/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 head/secure/lib/libcrypto/man/d2i_DHparams.3 head/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 head/secure/lib/libcrypto/man/d2i_ECPKParameters.3 head/secure/lib/libcrypto/man/d2i_ECPrivateKey.3 head/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 head/secure/lib/libcrypto/man/d2i_PrivateKey.3 head/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 head/secure/lib/libcrypto/man/d2i_X509.3 head/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 head/secure/lib/libcrypto/man/d2i_X509_CRL.3 head/secure/lib/libcrypto/man/d2i_X509_NAME.3 head/secure/lib/libcrypto/man/d2i_X509_REQ.3 head/secure/lib/libcrypto/man/d2i_X509_SIG.3 head/secure/lib/libcrypto/man/des.3 head/secure/lib/libcrypto/man/dh.3 head/secure/lib/libcrypto/man/dsa.3 head/secure/lib/libcrypto/man/ec.3 head/secure/lib/libcrypto/man/ecdsa.3 head/secure/lib/libcrypto/man/engine.3 head/secure/lib/libcrypto/man/err.3 head/secure/lib/libcrypto/man/evp.3 head/secure/lib/libcrypto/man/hmac.3 head/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 head/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 head/secure/lib/libcrypto/man/lh_stats.3 head/secure/lib/libcrypto/man/lhash.3 head/secure/lib/libcrypto/man/md5.3 head/secure/lib/libcrypto/man/mdc2.3 head/secure/lib/libcrypto/man/pem.3 head/secure/lib/libcrypto/man/rand.3 head/secure/lib/libcrypto/man/rc4.3 head/secure/lib/libcrypto/man/ripemd.3 head/secure/lib/libcrypto/man/rsa.3 head/secure/lib/libcrypto/man/sha.3 head/secure/lib/libcrypto/man/threads.3 head/secure/lib/libcrypto/man/ui.3 head/secure/lib/libcrypto/man/ui_compat.3 head/secure/lib/libcrypto/man/x509.3 head/secure/lib/libssl/man/SSL_CIPHER_get_name.3 head/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 head/secure/lib/libssl/man/SSL_CONF_CTX_new.3 head/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 head/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 head/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 head/secure/lib/libssl/man/SSL_CONF_cmd.3 head/secure/lib/libssl/man/SSL_CONF_cmd_argv.3 head/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 head/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 head/secure/lib/libssl/man/SSL_CTX_add_session.3 head/secure/lib/libssl/man/SSL_CTX_ctrl.3 head/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 head/secure/lib/libssl/man/SSL_CTX_free.3 head/secure/lib/libssl/man/SSL_CTX_get0_param.3 head/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 head/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 head/secure/lib/libssl/man/SSL_CTX_new.3 head/secure/lib/libssl/man/SSL_CTX_sess_number.3 head/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 head/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 head/secure/lib/libssl/man/SSL_CTX_sessions.3 head/secure/lib/libssl/man/SSL_CTX_set1_curves.3 head/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 head/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 head/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 head/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 head/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 head/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 head/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 head/secure/lib/libssl/man/SSL_CTX_set_mode.3 head/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_options.3 head/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 head/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 head/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 head/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 head/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 head/secure/lib/libssl/man/SSL_CTX_set_timeout.3 head/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 head/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 head/secure/lib/libssl/man/SSL_CTX_set_verify.3 head/secure/lib/libssl/man/SSL_CTX_use_certificate.3 head/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 head/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 head/secure/lib/libssl/man/SSL_SESSION_free.3 head/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_SESSION_get_time.3 head/secure/lib/libssl/man/SSL_accept.3 head/secure/lib/libssl/man/SSL_alert_type_string.3 head/secure/lib/libssl/man/SSL_check_chain.3 head/secure/lib/libssl/man/SSL_clear.3 head/secure/lib/libssl/man/SSL_connect.3 head/secure/lib/libssl/man/SSL_do_handshake.3 head/secure/lib/libssl/man/SSL_free.3 head/secure/lib/libssl/man/SSL_get_SSL_CTX.3 head/secure/lib/libssl/man/SSL_get_ciphers.3 head/secure/lib/libssl/man/SSL_get_client_CA_list.3 head/secure/lib/libssl/man/SSL_get_current_cipher.3 head/secure/lib/libssl/man/SSL_get_default_timeout.3 head/secure/lib/libssl/man/SSL_get_error.3 head/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 head/secure/lib/libssl/man/SSL_get_ex_new_index.3 head/secure/lib/libssl/man/SSL_get_fd.3 head/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 head/secure/lib/libssl/man/SSL_get_peer_certificate.3 head/secure/lib/libssl/man/SSL_get_psk_identity.3 head/secure/lib/libssl/man/SSL_get_rbio.3 head/secure/lib/libssl/man/SSL_get_session.3 head/secure/lib/libssl/man/SSL_get_verify_result.3 head/secure/lib/libssl/man/SSL_get_version.3 head/secure/lib/libssl/man/SSL_library_init.3 head/secure/lib/libssl/man/SSL_load_client_CA_file.3 head/secure/lib/libssl/man/SSL_new.3 head/secure/lib/libssl/man/SSL_pending.3 head/secure/lib/libssl/man/SSL_read.3 head/secure/lib/libssl/man/SSL_rstate_string.3 head/secure/lib/libssl/man/SSL_session_reused.3 head/secure/lib/libssl/man/SSL_set_bio.3 head/secure/lib/libssl/man/SSL_set_connect_state.3 head/secure/lib/libssl/man/SSL_set_fd.3 head/secure/lib/libssl/man/SSL_set_session.3 head/secure/lib/libssl/man/SSL_set_shutdown.3 head/secure/lib/libssl/man/SSL_set_verify_result.3 head/secure/lib/libssl/man/SSL_shutdown.3 head/secure/lib/libssl/man/SSL_state_string.3 head/secure/lib/libssl/man/SSL_want.3 head/secure/lib/libssl/man/SSL_write.3 head/secure/lib/libssl/man/d2i_SSL_SESSION.3 head/secure/lib/libssl/man/ssl.3 head/secure/usr.bin/openssl/man/CA.pl.1 head/secure/usr.bin/openssl/man/asn1parse.1 head/secure/usr.bin/openssl/man/c_rehash.1 head/secure/usr.bin/openssl/man/ca.1 head/secure/usr.bin/openssl/man/ciphers.1 head/secure/usr.bin/openssl/man/cms.1 head/secure/usr.bin/openssl/man/crl.1 head/secure/usr.bin/openssl/man/crl2pkcs7.1 head/secure/usr.bin/openssl/man/dgst.1 head/secure/usr.bin/openssl/man/dhparam.1 head/secure/usr.bin/openssl/man/dsa.1 head/secure/usr.bin/openssl/man/dsaparam.1 head/secure/usr.bin/openssl/man/ec.1 head/secure/usr.bin/openssl/man/ecparam.1 head/secure/usr.bin/openssl/man/enc.1 head/secure/usr.bin/openssl/man/errstr.1 head/secure/usr.bin/openssl/man/gendsa.1 head/secure/usr.bin/openssl/man/genpkey.1 head/secure/usr.bin/openssl/man/genrsa.1 head/secure/usr.bin/openssl/man/nseq.1 head/secure/usr.bin/openssl/man/ocsp.1 head/secure/usr.bin/openssl/man/openssl.1 head/secure/usr.bin/openssl/man/passwd.1 head/secure/usr.bin/openssl/man/pkcs12.1 head/secure/usr.bin/openssl/man/pkcs7.1 head/secure/usr.bin/openssl/man/pkcs8.1 head/secure/usr.bin/openssl/man/pkey.1 head/secure/usr.bin/openssl/man/pkeyparam.1 head/secure/usr.bin/openssl/man/pkeyutl.1 head/secure/usr.bin/openssl/man/rand.1 head/secure/usr.bin/openssl/man/req.1 head/secure/usr.bin/openssl/man/rsa.1 head/secure/usr.bin/openssl/man/rsautl.1 head/secure/usr.bin/openssl/man/s_client.1 head/secure/usr.bin/openssl/man/s_server.1 head/secure/usr.bin/openssl/man/s_time.1 head/secure/usr.bin/openssl/man/sess_id.1 head/secure/usr.bin/openssl/man/smime.1 head/secure/usr.bin/openssl/man/speed.1 head/secure/usr.bin/openssl/man/spkac.1 head/secure/usr.bin/openssl/man/ts.1 head/secure/usr.bin/openssl/man/tsget.1 head/secure/usr.bin/openssl/man/verify.1 head/secure/usr.bin/openssl/man/version.1 head/secure/usr.bin/openssl/man/x509.1 head/secure/usr.bin/openssl/man/x509v3_config.1 Directory Properties: head/crypto/openssl/ (props changed) Modified: head/crypto/openssl/CHANGES ============================================================================== --- head/crypto/openssl/CHANGES Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/CHANGES Thu Jan 26 19:10:29 2017 (r312825) @@ -2,6 +2,67 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2j and 1.0.2k [26 Jan 2017] + + *) Truncated packet could crash via OOB read + + If one side of an SSL/TLS path is running on a 32-bit host and a specific + cipher is being used, then a truncated packet can cause that host to + perform an out-of-bounds read, usually resulting in a crash. + + This issue was reported to OpenSSL by Robert Święcki of Google. + (CVE-2017-3731) + [Andy Polyakov] + + *) BN_mod_exp may produce incorrect results on x86_64 + + There is a carry propagating bug in the x86_64 Montgomery squaring + procedure. No EC algorithms are affected. Analysis suggests that attacks + against RSA and DSA as a result of this defect would be very difficult to + perform and are not believed likely. Attacks against DH are considered just + feasible (although very difficult) because most of the work necessary to + deduce information about a private key may be performed offline. The amount + of resources required for such an attack would be very significant and + likely only accessible to a limited number of attackers. An attacker would + additionally need online access to an unpatched system using the target + private key in a scenario with persistent DH parameters and a private + key that is shared between multiple clients. For example this can occur by + default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very + similar to CVE-2015-3193 but must be treated as a separate problem. + + This issue was reported to OpenSSL by the OSS-Fuzz project. + (CVE-2017-3732) + [Andy Polyakov] + + *) Montgomery multiplication may produce incorrect results + + There is a carry propagating bug in the Broadwell-specific Montgomery + multiplication procedure that handles input lengths divisible by, but + longer than 256 bits. Analysis suggests that attacks against RSA, DSA + and DH private keys are impossible. This is because the subroutine in + question is not used in operations with the private key itself and an input + of the attacker's direct choice. Otherwise the bug can manifest itself as + transient authentication and key negotiation failures or reproducible + erroneous outcome of public-key operations with specially crafted input. + Among EC algorithms only Brainpool P-512 curves are affected and one + presumably can attack ECDH key negotiation. Impact was not analyzed in + detail, because pre-requisites for attack are considered unlikely. Namely + multiple clients have to choose the curve in question and the server has to + share the private key among them, neither of which is default behaviour. + Even then only clients that chose the curve will be affected. + + This issue was publicly reported as transient failures and was not + initially recognized as a security issue. Thanks to Richard Morgan for + providing reproducible case. + (CVE-2016-7055) + [Andy Polyakov] + + *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 + or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to + prevent issues where no progress is being made and the peer continually + sends unrecognised record types, using up resources processing them. + [Matt Caswell] + Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check Modified: head/crypto/openssl/CONTRIBUTING ============================================================================== --- head/crypto/openssl/CONTRIBUTING Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/CONTRIBUTING Thu Jan 26 19:10:29 2017 (r312825) @@ -1,4 +1,4 @@ -HOW TO CONTRIBUTE TO PATCHES OpenSSL +HOW TO CONTRIBUTE PATCHES TO OpenSSL ------------------------------------ (Please visit https://www.openssl.org/community/getting-started.html for @@ -11,34 +11,12 @@ OpenSSL community you might want to disc list first. Someone may be already working on the same thing or there may be a good reason as to why that feature isn't implemented. -The best way to submit a patch is to make a pull request on GitHub. -(It is not necessary to send mail to rt@openssl.org to open a ticket!) -If you think the patch could use feedback from the community, please -start a thread on openssl-dev. - -You can also submit patches by sending it as mail to rt@openssl.org. -Please include the word "PATCH" and an explanation of what the patch -does in the subject line. If you do this, our preferred format is "git -format-patch" output. For example to provide a patch file containing the -last commit in your local git repository use the following command: - - % git format-patch --stdout HEAD^ >mydiffs.patch - -Another method of creating an acceptable patch file without using git is as -follows: - - % cd openssl-work - ...make your changes... - % ./Configure dist; make clean - % cd .. - % diff -ur openssl-orig openssl-work >mydiffs.patch - -Note that pull requests are generally easier for the team, and community, to -work with. Pull requests benefit from all of the standard GitHub features, -including code review tools, simpler integration, and CI build support. +To submit a patch, make a pull request on GitHub. If you think the patch +could use feedback from the community, please start a thread on openssl-dev +to discuss it. -No matter how a patch is submitted, the following items will help make -the acceptance and review process faster: +Having addressed the following items before the PR will help make the +acceptance and review process faster: 1. Anything other than trivial contributions will require a contributor licensing agreement, giving us permission to use your code. See @@ -55,21 +33,22 @@ the acceptance and review process faster in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html - 3. Patches should be as current as possible. When using GitHub, please - expect to have to rebase and update often. Note that we do not accept merge - commits. You will be asked to remove them before a patch is considered - acceptable. + 3. Patches should be as current as possible; expect to have to rebase + often. We do not accept merge commits; You will be asked to remove + them before a patch is considered acceptable. 4. Patches should follow our coding style (see https://www.openssl.org/policies/codingstyle.html) and compile without warnings. Where gcc or clang is availble you should use the --strict-warnings Configure option. OpenSSL compiles on many varied platforms: try to ensure you only use portable features. + Clean builds via Travis and AppVeyor are expected, and done whenever + a PR is created or updated. - 5. When at all possible, patches should include tests. These can either be - added to an existing test, or completely new. Please see test/README - for information on the test framework. - - 6. New features or changed functionality must include documentation. Please - look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of - our style. + 5. When at all possible, patches should include tests. These can + either be added to an existing test, or completely new. Please see + test/README for information on the test framework. + + 6. New features or changed functionality must include + documentation. Please look at the "pod" files in doc/apps, doc/crypto + and doc/ssl for examples of our style. Modified: head/crypto/openssl/Configure ============================================================================== --- head/crypto/openssl/Configure Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/Configure Thu Jan 26 19:10:29 2017 (r312825) @@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}' require 5.000; use strict; +use File::Compare; # see INSTALL for instructions. @@ -57,12 +58,13 @@ my $usage="Usage: Configure [no- # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support -# 386 generate 80386 code # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. -# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 +# 386 generate 80386 code in assembly modules +# no-sse2 disables IA-32 SSE2 code in assembly modules, the above +# mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # @@ -1792,8 +1794,16 @@ while () } close(IN); close(OUT); -rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; -rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; +if ((compare($Makefile, "$Makefile.new")) + or file_newer('Configure', $Makefile) + or file_newer('config', $Makefile) + or file_newer('Makefile.org', $Makefile)) + { + rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; + rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; + } +else + { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; @@ -1985,9 +1995,13 @@ print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); -rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; -rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; - +if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) + { + rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; + rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; + } +else + { unlink("crypto/opensslconf.h.new"); } # Fix the date @@ -2289,3 +2303,9 @@ sub test_sanity print STDERR "No sanity errors detected!\n" if $errorcnt == 0; return $errorcnt; } + +sub file_newer + { + my ($file1, $file2) = @_; + return (stat($file1))[9] > (stat($file2))[9] + } Modified: head/crypto/openssl/INSTALL ============================================================================== --- head/crypto/openssl/INSTALL Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/INSTALL Thu Jan 26 19:10:29 2017 (r312825) @@ -74,24 +74,26 @@ no-asm Do not use assembler code. - 386 Use the 80386 instruction set only (the default x86 code is - more efficient, but requires at least a 486). Note: Use - compiler flags for any other CPU specific configuration, - e.g. "-m32" to build x86 code on an x64 system. - - no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is - detected at run-time, but the decision whether or not the - machine code will be executed is taken solely on CPU - capability vector. This means that if you happen to run OS - kernel which does not support SSE2 extension on Intel P4 - processor, then your application might be exposed to - "illegal instruction" exception. There might be a way - to enable support in kernel, e.g. FreeBSD kernel can be - compiled with CPU_ENABLE_SSE, and there is a way to - disengage SSE2 code pathes upon application start-up, - but if you aim for wider "audience" running such kernel, - consider no-sse2. Both 386 and no-asm options above imply - no-sse2. + 386 In 32-bit x86 builds, when generating assembly modules, + use the 80386 instruction set only (the default x86 code + is more efficient, but requires at least a 486). Note: + This doesn't affect code generated by compiler, you're + likely to complement configuration command line with + suitable compiler-specific option. + + no-sse2 Exclude SSE2 code paths from 32-bit x86 assembly modules. + Normally SSE2 extension is detected at run-time, but the + decision whether or not the machine code will be executed + is taken solely on CPU capability vector. This means that + if you happen to run OS kernel which does not support SSE2 + extension on Intel P4 processor, then your application + might be exposed to "illegal instruction" exception. + There might be a way to enable support in kernel, e.g. + FreeBSD kernel can be compiled with CPU_ENABLE_SSE, and + there is a way to disengage SSE2 code paths upon application + start-up, but if you aim for wider "audience" running + such kernel, consider no-sse2. Both the 386 and + no-asm options imply no-sse2. no- Build without the specified cipher (bf, cast, des, dh, dsa, hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). @@ -101,7 +103,12 @@ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will be passed through to the compiler to allow you to define preprocessor symbols, specify additional libraries, - library directories or other compiler options. + library directories or other compiler options. It might be + worth noting that some compilers generate code specifically + for processor the compiler currently executes on. This is + not necessarily what you might have in mind, since it might + be unsuitable for execution on other, typically older, + processor. Consult your compiler documentation. -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using BSD. Useful if you are running ocf-linux or something @@ -159,18 +166,18 @@ OpenSSL binary ("openssl"). The libraries will be built in the top-level directory, and the binary will be in the "apps" directory. - If "make" fails, look at the output. There may be reasons for - the failure that aren't problems in OpenSSL itself (like missing - standard headers). If it is a problem with OpenSSL itself, please - report the problem to (note that your - message will be recorded in the request tracker publicly readable - at https://www.openssl.org/community/index.html#bugs and will be - forwarded to a public mailing list). Include the output of "make - report" in your message. Please check out the request tracker. Maybe - the bug was already reported or has already been fixed. + If the build fails, look at the output. There may be reasons + for the failure that aren't problems in OpenSSL itself (like + missing standard headers). If you are having problems you can + get help by sending an email to the openssl-users email list (see + https://www.openssl.org/community/mailinglists.html for details). If + it is a bug with OpenSSL itself, please open an issue on GitHub, at + https://github.com/openssl/openssl/issues. Please review the existing + ones first; maybe the bug was already reported or has already been + fixed. - [If you encounter assembler error messages, try the "no-asm" - configuration option as an immediate fix.] + (If you encounter assembler error messages, try the "no-asm" + configuration option as an immediate fix.) Compiling parts of OpenSSL with gcc and others with the system compiler will result in unresolved symbols on some systems. Modified: head/crypto/openssl/Makefile ============================================================================== --- head/crypto/openssl/Makefile Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/Makefile Thu Jan 26 19:10:29 2017 (r312825) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2j +VERSION=1.0.2k MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -203,7 +203,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: head/crypto/openssl/Makefile.org ============================================================================== --- head/crypto/openssl/Makefile.org Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/Makefile.org Thu Jan 26 19:10:29 2017 (r312825) @@ -201,7 +201,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: head/crypto/openssl/NEWS ============================================================================== --- head/crypto/openssl/NEWS Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/NEWS Thu Jan 26 19:10:29 2017 (r312825) @@ -5,9 +5,15 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] + + o Truncated packet could crash via OOB read (CVE-2017-3731) + o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) + o Montgomery multiplication may produce incorrect results (CVE-2016-7055) + Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] - o Fix Use After Free for large message sizes (CVE-2016-6309) + o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] Modified: head/crypto/openssl/README ============================================================================== --- head/crypto/openssl/README Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/README Thu Jan 26 19:10:29 2017 (r312825) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2j 26 Sep 2016 + OpenSSL 1.0.2k 26 Jan 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -66,13 +66,13 @@ If you have any problems with OpenSSL then please take the following steps first: - - Download the current snapshot from ftp://ftp.openssl.org/snapshot/ + - Download the latest version from the repository to see if the problem has already been addressed - - Remove ASM versions of libraries + - Configure with no-asm - Remove compiler optimisation flags - If you wish to report a bug then please include the following information in - any bug report: + If you wish to report a bug then please include the following information + and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' @@ -84,27 +84,9 @@ - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) - Email the report to: - - rt@openssl.org - - In order to avoid spam, this is a moderated mailing list, and it might - take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail - to this address is recorded in the public RT (request tracker) database - (see https://www.openssl.org/community/index.html#bugs for details) and - also forwarded the public openssl-dev mailing list. Confidential mail - may be sent to openssl-security@openssl.org (PGP key available from the - key servers). - - Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. - You can also make GitHub pull requests. If you do this, please also send - mail to rt@openssl.org with a link to the PR so that we can more easily - keep track of it. - HOW TO CONTRIBUTE TO OpenSSL ---------------------------- @@ -113,7 +95,7 @@ LEGALITIES ---------- - A number of nations, in particular the U.S., restrict the use or export - of cryptography. If you are potentially subject to such restrictions - you should seek competent professional legal advice before attempting to - develop or distribute cryptographic code. + A number of nations restrict the use or export of cryptography. If you + are potentially subject to such restrictions you should seek competent + professional legal advice before attempting to develop or distribute + cryptographic code. Modified: head/crypto/openssl/apps/apps.c ============================================================================== --- head/crypto/openssl/apps/apps.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/apps.c Thu Jan 26 19:10:29 2017 (r312825) @@ -972,7 +972,10 @@ EVP_PKEY *load_key(BIO *err, const char if (!e) BIO_printf(err, "no engine specified\n"); else { - pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (ENGINE_init(e)) { + pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + ENGINE_finish(e); + } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); @@ -1532,11 +1535,13 @@ static ENGINE *try_load_engine(BIO *err, } return e; } +#endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; +#ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); @@ -1561,13 +1566,19 @@ ENGINE *setup_engine(BIO *err, const cha } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); - - /* Free our "structural" reference. */ - ENGINE_free(e); } +#endif return e; } + +void release_engine(ENGINE *e) +{ +#ifndef OPENSSL_NO_ENGINE + if (e != NULL) + /* Free our "structural" reference. */ + ENGINE_free(e); #endif +} int load_config(BIO *err, CONF *cnf) { Modified: head/crypto/openssl/apps/apps.h ============================================================================== --- head/crypto/openssl/apps/apps.h Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/apps.h Thu Jan 26 19:10:29 2017 (r312825) @@ -259,9 +259,9 @@ STACK_OF(X509_CRL) *load_crls(BIO *err, const char *pass, ENGINE *e, const char *cert_descrip); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); -# ifndef OPENSSL_NO_ENGINE + ENGINE *setup_engine(BIO *err, const char *engine, int debug); -# endif +void release_engine(ENGINE *e); # ifndef OPENSSL_NO_OCSP OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, Modified: head/crypto/openssl/apps/ca.c ============================================================================== --- head/crypto/openssl/apps/ca.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/ca.c Thu Jan 26 19:10:29 2017 (r312825) @@ -319,9 +319,7 @@ int MAIN(int argc, char **argv) #define BSIZE 256 MS_STATIC char buf[3][BSIZE]; char *randfile = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif char *tofree = NULL; DB_ATTR db_attr; @@ -595,9 +593,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, conf)) goto err; -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif /* Lets get the config section we are using */ if (section == NULL) { @@ -1485,6 +1481,7 @@ int MAIN(int argc, char **argv) X509_CRL_free(crl); NCONF_free(conf); NCONF_free(extconf); + release_engine(e); OBJ_cleanup(); apps_shutdown(); OPENSSL_EXIT(ret); @@ -2227,7 +2224,6 @@ static int certify_spkac(X509 **xret, ch sk = CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) { BIO_printf(bio_err, "no name/value pairs found in %s\n", infile); - CONF_free(parms); goto err; } Modified: head/crypto/openssl/apps/cms.c ============================================================================== --- head/crypto/openssl/apps/cms.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/cms.c Thu Jan 26 19:10:29 2017 (r312825) @@ -143,9 +143,7 @@ int MAIN(int argc, char **argv) const EVP_MD *sign_md = NULL; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif unsigned char *secret_key = NULL, *secret_keyid = NULL; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; size_t secret_keylen = 0, secret_keyidlen = 0; @@ -665,9 +663,7 @@ int MAIN(int argc, char **argv) "cert.pem recipient certificate(s) for encryption\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); @@ -1170,6 +1166,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(key); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); + release_engine(e); BIO_free(rctin); BIO_free(in); BIO_free(indata); Modified: head/crypto/openssl/apps/dgst.c ============================================================================== --- head/crypto/openssl/apps/dgst.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/dgst.c Thu Jan 26 19:10:29 2017 (r312825) @@ -537,6 +537,7 @@ int MAIN(int argc, char **argv) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(err); } Modified: head/crypto/openssl/apps/dh.c ============================================================================== --- head/crypto/openssl/apps/dh.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/dh.c Thu Jan 26 19:10:29 2017 (r312825) @@ -94,9 +94,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif apps_startup(); @@ -107,9 +105,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -183,9 +179,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); Modified: head/crypto/openssl/apps/dhparam.c ============================================================================== --- head/crypto/openssl/apps/dhparam.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/dhparam.c Thu Jan 26 19:10:29 2017 (r312825) @@ -159,9 +159,8 @@ int MAIN(int argc, char **argv) int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; int num = 0, g = 0; apps_startup(); @@ -270,9 +269,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (g && !num) num = DEFBITS; @@ -512,6 +509,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dh != NULL) DH_free(dh); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: head/crypto/openssl/apps/dsa.c ============================================================================== --- head/crypto/openssl/apps/dsa.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/dsa.c Thu Jan 26 19:10:29 2017 (r312825) @@ -106,9 +106,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; @@ -124,9 +122,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -239,9 +235,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -358,6 +352,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: head/crypto/openssl/apps/dsaparam.c ============================================================================== --- head/crypto/openssl/apps/dsaparam.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/dsaparam.c Thu Jan 26 19:10:29 2017 (r312825) @@ -121,9 +121,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog, *inrand = NULL; int numbits = -1, num, genkey = 0; int need_rand = 0; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; # ifdef GENCB_TEST int timebomb = 0; # endif @@ -263,9 +262,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (need_rand) { app_RAND_load_file(NULL, bio_err, (inrand != NULL)); @@ -433,6 +430,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: head/crypto/openssl/apps/ec.c ============================================================================== --- head/crypto/openssl/apps/ec.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/ec.c Thu Jan 26 19:10:29 2017 (r312825) @@ -95,6 +95,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0, param_out = 0; char *infile, *outfile, *prog, *engine; + ENGINE *e = NULL; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; @@ -235,9 +236,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -349,6 +348,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (eckey) EC_KEY_free(eckey); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: head/crypto/openssl/apps/ecparam.c ============================================================================== --- head/crypto/openssl/apps/ecparam.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/ecparam.c Thu Jan 26 19:10:29 2017 (r312825) @@ -131,6 +131,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; char *engine = NULL; + ENGINE *e = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; @@ -311,9 +312,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (list_curves) { EC_builtin_curve *curves = NULL; @@ -620,12 +619,13 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); + if (group != NULL) + EC_GROUP_free(group); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - if (group != NULL) - EC_GROUP_free(group); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: head/crypto/openssl/apps/enc.c ============================================================================== --- head/crypto/openssl/apps/enc.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/enc.c Thu Jan 26 19:10:29 2017 (r312825) @@ -126,9 +126,8 @@ int MAIN(int argc, char **argv) NULL, *wbio = NULL; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE + 1]; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; const EVP_MD *dgst = NULL; int non_fips_allow = 0; @@ -322,9 +321,7 @@ int MAIN(int argc, char **argv) argv++; } -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) { BIO_printf(bio_err, @@ -674,6 +671,7 @@ int MAIN(int argc, char **argv) if (bzl != NULL) BIO_free(bzl); #endif + release_engine(e); if (pass) OPENSSL_free(pass); apps_shutdown(); Modified: head/crypto/openssl/apps/gendh.c ============================================================================== --- head/crypto/openssl/apps/gendh.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/gendh.c Thu Jan 26 19:10:29 2017 (r312825) @@ -96,9 +96,7 @@ int MAIN(int argc, char **argv) int g = 2; char *outfile = NULL; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif BIO *out = NULL; apps_startup(); @@ -162,9 +160,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, " the random number generator\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif out = BIO_new(BIO_s_file()); if (out == NULL) { Modified: head/crypto/openssl/apps/gendsa.c ============================================================================== --- head/crypto/openssl/apps/gendsa.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/gendsa.c Thu Jan 26 19:10:29 2017 (r312825) @@ -85,9 +85,8 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out = NULL, *in = NULL; const EVP_CIPHER *enc = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; apps_startup(); @@ -206,9 +205,7 @@ int MAIN(int argc, char **argv) " - a DSA parameter file as generated by the dsaparam command\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); @@ -273,6 +270,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passout) OPENSSL_free(passout); apps_shutdown(); Modified: head/crypto/openssl/apps/genpkey.c ============================================================================== --- head/crypto/openssl/apps/genpkey.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/genpkey.c Thu Jan 26 19:10:29 2017 (r312825) @@ -275,9 +275,9 @@ int MAIN(int argc, char **argv) if (out) BIO_free_all(out); BIO_free(in); + release_engine(e); if (pass) OPENSSL_free(pass); - return ret; } Modified: head/crypto/openssl/apps/genrsa.c ============================================================================== --- head/crypto/openssl/apps/genrsa.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/genrsa.c Thu Jan 26 19:10:29 2017 (r312825) @@ -91,9 +91,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -# ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; -# endif int ret = 1; int i, num = DEFBITS; long l; @@ -101,9 +99,7 @@ int MAIN(int argc, char **argv) unsigned long f4 = RSA_F4; char *outfile = NULL; char *passargout = NULL, *passout = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif char *inrand = NULL; BIO *out = NULL; BIGNUM *bn = BN_new(); @@ -240,9 +236,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error getting password\n"); goto err; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); @@ -314,6 +308,7 @@ int MAIN(int argc, char **argv) RSA_free(rsa); if (out) BIO_free_all(out); + release_engine(e); if (passout) OPENSSL_free(passout); if (ret != 0) Modified: head/crypto/openssl/apps/pkcs12.c ============================================================================== --- head/crypto/openssl/apps/pkcs12.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/pkcs12.c Thu Jan 26 19:10:29 2017 (r312825) @@ -129,9 +129,7 @@ int MAIN(int argc, char **argv) char *inrand = NULL; char *macalg = NULL; char *CApath = NULL, *CAfile = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif apps_startup(); @@ -406,9 +404,7 @@ int MAIN(int argc, char **argv) "-LMK Add local machine keyset attribute to private key\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (passarg) { if (export_cert) @@ -756,6 +752,7 @@ int MAIN(int argc, char **argv) # ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); # endif + release_engine(e); BIO_free(in); BIO_free_all(out); if (canames) @@ -1110,4 +1107,6 @@ static int set_pbe(BIO *err, int *ppbe, return 1; } +#else +static void *dummy = &dummy; #endif Modified: head/crypto/openssl/apps/pkcs7.c ============================================================================== --- head/crypto/openssl/apps/pkcs7.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/pkcs7.c Thu Jan 26 19:10:29 2017 (r312825) @@ -90,9 +90,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog; int print_certs = 0, text = 0, noout = 0, p7_print = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; apps_startup(); @@ -175,9 +174,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); @@ -303,6 +300,7 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) Modified: head/crypto/openssl/apps/pkcs8.c ============================================================================== --- head/crypto/openssl/apps/pkcs8.c Thu Jan 26 18:33:03 2017 (r312824) +++ head/crypto/openssl/apps/pkcs8.c Thu Jan 26 19:10:29 2017 (r312825) @@ -87,9 +87,7 @@ int MAIN(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); @@ -223,9 +221,7 @@ int MAIN(int argc, char **argv) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 19:14: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 19891CC305B; Thu, 26 Jan 2017 19:14:19 +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 A082B6C6; Thu, 26 Jan 2017 19:14:18 +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 v0QJEHkF059605; Thu, 26 Jan 2017 19:14:17 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QJEElY059576; Thu, 26 Jan 2017 19:14:14 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261914.v0QJEElY059576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 19:14: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: r312826 - in stable/11: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/crypto/... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 19:14:19 -0000 Author: jkim Date: Thu Jan 26 19:14:14 2017 New Revision: 312826 URL: https://svnweb.freebsd.org/changeset/base/312826 Log: MFC: r312825 Merge OpenSSL 1.0.2k. Modified: stable/11/crypto/openssl/CHANGES stable/11/crypto/openssl/CONTRIBUTING stable/11/crypto/openssl/Configure stable/11/crypto/openssl/INSTALL stable/11/crypto/openssl/Makefile stable/11/crypto/openssl/Makefile.org stable/11/crypto/openssl/NEWS stable/11/crypto/openssl/README stable/11/crypto/openssl/apps/apps.c stable/11/crypto/openssl/apps/apps.h stable/11/crypto/openssl/apps/ca.c stable/11/crypto/openssl/apps/cms.c stable/11/crypto/openssl/apps/dgst.c stable/11/crypto/openssl/apps/dh.c stable/11/crypto/openssl/apps/dhparam.c stable/11/crypto/openssl/apps/dsa.c stable/11/crypto/openssl/apps/dsaparam.c stable/11/crypto/openssl/apps/ec.c stable/11/crypto/openssl/apps/ecparam.c stable/11/crypto/openssl/apps/enc.c stable/11/crypto/openssl/apps/gendh.c stable/11/crypto/openssl/apps/gendsa.c stable/11/crypto/openssl/apps/genpkey.c stable/11/crypto/openssl/apps/genrsa.c stable/11/crypto/openssl/apps/pkcs12.c stable/11/crypto/openssl/apps/pkcs7.c stable/11/crypto/openssl/apps/pkcs8.c stable/11/crypto/openssl/apps/pkey.c stable/11/crypto/openssl/apps/pkeyparam.c stable/11/crypto/openssl/apps/pkeyutl.c stable/11/crypto/openssl/apps/prime.c stable/11/crypto/openssl/apps/rand.c stable/11/crypto/openssl/apps/req.c stable/11/crypto/openssl/apps/rsa.c stable/11/crypto/openssl/apps/rsautl.c stable/11/crypto/openssl/apps/s_cb.c stable/11/crypto/openssl/apps/s_client.c stable/11/crypto/openssl/apps/s_server.c stable/11/crypto/openssl/apps/smime.c stable/11/crypto/openssl/apps/speed.c stable/11/crypto/openssl/apps/spkac.c stable/11/crypto/openssl/apps/srp.c stable/11/crypto/openssl/apps/verify.c stable/11/crypto/openssl/apps/x509.c stable/11/crypto/openssl/crypto/aes/asm/aes-s390x.pl stable/11/crypto/openssl/crypto/asn1/p5_pbev2.c stable/11/crypto/openssl/crypto/asn1/x_crl.c stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont.pl stable/11/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl stable/11/crypto/openssl/crypto/bn/bn_exp.c stable/11/crypto/openssl/crypto/bn/bn_mul.c stable/11/crypto/openssl/crypto/bn/bn_prime.c stable/11/crypto/openssl/crypto/bn/bn_sqr.c stable/11/crypto/openssl/crypto/cms/cms_kari.c stable/11/crypto/openssl/crypto/dh/dh_key.c stable/11/crypto/openssl/crypto/dsa/dsa_pmeth.c stable/11/crypto/openssl/crypto/ec/ec2_mult.c stable/11/crypto/openssl/crypto/ecdh/ech_ossl.c stable/11/crypto/openssl/crypto/err/err.c stable/11/crypto/openssl/crypto/evp/e_aes.c stable/11/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c stable/11/crypto/openssl/crypto/evp/evp.h stable/11/crypto/openssl/crypto/evp/evp_err.c stable/11/crypto/openssl/crypto/evp/pmeth_fn.c stable/11/crypto/openssl/crypto/evp/pmeth_lib.c stable/11/crypto/openssl/crypto/modes/ctr128.c stable/11/crypto/openssl/crypto/opensslv.h stable/11/crypto/openssl/crypto/perlasm/x86_64-xlate.pl stable/11/crypto/openssl/crypto/rsa/rsa_gen.c stable/11/crypto/openssl/crypto/rsa/rsa_oaep.c stable/11/crypto/openssl/crypto/rsa/rsa_pmeth.c stable/11/crypto/openssl/crypto/s390xcap.c stable/11/crypto/openssl/crypto/ui/ui_lib.c stable/11/crypto/openssl/crypto/ui/ui_openssl.c stable/11/crypto/openssl/doc/apps/ocsp.pod stable/11/crypto/openssl/doc/crypto/EVP_DigestSignInit.pod stable/11/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod stable/11/crypto/openssl/doc/crypto/RSA_generate_key.pod stable/11/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod stable/11/crypto/openssl/doc/crypto/X509_NAME_print_ex.pod stable/11/crypto/openssl/doc/ssl/SSL_CTX_set_session_cache_mode.pod stable/11/crypto/openssl/doc/ssl/SSL_get_error.pod stable/11/crypto/openssl/doc/ssl/SSL_read.pod stable/11/crypto/openssl/doc/ssl/SSL_write.pod stable/11/crypto/openssl/engines/ccgost/Makefile stable/11/crypto/openssl/ssl/bad_dtls_test.c stable/11/crypto/openssl/ssl/s23_pkt.c stable/11/crypto/openssl/ssl/s2_lib.c stable/11/crypto/openssl/ssl/s2_pkt.c stable/11/crypto/openssl/ssl/s3_clnt.c stable/11/crypto/openssl/ssl/s3_pkt.c stable/11/crypto/openssl/ssl/s3_srvr.c stable/11/crypto/openssl/ssl/ssl_cert.c stable/11/crypto/openssl/ssl/ssl_err.c stable/11/crypto/openssl/ssl/ssl_lib.c stable/11/crypto/openssl/ssl/ssl_locl.h stable/11/crypto/openssl/ssl/ssl_sess.c stable/11/crypto/openssl/ssl/t1_lib.c stable/11/crypto/openssl/util/domd stable/11/crypto/openssl/util/mklink.pl stable/11/secure/lib/libcrypto/Makefile.inc stable/11/secure/lib/libcrypto/amd64/x86_64-mont.S stable/11/secure/lib/libcrypto/amd64/x86_64-mont5.S stable/11/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_length.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 stable/11/secure/lib/libcrypto/man/ASN1_TIME_set.3 stable/11/secure/lib/libcrypto/man/ASN1_generate_nconf.3 stable/11/secure/lib/libcrypto/man/BIO_ctrl.3 stable/11/secure/lib/libcrypto/man/BIO_f_base64.3 stable/11/secure/lib/libcrypto/man/BIO_f_buffer.3 stable/11/secure/lib/libcrypto/man/BIO_f_cipher.3 stable/11/secure/lib/libcrypto/man/BIO_f_md.3 stable/11/secure/lib/libcrypto/man/BIO_f_null.3 stable/11/secure/lib/libcrypto/man/BIO_f_ssl.3 stable/11/secure/lib/libcrypto/man/BIO_find_type.3 stable/11/secure/lib/libcrypto/man/BIO_new.3 stable/11/secure/lib/libcrypto/man/BIO_new_CMS.3 stable/11/secure/lib/libcrypto/man/BIO_push.3 stable/11/secure/lib/libcrypto/man/BIO_read.3 stable/11/secure/lib/libcrypto/man/BIO_s_accept.3 stable/11/secure/lib/libcrypto/man/BIO_s_bio.3 stable/11/secure/lib/libcrypto/man/BIO_s_connect.3 stable/11/secure/lib/libcrypto/man/BIO_s_fd.3 stable/11/secure/lib/libcrypto/man/BIO_s_file.3 stable/11/secure/lib/libcrypto/man/BIO_s_mem.3 stable/11/secure/lib/libcrypto/man/BIO_s_null.3 stable/11/secure/lib/libcrypto/man/BIO_s_socket.3 stable/11/secure/lib/libcrypto/man/BIO_set_callback.3 stable/11/secure/lib/libcrypto/man/BIO_should_retry.3 stable/11/secure/lib/libcrypto/man/BN_BLINDING_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_start.3 stable/11/secure/lib/libcrypto/man/BN_add.3 stable/11/secure/lib/libcrypto/man/BN_add_word.3 stable/11/secure/lib/libcrypto/man/BN_bn2bin.3 stable/11/secure/lib/libcrypto/man/BN_cmp.3 stable/11/secure/lib/libcrypto/man/BN_copy.3 stable/11/secure/lib/libcrypto/man/BN_generate_prime.3 stable/11/secure/lib/libcrypto/man/BN_mod_inverse.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 stable/11/secure/lib/libcrypto/man/BN_new.3 stable/11/secure/lib/libcrypto/man/BN_num_bytes.3 stable/11/secure/lib/libcrypto/man/BN_rand.3 stable/11/secure/lib/libcrypto/man/BN_set_bit.3 stable/11/secure/lib/libcrypto/man/BN_swap.3 stable/11/secure/lib/libcrypto/man/BN_zero.3 stable/11/secure/lib/libcrypto/man/CMS_add0_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_signer.3 stable/11/secure/lib/libcrypto/man/CMS_compress.3 stable/11/secure/lib/libcrypto/man/CMS_decrypt.3 stable/11/secure/lib/libcrypto/man/CMS_encrypt.3 stable/11/secure/lib/libcrypto/man/CMS_final.3 stable/11/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_type.3 stable/11/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 stable/11/secure/lib/libcrypto/man/CMS_sign.3 stable/11/secure/lib/libcrypto/man/CMS_sign_receipt.3 stable/11/secure/lib/libcrypto/man/CMS_uncompress.3 stable/11/secure/lib/libcrypto/man/CMS_verify.3 stable/11/secure/lib/libcrypto/man/CMS_verify_receipt.3 stable/11/secure/lib/libcrypto/man/CONF_modules_free.3 stable/11/secure/lib/libcrypto/man/CONF_modules_load_file.3 stable/11/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 stable/11/secure/lib/libcrypto/man/DH_generate_key.3 stable/11/secure/lib/libcrypto/man/DH_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DH_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DH_new.3 stable/11/secure/lib/libcrypto/man/DH_set_method.3 stable/11/secure/lib/libcrypto/man/DH_size.3 stable/11/secure/lib/libcrypto/man/DSA_SIG_new.3 stable/11/secure/lib/libcrypto/man/DSA_do_sign.3 stable/11/secure/lib/libcrypto/man/DSA_dup_DH.3 stable/11/secure/lib/libcrypto/man/DSA_generate_key.3 stable/11/secure/lib/libcrypto/man/DSA_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DSA_new.3 stable/11/secure/lib/libcrypto/man/DSA_set_method.3 stable/11/secure/lib/libcrypto/man/DSA_sign.3 stable/11/secure/lib/libcrypto/man/DSA_size.3 stable/11/secure/lib/libcrypto/man/EC_GFp_simple_method.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_copy.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_new.3 stable/11/secure/lib/libcrypto/man/EC_KEY_new.3 stable/11/secure/lib/libcrypto/man/EC_POINT_add.3 stable/11/secure/lib/libcrypto/man/EC_POINT_new.3 stable/11/secure/lib/libcrypto/man/ERR_GET_LIB.3 stable/11/secure/lib/libcrypto/man/ERR_clear_error.3 stable/11/secure/lib/libcrypto/man/ERR_error_string.3 stable/11/secure/lib/libcrypto/man/ERR_get_error.3 stable/11/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 stable/11/secure/lib/libcrypto/man/ERR_load_strings.3 stable/11/secure/lib/libcrypto/man/ERR_print_errors.3 stable/11/secure/lib/libcrypto/man/ERR_put_error.3 stable/11/secure/lib/libcrypto/man/ERR_remove_state.3 stable/11/secure/lib/libcrypto/man/ERR_set_mark.3 stable/11/secure/lib/libcrypto/man/EVP_BytesToKey.3 stable/11/secure/lib/libcrypto/man/EVP_DigestInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestSignInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncodeInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncryptInit.3 stable/11/secure/lib/libcrypto/man/EVP_OpenInit.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_derive.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_sign.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 stable/11/secure/lib/libcrypto/man/EVP_SealInit.3 stable/11/secure/lib/libcrypto/man/EVP_SignInit.3 stable/11/secure/lib/libcrypto/man/EVP_VerifyInit.3 stable/11/secure/lib/libcrypto/man/OBJ_nid2obj.3 stable/11/secure/lib/libcrypto/man/OPENSSL_Applink.3 stable/11/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 stable/11/secure/lib/libcrypto/man/OPENSSL_config.3 stable/11/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 stable/11/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 stable/11/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 stable/11/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 stable/11/secure/lib/libcrypto/man/PKCS12_create.3 stable/11/secure/lib/libcrypto/man/PKCS12_parse.3 stable/11/secure/lib/libcrypto/man/PKCS7_decrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_encrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 stable/11/secure/lib/libcrypto/man/PKCS7_verify.3 stable/11/secure/lib/libcrypto/man/RAND_add.3 stable/11/secure/lib/libcrypto/man/RAND_bytes.3 stable/11/secure/lib/libcrypto/man/RAND_cleanup.3 stable/11/secure/lib/libcrypto/man/RAND_egd.3 stable/11/secure/lib/libcrypto/man/RAND_load_file.3 stable/11/secure/lib/libcrypto/man/RAND_set_rand_method.3 stable/11/secure/lib/libcrypto/man/RSA_blinding_on.3 stable/11/secure/lib/libcrypto/man/RSA_check_key.3 stable/11/secure/lib/libcrypto/man/RSA_generate_key.3 stable/11/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/RSA_new.3 stable/11/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 stable/11/secure/lib/libcrypto/man/RSA_print.3 stable/11/secure/lib/libcrypto/man/RSA_private_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_public_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_set_method.3 stable/11/secure/lib/libcrypto/man/RSA_sign.3 stable/11/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 stable/11/secure/lib/libcrypto/man/RSA_size.3 stable/11/secure/lib/libcrypto/man/SMIME_read_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 stable/11/secure/lib/libcrypto/man/SMIME_write_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 stable/11/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 stable/11/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 stable/11/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 stable/11/secure/lib/libcrypto/man/X509_NAME_print_ex.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 stable/11/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 stable/11/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 stable/11/secure/lib/libcrypto/man/X509_check_host.3 stable/11/secure/lib/libcrypto/man/X509_new.3 stable/11/secure/lib/libcrypto/man/X509_verify_cert.3 stable/11/secure/lib/libcrypto/man/bio.3 stable/11/secure/lib/libcrypto/man/blowfish.3 stable/11/secure/lib/libcrypto/man/bn.3 stable/11/secure/lib/libcrypto/man/bn_internal.3 stable/11/secure/lib/libcrypto/man/buffer.3 stable/11/secure/lib/libcrypto/man/crypto.3 stable/11/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 stable/11/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 stable/11/secure/lib/libcrypto/man/d2i_DHparams.3 stable/11/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_ECPKParameters.3 stable/11/secure/lib/libcrypto/man/d2i_ECPrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_X509.3 stable/11/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 stable/11/secure/lib/libcrypto/man/d2i_X509_CRL.3 stable/11/secure/lib/libcrypto/man/d2i_X509_NAME.3 stable/11/secure/lib/libcrypto/man/d2i_X509_REQ.3 stable/11/secure/lib/libcrypto/man/d2i_X509_SIG.3 stable/11/secure/lib/libcrypto/man/des.3 stable/11/secure/lib/libcrypto/man/dh.3 stable/11/secure/lib/libcrypto/man/dsa.3 stable/11/secure/lib/libcrypto/man/ec.3 stable/11/secure/lib/libcrypto/man/ecdsa.3 stable/11/secure/lib/libcrypto/man/engine.3 stable/11/secure/lib/libcrypto/man/err.3 stable/11/secure/lib/libcrypto/man/evp.3 stable/11/secure/lib/libcrypto/man/hmac.3 stable/11/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 stable/11/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 stable/11/secure/lib/libcrypto/man/lh_stats.3 stable/11/secure/lib/libcrypto/man/lhash.3 stable/11/secure/lib/libcrypto/man/md5.3 stable/11/secure/lib/libcrypto/man/mdc2.3 stable/11/secure/lib/libcrypto/man/pem.3 stable/11/secure/lib/libcrypto/man/rand.3 stable/11/secure/lib/libcrypto/man/rc4.3 stable/11/secure/lib/libcrypto/man/ripemd.3 stable/11/secure/lib/libcrypto/man/rsa.3 stable/11/secure/lib/libcrypto/man/sha.3 stable/11/secure/lib/libcrypto/man/threads.3 stable/11/secure/lib/libcrypto/man/ui.3 stable/11/secure/lib/libcrypto/man/ui_compat.3 stable/11/secure/lib/libcrypto/man/x509.3 stable/11/secure/lib/libssl/man/SSL_CIPHER_get_name.3 stable/11/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd_argv.3 stable/11/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_session.3 stable/11/secure/lib/libssl/man/SSL_CTX_ctrl.3 stable/11/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_free.3 stable/11/secure/lib/libssl/man/SSL_CTX_get0_param.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 stable/11/secure/lib/libssl/man/SSL_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_number.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_curves.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_options.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_timeout.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_verify.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_certificate.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 stable/11/secure/lib/libssl/man/SSL_SESSION_free.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_time.3 stable/11/secure/lib/libssl/man/SSL_accept.3 stable/11/secure/lib/libssl/man/SSL_alert_type_string.3 stable/11/secure/lib/libssl/man/SSL_check_chain.3 stable/11/secure/lib/libssl/man/SSL_clear.3 stable/11/secure/lib/libssl/man/SSL_connect.3 stable/11/secure/lib/libssl/man/SSL_do_handshake.3 stable/11/secure/lib/libssl/man/SSL_free.3 stable/11/secure/lib/libssl/man/SSL_get_SSL_CTX.3 stable/11/secure/lib/libssl/man/SSL_get_ciphers.3 stable/11/secure/lib/libssl/man/SSL_get_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_get_current_cipher.3 stable/11/secure/lib/libssl/man/SSL_get_default_timeout.3 stable/11/secure/lib/libssl/man/SSL_get_error.3 stable/11/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 stable/11/secure/lib/libssl/man/SSL_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_get_fd.3 stable/11/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 stable/11/secure/lib/libssl/man/SSL_get_peer_certificate.3 stable/11/secure/lib/libssl/man/SSL_get_psk_identity.3 stable/11/secure/lib/libssl/man/SSL_get_rbio.3 stable/11/secure/lib/libssl/man/SSL_get_session.3 stable/11/secure/lib/libssl/man/SSL_get_verify_result.3 stable/11/secure/lib/libssl/man/SSL_get_version.3 stable/11/secure/lib/libssl/man/SSL_library_init.3 stable/11/secure/lib/libssl/man/SSL_load_client_CA_file.3 stable/11/secure/lib/libssl/man/SSL_new.3 stable/11/secure/lib/libssl/man/SSL_pending.3 stable/11/secure/lib/libssl/man/SSL_read.3 stable/11/secure/lib/libssl/man/SSL_rstate_string.3 stable/11/secure/lib/libssl/man/SSL_session_reused.3 stable/11/secure/lib/libssl/man/SSL_set_bio.3 stable/11/secure/lib/libssl/man/SSL_set_connect_state.3 stable/11/secure/lib/libssl/man/SSL_set_fd.3 stable/11/secure/lib/libssl/man/SSL_set_session.3 stable/11/secure/lib/libssl/man/SSL_set_shutdown.3 stable/11/secure/lib/libssl/man/SSL_set_verify_result.3 stable/11/secure/lib/libssl/man/SSL_shutdown.3 stable/11/secure/lib/libssl/man/SSL_state_string.3 stable/11/secure/lib/libssl/man/SSL_want.3 stable/11/secure/lib/libssl/man/SSL_write.3 stable/11/secure/lib/libssl/man/d2i_SSL_SESSION.3 stable/11/secure/lib/libssl/man/ssl.3 stable/11/secure/usr.bin/openssl/man/CA.pl.1 stable/11/secure/usr.bin/openssl/man/asn1parse.1 stable/11/secure/usr.bin/openssl/man/c_rehash.1 stable/11/secure/usr.bin/openssl/man/ca.1 stable/11/secure/usr.bin/openssl/man/ciphers.1 stable/11/secure/usr.bin/openssl/man/cms.1 stable/11/secure/usr.bin/openssl/man/crl.1 stable/11/secure/usr.bin/openssl/man/crl2pkcs7.1 stable/11/secure/usr.bin/openssl/man/dgst.1 stable/11/secure/usr.bin/openssl/man/dhparam.1 stable/11/secure/usr.bin/openssl/man/dsa.1 stable/11/secure/usr.bin/openssl/man/dsaparam.1 stable/11/secure/usr.bin/openssl/man/ec.1 stable/11/secure/usr.bin/openssl/man/ecparam.1 stable/11/secure/usr.bin/openssl/man/enc.1 stable/11/secure/usr.bin/openssl/man/errstr.1 stable/11/secure/usr.bin/openssl/man/gendsa.1 stable/11/secure/usr.bin/openssl/man/genpkey.1 stable/11/secure/usr.bin/openssl/man/genrsa.1 stable/11/secure/usr.bin/openssl/man/nseq.1 stable/11/secure/usr.bin/openssl/man/ocsp.1 stable/11/secure/usr.bin/openssl/man/openssl.1 stable/11/secure/usr.bin/openssl/man/passwd.1 stable/11/secure/usr.bin/openssl/man/pkcs12.1 stable/11/secure/usr.bin/openssl/man/pkcs7.1 stable/11/secure/usr.bin/openssl/man/pkcs8.1 stable/11/secure/usr.bin/openssl/man/pkey.1 stable/11/secure/usr.bin/openssl/man/pkeyparam.1 stable/11/secure/usr.bin/openssl/man/pkeyutl.1 stable/11/secure/usr.bin/openssl/man/rand.1 stable/11/secure/usr.bin/openssl/man/req.1 stable/11/secure/usr.bin/openssl/man/rsa.1 stable/11/secure/usr.bin/openssl/man/rsautl.1 stable/11/secure/usr.bin/openssl/man/s_client.1 stable/11/secure/usr.bin/openssl/man/s_server.1 stable/11/secure/usr.bin/openssl/man/s_time.1 stable/11/secure/usr.bin/openssl/man/sess_id.1 stable/11/secure/usr.bin/openssl/man/smime.1 stable/11/secure/usr.bin/openssl/man/speed.1 stable/11/secure/usr.bin/openssl/man/spkac.1 stable/11/secure/usr.bin/openssl/man/ts.1 stable/11/secure/usr.bin/openssl/man/tsget.1 stable/11/secure/usr.bin/openssl/man/verify.1 stable/11/secure/usr.bin/openssl/man/version.1 stable/11/secure/usr.bin/openssl/man/x509.1 stable/11/secure/usr.bin/openssl/man/x509v3_config.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/crypto/openssl/CHANGES ============================================================================== --- stable/11/crypto/openssl/CHANGES Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/CHANGES Thu Jan 26 19:14:14 2017 (r312826) @@ -2,6 +2,67 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2j and 1.0.2k [26 Jan 2017] + + *) Truncated packet could crash via OOB read + + If one side of an SSL/TLS path is running on a 32-bit host and a specific + cipher is being used, then a truncated packet can cause that host to + perform an out-of-bounds read, usually resulting in a crash. + + This issue was reported to OpenSSL by Robert Święcki of Google. + (CVE-2017-3731) + [Andy Polyakov] + + *) BN_mod_exp may produce incorrect results on x86_64 + + There is a carry propagating bug in the x86_64 Montgomery squaring + procedure. No EC algorithms are affected. Analysis suggests that attacks + against RSA and DSA as a result of this defect would be very difficult to + perform and are not believed likely. Attacks against DH are considered just + feasible (although very difficult) because most of the work necessary to + deduce information about a private key may be performed offline. The amount + of resources required for such an attack would be very significant and + likely only accessible to a limited number of attackers. An attacker would + additionally need online access to an unpatched system using the target + private key in a scenario with persistent DH parameters and a private + key that is shared between multiple clients. For example this can occur by + default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very + similar to CVE-2015-3193 but must be treated as a separate problem. + + This issue was reported to OpenSSL by the OSS-Fuzz project. + (CVE-2017-3732) + [Andy Polyakov] + + *) Montgomery multiplication may produce incorrect results + + There is a carry propagating bug in the Broadwell-specific Montgomery + multiplication procedure that handles input lengths divisible by, but + longer than 256 bits. Analysis suggests that attacks against RSA, DSA + and DH private keys are impossible. This is because the subroutine in + question is not used in operations with the private key itself and an input + of the attacker's direct choice. Otherwise the bug can manifest itself as + transient authentication and key negotiation failures or reproducible + erroneous outcome of public-key operations with specially crafted input. + Among EC algorithms only Brainpool P-512 curves are affected and one + presumably can attack ECDH key negotiation. Impact was not analyzed in + detail, because pre-requisites for attack are considered unlikely. Namely + multiple clients have to choose the curve in question and the server has to + share the private key among them, neither of which is default behaviour. + Even then only clients that chose the curve will be affected. + + This issue was publicly reported as transient failures and was not + initially recognized as a security issue. Thanks to Richard Morgan for + providing reproducible case. + (CVE-2016-7055) + [Andy Polyakov] + + *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 + or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to + prevent issues where no progress is being made and the peer continually + sends unrecognised record types, using up resources processing them. + [Matt Caswell] + Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check Modified: stable/11/crypto/openssl/CONTRIBUTING ============================================================================== --- stable/11/crypto/openssl/CONTRIBUTING Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/CONTRIBUTING Thu Jan 26 19:14:14 2017 (r312826) @@ -1,4 +1,4 @@ -HOW TO CONTRIBUTE TO PATCHES OpenSSL +HOW TO CONTRIBUTE PATCHES TO OpenSSL ------------------------------------ (Please visit https://www.openssl.org/community/getting-started.html for @@ -11,34 +11,12 @@ OpenSSL community you might want to disc list first. Someone may be already working on the same thing or there may be a good reason as to why that feature isn't implemented. -The best way to submit a patch is to make a pull request on GitHub. -(It is not necessary to send mail to rt@openssl.org to open a ticket!) -If you think the patch could use feedback from the community, please -start a thread on openssl-dev. - -You can also submit patches by sending it as mail to rt@openssl.org. -Please include the word "PATCH" and an explanation of what the patch -does in the subject line. If you do this, our preferred format is "git -format-patch" output. For example to provide a patch file containing the -last commit in your local git repository use the following command: - - % git format-patch --stdout HEAD^ >mydiffs.patch - -Another method of creating an acceptable patch file without using git is as -follows: - - % cd openssl-work - ...make your changes... - % ./Configure dist; make clean - % cd .. - % diff -ur openssl-orig openssl-work >mydiffs.patch - -Note that pull requests are generally easier for the team, and community, to -work with. Pull requests benefit from all of the standard GitHub features, -including code review tools, simpler integration, and CI build support. +To submit a patch, make a pull request on GitHub. If you think the patch +could use feedback from the community, please start a thread on openssl-dev +to discuss it. -No matter how a patch is submitted, the following items will help make -the acceptance and review process faster: +Having addressed the following items before the PR will help make the +acceptance and review process faster: 1. Anything other than trivial contributions will require a contributor licensing agreement, giving us permission to use your code. See @@ -55,21 +33,22 @@ the acceptance and review process faster in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html - 3. Patches should be as current as possible. When using GitHub, please - expect to have to rebase and update often. Note that we do not accept merge - commits. You will be asked to remove them before a patch is considered - acceptable. + 3. Patches should be as current as possible; expect to have to rebase + often. We do not accept merge commits; You will be asked to remove + them before a patch is considered acceptable. 4. Patches should follow our coding style (see https://www.openssl.org/policies/codingstyle.html) and compile without warnings. Where gcc or clang is availble you should use the --strict-warnings Configure option. OpenSSL compiles on many varied platforms: try to ensure you only use portable features. + Clean builds via Travis and AppVeyor are expected, and done whenever + a PR is created or updated. - 5. When at all possible, patches should include tests. These can either be - added to an existing test, or completely new. Please see test/README - for information on the test framework. - - 6. New features or changed functionality must include documentation. Please - look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of - our style. + 5. When at all possible, patches should include tests. These can + either be added to an existing test, or completely new. Please see + test/README for information on the test framework. + + 6. New features or changed functionality must include + documentation. Please look at the "pod" files in doc/apps, doc/crypto + and doc/ssl for examples of our style. Modified: stable/11/crypto/openssl/Configure ============================================================================== --- stable/11/crypto/openssl/Configure Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Configure Thu Jan 26 19:14:14 2017 (r312826) @@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}' require 5.000; use strict; +use File::Compare; # see INSTALL for instructions. @@ -57,12 +58,13 @@ my $usage="Usage: Configure [no- # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support -# 386 generate 80386 code # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. -# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 +# 386 generate 80386 code in assembly modules +# no-sse2 disables IA-32 SSE2 code in assembly modules, the above +# mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # @@ -1792,8 +1794,16 @@ while () } close(IN); close(OUT); -rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; -rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; +if ((compare($Makefile, "$Makefile.new")) + or file_newer('Configure', $Makefile) + or file_newer('config', $Makefile) + or file_newer('Makefile.org', $Makefile)) + { + rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; + rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; + } +else + { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; @@ -1985,9 +1995,13 @@ print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); -rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; -rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; - +if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) + { + rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; + rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; + } +else + { unlink("crypto/opensslconf.h.new"); } # Fix the date @@ -2289,3 +2303,9 @@ sub test_sanity print STDERR "No sanity errors detected!\n" if $errorcnt == 0; return $errorcnt; } + +sub file_newer + { + my ($file1, $file2) = @_; + return (stat($file1))[9] > (stat($file2))[9] + } Modified: stable/11/crypto/openssl/INSTALL ============================================================================== --- stable/11/crypto/openssl/INSTALL Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/INSTALL Thu Jan 26 19:14:14 2017 (r312826) @@ -74,24 +74,26 @@ no-asm Do not use assembler code. - 386 Use the 80386 instruction set only (the default x86 code is - more efficient, but requires at least a 486). Note: Use - compiler flags for any other CPU specific configuration, - e.g. "-m32" to build x86 code on an x64 system. - - no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is - detected at run-time, but the decision whether or not the - machine code will be executed is taken solely on CPU - capability vector. This means that if you happen to run OS - kernel which does not support SSE2 extension on Intel P4 - processor, then your application might be exposed to - "illegal instruction" exception. There might be a way - to enable support in kernel, e.g. FreeBSD kernel can be - compiled with CPU_ENABLE_SSE, and there is a way to - disengage SSE2 code pathes upon application start-up, - but if you aim for wider "audience" running such kernel, - consider no-sse2. Both 386 and no-asm options above imply - no-sse2. + 386 In 32-bit x86 builds, when generating assembly modules, + use the 80386 instruction set only (the default x86 code + is more efficient, but requires at least a 486). Note: + This doesn't affect code generated by compiler, you're + likely to complement configuration command line with + suitable compiler-specific option. + + no-sse2 Exclude SSE2 code paths from 32-bit x86 assembly modules. + Normally SSE2 extension is detected at run-time, but the + decision whether or not the machine code will be executed + is taken solely on CPU capability vector. This means that + if you happen to run OS kernel which does not support SSE2 + extension on Intel P4 processor, then your application + might be exposed to "illegal instruction" exception. + There might be a way to enable support in kernel, e.g. + FreeBSD kernel can be compiled with CPU_ENABLE_SSE, and + there is a way to disengage SSE2 code paths upon application + start-up, but if you aim for wider "audience" running + such kernel, consider no-sse2. Both the 386 and + no-asm options imply no-sse2. no- Build without the specified cipher (bf, cast, des, dh, dsa, hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). @@ -101,7 +103,12 @@ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will be passed through to the compiler to allow you to define preprocessor symbols, specify additional libraries, - library directories or other compiler options. + library directories or other compiler options. It might be + worth noting that some compilers generate code specifically + for processor the compiler currently executes on. This is + not necessarily what you might have in mind, since it might + be unsuitable for execution on other, typically older, + processor. Consult your compiler documentation. -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using BSD. Useful if you are running ocf-linux or something @@ -159,18 +166,18 @@ OpenSSL binary ("openssl"). The libraries will be built in the top-level directory, and the binary will be in the "apps" directory. - If "make" fails, look at the output. There may be reasons for - the failure that aren't problems in OpenSSL itself (like missing - standard headers). If it is a problem with OpenSSL itself, please - report the problem to (note that your - message will be recorded in the request tracker publicly readable - at https://www.openssl.org/community/index.html#bugs and will be - forwarded to a public mailing list). Include the output of "make - report" in your message. Please check out the request tracker. Maybe - the bug was already reported or has already been fixed. + If the build fails, look at the output. There may be reasons + for the failure that aren't problems in OpenSSL itself (like + missing standard headers). If you are having problems you can + get help by sending an email to the openssl-users email list (see + https://www.openssl.org/community/mailinglists.html for details). If + it is a bug with OpenSSL itself, please open an issue on GitHub, at + https://github.com/openssl/openssl/issues. Please review the existing + ones first; maybe the bug was already reported or has already been + fixed. - [If you encounter assembler error messages, try the "no-asm" - configuration option as an immediate fix.] + (If you encounter assembler error messages, try the "no-asm" + configuration option as an immediate fix.) Compiling parts of OpenSSL with gcc and others with the system compiler will result in unresolved symbols on some systems. Modified: stable/11/crypto/openssl/Makefile ============================================================================== --- stable/11/crypto/openssl/Makefile Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Makefile Thu Jan 26 19:14:14 2017 (r312826) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2j +VERSION=1.0.2k MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -203,7 +203,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: stable/11/crypto/openssl/Makefile.org ============================================================================== --- stable/11/crypto/openssl/Makefile.org Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/Makefile.org Thu Jan 26 19:14:14 2017 (r312826) @@ -201,7 +201,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: stable/11/crypto/openssl/NEWS ============================================================================== --- stable/11/crypto/openssl/NEWS Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/NEWS Thu Jan 26 19:14:14 2017 (r312826) @@ -5,9 +5,15 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] + + o Truncated packet could crash via OOB read (CVE-2017-3731) + o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) + o Montgomery multiplication may produce incorrect results (CVE-2016-7055) + Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] - o Fix Use After Free for large message sizes (CVE-2016-6309) + o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] Modified: stable/11/crypto/openssl/README ============================================================================== --- stable/11/crypto/openssl/README Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/README Thu Jan 26 19:14:14 2017 (r312826) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2j 26 Sep 2016 + OpenSSL 1.0.2k 26 Jan 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -66,13 +66,13 @@ If you have any problems with OpenSSL then please take the following steps first: - - Download the current snapshot from ftp://ftp.openssl.org/snapshot/ + - Download the latest version from the repository to see if the problem has already been addressed - - Remove ASM versions of libraries + - Configure with no-asm - Remove compiler optimisation flags - If you wish to report a bug then please include the following information in - any bug report: + If you wish to report a bug then please include the following information + and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' @@ -84,27 +84,9 @@ - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) - Email the report to: - - rt@openssl.org - - In order to avoid spam, this is a moderated mailing list, and it might - take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail - to this address is recorded in the public RT (request tracker) database - (see https://www.openssl.org/community/index.html#bugs for details) and - also forwarded the public openssl-dev mailing list. Confidential mail - may be sent to openssl-security@openssl.org (PGP key available from the - key servers). - - Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. - You can also make GitHub pull requests. If you do this, please also send - mail to rt@openssl.org with a link to the PR so that we can more easily - keep track of it. - HOW TO CONTRIBUTE TO OpenSSL ---------------------------- @@ -113,7 +95,7 @@ LEGALITIES ---------- - A number of nations, in particular the U.S., restrict the use or export - of cryptography. If you are potentially subject to such restrictions - you should seek competent professional legal advice before attempting to - develop or distribute cryptographic code. + A number of nations restrict the use or export of cryptography. If you + are potentially subject to such restrictions you should seek competent + professional legal advice before attempting to develop or distribute + cryptographic code. Modified: stable/11/crypto/openssl/apps/apps.c ============================================================================== --- stable/11/crypto/openssl/apps/apps.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/apps.c Thu Jan 26 19:14:14 2017 (r312826) @@ -972,7 +972,10 @@ EVP_PKEY *load_key(BIO *err, const char if (!e) BIO_printf(err, "no engine specified\n"); else { - pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (ENGINE_init(e)) { + pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + ENGINE_finish(e); + } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); @@ -1532,11 +1535,13 @@ static ENGINE *try_load_engine(BIO *err, } return e; } +#endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; +#ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); @@ -1561,13 +1566,19 @@ ENGINE *setup_engine(BIO *err, const cha } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); - - /* Free our "structural" reference. */ - ENGINE_free(e); } +#endif return e; } + +void release_engine(ENGINE *e) +{ +#ifndef OPENSSL_NO_ENGINE + if (e != NULL) + /* Free our "structural" reference. */ + ENGINE_free(e); #endif +} int load_config(BIO *err, CONF *cnf) { Modified: stable/11/crypto/openssl/apps/apps.h ============================================================================== --- stable/11/crypto/openssl/apps/apps.h Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/apps.h Thu Jan 26 19:14:14 2017 (r312826) @@ -259,9 +259,9 @@ STACK_OF(X509_CRL) *load_crls(BIO *err, const char *pass, ENGINE *e, const char *cert_descrip); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); -# ifndef OPENSSL_NO_ENGINE + ENGINE *setup_engine(BIO *err, const char *engine, int debug); -# endif +void release_engine(ENGINE *e); # ifndef OPENSSL_NO_OCSP OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, Modified: stable/11/crypto/openssl/apps/ca.c ============================================================================== --- stable/11/crypto/openssl/apps/ca.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ca.c Thu Jan 26 19:14:14 2017 (r312826) @@ -319,9 +319,7 @@ int MAIN(int argc, char **argv) #define BSIZE 256 MS_STATIC char buf[3][BSIZE]; char *randfile = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif char *tofree = NULL; DB_ATTR db_attr; @@ -595,9 +593,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, conf)) goto err; -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif /* Lets get the config section we are using */ if (section == NULL) { @@ -1485,6 +1481,7 @@ int MAIN(int argc, char **argv) X509_CRL_free(crl); NCONF_free(conf); NCONF_free(extconf); + release_engine(e); OBJ_cleanup(); apps_shutdown(); OPENSSL_EXIT(ret); @@ -2227,7 +2224,6 @@ static int certify_spkac(X509 **xret, ch sk = CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) { BIO_printf(bio_err, "no name/value pairs found in %s\n", infile); - CONF_free(parms); goto err; } Modified: stable/11/crypto/openssl/apps/cms.c ============================================================================== --- stable/11/crypto/openssl/apps/cms.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/cms.c Thu Jan 26 19:14:14 2017 (r312826) @@ -143,9 +143,7 @@ int MAIN(int argc, char **argv) const EVP_MD *sign_md = NULL; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif unsigned char *secret_key = NULL, *secret_keyid = NULL; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; size_t secret_keylen = 0, secret_keyidlen = 0; @@ -665,9 +663,7 @@ int MAIN(int argc, char **argv) "cert.pem recipient certificate(s) for encryption\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); @@ -1170,6 +1166,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(key); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); + release_engine(e); BIO_free(rctin); BIO_free(in); BIO_free(indata); Modified: stable/11/crypto/openssl/apps/dgst.c ============================================================================== --- stable/11/crypto/openssl/apps/dgst.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dgst.c Thu Jan 26 19:14:14 2017 (r312826) @@ -537,6 +537,7 @@ int MAIN(int argc, char **argv) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(err); } Modified: stable/11/crypto/openssl/apps/dh.c ============================================================================== --- stable/11/crypto/openssl/apps/dh.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dh.c Thu Jan 26 19:14:14 2017 (r312826) @@ -94,9 +94,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif apps_startup(); @@ -107,9 +105,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -183,9 +179,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); Modified: stable/11/crypto/openssl/apps/dhparam.c ============================================================================== --- stable/11/crypto/openssl/apps/dhparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dhparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -159,9 +159,8 @@ int MAIN(int argc, char **argv) int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; int num = 0, g = 0; apps_startup(); @@ -270,9 +269,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (g && !num) num = DEFBITS; @@ -512,6 +509,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dh != NULL) DH_free(dh); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/dsa.c ============================================================================== --- stable/11/crypto/openssl/apps/dsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -106,9 +106,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; @@ -124,9 +122,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -239,9 +235,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -358,6 +352,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: stable/11/crypto/openssl/apps/dsaparam.c ============================================================================== --- stable/11/crypto/openssl/apps/dsaparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/dsaparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -121,9 +121,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog, *inrand = NULL; int numbits = -1, num, genkey = 0; int need_rand = 0; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; # ifdef GENCB_TEST int timebomb = 0; # endif @@ -263,9 +262,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (need_rand) { app_RAND_load_file(NULL, bio_err, (inrand != NULL)); @@ -433,6 +430,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/ec.c ============================================================================== --- stable/11/crypto/openssl/apps/ec.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ec.c Thu Jan 26 19:14:14 2017 (r312826) @@ -95,6 +95,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0, param_out = 0; char *infile, *outfile, *prog, *engine; + ENGINE *e = NULL; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; @@ -235,9 +236,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -349,6 +348,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (eckey) EC_KEY_free(eckey); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: stable/11/crypto/openssl/apps/ecparam.c ============================================================================== --- stable/11/crypto/openssl/apps/ecparam.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/ecparam.c Thu Jan 26 19:14:14 2017 (r312826) @@ -131,6 +131,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; char *engine = NULL; + ENGINE *e = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; @@ -311,9 +312,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (list_curves) { EC_builtin_curve *curves = NULL; @@ -620,12 +619,13 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); + if (group != NULL) + EC_GROUP_free(group); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - if (group != NULL) - EC_GROUP_free(group); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: stable/11/crypto/openssl/apps/enc.c ============================================================================== --- stable/11/crypto/openssl/apps/enc.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/enc.c Thu Jan 26 19:14:14 2017 (r312826) @@ -126,9 +126,8 @@ int MAIN(int argc, char **argv) NULL, *wbio = NULL; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE + 1]; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; const EVP_MD *dgst = NULL; int non_fips_allow = 0; @@ -322,9 +321,7 @@ int MAIN(int argc, char **argv) argv++; } -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) { BIO_printf(bio_err, @@ -674,6 +671,7 @@ int MAIN(int argc, char **argv) if (bzl != NULL) BIO_free(bzl); #endif + release_engine(e); if (pass) OPENSSL_free(pass); apps_shutdown(); Modified: stable/11/crypto/openssl/apps/gendh.c ============================================================================== --- stable/11/crypto/openssl/apps/gendh.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/gendh.c Thu Jan 26 19:14:14 2017 (r312826) @@ -96,9 +96,7 @@ int MAIN(int argc, char **argv) int g = 2; char *outfile = NULL; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif BIO *out = NULL; apps_startup(); @@ -162,9 +160,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, " the random number generator\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif out = BIO_new(BIO_s_file()); if (out == NULL) { Modified: stable/11/crypto/openssl/apps/gendsa.c ============================================================================== --- stable/11/crypto/openssl/apps/gendsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/gendsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -85,9 +85,8 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out = NULL, *in = NULL; const EVP_CIPHER *enc = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; apps_startup(); @@ -206,9 +205,7 @@ int MAIN(int argc, char **argv) " - a DSA parameter file as generated by the dsaparam command\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); @@ -273,6 +270,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passout) OPENSSL_free(passout); apps_shutdown(); Modified: stable/11/crypto/openssl/apps/genpkey.c ============================================================================== --- stable/11/crypto/openssl/apps/genpkey.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/genpkey.c Thu Jan 26 19:14:14 2017 (r312826) @@ -275,9 +275,9 @@ int MAIN(int argc, char **argv) if (out) BIO_free_all(out); BIO_free(in); + release_engine(e); if (pass) OPENSSL_free(pass); - return ret; } Modified: stable/11/crypto/openssl/apps/genrsa.c ============================================================================== --- stable/11/crypto/openssl/apps/genrsa.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/genrsa.c Thu Jan 26 19:14:14 2017 (r312826) @@ -91,9 +91,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -# ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; -# endif int ret = 1; int i, num = DEFBITS; long l; @@ -101,9 +99,7 @@ int MAIN(int argc, char **argv) unsigned long f4 = RSA_F4; char *outfile = NULL; char *passargout = NULL, *passout = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif char *inrand = NULL; BIO *out = NULL; BIGNUM *bn = BN_new(); @@ -240,9 +236,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error getting password\n"); goto err; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); @@ -314,6 +308,7 @@ int MAIN(int argc, char **argv) RSA_free(rsa); if (out) BIO_free_all(out); + release_engine(e); if (passout) OPENSSL_free(passout); if (ret != 0) Modified: stable/11/crypto/openssl/apps/pkcs12.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs12.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs12.c Thu Jan 26 19:14:14 2017 (r312826) @@ -129,9 +129,7 @@ int MAIN(int argc, char **argv) char *inrand = NULL; char *macalg = NULL; char *CApath = NULL, *CAfile = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif apps_startup(); @@ -406,9 +404,7 @@ int MAIN(int argc, char **argv) "-LMK Add local machine keyset attribute to private key\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (passarg) { if (export_cert) @@ -756,6 +752,7 @@ int MAIN(int argc, char **argv) # ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); # endif + release_engine(e); BIO_free(in); BIO_free_all(out); if (canames) @@ -1110,4 +1107,6 @@ static int set_pbe(BIO *err, int *ppbe, return 1; } +#else +static void *dummy = &dummy; #endif Modified: stable/11/crypto/openssl/apps/pkcs7.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs7.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs7.c Thu Jan 26 19:14:14 2017 (r312826) @@ -90,9 +90,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog; int print_certs = 0, text = 0, noout = 0, p7_print = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; apps_startup(); @@ -175,9 +174,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); @@ -303,6 +300,7 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) Modified: stable/11/crypto/openssl/apps/pkcs8.c ============================================================================== --- stable/11/crypto/openssl/apps/pkcs8.c Thu Jan 26 19:10:29 2017 (r312825) +++ stable/11/crypto/openssl/apps/pkcs8.c Thu Jan 26 19:14:14 2017 (r312826) @@ -87,9 +87,7 @@ int MAIN(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); @@ -223,9 +221,7 @@ int MAIN(int argc, char **argv) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 20:09: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 07044CC3031; Thu, 26 Jan 2017 20:09:00 +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 B961490D; Thu, 26 Jan 2017 20:08:59 +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 v0QK8wf0081445; Thu, 26 Jan 2017 20:08:58 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QK8wWl081443; Thu, 26 Jan 2017 20:08:58 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201701262008.v0QK8wWl081443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 26 Jan 2017 20:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312827 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:09:00 -0000 Author: scottl Date: Thu Jan 26 20:08:58 2017 New Revision: 312827 URL: https://svnweb.freebsd.org/changeset/base/312827 Log: Refactor xpt_print_path, xpt_print, and xpt_path_string. Implement all of them in terms of an sbuf-based back-end, xpt_path_sbuf. This unifies the implementation, but more importantly it stops the output fropm being split between 4 or more invocations of printf. The multiple invocations cause interleaving of the messages on the console during boot, making the output of disk discovery often unintelligible. This change helps a lot, but more work is needed. Reviewed by: ken, mav Sponsored by: Netflix Modified: head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jan 26 19:14:14 2017 (r312826) +++ head/sys/cam/cam_xpt.c Thu Jan 26 20:08:58 2017 (r312827) @@ -3697,33 +3697,14 @@ xpt_path_comp_dev(struct cam_path *path, void xpt_print_path(struct cam_path *path) { + struct sbuf sb; + char buffer[XPT_PRINT_LEN]; - if (path == NULL) - printf("(nopath): "); - else { - if (path->periph != NULL) - printf("(%s%d:", path->periph->periph_name, - path->periph->unit_number); - else - printf("(noperiph:"); - - if (path->bus != NULL) - printf("%s%d:%d:", path->bus->sim->sim_name, - path->bus->sim->unit_number, - path->bus->sim->bus_id); - else - printf("nobus:"); - - if (path->target != NULL) - printf("%d:", path->target->target_id); - else - printf("X:"); - - if (path->device != NULL) - printf("%jx): ", (uintmax_t)path->device->lun_id); - else - printf("X): "); - } + sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN); + xpt_path_sbuf(path, &sb); + sbuf_finish(&sb); + printf("%s", sbuf_data(&sb)); + sbuf_delete(&sb); } void @@ -3745,49 +3726,66 @@ void xpt_print(struct cam_path *path, const char *fmt, ...) { va_list ap; - xpt_print_path(path); + struct sbuf sb; + char buffer[XPT_PRINT_MAXLEN]; + + sbuf_new(&sb, buffer, XPT_PRINT_MAXLEN, SBUF_FIXEDLEN); + + xpt_path_sbuf(path, &sb); va_start(ap, fmt); - vprintf(fmt, ap); + sbuf_vprintf(&sb, fmt, ap); va_end(ap); + + sbuf_finish(&sb); + printf("%s", sbuf_data(&sb)); + sbuf_delete(&sb); } int xpt_path_string(struct cam_path *path, char *str, size_t str_len) { struct sbuf sb; + int len; sbuf_new(&sb, str, str_len, 0); + len = xpt_path_sbuf(path, &sb); + sbuf_finish(&sb); + return (len); +} + +int +xpt_path_sbuf(struct cam_path *path, struct sbuf *sb) +{ if (path == NULL) - sbuf_printf(&sb, "(nopath): "); + sbuf_printf(sb, "(nopath): "); else { if (path->periph != NULL) - sbuf_printf(&sb, "(%s%d:", path->periph->periph_name, + sbuf_printf(sb, "(%s%d:", path->periph->periph_name, path->periph->unit_number); else - sbuf_printf(&sb, "(noperiph:"); + sbuf_printf(sb, "(noperiph:"); if (path->bus != NULL) - sbuf_printf(&sb, "%s%d:%d:", path->bus->sim->sim_name, + sbuf_printf(sb, "%s%d:%d:", path->bus->sim->sim_name, path->bus->sim->unit_number, path->bus->sim->bus_id); else - sbuf_printf(&sb, "nobus:"); + sbuf_printf(sb, "nobus:"); if (path->target != NULL) - sbuf_printf(&sb, "%d:", path->target->target_id); + sbuf_printf(sb, "%d:", path->target->target_id); else - sbuf_printf(&sb, "X:"); + sbuf_printf(sb, "X:"); if (path->device != NULL) - sbuf_printf(&sb, "%jx): ", + sbuf_printf(sb, "%jx): ", (uintmax_t)path->device->lun_id); else - sbuf_printf(&sb, "X): "); + sbuf_printf(sb, "X): "); } - sbuf_finish(&sb); - return(sbuf_len(&sb)); + return(sbuf_len(sb)); } path_id_t Modified: head/sys/cam/cam_xpt.h ============================================================================== --- head/sys/cam/cam_xpt.h Thu Jan 26 19:14:14 2017 (r312826) +++ head/sys/cam/cam_xpt.h Thu Jan 26 20:08:58 2017 (r312827) @@ -32,11 +32,15 @@ #ifndef _CAM_CAM_XPT_H #define _CAM_CAM_XPT_H 1 +#include +#include "opt_printf.h" + /* Forward Declarations */ union ccb; struct cam_periph; struct cam_ed; struct cam_sim; +struct sbuf; /* * Definition of a CAM path. Paths are created from bus, target, and lun ids @@ -49,6 +53,15 @@ struct cam_path; #ifdef _KERNEL +/* Wild guess based on not wanting to grow the stack too much */ +#define XPT_PRINT_MAXLEN 512 +#ifdef PRINTF_BUFR_SIZE +#define XPT_PRINT_LEN PRINTF_BUFR_SIZE +#else +#define XPT_PRINT_LEN 128 +#endif +_Static_assert(XPT_PRINT_LEN <= XPT_PRINT_MAXLEN, "XPT_PRINT_LEN is too large"); + /* * Definition of an async handler callback block. These are used to add * SIMs and peripherals to the async callback lists. @@ -102,6 +115,7 @@ void xpt_print_device(struct cam_ed *d void xpt_print(struct cam_path *path, const char *fmt, ...); int xpt_path_string(struct cam_path *path, char *str, size_t str_len); +int xpt_path_sbuf(struct cam_path *path, struct sbuf *sb); path_id_t xpt_path_path_id(struct cam_path *path); target_id_t xpt_path_target_id(struct cam_path *path); lun_id_t xpt_path_lun_id(struct cam_path *path); From owner-svn-src-all@freebsd.org Thu Jan 26 20:10: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 51BEACC30D1; Thu, 26 Jan 2017 20:10:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD190AA9; Thu, 26 Jan 2017 20:10:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKAXnE081576; Thu, 26 Jan 2017 20:10:33 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKAVSx081562; Thu, 26 Jan 2017 20:10:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201701262010.v0QKAVSx081562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Jan 2017 20:10:31 +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: r312828 - in stable/10: . tests/sys/geom/class/eli tests/sys/geom/class/nop X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:10:34 -0000 Author: asomers Date: Thu Jan 26 20:10:31 2017 New Revision: 312828 URL: https://svnweb.freebsd.org/changeset/base/312828 Log: MFC r310786, r310803, r310985, r311894 r310786: Reduce the runtime of the GELI tests There is no reduction in test coverage. On my system runtime is reduced from 38m32s to 6m24s. tests/sys/geom/class/eli/conf.sh tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh tests/sys/geom/class/eli/onetime_test.sh Move the looping code into common functions in conf.sh, and remove alias ciphers from the list. tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Move a few commands that don't need to be in the inner loop out. tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Reduce the sector count tests/sys/geom/class/eli/Makefile tests/sys/geom/class/eli/init_alias_test.sh Add a test for initializing a GELI device using one of the cipher aliases, and check that the alias is correctly interpreted. MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8814 r310803: ATFify the gnop tests Also, add test cases for the -p, -P, and -s options to gnop create Reviewed by: ngie MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D8892 r310985: Update ObsoleteFiles.inc for r310803 MFC after: 26 days X-MFC-with: 310803 r311894: Fix typo from change 310985 in ObsoleteFiles.inc MFC after: 16 days X-MFC-With: 310803 Sponsored by: Spectra Logic Corp Added: stable/10/tests/sys/geom/class/eli/init_alias_test.sh - copied unchanged from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh stable/10/tests/sys/geom/class/nop/nop_test.sh - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh Deleted: stable/10/tests/sys/geom/class/nop/1_test.sh stable/10/tests/sys/geom/class/nop/2_test.sh stable/10/tests/sys/geom/class/nop/conf.sh Modified: stable/10/ObsoleteFiles.inc stable/10/tests/sys/geom/class/eli/Makefile stable/10/tests/sys/geom/class/eli/conf.sh stable/10/tests/sys/geom/class/eli/init_a_test.sh stable/10/tests/sys/geom/class/eli/init_test.sh stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh stable/10/tests/sys/geom/class/eli/integrity_data_test.sh stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh stable/10/tests/sys/geom/class/eli/onetime_a_test.sh stable/10/tests/sys/geom/class/eli/onetime_test.sh stable/10/tests/sys/geom/class/nop/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017 (r312828) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20161229: Three files from gnop tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/nop/1_test +OLD_FILES+=usr/tests/sys/geom/class/nop/2_test +OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh # 20161121: Hyper-V manuals only apply to amd64 and i386. .if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "i386" OLD_FILES+=usr/share/man/man4/hv_kvp.4.gz Modified: stable/10/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017 (r312828) @@ -9,6 +9,7 @@ TAP_TESTS_SH+= detach_l_test TAP_TESTS_SH+= init_B_test TAP_TESTS_SH+= init_J_test TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_alias_test TAP_TESTS_SH+= init_i_P_test TAP_TESTS_SH+= init_test TAP_TESTS_SH+= integrity_copy_test Modified: stable/10/tests/sys/geom/class/eli/conf.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do : $(( no += 1 )) done +# Execute `func` for each combination of cipher, sectorsize, and hmac algo +# `func` usage should be: +# func +for_each_geli_config() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ + hmac/sha384 hmac/sha512; do + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done + done +} + +# Execute `func` for each combination of cipher, and sectorsize, with no hmac +# `func` usage should be: +# func +for_each_geli_config_nointegrity() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done +} + + geli_test_cleanup() { [ -c /dev/md${no}.eli ] && geli detach md${no}.eli Modified: stable/10/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -6,55 +6,45 @@ base=`basename $0` sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" - -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +echo "1..600" + +i=1 + +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${rnd} bs=8192 count=${sectors} >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd rm -f $keyfile Copied: stable/10/tests/sys/geom/class/eli/init_alias_test.sh (from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tests/sys/geom/class/eli/init_alias_test.sh Thu Jan 26 20:10:31 2017 (r312828, copy of r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) @@ -0,0 +1,64 @@ +#!/bin/sh +# $FreeBSD$ + +# Test "geli init"'s various cipher aliases +. $(dirname $0)/conf.sh + +base=`basename $0` +sectors=100 +keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 + +do_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + real_ealgo=`geli list md${no}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list md${no}.eli | awk '/KeyLength/ {print $2}'` + + if [ ${real_ealgo} = ${expected_ealgo} ]; then + echo "ok $i - ${ealgo} aliased to ${real_ealgo}" + else + echo "not ok $i - expected ${expected_ealgo} but got ${real_ealgo}" + fi + i=$((i+1)) + + if [ ${real_keylen} = ${expected_keylen} ]; then + echo "ok $i - keylen=${keylen} for ealgo=${ealgo} aliases to ${real_keylen}" + else + echo "not ok $i - expected ${expected_keylen} but got ${real_keylen}" + fi + i=$((i+1)) + + geli detach md${no} +} + +echo "1..38" +i=1 +mdconfig -a -t malloc -s 1024k -u $no || exit 1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + do_test $ealgo $keylen $expected_ealgo $expected_keylen +done + +rm -f $keyfile Modified: stable/10/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,62 +4,52 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=32 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +for_each_geli_config_nointegrity do_test + +rm -f $rnd rm -f $keyfile Modified: stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,96 +4,85 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..5520" +echo "1..2400" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - mdconfig -a -t malloc -s $sectors -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first small sector to the second small sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` - ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first big sector to the second big sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + + # Fix the corruption + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first big sector to the second big sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,66 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of data. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of data. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,66 +4,43 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of HMAC. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 2 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of HMAC. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/10/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -4,51 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=8 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${rnd} bs=1024 count=1024 >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd Modified: stable/10/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- stable/10/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:10:31 2017 (r312828) @@ -6,54 +6,45 @@ base=`basename $0` sectors=100 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 - - geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + + rnd=`mktemp $base.XXXXXX` || exit 1 + mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 + + geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + rm -f $rnd + mdconfig -d -u $no +} + +i=1 +for_each_geli_config_nointegrity do_test Modified: stable/10/tests/sys/geom/class/nop/Makefile ============================================================================== --- stable/10/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:08:58 2017 (r312827) +++ stable/10/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:10:31 2017 (r312828) @@ -2,15 +2,6 @@ TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test - -FILES+= conf.sh -FILESNAME_conf.sh= conf.sh -FILESDIR= ${TESTSDIR} - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= nop_test .include Copied: stable/10/tests/sys/geom/class/nop/nop_test.sh (from r310803, head/tests/sys/geom/class/nop/nop_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tests/sys/geom/class/nop/nop_test.sh Thu Jan 26 20:10:31 2017 (r312828, copy of r310803, head/tests/sys/geom/class/nop/nop_test.sh) @@ -0,0 +1,166 @@ +# Copyright (c) 2016 Alan Somers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +MD_DEVS="md.devs" +PLAINFILES=plainfiles + +atf_test_case diskinfo cleanup +diskinfo_head() +{ + atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +diskinfo_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + md_secsize=$(diskinfo ${us} | cut -wf 2) + md_mediasize=$(diskinfo ${us} | cut -wf 3) + md_stripesize=$(diskinfo ${us} | cut -wf 5) + nop_secsize=$(diskinfo ${us}.nop | cut -wf 2) + nop_mediasize=$(diskinfo ${us}.nop | cut -wf 3) + nop_stripesize=$(diskinfo ${us}.nop | cut -wf 5) + atf_check_equal "$md_secsize" "$nop_secsize" + atf_check_equal "$md_mediasize" "$nop_mediasize" + atf_check_equal "$md_stripesize" "$nop_stripesize" +} +diskinfo_cleanup() +{ + common_cleanup +} + +atf_test_case io cleanup +io_head() +{ + atf_set "descr" "I/O works on gnop devices" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +io_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + + echo src >> $PLAINFILES + echo dst >> $PLAINFILES + dd if=/dev/random of=src bs=1m count=1 >/dev/null 2>&1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 20:15: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 1B4F1CC32A1; Thu, 26 Jan 2017 20:15:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8363F11; Thu, 26 Jan 2017 20:15:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKFFkQ085281; Thu, 26 Jan 2017 20:15:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKFExH085265; Thu, 26 Jan 2017 20:15:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201701262015.v0QKFExH085265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Jan 2017 20:15: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: r312829 - in stable/11: . tests/sys/geom/class/eli tests/sys/geom/class/nop X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:15:17 -0000 Author: asomers Date: Thu Jan 26 20:15:14 2017 New Revision: 312829 URL: https://svnweb.freebsd.org/changeset/base/312829 Log: MFC r310786, r310803, r310985, r311894 r310786: Reduce the runtime of the GELI tests There is no reduction in test coverage. On my system runtime is reduced from 38m32s to 6m24s. tests/sys/geom/class/eli/conf.sh tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh tests/sys/geom/class/eli/onetime_test.sh Move the looping code into common functions in conf.sh, and remove alias ciphers from the list. tests/sys/geom/class/eli/init_a_test.sh tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/integrity_copy_test.sh tests/sys/geom/class/eli/integrity_data_test.sh tests/sys/geom/class/eli/integrity_hmac_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Move a few commands that don't need to be in the inner loop out. tests/sys/geom/class/eli/init_test.sh tests/sys/geom/class/eli/onetime_a_test.sh Reduce the sector count tests/sys/geom/class/eli/Makefile tests/sys/geom/class/eli/init_alias_test.sh Add a test for initializing a GELI device using one of the cipher aliases, and check that the alias is correctly interpreted. MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8814 r310803: ATFify the gnop tests Also, add test cases for the -p, -P, and -s options to gnop create Reviewed by: ngie MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D8892 r310985: Update ObsoleteFiles.inc for r310803 MFC after: 26 days X-MFC-with: 310803 r311894: Fix typo from change 310985 in ObsoleteFiles.inc MFC after: 16 days X-MFC-With: 310803 Sponsored by: Spectra Logic Corp Added: stable/11/tests/sys/geom/class/eli/init_alias_test.sh - copied unchanged from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh stable/11/tests/sys/geom/class/nop/nop_test.sh - copied unchanged from r310803, head/tests/sys/geom/class/nop/nop_test.sh Deleted: stable/11/tests/sys/geom/class/nop/1_test.sh stable/11/tests/sys/geom/class/nop/2_test.sh stable/11/tests/sys/geom/class/nop/conf.sh Modified: stable/11/ObsoleteFiles.inc stable/11/tests/sys/geom/class/eli/Makefile stable/11/tests/sys/geom/class/eli/conf.sh stable/11/tests/sys/geom/class/eli/init_a_test.sh stable/11/tests/sys/geom/class/eli/init_test.sh stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh stable/11/tests/sys/geom/class/eli/integrity_data_test.sh stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh stable/11/tests/sys/geom/class/eli/onetime_a_test.sh stable/11/tests/sys/geom/class/eli/onetime_test.sh stable/11/tests/sys/geom/class/nop/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/ObsoleteFiles.inc Thu Jan 26 20:15:14 2017 (r312829) @@ -40,6 +40,10 @@ # 20170112: sysdecode_getfsstat_flags() renamed to sysdecode_getfsstat_mode() OLD_FILES+=usr/share/man/man3/sysdecode_getfsstat_flags.3.gz +# 20161229: Three files from gnop tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/nop/1_test +OLD_FILES+=usr/tests/sys/geom/class/nop/2_test +OLD_FILES+=usr/tests/sys/geom/class/nop/conf.sh # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1. OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h Modified: stable/11/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/Makefile Thu Jan 26 20:15:14 2017 (r312829) @@ -11,6 +11,7 @@ TAP_TESTS_SH+= detach_l_test TAP_TESTS_SH+= init_B_test TAP_TESTS_SH+= init_J_test TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_alias_test TAP_TESTS_SH+= init_i_P_test TAP_TESTS_SH+= init_test TAP_TESTS_SH+= integrity_copy_test Modified: stable/11/tests/sys/geom/class/eli/conf.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/conf.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -11,6 +11,54 @@ while [ -c /dev/md$no ]; do : $(( no += 1 )) done +# Execute `func` for each combination of cipher, sectorsize, and hmac algo +# `func` usage should be: +# func +for_each_geli_config() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \ + hmac/sha384 hmac/sha512; do + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done + done +} + +# Execute `func` for each combination of cipher, and sectorsize, with no hmac +# `func` usage should be: +# func +for_each_geli_config_nointegrity() { + func=$1 + + for cipher in aes-xts:128 aes-xts:256 \ + aes-cbc:128 aes-cbc:192 aes-cbc:256 \ + 3des-cbc:192 \ + blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \ + blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \ + blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do + ealgo=${cipher%%:*} + keylen=${cipher##*:} + for secsize in 512 1024 2048 4096 8192; do + ${func} $cipher $aalgo $secsize + done + done +} + + geli_test_cleanup() { [ -c /dev/md${no}.eli ] && geli detach md${no}.eli Modified: stable/11/tests/sys/geom/class/eli/init_a_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/init_a_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -6,55 +6,45 @@ base=`basename $0` sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" - -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +echo "1..600" + +i=1 + +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${rnd} bs=8192 count=${sectors} >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd rm -f $keyfile Copied: stable/11/tests/sys/geom/class/eli/init_alias_test.sh (from r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/eli/init_alias_test.sh Thu Jan 26 20:15:14 2017 (r312829, copy of r310786, head/tests/sys/geom/class/eli/init_alias_test.sh) @@ -0,0 +1,64 @@ +#!/bin/sh +# $FreeBSD$ + +# Test "geli init"'s various cipher aliases +. $(dirname $0)/conf.sh + +base=`basename $0` +sectors=100 +keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 + +do_test() { + ealgo=$1 + keylen=$2 + expected_ealgo=$3 + expected_keylen=$4 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + real_ealgo=`geli list md${no}.eli | awk '/EncryptionAlgorithm/ {print $2}'` + real_keylen=`geli list md${no}.eli | awk '/KeyLength/ {print $2}'` + + if [ ${real_ealgo} = ${expected_ealgo} ]; then + echo "ok $i - ${ealgo} aliased to ${real_ealgo}" + else + echo "not ok $i - expected ${expected_ealgo} but got ${real_ealgo}" + fi + i=$((i+1)) + + if [ ${real_keylen} = ${expected_keylen} ]; then + echo "ok $i - keylen=${keylen} for ealgo=${ealgo} aliases to ${real_keylen}" + else + echo "not ok $i - expected ${expected_keylen} but got ${real_keylen}" + fi + i=$((i+1)) + + geli detach md${no} +} + +echo "1..38" +i=1 +mdconfig -a -t malloc -s 1024k -u $no || exit 1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \ + 3des:0:3DES-CBC:192 3des:192:3DES-CBC:192 \ + blowfish:0:Blowfish-CBC:128 blowfish:128:Blowfish-CBC:128 \ + blowfish:160:Blowfish-CBC:160 blowfish:192:Blowfish-CBC:192 \ + blowfish:224:Blowfish-CBC:224 blowfish:256:Blowfish-CBC:256 \ + blowfish:288:Blowfish-CBC:288 blowfish:352:Blowfish-CBC:352 \ + blowfish:384:Blowfish-CBC:384 blowfish:416:Blowfish-CBC:416 \ + blowfish:448:Blowfish-CBC:448 \ + camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \ + camellia:256:CAMELLIA-CBC:256 ; do + + ealgo=`echo $spec | cut -d : -f 1` + keylen=`echo $spec | cut -d : -f 2` + expected_ealgo=`echo $spec | cut -d : -f 3` + expected_keylen=`echo $spec | cut -d : -f 4` + + do_test $ealgo $keylen $expected_ealgo $expected_keylen +done + +rm -f $keyfile Modified: stable/11/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/init_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,62 +4,52 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=32 keyfile=`mktemp $base.XXXXXX` || exit 1 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + + geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 +for_each_geli_config_nointegrity do_test + +rm -f $rnd rm -f $keyfile Modified: stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_copy_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,96 +4,85 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..5520" +echo "1..2400" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - mdconfig -a -t malloc -s $sectors -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first small sector to the second small sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` - ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Copy first big sector to the second big sector. - # This should be detected as corruption. - dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + geli attach -p -k $keyfile md${no} + + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first small sector to the second small sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'` + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc` + + # Fix the corruption + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + # Copy first big sector to the second big sector. + # This should be detected as corruption. + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/integrity_data_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_data_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,66 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of data. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of data. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/integrity_hmac_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,66 +4,43 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 keyfile=`mktemp $base.XXXXXX` || exit 1 sector=`mktemp $base.XXXXXX` || exit 1 -echo "1..2760" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1 - - dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 - - geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null - geli attach -p -k $keyfile md${no} - - dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - # Corrupt 8 bytes of HMAC. - dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 - dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 - dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 - geli attach -p -k $keyfile md${no} - - dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 2 + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null + + # Corrupt 8 bytes of HMAC. + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1 + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1 + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1 + geli attach -p -k $keyfile md${no} + + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + + +i=1 +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 + +for_each_geli_config do_test rm -f $keyfile $sector Modified: stable/11/tests/sys/geom/class/eli/onetime_a_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/onetime_a_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -4,51 +4,42 @@ . $(dirname $0)/conf.sh base=`basename $0` -sectors=100 +sectors=8 +rnd=`mktemp $base.XXXXXX` || exit 1 -echo "1..1380" +echo "1..600" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + aalgo=$2 + secsize=$3 ealgo=${cipher%%:*} keylen=${cipher##*:} - for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 - - geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done - done -done + + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 + geli onetime -a $aalgo -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + mdconfig -d -u $no +} + +i=1 +dd if=/dev/random of=${rnd} bs=1024 count=1024 >/dev/null 2>&1 + +for_each_geli_config do_test + +rm -f $rnd Modified: stable/11/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- stable/11/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/eli/onetime_test.sh Thu Jan 26 20:15:14 2017 (r312829) @@ -6,54 +6,45 @@ base=`basename $0` sectors=100 -echo "1..460" +echo "1..200" -i=1 -for cipher in aes:0 aes:128 aes:256 \ - aes-xts:0 aes-xts:128 aes-xts:256 \ - aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ - 3des:0 3des:192 \ - 3des-cbc:0 3des-cbc:192 \ - blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ - blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ - blowfish:416 blowfish:448 \ - blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ - blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ - blowfish-cbc:416 blowfish-cbc:448 \ - camellia:0 camellia:128 camellia:192 camellia:256 \ - camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do +do_test() { + cipher=$1 + secsize=$2 ealgo=${cipher%%:*} keylen=${cipher##*:} - for secsize in 512 1024 2048 4096 8192; do - rnd=`mktemp $base.XXXXXX` || exit 1 - mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 - - geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null - - secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` - - dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 - dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null - - md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` - md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` - md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` - - if [ ${md_rnd} = ${md_ddev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - if [ ${md_rnd} != ${md_edev} ]; then - echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - else - echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" - fi - i=$((i+1)) - - geli detach md${no} - rm -f $rnd - mdconfig -d -u $no - done -done + + rnd=`mktemp $base.XXXXXX` || exit 1 + mdconfig -a -t malloc -s `expr $secsize \* $sectors`b -u $no || exit 1 + + geli onetime -e $ealgo -l $keylen -s $secsize md${no} 2>/dev/null + + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` + + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null + + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` + + if [ ${md_rnd} = ${md_ddev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + if [ ${md_rnd} != ${md_edev} ]; then + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + else + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" + fi + i=$((i+1)) + + geli detach md${no} + rm -f $rnd + mdconfig -d -u $no +} + +i=1 +for_each_geli_config_nointegrity do_test Modified: stable/11/tests/sys/geom/class/nop/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:10:31 2017 (r312828) +++ stable/11/tests/sys/geom/class/nop/Makefile Thu Jan 26 20:15:14 2017 (r312829) @@ -4,13 +4,6 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test - -${PACKAGE}FILES+= conf.sh - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= nop_test .include Copied: stable/11/tests/sys/geom/class/nop/nop_test.sh (from r310803, head/tests/sys/geom/class/nop/nop_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/nop/nop_test.sh Thu Jan 26 20:15:14 2017 (r312829, copy of r310803, head/tests/sys/geom/class/nop/nop_test.sh) @@ -0,0 +1,166 @@ +# Copyright (c) 2016 Alan Somers +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +MD_DEVS="md.devs" +PLAINFILES=plainfiles + +atf_test_case diskinfo cleanup +diskinfo_head() +{ + atf_set "descr" "gnop should preserve diskinfo's basic properties" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +diskinfo_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + md_secsize=$(diskinfo ${us} | cut -wf 2) + md_mediasize=$(diskinfo ${us} | cut -wf 3) + md_stripesize=$(diskinfo ${us} | cut -wf 5) + nop_secsize=$(diskinfo ${us}.nop | cut -wf 2) + nop_mediasize=$(diskinfo ${us}.nop | cut -wf 3) + nop_stripesize=$(diskinfo ${us}.nop | cut -wf 5) + atf_check_equal "$md_secsize" "$nop_secsize" + atf_check_equal "$md_mediasize" "$nop_mediasize" + atf_check_equal "$md_stripesize" "$nop_stripesize" +} +diskinfo_cleanup() +{ + common_cleanup +} + +atf_test_case io cleanup +io_head() +{ + atf_set "descr" "I/O works on gnop devices" + atf_set "require.user" "root" + atf_set "timeout" 15 +} +io_body() +{ + us=$(alloc_md) + atf_check gnop create /dev/${us} + + echo src >> $PLAINFILES + echo dst >> $PLAINFILES + dd if=/dev/random of=src bs=1m count=1 >/dev/null 2>&1 + dd if=src of=/dev/${us}.nop bs=1m count=1 > /dev/null 2>&1 + dd if=/dev/${us}.nop of=dst bs=1m count=1 > /dev/null 2>&1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 20:18: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 8B930CC3429; Thu, 26 Jan 2017 20:18:04 +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 58D571207; Thu, 26 Jan 2017 20:18:04 +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 v0QKI3Dm085547; Thu, 26 Jan 2017 20:18:03 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKI3PF085546; Thu, 26 Jan 2017 20:18:03 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201701262018.v0QKI3PF085546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 26 Jan 2017 20:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312830 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:18:04 -0000 Author: scottl Date: Thu Jan 26 20:18:03 2017 New Revision: 312830 URL: https://svnweb.freebsd.org/changeset/base/312830 Log: Fix a development mis-merge from r312827 Sponsored by: Netflix Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jan 26 20:15:14 2017 (r312829) +++ head/sys/cam/cam_xpt.c Thu Jan 26 20:18:03 2017 (r312830) @@ -3727,9 +3727,9 @@ xpt_print(struct cam_path *path, const c { va_list ap; struct sbuf sb; - char buffer[XPT_PRINT_MAXLEN]; + char buffer[XPT_PRINT_LEN]; - sbuf_new(&sb, buffer, XPT_PRINT_MAXLEN, SBUF_FIXEDLEN); + sbuf_new(&sb, buffer, XPT_PRINT_LEN, SBUF_FIXEDLEN); xpt_path_sbuf(path, &sb); va_start(ap, fmt); From owner-svn-src-all@freebsd.org Thu Jan 26 20: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 B6E5BCC3480; Thu, 26 Jan 2017 20:18: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 83038136B; Thu, 26 Jan 2017 20:18: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 v0QKIScx085607; Thu, 26 Jan 2017 20:18:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKISDl085603; Thu, 26 Jan 2017 20:18:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701262018.v0QKISDl085603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 26 Jan 2017 20:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312831 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:18:29 -0000 Author: dim Date: Thu Jan 26 20:18:28 2017 New Revision: 312831 URL: https://svnweb.freebsd.org/changeset/base/312831 Log: Revert r312765 for now, since it causes assertions when building lang/spidermonkey24. Reported by: antoine PR: 215649 Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Thu Jan 26 20:18:03 2017 (r312830) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Thu Jan 26 20:18:28 2017 (r312831) @@ -495,29 +495,10 @@ namespace llvm { /// The typedef for ExprValueMap. /// - typedef std::pair ValueOffsetPair; - typedef DenseMap> ExprValueMapType; + typedef DenseMap> ExprValueMapType; /// ExprValueMap -- This map records the original values from which /// the SCEV expr is generated from. - /// - /// We want to represent the mapping as SCEV -> ValueOffsetPair instead - /// of SCEV -> Value: - /// Suppose we know S1 expands to V1, and - /// S1 = S2 + C_a - /// S3 = S2 + C_b - /// where C_a and C_b are different SCEVConstants. Then we'd like to - /// expand S3 as V1 - C_a + C_b instead of expanding S2 literally. - /// It is helpful when S2 is a complex SCEV expr. - /// - /// In order to do that, we represent ExprValueMap as a mapping from - /// SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and - /// S2->{V1, C_a} into the map when we create SCEV for V1. When S3 - /// is expanded, it will first expand S2 to V1 - C_a because of - /// S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. - /// - /// Note: S->{V, Offset} in the ExprValueMap means S can be expanded - /// to V - Offset. ExprValueMapType ExprValueMap; /// The typedef for ValueExprMap. @@ -1200,7 +1181,7 @@ namespace llvm { bool containsAddRecurrence(const SCEV *S); /// Return the Value set from which the SCEV expr is generated. - SetVector *getSCEVValues(const SCEV *S); + SetVector *getSCEVValues(const SCEV *S); /// Erase Value from ValueExprMap and ExprValueMap. void eraseValueFromMap(Value *V); Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Jan 26 20:18:03 2017 (r312830) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Jan 26 20:18:28 2017 (r312831) @@ -325,8 +325,7 @@ namespace llvm { PointerType *PTy, Type *Ty, Value *V); /// \brief Find a previous Value in ExprValueMap for expand. - ScalarEvolution::ValueOffsetPair - FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); + Value *FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); Value *expand(const SCEV *S); Modified: head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Thu Jan 26 20:18:03 2017 (r312830) +++ head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Thu Jan 26 20:18:28 2017 (r312831) @@ -3378,28 +3378,8 @@ bool ScalarEvolution::containsAddRecurre return F.FoundOne; } -/// Try to split a SCEVAddExpr into a pair of {SCEV, ConstantInt}. -/// If \p S is a SCEVAddExpr and is composed of a sub SCEV S' and an -/// offset I, then return {S', I}, else return {\p S, nullptr}. -static std::pair splitAddExpr(const SCEV *S) { - const auto *Add = dyn_cast(S); - if (!Add) - return {S, nullptr}; - - if (Add->getNumOperands() != 2) - return {S, nullptr}; - - auto *ConstOp = dyn_cast(Add->getOperand(0)); - if (!ConstOp) - return {S, nullptr}; - - return {Add->getOperand(1), ConstOp->getValue()}; -} - -/// Return the ValueOffsetPair set for \p S. \p S can be represented -/// by the value and offset from any ValueOffsetPair in the set. -SetVector * -ScalarEvolution::getSCEVValues(const SCEV *S) { +/// Return the Value set from S. +SetVector *ScalarEvolution::getSCEVValues(const SCEV *S) { ExprValueMapType::iterator SI = ExprValueMap.find_as(S); if (SI == ExprValueMap.end()) return nullptr; @@ -3407,31 +3387,24 @@ ScalarEvolution::getSCEVValues(const SCE if (VerifySCEVMap) { // Check there is no dangling Value in the set returned. for (const auto &VE : SI->second) - assert(ValueExprMap.count(VE.first)); + assert(ValueExprMap.count(VE)); } #endif return &SI->second; } -/// Erase Value from ValueExprMap and ExprValueMap. ValueExprMap.erase(V) -/// cannot be used separately. eraseValueFromMap should be used to remove -/// V from ValueExprMap and ExprValueMap at the same time. +/// Erase Value from ValueExprMap and ExprValueMap. If ValueExprMap.erase(V) is +/// not used together with forgetMemoizedResults(S), eraseValueFromMap should be +/// used instead to ensure whenever V->S is removed from ValueExprMap, V is also +/// removed from the set of ExprValueMap[S]. void ScalarEvolution::eraseValueFromMap(Value *V) { ValueExprMapType::iterator I = ValueExprMap.find_as(V); if (I != ValueExprMap.end()) { const SCEV *S = I->second; - // Remove {V, 0} from the set of ExprValueMap[S] - if (SetVector *SV = getSCEVValues(S)) - SV->remove({V, nullptr}); - - // Remove {V, Offset} from the set of ExprValueMap[Stripped] - const SCEV *Stripped; - ConstantInt *Offset; - std::tie(Stripped, Offset) = splitAddExpr(S); - if (Offset != nullptr) { - if (SetVector *SV = getSCEVValues(Stripped)) - SV->remove({V, Offset}); - } + SetVector *SV = getSCEVValues(S); + // Remove V from the set of ExprValueMap[S] + if (SV) + SV->remove(V); ValueExprMap.erase(V); } } @@ -3446,26 +3419,11 @@ const SCEV *ScalarEvolution::getSCEV(Val S = createSCEV(V); // During PHI resolution, it is possible to create two SCEVs for the same // V, so it is needed to double check whether V->S is inserted into - // ValueExprMap before insert S->{V, 0} into ExprValueMap. + // ValueExprMap before insert S->V into ExprValueMap. std::pair Pair = ValueExprMap.insert({SCEVCallbackVH(V, this), S}); - if (Pair.second) { - ExprValueMap[S].insert({V, nullptr}); - - // If S == Stripped + Offset, add Stripped -> {V, Offset} into - // ExprValueMap. - const SCEV *Stripped = S; - ConstantInt *Offset = nullptr; - std::tie(Stripped, Offset) = splitAddExpr(S); - // If stripped is SCEVUnknown, don't bother to save - // Stripped -> {V, offset}. It doesn't simplify and sometimes even - // increase the complexity of the expansion code. - // If V is GetElementPtrInst, don't save Stripped -> {V, offset} - // because it may generate add/sub instead of GEP in SCEV expansion. - if (Offset != nullptr && !isa(Stripped) && - !isa(V)) - ExprValueMap[Stripped].insert({V, Offset}); - } + if (Pair.second) + ExprValueMap[S].insert(V); } return S; } @@ -3478,8 +3436,8 @@ const SCEV *ScalarEvolution::getExisting const SCEV *S = I->second; if (checkValidity(S)) return S; - eraseValueFromMap(V); forgetMemoizedResults(S); + ValueExprMap.erase(I); } return nullptr; } @@ -3717,8 +3675,8 @@ void ScalarEvolution::forgetSymbolicName if (!isa(I) || !isa(Old) || (I != PN && Old == SymName)) { - eraseValueFromMap(It->first); forgetMemoizedResults(Old); + ValueExprMap.erase(It); } } @@ -4097,7 +4055,7 @@ const SCEV *ScalarEvolution::createAddRe // to create an AddRecExpr for this PHI node. We can not keep this temporary // as it will prevent later (possibly simpler) SCEV expressions to be added // to the ValueExprMap. - eraseValueFromMap(PN); + ValueExprMap.erase(PN); } return nullptr; @@ -5477,8 +5435,8 @@ ScalarEvolution::getBackedgeTakenInfo(co // case, createNodeForPHI will perform the necessary updates on its // own when it gets to that point. if (!isa(I) || !isa(Old)) { - eraseValueFromMap(It->first); forgetMemoizedResults(Old); + ValueExprMap.erase(It); } if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); @@ -5523,8 +5481,8 @@ void ScalarEvolution::forgetLoop(const L ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { - eraseValueFromMap(It->first); forgetMemoizedResults(It->second); + ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } @@ -5557,8 +5515,8 @@ void ScalarEvolution::forgetValue(Value ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { - eraseValueFromMap(It->first); forgetMemoizedResults(It->second); + ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } Modified: head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Thu Jan 26 20:18:03 2017 (r312830) +++ head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Thu Jan 26 20:18:28 2017 (r312831) @@ -1625,10 +1625,9 @@ Value *SCEVExpander::expandCodeFor(const return V; } -ScalarEvolution::ValueOffsetPair -SCEVExpander::FindValueInExprValueMap(const SCEV *S, - const Instruction *InsertPt) { - SetVector *Set = SE.getSCEVValues(S); +Value *SCEVExpander::FindValueInExprValueMap(const SCEV *S, + const Instruction *InsertPt) { + SetVector *Set = SE.getSCEVValues(S); // If the expansion is not in CanonicalMode, and the SCEV contains any // sub scAddRecExpr type SCEV, it is required to expand the SCEV literally. if (CanonicalMode || !SE.containsAddRecurrence(S)) { @@ -1637,21 +1636,21 @@ SCEVExpander::FindValueInExprValueMap(co // Choose a Value from the set which dominates the insertPt. // insertPt should be inside the Value's parent loop so as not to break // the LCSSA form. - for (auto const &VOPair : *Set) { - Value *V = VOPair.first; - ConstantInt *Offset = VOPair.second; + for (auto const &Ent : *Set) { Instruction *EntInst = nullptr; - if (V && isa(V) && (EntInst = cast(V)) && - S->getType() == V->getType() && + if (Ent && isa(Ent) && + (EntInst = cast(Ent)) && + S->getType() == Ent->getType() && EntInst->getFunction() == InsertPt->getFunction() && SE.DT.dominates(EntInst, InsertPt) && (SE.LI.getLoopFor(EntInst->getParent()) == nullptr || - SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) - return {V, Offset}; + SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) { + return Ent; + } } } } - return {nullptr, nullptr}; + return nullptr; } // The expansion of SCEV will either reuse a previous Value in ExprValueMap, @@ -1699,14 +1698,10 @@ Value *SCEVExpander::expand(const SCEV * Builder.SetInsertPoint(InsertPt); // Expand the expression into instructions. - ScalarEvolution::ValueOffsetPair VO = FindValueInExprValueMap(S, InsertPt); - Value *V = VO.first; + Value *V = FindValueInExprValueMap(S, InsertPt); if (!V) V = visit(S); - else if (VO.second) { - V = Builder.CreateSub(V, VO.second); - } // Remember the expanded value for this SCEV at this location. // @@ -1919,7 +1914,7 @@ Value *SCEVExpander::findExistingExpansi // Use expand's logic which is used for reusing a previous Value in // ExprValueMap. - if (Value *Val = FindValueInExprValueMap(S, At).first) + if (Value *Val = FindValueInExprValueMap(S, At)) return Val; // There is potential to make this significantly smarter, but this simple From owner-svn-src-all@freebsd.org Thu Jan 26 20:39: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 DE7DECC3ABB; Thu, 26 Jan 2017 20:39:44 +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 AA4041F43; Thu, 26 Jan 2017 20:39:44 +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 v0QKdhJe094029; Thu, 26 Jan 2017 20:39:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKdhmb094023; Thu, 26 Jan 2017 20:39:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701262039.v0QKdhmb094023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 26 Jan 2017 20:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312832 - in head/contrib/llvm: include/llvm/Analysis lib/Analysis lib/Transforms/Scalar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:39:45 -0000 Author: dim Date: Thu Jan 26 20:39:43 2017 New Revision: 312832 URL: https://svnweb.freebsd.org/changeset/base/312832 Log: Pull in r278160 from upstream llvm trunk (by Wei Mi): Recommit "Use ValueOffsetPair to enhance value reuse during SCEV expansion". The fix for PR28705 will be committed consecutively. In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion. However, const folding and sext/zext distribution can make the reuse still difficult. A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and S1 = S2 + C_a S3 = S2 + C_b where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused by the fact that S3 is generated from S1 after const folding. In order to do that, we represent ExprValueMap as a mapping from SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. Differential Revision: https://reviews.llvm.org/D21313 Pull in r278161 from upstream llvm trunk (by Wei Mi): Fix the runtime error caused by "Use ValueOffsetPair to enhance value reuse during SCEV expansion". The patch is to fix the bug in PR28705. It was caused by setting wrong return value for SCEVExpander::findExistingExpansion. The return values of findExistingExpansion have different meanings when the function is used in different ways so it is easy to make mistake. The fix creates two new interfaces to replace SCEVExpander::findExistingExpansion, and specifies where each interface is expected to be used. Differential Revision: https://reviews.llvm.org/D22942 Pull in r281439 from upstream llvm trunk (by Wei Mi): Create a getelementptr instead of sub expr for ValueOffsetPair if the value is a pointer. This patch is to fix PR30213. When expanding an expr based on ValueOffsetPair, if the value is of pointer type, we can only create a getelementptr instead of sub expr. Differential Revision: https://reviews.llvm.org/D24088 This should fix assertion failures when building OpenCV >= 3.1, and also allow building lang/spidermonkey24 without any further assertions. PR: 215649 MFC after: 1 week Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Thu Jan 26 20:18:28 2017 (r312831) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h Thu Jan 26 20:39:43 2017 (r312832) @@ -495,10 +495,29 @@ namespace llvm { /// The typedef for ExprValueMap. /// - typedef DenseMap> ExprValueMapType; + typedef std::pair ValueOffsetPair; + typedef DenseMap> ExprValueMapType; /// ExprValueMap -- This map records the original values from which /// the SCEV expr is generated from. + /// + /// We want to represent the mapping as SCEV -> ValueOffsetPair instead + /// of SCEV -> Value: + /// Suppose we know S1 expands to V1, and + /// S1 = S2 + C_a + /// S3 = S2 + C_b + /// where C_a and C_b are different SCEVConstants. Then we'd like to + /// expand S3 as V1 - C_a + C_b instead of expanding S2 literally. + /// It is helpful when S2 is a complex SCEV expr. + /// + /// In order to do that, we represent ExprValueMap as a mapping from + /// SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and + /// S2->{V1, C_a} into the map when we create SCEV for V1. When S3 + /// is expanded, it will first expand S2 to V1 - C_a because of + /// S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. + /// + /// Note: S->{V, Offset} in the ExprValueMap means S can be expanded + /// to V - Offset. ExprValueMapType ExprValueMap; /// The typedef for ValueExprMap. @@ -1181,7 +1200,7 @@ namespace llvm { bool containsAddRecurrence(const SCEV *S); /// Return the Value set from which the SCEV expr is generated. - SetVector *getSCEVValues(const SCEV *S); + SetVector *getSCEVValues(const SCEV *S); /// Erase Value from ValueExprMap and ExprValueMap. void eraseValueFromMap(Value *V); Modified: head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Jan 26 20:18:28 2017 (r312831) +++ head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Jan 26 20:39:43 2017 (r312832) @@ -14,6 +14,7 @@ #ifndef LLVM_ANALYSIS_SCALAREVOLUTIONEXPANDER_H #define LLVM_ANALYSIS_SCALAREVOLUTIONEXPANDER_H +#include "llvm/ADT/Optional.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/ScalarEvolutionNormalization.h" #include "llvm/Analysis/TargetFolder.h" @@ -284,7 +285,15 @@ namespace llvm { void setChainedPhi(PHINode *PN) { ChainedPhis.insert(PN); } - /// \brief Try to find LLVM IR value for S available at the point At. + /// Try to find existing LLVM IR value for S available at the point At. + Value *getExactExistingExpansion(const SCEV *S, const Instruction *At, + Loop *L); + + /// Try to find the ValueOffsetPair for S. The function is mainly + /// used to check whether S can be expanded cheaply. + /// If this returns a non-None value, we know we can codegen the + /// `ValueOffsetPair` into a suitable expansion identical with S + /// so that S can be expanded cheaply. /// /// L is a hint which tells in which loop to look for the suitable value. /// On success return value which is equivalent to the expanded S at point @@ -292,7 +301,9 @@ namespace llvm { /// /// Note that this function does not perform an exhaustive search. I.e if it /// didn't find any value it does not mean that there is no such value. - Value *findExistingExpansion(const SCEV *S, const Instruction *At, Loop *L); + /// + Optional + getRelatedExistingExpansion(const SCEV *S, const Instruction *At, Loop *L); private: LLVMContext &getContext() const { return SE.getContext(); } @@ -325,7 +336,8 @@ namespace llvm { PointerType *PTy, Type *Ty, Value *V); /// \brief Find a previous Value in ExprValueMap for expand. - Value *FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); + ScalarEvolution::ValueOffsetPair + FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt); Value *expand(const SCEV *S); Modified: head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Thu Jan 26 20:18:28 2017 (r312831) +++ head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Thu Jan 26 20:39:43 2017 (r312832) @@ -3378,8 +3378,28 @@ bool ScalarEvolution::containsAddRecurre return F.FoundOne; } -/// Return the Value set from S. -SetVector *ScalarEvolution::getSCEVValues(const SCEV *S) { +/// Try to split a SCEVAddExpr into a pair of {SCEV, ConstantInt}. +/// If \p S is a SCEVAddExpr and is composed of a sub SCEV S' and an +/// offset I, then return {S', I}, else return {\p S, nullptr}. +static std::pair splitAddExpr(const SCEV *S) { + const auto *Add = dyn_cast(S); + if (!Add) + return {S, nullptr}; + + if (Add->getNumOperands() != 2) + return {S, nullptr}; + + auto *ConstOp = dyn_cast(Add->getOperand(0)); + if (!ConstOp) + return {S, nullptr}; + + return {Add->getOperand(1), ConstOp->getValue()}; +} + +/// Return the ValueOffsetPair set for \p S. \p S can be represented +/// by the value and offset from any ValueOffsetPair in the set. +SetVector * +ScalarEvolution::getSCEVValues(const SCEV *S) { ExprValueMapType::iterator SI = ExprValueMap.find_as(S); if (SI == ExprValueMap.end()) return nullptr; @@ -3387,24 +3407,31 @@ SetVector *ScalarEvolution::get if (VerifySCEVMap) { // Check there is no dangling Value in the set returned. for (const auto &VE : SI->second) - assert(ValueExprMap.count(VE)); + assert(ValueExprMap.count(VE.first)); } #endif return &SI->second; } -/// Erase Value from ValueExprMap and ExprValueMap. If ValueExprMap.erase(V) is -/// not used together with forgetMemoizedResults(S), eraseValueFromMap should be -/// used instead to ensure whenever V->S is removed from ValueExprMap, V is also -/// removed from the set of ExprValueMap[S]. +/// Erase Value from ValueExprMap and ExprValueMap. ValueExprMap.erase(V) +/// cannot be used separately. eraseValueFromMap should be used to remove +/// V from ValueExprMap and ExprValueMap at the same time. void ScalarEvolution::eraseValueFromMap(Value *V) { ValueExprMapType::iterator I = ValueExprMap.find_as(V); if (I != ValueExprMap.end()) { const SCEV *S = I->second; - SetVector *SV = getSCEVValues(S); - // Remove V from the set of ExprValueMap[S] - if (SV) - SV->remove(V); + // Remove {V, 0} from the set of ExprValueMap[S] + if (SetVector *SV = getSCEVValues(S)) + SV->remove({V, nullptr}); + + // Remove {V, Offset} from the set of ExprValueMap[Stripped] + const SCEV *Stripped; + ConstantInt *Offset; + std::tie(Stripped, Offset) = splitAddExpr(S); + if (Offset != nullptr) { + if (SetVector *SV = getSCEVValues(Stripped)) + SV->remove({V, Offset}); + } ValueExprMap.erase(V); } } @@ -3419,11 +3446,26 @@ const SCEV *ScalarEvolution::getSCEV(Val S = createSCEV(V); // During PHI resolution, it is possible to create two SCEVs for the same // V, so it is needed to double check whether V->S is inserted into - // ValueExprMap before insert S->V into ExprValueMap. + // ValueExprMap before insert S->{V, 0} into ExprValueMap. std::pair Pair = ValueExprMap.insert({SCEVCallbackVH(V, this), S}); - if (Pair.second) - ExprValueMap[S].insert(V); + if (Pair.second) { + ExprValueMap[S].insert({V, nullptr}); + + // If S == Stripped + Offset, add Stripped -> {V, Offset} into + // ExprValueMap. + const SCEV *Stripped = S; + ConstantInt *Offset = nullptr; + std::tie(Stripped, Offset) = splitAddExpr(S); + // If stripped is SCEVUnknown, don't bother to save + // Stripped -> {V, offset}. It doesn't simplify and sometimes even + // increase the complexity of the expansion code. + // If V is GetElementPtrInst, don't save Stripped -> {V, offset} + // because it may generate add/sub instead of GEP in SCEV expansion. + if (Offset != nullptr && !isa(Stripped) && + !isa(V)) + ExprValueMap[Stripped].insert({V, Offset}); + } } return S; } @@ -3436,8 +3478,8 @@ const SCEV *ScalarEvolution::getExisting const SCEV *S = I->second; if (checkValidity(S)) return S; + eraseValueFromMap(V); forgetMemoizedResults(S); - ValueExprMap.erase(I); } return nullptr; } @@ -3675,8 +3717,8 @@ void ScalarEvolution::forgetSymbolicName if (!isa(I) || !isa(Old) || (I != PN && Old == SymName)) { + eraseValueFromMap(It->first); forgetMemoizedResults(Old); - ValueExprMap.erase(It); } } @@ -4055,7 +4097,7 @@ const SCEV *ScalarEvolution::createAddRe // to create an AddRecExpr for this PHI node. We can not keep this temporary // as it will prevent later (possibly simpler) SCEV expressions to be added // to the ValueExprMap. - ValueExprMap.erase(PN); + eraseValueFromMap(PN); } return nullptr; @@ -5435,8 +5477,8 @@ ScalarEvolution::getBackedgeTakenInfo(co // case, createNodeForPHI will perform the necessary updates on its // own when it gets to that point. if (!isa(I) || !isa(Old)) { + eraseValueFromMap(It->first); forgetMemoizedResults(Old); - ValueExprMap.erase(It); } if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); @@ -5481,8 +5523,8 @@ void ScalarEvolution::forgetLoop(const L ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { + eraseValueFromMap(It->first); forgetMemoizedResults(It->second); - ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } @@ -5515,8 +5557,8 @@ void ScalarEvolution::forgetValue(Value ValueExprMapType::iterator It = ValueExprMap.find_as(static_cast(I)); if (It != ValueExprMap.end()) { + eraseValueFromMap(It->first); forgetMemoizedResults(It->second); - ValueExprMap.erase(It); if (PHINode *PN = dyn_cast(I)) ConstantEvolutionLoopExitValue.erase(PN); } Modified: head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Thu Jan 26 20:18:28 2017 (r312831) +++ head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp Thu Jan 26 20:39:43 2017 (r312832) @@ -1625,9 +1625,10 @@ Value *SCEVExpander::expandCodeFor(const return V; } -Value *SCEVExpander::FindValueInExprValueMap(const SCEV *S, - const Instruction *InsertPt) { - SetVector *Set = SE.getSCEVValues(S); +ScalarEvolution::ValueOffsetPair +SCEVExpander::FindValueInExprValueMap(const SCEV *S, + const Instruction *InsertPt) { + SetVector *Set = SE.getSCEVValues(S); // If the expansion is not in CanonicalMode, and the SCEV contains any // sub scAddRecExpr type SCEV, it is required to expand the SCEV literally. if (CanonicalMode || !SE.containsAddRecurrence(S)) { @@ -1636,21 +1637,21 @@ Value *SCEVExpander::FindValueInExprValu // Choose a Value from the set which dominates the insertPt. // insertPt should be inside the Value's parent loop so as not to break // the LCSSA form. - for (auto const &Ent : *Set) { + for (auto const &VOPair : *Set) { + Value *V = VOPair.first; + ConstantInt *Offset = VOPair.second; Instruction *EntInst = nullptr; - if (Ent && isa(Ent) && - (EntInst = cast(Ent)) && - S->getType() == Ent->getType() && + if (V && isa(V) && (EntInst = cast(V)) && + S->getType() == V->getType() && EntInst->getFunction() == InsertPt->getFunction() && SE.DT.dominates(EntInst, InsertPt) && (SE.LI.getLoopFor(EntInst->getParent()) == nullptr || - SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) { - return Ent; - } + SE.LI.getLoopFor(EntInst->getParent())->contains(InsertPt))) + return {V, Offset}; } } } - return nullptr; + return {nullptr, nullptr}; } // The expansion of SCEV will either reuse a previous Value in ExprValueMap, @@ -1698,11 +1699,33 @@ Value *SCEVExpander::expand(const SCEV * Builder.SetInsertPoint(InsertPt); // Expand the expression into instructions. - Value *V = FindValueInExprValueMap(S, InsertPt); + ScalarEvolution::ValueOffsetPair VO = FindValueInExprValueMap(S, InsertPt); + Value *V = VO.first; if (!V) V = visit(S); - + else if (VO.second) { + if (PointerType *Vty = dyn_cast(V->getType())) { + Type *Ety = Vty->getPointerElementType(); + int64_t Offset = VO.second->getSExtValue(); + int64_t ESize = SE.getTypeSizeInBits(Ety); + if ((Offset * 8) % ESize == 0) { + ConstantInt *Idx = + ConstantInt::getSigned(VO.second->getType(), -(Offset * 8) / ESize); + V = Builder.CreateGEP(Ety, V, Idx, "scevgep"); + } else { + ConstantInt *Idx = + ConstantInt::getSigned(VO.second->getType(), -Offset); + unsigned AS = Vty->getAddressSpace(); + V = Builder.CreateBitCast(V, Type::getInt8PtrTy(SE.getContext(), AS)); + V = Builder.CreateGEP(Type::getInt8Ty(SE.getContext()), V, Idx, + "uglygep"); + V = Builder.CreateBitCast(V, Vty); + } + } else { + V = Builder.CreateSub(V, VO.second); + } + } // Remember the expanded value for this SCEV at this location. // // This is independent of PostIncLoops. The mapped value simply materializes @@ -1887,8 +1910,18 @@ unsigned SCEVExpander::replaceCongruentI return NumElim; } -Value *SCEVExpander::findExistingExpansion(const SCEV *S, - const Instruction *At, Loop *L) { +Value *SCEVExpander::getExactExistingExpansion(const SCEV *S, + const Instruction *At, Loop *L) { + Optional VO = + getRelatedExistingExpansion(S, At, L); + if (VO && VO.getValue().second == nullptr) + return VO.getValue().first; + return nullptr; +} + +Optional +SCEVExpander::getRelatedExistingExpansion(const SCEV *S, const Instruction *At, + Loop *L) { using namespace llvm::PatternMatch; SmallVector ExitingBlocks; @@ -1906,22 +1939,23 @@ Value *SCEVExpander::findExistingExpansi continue; if (SE.getSCEV(LHS) == S && SE.DT.dominates(LHS, At)) - return LHS; + return ScalarEvolution::ValueOffsetPair(LHS, nullptr); if (SE.getSCEV(RHS) == S && SE.DT.dominates(RHS, At)) - return RHS; + return ScalarEvolution::ValueOffsetPair(RHS, nullptr); } // Use expand's logic which is used for reusing a previous Value in // ExprValueMap. - if (Value *Val = FindValueInExprValueMap(S, At)) - return Val; + ScalarEvolution::ValueOffsetPair VO = FindValueInExprValueMap(S, At); + if (VO.first) + return VO; // There is potential to make this significantly smarter, but this simple // heuristic already gets some interesting cases. // Can not find suitable value. - return nullptr; + return None; } bool SCEVExpander::isHighCostExpansionHelper( @@ -1930,7 +1964,7 @@ bool SCEVExpander::isHighCostExpansionHe // If we can find an existing value for this scev avaliable at the point "At" // then consider the expression cheap. - if (At && findExistingExpansion(S, At, L) != nullptr) + if (At && getRelatedExistingExpansion(S, At, L)) return false; // Zero/One operand expressions @@ -1978,7 +2012,7 @@ bool SCEVExpander::isHighCostExpansionHe // involving division. This is just a simple search heuristic. if (!At) At = &ExitingBB->back(); - if (!findExistingExpansion( + if (!getRelatedExistingExpansion( SE.getAddExpr(S, SE.getConstant(S->getType(), 1)), At, L)) return true; } Modified: head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Jan 26 20:18:28 2017 (r312831) +++ head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Jan 26 20:39:43 2017 (r312832) @@ -481,7 +481,7 @@ Value *IndVarSimplify::expandSCEVIfNeede Type *ResultTy) { // Before expanding S into an expensive LLVM expression, see if we can use an // already existing value as the expansion for S. - if (Value *ExistingValue = Rewriter.findExistingExpansion(S, InsertPt, L)) + if (Value *ExistingValue = Rewriter.getExactExistingExpansion(S, InsertPt, L)) if (ExistingValue->getType() == ResultTy) return ExistingValue; From owner-svn-src-all@freebsd.org Thu Jan 26 20:45: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 2FE97CC3D09; Thu, 26 Jan 2017 20:45:06 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F16506B6; Thu, 26 Jan 2017 20:45:05 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QKj5ni097896; Thu, 26 Jan 2017 20:45:05 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKj5oh097895; Thu, 26 Jan 2017 20:45:05 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201701262045.v0QKj5oh097895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 26 Jan 2017 20:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312833 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:45:06 -0000 Author: lidl Date: Thu Jan 26 20:45:04 2017 New Revision: 312833 URL: https://svnweb.freebsd.org/changeset/base/312833 Log: Remove 'options NO_SWAPPING' from ERL configuration file Modified: head/sys/mips/conf/ERL Modified: head/sys/mips/conf/ERL ============================================================================== --- head/sys/mips/conf/ERL Thu Jan 26 20:39:43 2017 (r312832) +++ head/sys/mips/conf/ERL Thu Jan 26 20:45:04 2017 (r312833) @@ -88,7 +88,6 @@ options MAC # TrustedBSD MAC Framewor #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel -options NO_SWAPPING # Disable support for paging options TMPFS # Temporary file system # Debugging for use in -current From owner-svn-src-all@freebsd.org Thu Jan 26 20:49: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 B9A15CC100E; Thu, 26 Jan 2017 20:49: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 52A50BD6; Thu, 26 Jan 2017 20:49: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 v0QKnJ8w098177; Thu, 26 Jan 2017 20:49:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKnJeR098175; Thu, 26 Jan 2017 20:49:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262049.v0QKnJeR098175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:49: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: r312834 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:49:20 -0000 Author: mav Date: Thu Jan 26 20:49:19 2017 New Revision: 312834 URL: https://svnweb.freebsd.org/changeset/base/312834 Log: MFC r310778, r310782: Improve use of I/O's private area. - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend_block.c stable/11/sys/cam/ctl/ctl_backend_ramdisk.c stable/11/sys/cam/ctl/ctl_error.c stable/11/sys/cam/ctl/ctl_io.h stable/11/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:45:04 2017 (r312833) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017 (r312834) @@ -437,7 +437,6 @@ static int ctl_alloc_lun(struct ctl_soft struct ctl_be_lun *be_lun); static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); -static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -448,7 +447,7 @@ static int ctl_pro_preempt(struct ctl_so struct scsi_per_res_out_parms* param); static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg); -static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); @@ -567,13 +566,12 @@ static struct ctl_frontend ha_frontend = static void ctl_ha_datamove(union ctl_io *io) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(io); struct ctl_sg_entry *sgl; union ctl_ha_msg msg; uint32_t sg_entries_sent; int do_sg_copy, i, j; - lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.original_sc; @@ -1803,7 +1801,8 @@ ctl_init(void) args.mda_si_drv1 = softc; error = make_dev_s(&args, &softc->dev, "cam/ctl"); if (error != 0) { - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); + control_softc = NULL; return (error); } @@ -1815,7 +1814,7 @@ ctl_init(void) if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); destroy_dev(softc->dev); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; return (ENOMEM); } @@ -1963,7 +1962,7 @@ ctl_shutdown(void) sysctl_ctx_free(&softc->sysctl_ctx); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; } @@ -2205,18 +2204,16 @@ ctl_create_iid(struct ctl_port *port, in static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); union ctl_ha_msg msg_info; - struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - mtx_lock(&softc->ctl_lock); /* Make sure that we know about this port. */ - port = ctl_io_port(&ctsio->io_hdr); if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) { ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 1); @@ -2224,6 +2221,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ + mtx_lock(&softc->ctl_lock); if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); @@ -2256,8 +2254,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc goto badjuju; } - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun; + CTL_LUN(ctsio) = lun; + CTL_BACKEND_LUN(ctsio) = lun->be_lun; /* * Every I/O goes into the OOA queue for a @@ -3625,13 +3623,6 @@ ctl_encode_lun(uint32_t decoded) return ((((uint64_t)RPL_LUNDATA_ATYP_EXTLUN | 0x22) << 56) | (l << 16)); } -static struct ctl_port * -ctl_io_port(struct ctl_io_hdr *io_hdr) -{ - - return (control_softc->ctl_ports[io_hdr->nexus.targ_port]); -} - int ctl_ffz(uint32_t *mask, uint32_t first, uint32_t last) { @@ -3749,7 +3740,6 @@ int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool) { -#ifdef IO_POOLS struct ctl_io_pool *pool; pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, @@ -3759,14 +3749,15 @@ ctl_pool_create(struct ctl_softc *ctl_so snprintf(pool->name, sizeof(pool->name), "CTL IO %s", pool_name); pool->ctl_softc = ctl_softc; +#ifdef IO_POOLS pool->zone = uma_zsecond_create(pool->name, NULL, NULL, NULL, NULL, ctl_softc->io_zone); /* uma_prealloc(pool->zone, total_ctl_io); */ - - *npool = pool; #else - *npool = ctl_softc->io_zone; + pool->zone = ctl_softc->io_zone; #endif + + *npool = pool; return (0); } @@ -3779,64 +3770,54 @@ ctl_pool_free(struct ctl_io_pool *pool) #ifdef IO_POOLS uma_zdestroy(pool->zone); - free(pool, M_CTL); #endif + free(pool, M_CTL); } union ctl_io * ctl_alloc_io(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_WAITOK); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_WAITOK); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } union ctl_io * ctl_alloc_io_nowait(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_NOWAIT); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_NOWAIT); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } void ctl_free_io(union ctl_io *io) { -#ifdef IO_POOLS struct ctl_io_pool *pool; -#endif if (io == NULL) return; -#ifdef IO_POOLS pool = (struct ctl_io_pool *)io->io_hdr.pool; uma_zfree(pool->zone, io); -#else - uma_zfree((uma_zone_t)io->io_hdr.pool, io); -#endif } void ctl_zero_io(union ctl_io *io) { - void *pool_ref; + struct ctl_io_pool *pool; if (io == NULL) return; @@ -3844,9 +3825,10 @@ ctl_zero_io(union ctl_io *io) /* * May need to preserve linked list pointers at some point too. */ - pool_ref = io->io_hdr.pool; + pool = io->io_hdr.pool; memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; + io->io_hdr.pool = pool; + CTL_SOFTC(io) = pool->ctl_softc; } int @@ -4653,12 +4635,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft static int ctl_free_lun(struct ctl_lun *lun) { - struct ctl_softc *softc; + struct ctl_softc *softc = lun->ctl_softc; struct ctl_lun *nlun; int i; - softc = lun->ctl_softc; - mtx_assert(&softc->ctl_lock, MA_OWNED); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); @@ -5159,13 +5139,12 @@ ctl_config_read_done(union ctl_io *io) int ctl_scsi_release(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_scsi_release\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5197,13 +5176,12 @@ ctl_scsi_release(struct ctl_scsiio *ctsi int ctl_scsi_reserve(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_reserve\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5238,13 +5216,12 @@ bailout: int ctl_start_stop(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_start_stop_unit *cdb; - struct ctl_lun *lun; int retval; CTL_DEBUG_PRINT(("ctl_start_stop\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; if ((cdb->how & SSS_PC_MASK) == 0) { @@ -5293,14 +5270,13 @@ ctl_start_stop(struct ctl_scsiio *ctsio) int ctl_prevent_allow(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_prevent *cdb; int retval; uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { @@ -5334,8 +5310,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts int ctl_sync_cache(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - struct ctl_softc *softc; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t starting_lba; uint32_t block_count; @@ -5344,8 +5319,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_sync_cache\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; retval = 0; switch (ctsio->cdb[0]) { @@ -5401,13 +5374,10 @@ int ctl_format(struct ctl_scsiio *ctsio) { struct scsi_format *cdb; - struct ctl_lun *lun; int length, defect_list_len; CTL_DEBUG_PRINT(("ctl_format\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - cdb = (struct scsi_format *)ctsio->cdb; length = 0; @@ -5486,7 +5456,7 @@ bailout: int ctl_read_buffer(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint64_t buffer_offset; uint32_t len; uint8_t byte2; @@ -5494,7 +5464,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio static uint8_t echo_descr[4] = { 0 }; CTL_DEBUG_PRINT(("ctl_read_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + switch (ctsio->cdb[0]) { case READ_BUFFER: { struct scsi_read_buffer *cdb; @@ -5561,13 +5531,12 @@ ctl_read_buffer(struct ctl_scsiio *ctsio int ctl_write_buffer(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_write_buffer *cdb; - struct ctl_lun *lun; int buffer_offset, len; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; len = scsi_3btoul(cdb->length); @@ -5614,7 +5583,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi int ctl_write_same(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; @@ -5623,8 +5592,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_write_same\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - switch (ctsio->cdb[0]) { case WRITE_SAME_10: { struct scsi_write_same_10 *cdb; @@ -5728,7 +5695,7 @@ ctl_write_same(struct ctl_scsiio *ctsio) int ctl_unmap(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_unmap *cdb; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; @@ -5740,9 +5707,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_unmap\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_unmap *)ctsio->cdb; - len = scsi_2btoul(cdb->length); byte2 = cdb->byte2; @@ -5832,12 +5797,11 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint8_t *current_cp; int set_ua; uint32_t initidx; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; @@ -5887,13 +5851,12 @@ int ctl_ie_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_info_exceptions_page *pg; - struct ctl_lun *lun; uint64_t t; (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; pg = (struct scsi_info_exceptions_page *)page_ptr; mtx_lock(&lun->lun_lock); if (pg->info_flags & SIEP_FLAGS_TEST) { @@ -5930,19 +5893,18 @@ ctl_ie_page_handler(struct ctl_scsiio *c static int ctl_do_mode_select(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct scsi_mode_page_header *page_header; struct ctl_page_index *page_index; struct ctl_scsiio *ctsio; int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; - struct ctl_lun *lun; uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; page_index = NULL; page_len = 0; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; modepage_info = (union ctl_modepage_info *) ctsio->io_hdr.ctl_private[CTL_PRIV_MODEPAGE].bytes; @@ -6155,12 +6117,11 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); union ctl_modepage_info *modepage_info; int bd_len, i, header_size, param_len, pf, rtd, sp; uint32_t initidx; - lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { @@ -6305,7 +6266,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio int ctl_mode_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int pc, page_code, dbd, llba, subpage; int alloc_len, page_len, header_len, total_len; struct scsi_mode_block_descr *block_desc; @@ -6317,7 +6278,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_mode_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6653,12 +6613,11 @@ ctl_lbp_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_param_header *phdr; uint8_t *data; uint64_t val; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = page_index->page_data; if (lun->backend->lun_attr != NULL && @@ -6722,13 +6681,12 @@ ctl_sap_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; uint64_t rn, wn, rb, wb; struct bintime rt, wt; int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct stat_page *)page_index->page_data; scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code); @@ -6781,10 +6739,9 @@ ctl_ie_log_sense_handler(struct ctl_scsi struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_informational_exceptions *data; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct scsi_log_informational_exceptions *)page_index->page_data; scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); @@ -6800,7 +6757,7 @@ ctl_ie_log_sense_handler(struct ctl_scsi int ctl_log_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int i, pc, page_code, subpage; int alloc_len, total_len; struct ctl_page_index *page_index; @@ -6809,7 +6766,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_log_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_log_sense *)ctsio->cdb; pc = (cdb->page & SLS_PAGE_CTRL_MASK) >> 6; page_code = cdb->page & SLS_PAGE_CODE; @@ -6886,9 +6842,9 @@ ctl_log_sense(struct ctl_scsiio *ctsio) int ctl_read_capacity(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity *cdb; struct scsi_read_capacity_data *data; - struct ctl_lun *lun; uint32_t lba; CTL_DEBUG_PRINT(("ctl_read_capacity\n")); @@ -6908,8 +6864,6 @@ ctl_read_capacity(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; @@ -6944,9 +6898,9 @@ ctl_read_capacity(struct ctl_scsiio *cts int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity_16 *cdb; struct scsi_read_capacity_data_long *data; - struct ctl_lun *lun; uint64_t lba; uint32_t alloc_len; @@ -6969,8 +6923,6 @@ ctl_read_capacity_16(struct ctl_scsiio * return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; @@ -7005,9 +6957,9 @@ ctl_read_capacity_16(struct ctl_scsiio * int ctl_get_lba_status(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_get_lba_status *cdb; struct scsi_get_lba_status_data *data; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t alloc_len, total_len; @@ -7015,7 +6967,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct CTL_DEBUG_PRINT(("ctl_get_lba_status\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_get_lba_status *)ctsio->cdb; lba = scsi_8btou64(cdb->addr); alloc_len = scsi_4btoul(cdb->alloc_len); @@ -7128,12 +7079,12 @@ ctl_read_defect(struct ctl_scsiio *ctsio int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_maintenance_in *cdb; int retval; int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; int num_ha_groups, num_target_ports, shared_group; - struct ctl_lun *lun; - struct ctl_softc *softc; struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; struct scsi_target_group_data_extended *rtg_ext_ptr; @@ -7142,9 +7093,6 @@ ctl_report_tagret_port_groups(struct ctl CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retval = CTL_RETVAL_COMPLETE; switch (cdb->byte2 & STG_PDF_MASK) { @@ -7310,7 +7258,7 @@ ctl_report_tagret_port_groups(struct ctl int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; @@ -7323,8 +7271,6 @@ ctl_report_supported_opcodes(struct ctl_ CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; @@ -7589,11 +7535,11 @@ ctl_report_timestamp(struct ctl_scsiio * int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_per_res_in *cdb; int alloc_len, total_len = 0; /* struct scsi_per_res_in_rsrv in_data; */ - struct ctl_lun *lun; - struct ctl_softc *softc; uint64_t key; CTL_DEBUG_PRINT(("ctl_persistent_reserve_in\n")); @@ -7602,9 +7548,6 @@ ctl_persistent_reserve_in(struct ctl_scs alloc_len = scsi_2btoul(cdb->length); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retry: mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -8167,12 +8110,12 @@ ctl_pro_preempt_other(struct ctl_lun *lu int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); int retval; u_int32_t param_len; struct scsi_per_res_out *cdb; - struct ctl_lun *lun; struct scsi_per_res_out_parms* param; - struct ctl_softc *softc; uint32_t residx; uint64_t res_key, sa_res_key, key; uint8_t type; @@ -8181,11 +8124,8 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_DEBUG_PRINT(("ctl_persistent_reserve_out\n")); - retval = CTL_RETVAL_COMPLETE; - cdb = (struct scsi_per_res_out *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; + retval = CTL_RETVAL_COMPLETE; /* * We only support whole-LUN scope. The scope & type are ignored for @@ -8559,9 +8499,10 @@ done: * in sync. */ static void -ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) +ctl_hndl_per_res_out_on_other_sc(union ctl_io *io) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(io); + union ctl_ha_msg *msg = (union ctl_ha_msg *)&io->presio.pr_msg; struct ctl_lun *lun; int i; uint32_t residx, targ_lun; @@ -8680,15 +8621,13 @@ ctl_hndl_per_res_out_on_other_sc(union c int ctl_read_write(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; int isread; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8873,15 +8812,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) static int ctl_cnw_cont(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct ctl_scsiio *ctsio; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; int retval; ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; lbalen = (struct ctl_lba_len_flags *) &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->flags &= ~CTL_LLF_COMPARE; @@ -8895,14 +8833,12 @@ ctl_cnw_cont(union ctl_io *io) int ctl_cnw(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8983,15 +8919,13 @@ ctl_cnw(struct ctl_scsiio *ctsio) int ctl_verify(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int bytchk, flags; int retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); bytchk = 0; @@ -9087,19 +9021,17 @@ ctl_verify(struct ctl_scsiio *ctsio) int ctl_report_luns(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio); struct scsi_report_luns *cdb; struct scsi_report_luns_data *lun_data; - struct ctl_lun *lun, *request_lun; - struct ctl_port *port; int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; cdb = (struct scsi_report_luns *)ctsio->cdb; - port = ctl_io_port(&ctsio->io_hdr); - softc = port->ctl_softc; CTL_DEBUG_PRINT(("ctl_report_luns\n")); @@ -9152,9 +9084,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio return (retval); } - request_lun = (struct ctl_lun *) - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); @@ -9245,10 +9174,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio int ctl_request_sense(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *softc; - struct ctl_lun *lun; uint32_t initidx; int have_error; u_int sense_len = SSD_FULL_SIZE; @@ -9258,9 +9187,6 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - softc = control_softc; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_request_sense\n")); /* @@ -9403,13 +9329,11 @@ ctl_tur(struct ctl_scsiio *ctsio) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; - struct ctl_lun *lun; int p; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); @@ -9478,12 +9402,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_unit_serial_number *sn_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; @@ -9537,12 +9459,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_extended_inquiry_data *eid_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; @@ -9613,12 +9533,10 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_mode_page_policy *mpp_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + sizeof(struct scsi_vpd_mode_page_policy_descr); @@ -9667,19 +9585,14 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_device_id *devid_ptr; struct scsi_vpd_id_descriptor *desc; - struct ctl_softc *softc; - struct ctl_lun *lun; - struct ctl_port *port; int data_len, g; uint8_t proto; - softc = control_softc; - - port = ctl_io_port(&ctsio->io_hdr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_device_id) + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + @@ -9792,16 +9705,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_scsi_ports *sp; struct scsi_vpd_port_designation *pd; struct scsi_vpd_port_designation_cont *pdc; - struct ctl_lun *lun; struct ctl_port *port; int data_len, num_target_ports, iid_len, id_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - num_target_ports = 0; iid_len = 0; id_len = 0; @@ -9895,12 +9806,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_limits *bl_ptr; - struct ctl_lun *lun; uint64_t ival; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9972,13 +9881,11 @@ ctl_inquiry_evpd_block_limits(struct ctl static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_device_characteristics *bdc_ptr; - struct ctl_lun *lun; const char *value; u_int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10032,12 +9939,10 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_logical_block_prov *lbp_ptr; - struct ctl_lun *lun; const char *value; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10095,11 +10000,10 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_inquiry *cdb; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; alloc_len = scsi_2btoul(cdb->length); @@ -10162,21 +10066,19 @@ err: static int ctl_inquiry_std(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 20:50: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 C1A08CC10E3; Thu, 26 Jan 2017 20:50: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 5912CD7E; Thu, 26 Jan 2017 20:50: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 v0QKo19E098293; Thu, 26 Jan 2017 20:50:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKo1hD098291; Thu, 26 Jan 2017 20:50:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262050.v0QKo1hD098291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:50:01 +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: r312835 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:50:02 -0000 Author: mav Date: Thu Jan 26 20:50:01 2017 New Revision: 312835 URL: https://svnweb.freebsd.org/changeset/base/312835 Log: MFC r310778, r310782: Improve use of I/O's private area. - Since I/Os are allocates from per-port pools, make allocations store pointer to CTL softc there, and use it where needed instead of global. - Created bunch of helper macros to access LUN, port and CTL softc. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_backend_ramdisk.c stable/10/sys/cam/ctl/ctl_error.c stable/10/sys/cam/ctl/ctl_io.h stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:49:19 2017 (r312834) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017 (r312835) @@ -439,7 +439,6 @@ static int ctl_alloc_lun(struct ctl_soft struct ctl_be_lun *be_lun); static int ctl_free_lun(struct ctl_lun *lun); static void ctl_create_lun(struct ctl_be_lun *be_lun); -static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -450,7 +449,7 @@ static int ctl_pro_preempt(struct ctl_so struct scsi_per_res_out_parms* param); static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg); -static void ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg); +static void ctl_hndl_per_res_out_on_other_sc(union ctl_io *io); static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len); static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len); @@ -569,13 +568,12 @@ static struct ctl_frontend ha_frontend = static void ctl_ha_datamove(union ctl_io *io) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(io); struct ctl_sg_entry *sgl; union ctl_ha_msg msg; uint32_t sg_entries_sent; int do_sg_copy, i, j; - lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.original_sc; @@ -1805,7 +1803,8 @@ ctl_init(void) args.mda_si_drv1 = softc; error = make_dev_s(&args, &softc->dev, "cam/ctl"); if (error != 0) { - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); + control_softc = NULL; return (error); } @@ -1817,7 +1816,7 @@ ctl_init(void) if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); destroy_dev(softc->dev); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; return (ENOMEM); } @@ -1967,7 +1966,7 @@ ctl_shutdown(void) sysctl_ctx_free(&softc->sysctl_ctx); - free(control_softc, M_DEVBUF); + free(softc, M_DEVBUF); control_softc = NULL; } @@ -2209,18 +2208,16 @@ ctl_create_iid(struct ctl_port *port, in static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); union ctl_ha_msg msg_info; - struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; - mtx_lock(&softc->ctl_lock); /* Make sure that we know about this port. */ - port = ctl_io_port(&ctsio->io_hdr); if (port == NULL || (port->status & CTL_PORT_STATUS_ONLINE) == 0) { ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, /*retry_count*/ 1); @@ -2228,6 +2225,7 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ + mtx_lock(&softc->ctl_lock); if (targ_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(&softc->ctl_lock); @@ -2260,8 +2258,8 @@ ctl_serialize_other_sc_cmd(struct ctl_sc goto badjuju; } - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; - ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = lun->be_lun; + CTL_LUN(ctsio) = lun; + CTL_BACKEND_LUN(ctsio) = lun->be_lun; /* * Every I/O goes into the OOA queue for a @@ -3616,13 +3614,6 @@ ctl_encode_lun(uint32_t decoded) return ((((uint64_t)RPL_LUNDATA_ATYP_EXTLUN | 0x22) << 56) | (l << 16)); } -static struct ctl_port * -ctl_io_port(struct ctl_io_hdr *io_hdr) -{ - - return (control_softc->ctl_ports[io_hdr->nexus.targ_port]); -} - int ctl_ffz(uint32_t *mask, uint32_t first, uint32_t last) { @@ -3740,7 +3731,6 @@ int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool) { -#ifdef IO_POOLS struct ctl_io_pool *pool; pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, @@ -3750,14 +3740,15 @@ ctl_pool_create(struct ctl_softc *ctl_so snprintf(pool->name, sizeof(pool->name), "CTL IO %s", pool_name); pool->ctl_softc = ctl_softc; +#ifdef IO_POOLS pool->zone = uma_zsecond_create(pool->name, NULL, NULL, NULL, NULL, ctl_softc->io_zone); /* uma_prealloc(pool->zone, total_ctl_io); */ - - *npool = pool; #else - *npool = ctl_softc->io_zone; + pool->zone = ctl_softc->io_zone; #endif + + *npool = pool; return (0); } @@ -3770,64 +3761,54 @@ ctl_pool_free(struct ctl_io_pool *pool) #ifdef IO_POOLS uma_zdestroy(pool->zone); - free(pool, M_CTL); #endif + free(pool, M_CTL); } union ctl_io * ctl_alloc_io(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_WAITOK); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_WAITOK); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } union ctl_io * ctl_alloc_io_nowait(void *pool_ref) { - union ctl_io *io; -#ifdef IO_POOLS struct ctl_io_pool *pool = (struct ctl_io_pool *)pool_ref; + union ctl_io *io; io = uma_zalloc(pool->zone, M_NOWAIT); -#else - io = uma_zalloc((uma_zone_t)pool_ref, M_NOWAIT); -#endif - if (io != NULL) + if (io != NULL) { io->io_hdr.pool = pool_ref; + CTL_SOFTC(io) = pool->ctl_softc; + } return (io); } void ctl_free_io(union ctl_io *io) { -#ifdef IO_POOLS struct ctl_io_pool *pool; -#endif if (io == NULL) return; -#ifdef IO_POOLS pool = (struct ctl_io_pool *)io->io_hdr.pool; uma_zfree(pool->zone, io); -#else - uma_zfree((uma_zone_t)io->io_hdr.pool, io); -#endif } void ctl_zero_io(union ctl_io *io) { - void *pool_ref; + struct ctl_io_pool *pool; if (io == NULL) return; @@ -3835,9 +3816,10 @@ ctl_zero_io(union ctl_io *io) /* * May need to preserve linked list pointers at some point too. */ - pool_ref = io->io_hdr.pool; + pool = io->io_hdr.pool; memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; + io->io_hdr.pool = pool; + CTL_SOFTC(io) = pool->ctl_softc; } int @@ -4644,12 +4626,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft static int ctl_free_lun(struct ctl_lun *lun) { - struct ctl_softc *softc; + struct ctl_softc *softc = lun->ctl_softc; struct ctl_lun *nlun; int i; - softc = lun->ctl_softc; - mtx_assert(&softc->ctl_lock, MA_OWNED); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); @@ -5150,13 +5130,12 @@ ctl_config_read_done(union ctl_io *io) int ctl_scsi_release(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_scsi_release\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5188,13 +5167,12 @@ ctl_scsi_release(struct ctl_scsiio *ctsi int ctl_scsi_reserve(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint32_t residx; CTL_DEBUG_PRINT(("ctl_reserve\n")); residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; /* * XXX KDM right now, we only support LUN reservation. We don't @@ -5229,13 +5207,12 @@ bailout: int ctl_start_stop(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_start_stop_unit *cdb; - struct ctl_lun *lun; int retval; CTL_DEBUG_PRINT(("ctl_start_stop\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; if ((cdb->how & SSS_PC_MASK) == 0) { @@ -5284,14 +5261,13 @@ ctl_start_stop(struct ctl_scsiio *ctsio) int ctl_prevent_allow(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_prevent *cdb; int retval; uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { @@ -5325,8 +5301,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts int ctl_sync_cache(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - struct ctl_softc *softc; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t starting_lba; uint32_t block_count; @@ -5335,8 +5310,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_sync_cache\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; retval = 0; switch (ctsio->cdb[0]) { @@ -5392,13 +5365,10 @@ int ctl_format(struct ctl_scsiio *ctsio) { struct scsi_format *cdb; - struct ctl_lun *lun; int length, defect_list_len; CTL_DEBUG_PRINT(("ctl_format\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - cdb = (struct scsi_format *)ctsio->cdb; length = 0; @@ -5477,7 +5447,7 @@ bailout: int ctl_read_buffer(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint64_t buffer_offset; uint32_t len; uint8_t byte2; @@ -5485,7 +5455,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio static uint8_t echo_descr[4] = { 0 }; CTL_DEBUG_PRINT(("ctl_read_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + switch (ctsio->cdb[0]) { case READ_BUFFER: { struct scsi_read_buffer *cdb; @@ -5552,13 +5522,12 @@ ctl_read_buffer(struct ctl_scsiio *ctsio int ctl_write_buffer(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_write_buffer *cdb; - struct ctl_lun *lun; int buffer_offset, len; CTL_DEBUG_PRINT(("ctl_write_buffer\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; len = scsi_3btoul(cdb->length); @@ -5605,7 +5574,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi int ctl_write_same(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; @@ -5614,8 +5583,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_write_same\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - switch (ctsio->cdb[0]) { case WRITE_SAME_10: { struct scsi_write_same_10 *cdb; @@ -5719,7 +5686,7 @@ ctl_write_same(struct ctl_scsiio *ctsio) int ctl_unmap(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_unmap *cdb; struct ctl_ptr_len_flags *ptrlen; struct scsi_unmap_header *hdr; @@ -5731,9 +5698,7 @@ ctl_unmap(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_unmap\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_unmap *)ctsio->cdb; - len = scsi_2btoul(cdb->length); byte2 = cdb->byte2; @@ -5823,12 +5788,11 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); uint8_t *current_cp; int set_ua; uint32_t initidx; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; @@ -5878,13 +5842,12 @@ int ctl_ie_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_info_exceptions_page *pg; - struct ctl_lun *lun; uint64_t t; (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; pg = (struct scsi_info_exceptions_page *)page_ptr; mtx_lock(&lun->lun_lock); if (pg->info_flags & SIEP_FLAGS_TEST) { @@ -5921,19 +5884,18 @@ ctl_ie_page_handler(struct ctl_scsiio *c static int ctl_do_mode_select(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct scsi_mode_page_header *page_header; struct ctl_page_index *page_index; struct ctl_scsiio *ctsio; int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; - struct ctl_lun *lun; uint16_t *len_left, *len_used; int retval, i; ctsio = &io->scsiio; page_index = NULL; page_len = 0; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; modepage_info = (union ctl_modepage_info *) ctsio->io_hdr.ctl_private[CTL_PRIV_MODEPAGE].bytes; @@ -6146,12 +6108,11 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); union ctl_modepage_info *modepage_info; int bd_len, i, header_size, param_len, pf, rtd, sp; uint32_t initidx; - lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { @@ -6296,7 +6257,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio int ctl_mode_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int pc, page_code, dbd, llba, subpage; int alloc_len, page_len, header_len, total_len; struct scsi_mode_block_descr *block_desc; @@ -6308,7 +6269,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_mode_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -6644,12 +6604,11 @@ ctl_lbp_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_param_header *phdr; uint8_t *data; uint64_t val; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = page_index->page_data; if (lun->backend->lun_attr != NULL && @@ -6713,13 +6672,12 @@ ctl_sap_log_sense_handler(struct ctl_scs struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; uint64_t rn, wn, rb, wb; struct bintime rt, wt; int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct stat_page *)page_index->page_data; scsi_ulto2b(SLP_SAP, data->sap.hdr.param_code); @@ -6772,10 +6730,9 @@ ctl_ie_log_sense_handler(struct ctl_scsi struct ctl_page_index *page_index, int pc) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_log_informational_exceptions *data; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; data = (struct scsi_log_informational_exceptions *)page_index->page_data; scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); @@ -6791,7 +6748,7 @@ ctl_ie_log_sense_handler(struct ctl_scsi int ctl_log_sense(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); int i, pc, page_code, subpage; int alloc_len, total_len; struct ctl_page_index *page_index; @@ -6800,7 +6757,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) CTL_DEBUG_PRINT(("ctl_log_sense\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_log_sense *)ctsio->cdb; pc = (cdb->page & SLS_PAGE_CTRL_MASK) >> 6; page_code = cdb->page & SLS_PAGE_CODE; @@ -6877,9 +6833,9 @@ ctl_log_sense(struct ctl_scsiio *ctsio) int ctl_read_capacity(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity *cdb; struct scsi_read_capacity_data *data; - struct ctl_lun *lun; uint32_t lba; CTL_DEBUG_PRINT(("ctl_read_capacity\n")); @@ -6899,8 +6855,6 @@ ctl_read_capacity(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; @@ -6935,9 +6889,9 @@ ctl_read_capacity(struct ctl_scsiio *cts int ctl_read_capacity_16(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_read_capacity_16 *cdb; struct scsi_read_capacity_data_long *data; - struct ctl_lun *lun; uint64_t lba; uint32_t alloc_len; @@ -6960,8 +6914,6 @@ ctl_read_capacity_16(struct ctl_scsiio * return (CTL_RETVAL_COMPLETE); } - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; @@ -6996,9 +6948,9 @@ ctl_read_capacity_16(struct ctl_scsiio * int ctl_get_lba_status(struct ctl_scsiio *ctsio) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_get_lba_status *cdb; struct scsi_get_lba_status_data *data; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t alloc_len, total_len; @@ -7006,7 +6958,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct CTL_DEBUG_PRINT(("ctl_get_lba_status\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_get_lba_status *)ctsio->cdb; lba = scsi_8btou64(cdb->addr); alloc_len = scsi_4btoul(cdb->alloc_len); @@ -7119,12 +7070,12 @@ ctl_read_defect(struct ctl_scsiio *ctsio int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_maintenance_in *cdb; int retval; int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; int num_ha_groups, num_target_ports, shared_group; - struct ctl_lun *lun; - struct ctl_softc *softc; struct ctl_port *port; struct scsi_target_group_data *rtg_ptr; struct scsi_target_group_data_extended *rtg_ext_ptr; @@ -7133,9 +7084,6 @@ ctl_report_tagret_port_groups(struct ctl CTL_DEBUG_PRINT(("ctl_report_tagret_port_groups\n")); cdb = (struct scsi_maintenance_in *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retval = CTL_RETVAL_COMPLETE; switch (cdb->byte2 & STG_PDF_MASK) { @@ -7301,7 +7249,7 @@ ctl_report_tagret_port_groups(struct ctl int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; @@ -7314,8 +7262,6 @@ ctl_report_supported_opcodes(struct ctl_ CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; @@ -7580,11 +7526,11 @@ ctl_report_timestamp(struct ctl_scsiio * int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_per_res_in *cdb; int alloc_len, total_len = 0; /* struct scsi_per_res_in_rsrv in_data; */ - struct ctl_lun *lun; - struct ctl_softc *softc; uint64_t key; CTL_DEBUG_PRINT(("ctl_persistent_reserve_in\n")); @@ -7593,9 +7539,6 @@ ctl_persistent_reserve_in(struct ctl_scs alloc_len = scsi_2btoul(cdb->length); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; - retry: mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -8158,12 +8101,12 @@ ctl_pro_preempt_other(struct ctl_lun *lu int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); int retval; u_int32_t param_len; struct scsi_per_res_out *cdb; - struct ctl_lun *lun; struct scsi_per_res_out_parms* param; - struct ctl_softc *softc; uint32_t residx; uint64_t res_key, sa_res_key, key; uint8_t type; @@ -8172,11 +8115,8 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_DEBUG_PRINT(("ctl_persistent_reserve_out\n")); - retval = CTL_RETVAL_COMPLETE; - cdb = (struct scsi_per_res_out *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - softc = lun->ctl_softc; + retval = CTL_RETVAL_COMPLETE; /* * We only support whole-LUN scope. The scope & type are ignored for @@ -8550,9 +8490,10 @@ done: * in sync. */ static void -ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) +ctl_hndl_per_res_out_on_other_sc(union ctl_io *io) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(io); + union ctl_ha_msg *msg = (union ctl_ha_msg *)&io->presio.pr_msg; struct ctl_lun *lun; int i; uint32_t residx, targ_lun; @@ -8671,15 +8612,13 @@ ctl_hndl_per_res_out_on_other_sc(union c int ctl_read_write(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; int isread; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8864,15 +8803,14 @@ ctl_read_write(struct ctl_scsiio *ctsio) static int ctl_cnw_cont(union ctl_io *io) { + struct ctl_lun *lun = CTL_LUN(io); struct ctl_scsiio *ctsio; - struct ctl_lun *lun; struct ctl_lba_len_flags *lbalen; int retval; ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; lbalen = (struct ctl_lba_len_flags *) &ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->flags &= ~CTL_LLF_COMPARE; @@ -8886,14 +8824,12 @@ ctl_cnw_cont(union ctl_io *io) int ctl_cnw(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int flags, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_cnw: command: %#x\n", ctsio->cdb[0])); flags = 0; @@ -8974,15 +8910,13 @@ ctl_cnw(struct ctl_scsiio *ctsio) int ctl_verify(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct ctl_lba_len_flags *lbalen; uint64_t lba; uint32_t num_blocks; int bytchk, flags; int retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_verify: command: %#x\n", ctsio->cdb[0])); bytchk = 0; @@ -9078,19 +9012,17 @@ ctl_verify(struct ctl_scsiio *ctsio) int ctl_report_luns(struct ctl_scsiio *ctsio) { - struct ctl_softc *softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio); struct scsi_report_luns *cdb; struct scsi_report_luns_data *lun_data; - struct ctl_lun *lun, *request_lun; - struct ctl_port *port; int num_filled, num_luns, num_port_luns, retval; uint32_t alloc_len, lun_datalen; uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; cdb = (struct scsi_report_luns *)ctsio->cdb; - port = ctl_io_port(&ctsio->io_hdr); - softc = port->ctl_softc; CTL_DEBUG_PRINT(("ctl_report_luns\n")); @@ -9143,9 +9075,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio return (retval); } - request_lun = (struct ctl_lun *) - ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); @@ -9236,10 +9165,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio int ctl_request_sense(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *softc; - struct ctl_lun *lun; uint32_t initidx; int have_error; u_int sense_len = SSD_FULL_SIZE; @@ -9249,9 +9178,6 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - softc = control_softc; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - CTL_DEBUG_PRINT(("ctl_request_sense\n")); /* @@ -9394,13 +9320,11 @@ ctl_tur(struct ctl_scsiio *ctsio) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; - struct ctl_lun *lun; int p; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); @@ -9469,12 +9393,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_unit_serial_number *sn_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; @@ -9528,12 +9450,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii static int ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_extended_inquiry_data *eid_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; @@ -9604,12 +9524,10 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_mode_page_policy *mpp_ptr; - struct ctl_lun *lun; int data_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + sizeof(struct scsi_vpd_mode_page_policy_descr); @@ -9658,19 +9576,14 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_device_id *devid_ptr; struct scsi_vpd_id_descriptor *desc; - struct ctl_softc *softc; - struct ctl_lun *lun; - struct ctl_port *port; int data_len, g; uint8_t proto; - softc = control_softc; - - port = ctl_io_port(&ctsio->io_hdr); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_device_id) + sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_rel_trgt_port_id) + @@ -9783,16 +9696,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) { - struct ctl_softc *softc = control_softc; + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_scsi_ports *sp; struct scsi_vpd_port_designation *pd; struct scsi_vpd_port_designation_cont *pdc; - struct ctl_lun *lun; struct ctl_port *port; int data_len, num_target_ports, iid_len, id_len; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - num_target_ports = 0; iid_len = 0; id_len = 0; @@ -9886,12 +9797,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_limits *bl_ptr; - struct ctl_lun *lun; uint64_t ival; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9963,13 +9872,11 @@ ctl_inquiry_evpd_block_limits(struct ctl static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_block_device_characteristics *bdc_ptr; - struct ctl_lun *lun; const char *value; u_int i; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10023,12 +9930,10 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) { + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_logical_block_prov *lbp_ptr; - struct ctl_lun *lun; const char *value; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10086,11 +9991,10 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; + struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_inquiry *cdb; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; alloc_len = scsi_2btoul(cdb->length); @@ -10153,21 +10057,19 @@ err: static int ctl_inquiry_std(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); + struct ctl_port *port = CTL_PORT(ctsio); + struct ctl_lun *lun = CTL_LUN(ctsio); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 20:51: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 9B578CC1180; Thu, 26 Jan 2017 20:51: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 61608F57; Thu, 26 Jan 2017 20:51: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 v0QKpI4F099784; Thu, 26 Jan 2017 20:51:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKpIjT099783; Thu, 26 Jan 2017 20:51:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262051.v0QKpIjT099783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:51: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: r312836 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:51:19 -0000 Author: mav Date: Thu Jan 26 20:51:18 2017 New Revision: 312836 URL: https://svnweb.freebsd.org/changeset/base/312836 Log: MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:50:01 2017 (r312835) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017 (r312836) @@ -2779,32 +2779,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_GETSTATS: { - struct ctl_stats *stats; + struct ctl_stats *stats = (struct ctl_stats *)addr; int i; - stats = (struct ctl_stats *)addr; - - if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) > - stats->alloc_len) { - stats->status = CTL_SS_NEED_MORE_SPACE; - stats->num_luns = softc->num_luns; - break; - } /* * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; + stats->fill_len += sizeof(lun->stats); } stats->num_luns = softc->num_luns; - stats->fill_len = sizeof(struct ctl_lun_io_stats) * - softc->num_luns; - stats->status = CTL_SS_OK; #ifdef CTL_TIME_IO stats->flags = CTL_STATS_FLAG_TIME_VALID; #else From owner-svn-src-all@freebsd.org Thu Jan 26 20: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 1B479CC1357; Thu, 26 Jan 2017 20:51: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 DC1561114; Thu, 26 Jan 2017 20:51:51 +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 v0QKpoMo099856; Thu, 26 Jan 2017 20:51:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKpo6U099855; Thu, 26 Jan 2017 20:51:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262051.v0QKpo6U099855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:51:50 +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: r312837 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:51:52 -0000 Author: mav Date: Thu Jan 26 20:51:50 2017 New Revision: 312837 URL: https://svnweb.freebsd.org/changeset/base/312837 Log: MFC r311680: Make CTL_GETSTATS ioctl return partial data if buffer is small. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:18 2017 (r312836) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017 (r312837) @@ -2770,32 +2770,29 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_GETSTATS: { - struct ctl_stats *stats; + struct ctl_stats *stats = (struct ctl_stats *)addr; int i; - stats = (struct ctl_stats *)addr; - - if ((sizeof(struct ctl_lun_io_stats) * softc->num_luns) > - stats->alloc_len) { - stats->status = CTL_SS_NEED_MORE_SPACE; - stats->num_luns = softc->num_luns; - break; - } /* * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; + stats->fill_len += sizeof(lun->stats); } stats->num_luns = softc->num_luns; - stats->fill_len = sizeof(struct ctl_lun_io_stats) * - softc->num_luns; - stats->status = CTL_SS_OK; #ifdef CTL_TIME_IO stats->flags = CTL_STATS_FLAG_TIME_VALID; #else From owner-svn-src-all@freebsd.org Thu Jan 26 20:57: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 AA4FECC1454; Thu, 26 Jan 2017 20:57: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 6875514F3; Thu, 26 Jan 2017 20:57: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 v0QKvJv3002345; Thu, 26 Jan 2017 20:57:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKvJmO002343; Thu, 26 Jan 2017 20:57:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262057.v0QKvJmO002343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:57: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: r312838 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:57:20 -0000 Author: mav Date: Thu Jan 26 20:57:19 2017 New Revision: 312838 URL: https://svnweb.freebsd.org/changeset/base/312838 Log: MFC r311787: Allocate memory for prevent flags only for removable LUs. This array takes 64KB of RAM now, that was more then half of struct ctl_lun size. If at some point we support more ports, this may need another tune. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:51:50 2017 (r312837) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017 (r312838) @@ -4585,6 +4585,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); + if (lun->flags & CTL_LUN_REMOVABLE) { + lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4, + M_CTL, M_WAITOK); + } /* * Initialize the mode and log page index. @@ -4666,6 +4670,7 @@ ctl_free_lun(struct ctl_lun *lun) for (i = 0; i < CTL_MAX_PORTS; i++) free(lun->pr_keys[i], M_CTL); free(lun->write_buffer, M_CTL); + free(lun->prevent, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5276,7 +5281,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts cdb = (struct scsi_prevent *)ctsio->cdb; - if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) { ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11872,8 +11877,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un ctl_clear_mask(lun->have_ca, i); #endif lun->prevent_count = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - ctl_clear_mask(lun->prevent, i); + if (lun->prevent) { + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); + } mtx_unlock(&lun->lun_lock); return (0); @@ -12019,7 +12026,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; - if (ctl_is_set(lun->prevent, initidx)) { + if (lun->prevent && ctl_is_set(lun->prevent, initidx)) { ctl_clear_mask(lun->prevent, initidx); lun->prevent_count--; } Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:51:50 2017 (r312837) +++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017 (r312838) @@ -412,7 +412,7 @@ struct ctl_lun { uint32_t pr_res_idx; uint8_t pr_res_type; int prevent_count; - uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; + uint32_t *prevent; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-all@freebsd.org Thu Jan 26 20:57: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 0C7BFCC151A; Thu, 26 Jan 2017 20:57:50 +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 BF0EC16C0; Thu, 26 Jan 2017 20:57:49 +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 v0QKvmKk002419; Thu, 26 Jan 2017 20:57:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKvme9002417; Thu, 26 Jan 2017 20:57:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262057.v0QKvme9002417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20:57:48 +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: r312839 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:57:50 -0000 Author: mav Date: Thu Jan 26 20:57:48 2017 New Revision: 312839 URL: https://svnweb.freebsd.org/changeset/base/312839 Log: MFC r311787: Allocate memory for prevent flags only for removable LUs. This array takes 64KB of RAM now, that was more then half of struct ctl_lun size. If at some point we support more ports, this may need another tune. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:19 2017 (r312838) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017 (r312839) @@ -4576,6 +4576,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); + if (lun->flags & CTL_LUN_REMOVABLE) { + lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4, + M_CTL, M_WAITOK); + } /* * Initialize the mode and log page index. @@ -4657,6 +4661,7 @@ ctl_free_lun(struct ctl_lun *lun) for (i = 0; i < CTL_MAX_PORTS; i++) free(lun->pr_keys[i], M_CTL); free(lun->write_buffer, M_CTL); + free(lun->prevent, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5267,7 +5272,7 @@ ctl_prevent_allow(struct ctl_scsiio *cts cdb = (struct scsi_prevent *)ctsio->cdb; - if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) { ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11863,8 +11868,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un ctl_clear_mask(lun->have_ca, i); #endif lun->prevent_count = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - ctl_clear_mask(lun->prevent, i); + if (lun->prevent) { + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); + } mtx_unlock(&lun->lun_lock); return (0); @@ -12010,7 +12017,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; - if (ctl_is_set(lun->prevent, initidx)) { + if (lun->prevent && ctl_is_set(lun->prevent, initidx)) { ctl_clear_mask(lun->prevent, initidx); lun->prevent_count--; } Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:19 2017 (r312838) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:48 2017 (r312839) @@ -412,7 +412,7 @@ struct ctl_lun { uint32_t pr_res_idx; uint8_t pr_res_type; int prevent_count; - uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; + uint32_t *prevent; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-all@freebsd.org Thu Jan 26 20:59: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 33C2FCC1619; Thu, 26 Jan 2017 20:59:39 +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 BF4D318AC; Thu, 26 Jan 2017 20:59: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 v0QKxbwo002539; Thu, 26 Jan 2017 20:59:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QKxb0D002531; Thu, 26 Jan 2017 20:59:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262059.v0QKxb0D002531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 20: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: r312840 - in stable/11: sys/cam/ctl usr.bin/ctlstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 20:59:39 -0000 Author: mav Date: Thu Jan 26 20:59:36 2017 New Revision: 312840 URL: https://svnweb.freebsd.org/changeset/base/312840 Log: MFC r311804: Rewrite CTL statistics in more simple and scalable way. Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB. Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities. Old API is still enabled in stable branches for compatibility reasons. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend.h stable/11/sys/cam/ctl/ctl_frontend.c stable/11/sys/cam/ctl/ctl_frontend.h stable/11/sys/cam/ctl/ctl_ioctl.h stable/11/sys/cam/ctl/ctl_private.h stable/11/usr.bin/ctlstat/ctlstat.8 stable/11/usr.bin/ctlstat/ctlstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -2567,6 +2567,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct thread *td) { struct ctl_softc *softc = dev->si_drv1; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -2778,6 +2779,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, #endif /* CTL_IO_DELAY */ break; } +#ifdef CTL_LEGACY_STATS case CTL_GETSTATS: { struct ctl_stats *stats = (struct ctl_stats *)addr; int i; @@ -2790,26 +2792,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, stats->status = CTL_SS_OK; stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (stats->fill_len + sizeof(lun->stats) > + if (stats->fill_len + sizeof(lun->legacy_stats) > stats->alloc_len) { stats->status = CTL_SS_NEED_MORE_SPACE; break; } - retval = copyout(&lun->stats, &stats->lun_stats[i++], - sizeof(lun->stats)); + retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++], + sizeof(lun->legacy_stats)); if (retval != 0) break; - stats->fill_len += sizeof(lun->stats); + stats->fill_len += sizeof(lun->legacy_stats); } stats->num_luns = softc->num_luns; -#ifdef CTL_TIME_IO - stats->flags = CTL_STATS_FLAG_TIME_VALID; -#else stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; #endif getnanouptime(&stats->timestamp); break; } +#endif /* CTL_LEGACY_STATS */ case CTL_ERROR_INJECT: { struct ctl_error_desc *err_desc, *new_err_desc; @@ -3397,6 +3399,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, ctl_isc_announce_port(port); break; } + case CTL_GET_LUN_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun < stats->first_item) + continue; + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&lun->stats, &stats->stats[i++], + sizeof(lun->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(lun->stats); + } + stats->num_items = softc->num_luns; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } + case CTL_GET_PORT_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port < stats->first_item) + continue; + if (stats->fill_len + sizeof(port->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&port->stats, &stats->stats[i++], + sizeof(port->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(port->stats); + } + stats->num_items = softc->num_ports; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -4391,7 +4459,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, i, lun_malloced; + int lun_number, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) @@ -4613,13 +4681,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_softc->num_luns++; /* Setup statistics gathering */ - lun->stats.device_type = be_lun->lun_type; - lun->stats.lun_number = lun_number; - lun->stats.blocksize = be_lun->blocksize; +#ifdef CTL_LEGACY_STATS + lun->legacy_stats.device_type = be_lun->lun_type; + lun->legacy_stats.lun_number = lun_number; + lun->legacy_stats.blocksize = be_lun->blocksize; if (be_lun->blocksize == 0) - lun->stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; - for (i = 0;i < CTL_MAX_PORTS;i++) - lun->stats.ports[i].targ_port = i; + lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; + for (len = 0; len < CTL_MAX_PORTS; len++) + lun->legacy_stats.ports[len].targ_port = len; +#endif /* CTL_LEGACY_STATS */ + lun->stats.item = lun_number; mtx_unlock(&ctl_softc->ctl_lock); @@ -6685,9 +6756,7 @@ ctl_sap_log_sense_handler(struct ctl_scs { struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; - uint64_t rn, wn, rb, wb; - struct bintime rt, wt; - int i; + struct bintime *t; data = (struct stat_page *)page_index->page_data; @@ -6695,28 +6764,21 @@ ctl_sap_log_sense_handler(struct ctl_scs data->sap.hdr.param_control = SLP_LBIN; data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) - sizeof(struct scsi_log_param_header); - rn = wn = rb = wb = 0; - bintime_clear(&rt); - bintime_clear(&wt); - for (i = 0; i < CTL_MAX_PORTS; i++) { - rn += lun->stats.ports[i].operations[CTL_STATS_READ]; - wn += lun->stats.ports[i].operations[CTL_STATS_WRITE]; - rb += lun->stats.ports[i].bytes[CTL_STATS_READ]; - wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE]; - bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]); - bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]); - } - scsi_u64to8b(rn, data->sap.read_num); - scsi_u64to8b(wn, data->sap.write_num); - if (lun->stats.blocksize > 0) { - scsi_u64to8b(wb / lun->stats.blocksize, - data->sap.recvieved_lba); - scsi_u64to8b(rb / lun->stats.blocksize, - data->sap.transmitted_lba); + scsi_u64to8b(lun->stats.operations[CTL_STATS_READ], + data->sap.read_num); + scsi_u64to8b(lun->stats.operations[CTL_STATS_WRITE], + data->sap.write_num); + if (lun->be_lun->blocksize > 0) { + scsi_u64to8b(lun->stats.bytes[CTL_STATS_WRITE] / + lun->be_lun->blocksize, data->sap.recvieved_lba); + scsi_u64to8b(lun->stats.bytes[CTL_STATS_READ] / + lun->be_lun->blocksize, data->sap.transmitted_lba); } - scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_READ]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.read_int); - scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_WRITE]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.write_int); scsi_u64to8b(0, data->sap.weighted_num); scsi_u64to8b(0, data->sap.weighted_int); @@ -13053,13 +13115,13 @@ static void ctl_process_done(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); + struct ctl_port *port = CTL_PORT(io); struct ctl_lun *lun = CTL_LUN(io); void (*fe_done)(union ctl_io *io); union ctl_ha_msg msg; - uint32_t targ_port = io->io_hdr.nexus.targ_port; CTL_DEBUG_PRINT(("ctl_process_done\n")); - fe_done = softc->ctl_ports[targ_port]->fe_done; + fe_done = port->fe_done; #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { @@ -13162,11 +13224,13 @@ ctl_process_done(union ctl_io *io) */ if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && io->io_hdr.io_type == CTL_IO_SCSI) { -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif int type; +#ifdef CTL_TIME_IO + struct bintime bt; + getbinuptime(&bt); + bintime_sub(&bt, &io->io_hdr.start_bt); +#endif if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) type = CTL_STATS_READ; @@ -13176,18 +13240,38 @@ ctl_process_done(union ctl_io *io) else type = CTL_STATS_NO_IO; - lun->stats.ports[targ_port].bytes[type] += +#ifdef CTL_LEGACY_STATS + uint32_t targ_port = port->targ_port; + lun->legacy_stats.ports[targ_port].bytes[type] += io->scsiio.kern_total_len; - lun->stats.ports[targ_port].operations[type]++; + lun->legacy_stats.ports[targ_port].operations[type] ++; + lun->legacy_stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; #ifdef CTL_TIME_IO - bintime_add(&lun->stats.ports[targ_port].dma_time[type], + bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); + bintime_add(&lun->legacy_stats.ports[targ_port].time[type], + &bt); #endif - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; +#endif /* CTL_LEGACY_STATS */ + + lun->stats.bytes[type] += io->scsiio.kern_total_len; + lun->stats.operations[type] ++; + lun->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&lun->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&lun->stats.time[type], &bt); +#endif + + mtx_lock(&port->port_lock); + port->stats.bytes[type] += io->scsiio.kern_total_len; + port->stats.operations[type] ++; + port->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&port->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&port->stats.time[type], &bt); +#endif + mtx_unlock(&port->port_lock); } /* Modified: stable/11/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,54 +40,7 @@ #ifndef _CTL_BACKEND_H_ #define _CTL_BACKEND_H_ -/* - * XXX KDM move this to another header file? - */ -#define CTL_BE_NAME_LEN 32 - -/* - * The ID_REQ flag is used to say that the caller has requested a - * particular LUN ID in the req_lun_id field. If we cannot allocate that - * LUN ID, the ctl_add_lun() call will fail. - * - * The STOPPED flag tells us that the LUN should default to the powered - * off state. It will return 0x04,0x02 until it is powered up. ("Logical - * unit not ready, initializing command required.") - * - * The NO_MEDIA flag tells us that the LUN has no media inserted. - * - * The PRIMARY flag tells us that this LUN is registered as a Primary LUN - * which is accessible via the Master shelf controller in an HA. This flag - * being set indicates a Primary LUN. This flag being reset represents a - * Secondary LUN controlled by the Secondary controller in an HA - * configuration. Flag is applicable at this time to T_DIRECT types. - * - * The SERIAL_NUM flag tells us that the serial_num field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x80. - * - * The DEVID flag tells us that the device_id field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x83. - * - * The DEV_TYPE flag tells us that the device_type field is filled in. - * - * The EJECTED flag tells us that the removable LUN has tray open. - * - * The UNMAP flag tells us that this LUN supports UNMAP. - * - * The OFFLINE flag tells us that this LUN can not access backing store. - */ -typedef enum { - CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_STOPPED = 0x02, - CTL_LUN_FLAG_NO_MEDIA = 0x04, - CTL_LUN_FLAG_PRIMARY = 0x08, - CTL_LUN_FLAG_SERIAL_NUM = 0x10, - CTL_LUN_FLAG_DEVID = 0x20, - CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_EJECTED = 0x100, - CTL_LUN_FLAG_READONLY = 0x200 -} ctl_backend_lun_flags; +#include typedef enum { CTL_LUN_SERSEQ_OFF, Modified: stable/11/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,13 +193,14 @@ error: mtx_unlock(&softc->ctl_lock); return (retval); } + port->targ_port = port_num; port->ctl_pool_ref = pool; - if (port->options.stqh_first == NULL) STAILQ_INIT(&port->options); + port->stats.item = port_num; + mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF); mtx_lock(&softc->ctl_lock); - port->targ_port = port_num; STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); for (tport = NULL, nport = STAILQ_FIRST(&softc->port_list); nport != NULL && nport->targ_port < port_num; @@ -218,17 +220,11 @@ int ctl_port_deregister(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; - struct ctl_io_pool *pool; - int retval, i; - - retval = 0; - - pool = (struct ctl_io_pool *)port->ctl_pool_ref; + struct ctl_io_pool *pool = (struct ctl_io_pool *)port->ctl_pool_ref; + int i; - if (port->targ_port == -1) { - retval = 1; - goto bailout; - } + if (port->targ_port == -1) + return (1); mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->port_list, port, ctl_port, links); @@ -251,9 +247,9 @@ ctl_port_deregister(struct ctl_port *por for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); + mtx_destroy(&port->port_lock); -bailout: - return (retval); + return (0); } void Modified: stable/11/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +40,8 @@ #ifndef _CTL_FRONTEND_H_ #define _CTL_FRONTEND_H_ +#include + typedef enum { CTL_PORT_STATUS_NONE = 0x00, CTL_PORT_STATUS_ONLINE = 0x01, @@ -243,6 +246,8 @@ struct ctl_port { struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ struct ctl_devid *init_devid; /* passed to CTL */ + struct ctl_io_stats stats; /* used by CTL */ + struct mtx port_lock; /* used by CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; Modified: stable/11/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2011 Spectra Logic Corporation + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +81,9 @@ /* Hopefully this won't conflict with new misc devices that pop up */ #define CTL_MINOR 225 +/* Legacy statistics accumulated for every port for every LU. */ +#define CTL_LEGACY_STATS 1 + typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -117,6 +121,18 @@ typedef enum { #define CTL_STATS_NUM_TYPES 3 typedef enum { + CTL_SS_OK, + CTL_SS_NEED_MORE_SPACE, + CTL_SS_ERROR +} ctl_stats_status; + +typedef enum { + CTL_STATS_FLAG_NONE = 0x00, + CTL_STATS_FLAG_TIME_VALID = 0x01 +} ctl_stats_flags; + +#ifdef CTL_LEGACY_STATS +typedef enum { CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 } ctl_lun_stats_flags; @@ -137,17 +153,6 @@ struct ctl_lun_io_stats { struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; -typedef enum { - CTL_SS_OK, - CTL_SS_NEED_MORE_SPACE, - CTL_SS_ERROR -} ctl_stats_status; - -typedef enum { - CTL_STATS_FLAG_NONE = 0x00, - CTL_STATS_FLAG_TIME_VALID = 0x01 -} ctl_stats_flags; - struct ctl_stats { int alloc_len; /* passed to kernel */ struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ @@ -157,6 +162,27 @@ struct ctl_stats { ctl_stats_flags flags; /* passed to userland */ struct timespec timestamp; /* passed to userland */ }; +#endif /* CTL_LEGACY_STATS */ + +struct ctl_io_stats { + uint32_t item; + uint64_t bytes[CTL_STATS_NUM_TYPES]; + uint64_t operations[CTL_STATS_NUM_TYPES]; + uint64_t dmas[CTL_STATS_NUM_TYPES]; + struct bintime time[CTL_STATS_NUM_TYPES]; + struct bintime dma_time[CTL_STATS_NUM_TYPES]; +}; + +struct ctl_get_io_stats { + struct ctl_io_stats *stats; /* passed to/from kernel */ + size_t alloc_len; /* passed to kernel */ + size_t fill_len; /* passed to userland */ + int first_item; /* passed to kernel */ + int num_items; /* passed to userland */ + ctl_stats_status status; /* passed to userland */ + ctl_stats_flags flags; /* passed to userland */ + struct timespec timestamp; /* passed to userland */ +}; /* * The types of errors that can be injected: @@ -342,12 +368,54 @@ typedef enum { CTL_LUNREQ_MODIFY, } ctl_lunreq_type; +/* + * The ID_REQ flag is used to say that the caller has requested a + * particular LUN ID in the req_lun_id field. If we cannot allocate that + * LUN ID, the ctl_add_lun() call will fail. + * + * The STOPPED flag tells us that the LUN should default to the powered + * off state. It will return 0x04,0x02 until it is powered up. ("Logical + * unit not ready, initializing command required.") + * + * The NO_MEDIA flag tells us that the LUN has no media inserted. + * + * The PRIMARY flag tells us that this LUN is registered as a Primary LUN + * which is accessible via the Master shelf controller in an HA. This flag + * being set indicates a Primary LUN. This flag being reset represents a + * Secondary LUN controlled by the Secondary controller in an HA + * configuration. Flag is applicable at this time to T_DIRECT types. + * + * The SERIAL_NUM flag tells us that the serial_num field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x80. + * + * The DEVID flag tells us that the device_id field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x83. + * + * The DEV_TYPE flag tells us that the device_type field is filled in. + * + * The EJECTED flag tells us that the removable LUN has tray open. + * + * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. + */ +typedef enum { + CTL_LUN_FLAG_ID_REQ = 0x01, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, + CTL_LUN_FLAG_PRIMARY = 0x08, + CTL_LUN_FLAG_SERIAL_NUM = 0x10, + CTL_LUN_FLAG_DEVID = 0x20, + CTL_LUN_FLAG_DEV_TYPE = 0x40, + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_EJECTED = 0x100, + CTL_LUN_FLAG_READONLY = 0x200 +} ctl_backend_lun_flags; /* * LUN creation parameters: * - * flags: Various LUN flags, see ctl_backend.h for a - * description of the flag values and meanings. + * flags: Various LUN flags, see above. * * device_type: The SCSI device type. e.g. 0 for Direct Access, * 3 for Processor, etc. Only certain backends may @@ -465,6 +533,7 @@ union ctl_lunreq_data { * kern_be_args: For kernel use only. */ struct ctl_lun_req { +#define CTL_BE_NAME_LEN 32 char backend[CTL_BE_NAME_LEN]; ctl_lunreq_type reqtype; union ctl_lunreq_data reqdata; @@ -773,6 +842,8 @@ struct ctl_lun_map { #define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) #define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map) +#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats) +#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats) #endif /* _CTL_IOCTL_H_ */ Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 26 20:59:36 2017 (r312840) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -404,7 +404,10 @@ struct ctl_lun { struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; - struct ctl_lun_io_stats stats; +#ifdef CTL_LEGACY_STATS + struct ctl_lun_io_stats legacy_stats; +#endif /* CTL_LEGACY_STATS */ + struct ctl_io_stats stats; uint32_t res_idx; uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; Modified: stable/11/usr.bin/ctlstat/ctlstat.8 ============================================================================== --- stable/11/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:59:36 2017 (r312840) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $ .\" $FreeBSD$ .\" -.Dd September 21, 2015 +.Dd January 9, 2017 .Dt CTLSTAT 8 .Os .Sh NAME @@ -120,3 +120,4 @@ every 10 seconds. .Sh AUTHORS .An Ken Merry Aq Mt ken@FreeBSD.org .An Will Andrews Aq Mt will@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org Modified: stable/11/usr.bin/ctlstat/ctlstat.c ============================================================================== --- stable/11/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:57:48 2017 (r312839) +++ stable/11/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:59:36 2017 (r312840) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp. + * Copyright (c) 2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,17 +67,17 @@ __FBSDID("$FreeBSD$"); #include /* - * The default amount of space we allocate for LUN storage space. We - * dynamically allocate more if needed. + * The default amount of space we allocate for stats storage space. + * We dynamically allocate more if needed. */ -#define CTL_STAT_NUM_LUNS 30 +#define CTL_STAT_NUM_ITEMS 256 /* * The default number of LUN selection bits we allocate. This is large * because we don't currently increase it if the user specifies a LUN * number of 1024 or larger. */ -#define CTL_STAT_LUN_BITS 1024L +#define CTL_STAT_BITS 1024L static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:"; static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]" @@ -101,31 +102,32 @@ typedef enum { #define CTLSTAT_FLAG_FIRST_RUN (1 << 2) #define CTLSTAT_FLAG_TOTALS (1 << 3) #define CTLSTAT_FLAG_DMA_TIME (1 << 4) -#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5) -#define CTLSTAT_FLAG_LUN_MASK (1 << 6) -#define CTLSTAT_FLAG_PORT_MASK (1 << 7) +#define CTLSTAT_FLAG_TIME_VALID (1 << 5) +#define CTLSTAT_FLAG_MASK (1 << 6) +#define CTLSTAT_FLAG_LUNS (1 << 7) +#define CTLSTAT_FLAG_PORTS (1 << 8) #define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU) #define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER) #define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN) #define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS) #define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME) -#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID) -#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK) -#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK) +#define F_TIMEVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_TIME_VALID) +#define F_MASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_MASK) +#define F_LUNS(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUNS) +#define F_PORTS(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORTS) struct ctlstat_context { ctlstat_mode_types mode; int flags; - struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats, - *tmp_lun_stats; - struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3]; + struct ctl_io_stats *cur_stats, *prev_stats; + struct ctl_io_stats cur_total_stats[3], prev_total_stats[3]; struct timespec cur_time, prev_time; struct ctl_cpu_stats cur_cpu, prev_cpu; uint64_t cur_total_jiffies, prev_total_jiffies; uint64_t cur_idle, prev_idle; - bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS); - bitstr_t bit_decl(port_mask, CTL_MAX_PORTS); - int num_luns; + bitstr_t bit_decl(item_mask, CTL_STAT_BITS); + int cur_items, prev_items; + int cur_alloc, prev_alloc; int numdevs; int header_interval; }; @@ -135,12 +137,11 @@ struct ctlstat_context { #endif static void usage(int error); -static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, - struct timespec *cur_time, int *lun_time_valid); +static int getstats(int fd, int *alloc_items, int *num_items, + struct ctl_io_stats **xstats, struct timespec *cur_time, int *time_valid); static int getcpu(struct ctl_cpu_stats *cpu_stats); -static void compute_stats(struct ctlstat_context *ctx, - struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, +static void compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, @@ -155,64 +156,55 @@ usage(int error) } static int -getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, +getstats(int fd, int *alloc_items, int *num_items, struct ctl_io_stats **stats, struct timespec *cur_time, int *flags) { - struct ctl_lun_io_stats *lun_stats; - struct ctl_stats stats; - int more_space_count; + struct ctl_get_io_stats get_stats; + int more_space_count = 0; - more_space_count = 0; - - if (*num_luns == 0) - *num_luns = CTL_STAT_NUM_LUNS; - - lun_stats = *xlun_stats; + if (*alloc_items == 0) + *alloc_items = CTL_STAT_NUM_ITEMS; retry: + if (*stats == NULL) + *stats = malloc(sizeof(**stats) * *alloc_items); - if (lun_stats == NULL) { - lun_stats = (struct ctl_lun_io_stats *)malloc( - sizeof(*lun_stats) * *num_luns); - } - - memset(&stats, 0, sizeof(stats)); - stats.alloc_len = *num_luns * sizeof(*lun_stats); - memset(lun_stats, 0, stats.alloc_len); - stats.lun_stats = lun_stats; - - if (ioctl(fd, CTL_GETSTATS, &stats) == -1) - err(1, "error returned from CTL_GETSTATS ioctl"); + memset(&get_stats, 0, sizeof(get_stats)); + get_stats.alloc_len = *alloc_items * sizeof(**stats); + memset(*stats, 0, get_stats.alloc_len); + get_stats.stats = *stats; + + if (ioctl(fd, (*flags & CTLSTAT_FLAG_PORTS) ? CTL_GET_PORT_STATS : + CTL_GET_LUN_STATS, &get_stats) == -1) + err(1, "CTL_GET_*_STATS ioctl returned error"); - switch (stats.status) { + switch (get_stats.status) { case CTL_SS_OK: break; case CTL_SS_ERROR: - err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl"); + err(1, "CTL_GET_*_STATS ioctl returned CTL_SS_ERROR"); break; case CTL_SS_NEED_MORE_SPACE: - if (more_space_count > 0) { - errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again"); - } - *num_luns = stats.num_luns; - free(lun_stats); - lun_stats = NULL; + if (more_space_count >= 2) + errx(1, "CTL_GET_*_STATS returned NEED_MORE_SPACE again"); + *alloc_items = get_stats.num_items * 5 / 4; + free(*stats); + *stats = NULL; more_space_count++; goto retry; break; /* NOTREACHED */ default: - errx(1, "unknown status %d returned from CTL_GETSTATS ioctl", - stats.status); + errx(1, "CTL_GET_*_STATS ioctl returned unknown status %d", + get_stats.status); break; } - *xlun_stats = lun_stats; - *num_luns = stats.num_luns; - cur_time->tv_sec = stats.timestamp.tv_sec; - cur_time->tv_nsec = stats.timestamp.tv_nsec; - if (stats.flags & CTL_STATS_FLAG_TIME_VALID) - *flags |= CTLSTAT_FLAG_LUN_TIME_VALID; + *num_items = get_stats.fill_len / sizeof(**stats); + cur_time->tv_sec = get_stats.timestamp.tv_sec; + cur_time->tv_nsec = get_stats.timestamp.tv_nsec; + if (get_stats.flags & CTL_STATS_FLAG_TIME_VALID) + *flags |= CTLSTAT_FLAG_TIME_VALID; else - *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID; + *flags &= ~CTLSTAT_FLAG_TIME_VALID; return (0); } @@ -240,14 +232,13 @@ getcpu(struct ctl_cpu_stats *cpu_stats) } static void -compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, long double etime, +compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, long double *ms_per_transfer, long double *ms_per_dma, long double *dmas_per_second) { uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0; - uint32_t port; struct bintime total_time_bt, total_dma_bt; struct timespec total_time_ts, total_dma_ts; int i; @@ -256,31 +247,18 @@ compute_stats(struct ctlstat_context *ct bzero(&total_dma_bt, sizeof(total_dma_bt)); bzero(&total_time_ts, sizeof(total_time_ts)); bzero(&total_dma_ts, sizeof(total_dma_ts)); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { - total_bytes += cur_stats->ports[port].bytes[i]; - total_operations += - cur_stats->ports[port].operations[i]; - total_dmas += cur_stats->ports[port].num_dmas[i]; - bintime_add(&total_time_bt, - &cur_stats->ports[port].time[i]); - bintime_add(&total_dma_bt, - &cur_stats->ports[port].dma_time[i]); - if (prev_stats != NULL) { - total_bytes -= - prev_stats->ports[port].bytes[i]; - total_operations -= - prev_stats->ports[port].operations[i]; - total_dmas -= - prev_stats->ports[port].num_dmas[i]; - bintime_sub(&total_time_bt, - &prev_stats->ports[port].time[i]); - bintime_sub(&total_dma_bt, - &prev_stats->ports[port].dma_time[i]); - } + for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { + total_bytes += cur_stats->bytes[i]; + total_operations += cur_stats->operations[i]; + total_dmas += cur_stats->dmas[i]; + bintime_add(&total_time_bt, &cur_stats->time[i]); + bintime_add(&total_dma_bt, &cur_stats->dma_time[i]); + if (prev_stats != NULL) { + total_bytes -= prev_stats->bytes[i]; + total_operations -= prev_stats->operations[i]; + total_dmas -= prev_stats->dmas[i]; + bintime_sub(&total_time_bt, &prev_stats->time[i]); + bintime_sub(&total_dma_bt, &prev_stats->dma_time[i]); } } @@ -340,35 +318,25 @@ compute_stats(struct ctlstat_context *ct static const char *iotypes[] = {"NO IO", "READ", "WRITE"}; static void -ctlstat_dump(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; +ctlstat_dump(struct ctlstat_context *ctx) +{ + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - for (lun = 0; lun < ctx->num_luns;lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + for (i = 0; i < ctx->cur_items;i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("lun %d\n", lun); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf(" port %d\n", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf(" io type %d (%s)\n", iotype, - iotypes[iotype]); - printf(" bytes %ju\n", (uintmax_t) - stats[lun].ports[port].bytes[iotype]); - printf(" operations %ju\n", (uintmax_t) - stats[lun].ports[port].operations[iotype]); - PRINT_BINTIME(" io time", - stats[lun].ports[port].time[iotype]); - printf(" num dmas %ju\n", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - PRINT_BINTIME(" dma time", - stats[lun].ports[port].dma_time[iotype]); - } + printf("%s %d\n", F_PORTS(ctx) ? "port" : "lun", stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf(" io type %d (%s)\n", iotype, iotypes[iotype]); + printf(" bytes %ju\n", (uintmax_t) + stats[i].bytes[iotype]); + printf(" operations %ju\n", (uintmax_t) + stats[i].operations[iotype]); + printf(" dmas %ju\n", (uintmax_t) + stats[i].dmas[iotype]); + PRINT_BINTIME(" io time", stats[i].time[iotype]); + PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]); } } } @@ -378,63 +346,49 @@ ctlstat_dump(struct ctlstat_context *ctx (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32)) static void ctlstat_json(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - printf("{\"luns\":["); - for (lun = 0; lun < ctx->num_luns; lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + printf("{\"%s\":[", F_PORTS(ctx) ? "ports" : "luns"); + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("{\"ports\":["); - for (port = 0; port < CTL_MAX_PORTS;port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf("{\"num\":%d,\"io\":[", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf("{\"type\":\"%s\",", iotypes[iotype]); - printf("\"bytes\":%ju,", (uintmax_t)stats[ - lun].ports[port].bytes[iotype]); - printf("\"operations\":%ju,", (uintmax_t)stats[ - lun].ports[port].operations[iotype]); - JSON_BINTIME("io time", - stats[lun].ports[port].time[iotype]); - JSON_BINTIME("dma time", - stats[lun].ports[port].dma_time[iotype]); - printf("\"num dmas\":%ju}", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - if (iotype < (CTL_STATS_NUM_TYPES - 1)) - printf(","); /* continue io array */ - } - printf("]}"); /* close port */ - if (port < (CTL_MAX_PORTS - 1)) - printf(","); /* continue port array */ + printf("{\"num\":%d,\"io\":[", + stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf("{\"type\":\"%s\",", iotypes[iotype]); + printf("\"bytes\":%ju,", (uintmax_t)stats[ + i].bytes[iotype]); + printf("\"operations\":%ju,", (uintmax_t)stats[ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 21:00: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 50C28CC1731; Thu, 26 Jan 2017 21:00:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC44F1A54; Thu, 26 Jan 2017 21:00:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QL0o4O002692; Thu, 26 Jan 2017 21:00:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL0noK002684; Thu, 26 Jan 2017 21:00:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262100.v0QL0noK002684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:00:49 +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: r312841 - in stable/10: sys/cam/ctl usr.bin/ctlstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:00:51 -0000 Author: mav Date: Thu Jan 26 21:00:49 2017 New Revision: 312841 URL: https://svnweb.freebsd.org/changeset/base/312841 Log: MFC r311804: Rewrite CTL statistics in more simple and scalable way. Instead of collecting statistics for each combination of ports and logical units, that consumed ~45KB per LU with present number of ports, collect separate statistics for every port and every logical unit separately, that consume only 176 bytes per each single LU/port. This reduces struct ctl_lun size down to just 6KB. Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should allow handling of very large quantities. Old API is still enabled in stable branches for compatibility reasons. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend.h stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/sys/cam/ctl/ctl_private.h stable/10/usr.bin/ctlstat/ctlstat.8 stable/10/usr.bin/ctlstat/ctlstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -2558,6 +2558,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct thread *td) { struct ctl_softc *softc = dev->si_drv1; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -2769,6 +2770,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, #endif /* CTL_IO_DELAY */ break; } +#ifdef CTL_LEGACY_STATS case CTL_GETSTATS: { struct ctl_stats *stats = (struct ctl_stats *)addr; int i; @@ -2781,26 +2783,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, stats->status = CTL_SS_OK; stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (stats->fill_len + sizeof(lun->stats) > + if (stats->fill_len + sizeof(lun->legacy_stats) > stats->alloc_len) { stats->status = CTL_SS_NEED_MORE_SPACE; break; } - retval = copyout(&lun->stats, &stats->lun_stats[i++], - sizeof(lun->stats)); + retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++], + sizeof(lun->legacy_stats)); if (retval != 0) break; - stats->fill_len += sizeof(lun->stats); + stats->fill_len += sizeof(lun->legacy_stats); } stats->num_luns = softc->num_luns; -#ifdef CTL_TIME_IO - stats->flags = CTL_STATS_FLAG_TIME_VALID; -#else stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; #endif getnanouptime(&stats->timestamp); break; } +#endif /* CTL_LEGACY_STATS */ case CTL_ERROR_INJECT: { struct ctl_error_desc *err_desc, *new_err_desc; @@ -3388,6 +3390,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, ctl_isc_announce_port(port); break; } + case CTL_GET_LUN_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun < stats->first_item) + continue; + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&lun->stats, &stats->stats[i++], + sizeof(lun->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(lun->stats); + } + stats->num_items = softc->num_luns; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } + case CTL_GET_PORT_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port < stats->first_item) + continue; + if (stats->fill_len + sizeof(port->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&port->stats, &stats->stats[i++], + sizeof(port->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(port->stats); + } + stats->num_items = softc->num_ports; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -4382,7 +4450,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, i, lun_malloced; + int lun_number, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) @@ -4604,13 +4672,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_softc->num_luns++; /* Setup statistics gathering */ - lun->stats.device_type = be_lun->lun_type; - lun->stats.lun_number = lun_number; - lun->stats.blocksize = be_lun->blocksize; +#ifdef CTL_LEGACY_STATS + lun->legacy_stats.device_type = be_lun->lun_type; + lun->legacy_stats.lun_number = lun_number; + lun->legacy_stats.blocksize = be_lun->blocksize; if (be_lun->blocksize == 0) - lun->stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; - for (i = 0;i < CTL_MAX_PORTS;i++) - lun->stats.ports[i].targ_port = i; + lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; + for (len = 0; len < CTL_MAX_PORTS; len++) + lun->legacy_stats.ports[len].targ_port = len; +#endif /* CTL_LEGACY_STATS */ + lun->stats.item = lun_number; mtx_unlock(&ctl_softc->ctl_lock); @@ -6676,9 +6747,7 @@ ctl_sap_log_sense_handler(struct ctl_scs { struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; - uint64_t rn, wn, rb, wb; - struct bintime rt, wt; - int i; + struct bintime *t; data = (struct stat_page *)page_index->page_data; @@ -6686,28 +6755,21 @@ ctl_sap_log_sense_handler(struct ctl_scs data->sap.hdr.param_control = SLP_LBIN; data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) - sizeof(struct scsi_log_param_header); - rn = wn = rb = wb = 0; - bintime_clear(&rt); - bintime_clear(&wt); - for (i = 0; i < CTL_MAX_PORTS; i++) { - rn += lun->stats.ports[i].operations[CTL_STATS_READ]; - wn += lun->stats.ports[i].operations[CTL_STATS_WRITE]; - rb += lun->stats.ports[i].bytes[CTL_STATS_READ]; - wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE]; - bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]); - bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]); - } - scsi_u64to8b(rn, data->sap.read_num); - scsi_u64to8b(wn, data->sap.write_num); - if (lun->stats.blocksize > 0) { - scsi_u64to8b(wb / lun->stats.blocksize, - data->sap.recvieved_lba); - scsi_u64to8b(rb / lun->stats.blocksize, - data->sap.transmitted_lba); + scsi_u64to8b(lun->stats.operations[CTL_STATS_READ], + data->sap.read_num); + scsi_u64to8b(lun->stats.operations[CTL_STATS_WRITE], + data->sap.write_num); + if (lun->be_lun->blocksize > 0) { + scsi_u64to8b(lun->stats.bytes[CTL_STATS_WRITE] / + lun->be_lun->blocksize, data->sap.recvieved_lba); + scsi_u64to8b(lun->stats.bytes[CTL_STATS_READ] / + lun->be_lun->blocksize, data->sap.transmitted_lba); } - scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_READ]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.read_int); - scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_WRITE]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.write_int); scsi_u64to8b(0, data->sap.weighted_num); scsi_u64to8b(0, data->sap.weighted_int); @@ -13044,13 +13106,13 @@ static void ctl_process_done(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); + struct ctl_port *port = CTL_PORT(io); struct ctl_lun *lun = CTL_LUN(io); void (*fe_done)(union ctl_io *io); union ctl_ha_msg msg; - uint32_t targ_port = io->io_hdr.nexus.targ_port; CTL_DEBUG_PRINT(("ctl_process_done\n")); - fe_done = softc->ctl_ports[targ_port]->fe_done; + fe_done = port->fe_done; #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { @@ -13153,11 +13215,13 @@ ctl_process_done(union ctl_io *io) */ if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && io->io_hdr.io_type == CTL_IO_SCSI) { -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif int type; +#ifdef CTL_TIME_IO + struct bintime bt; + getbinuptime(&bt); + bintime_sub(&bt, &io->io_hdr.start_bt); +#endif if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) type = CTL_STATS_READ; @@ -13167,18 +13231,38 @@ ctl_process_done(union ctl_io *io) else type = CTL_STATS_NO_IO; - lun->stats.ports[targ_port].bytes[type] += +#ifdef CTL_LEGACY_STATS + uint32_t targ_port = port->targ_port; + lun->legacy_stats.ports[targ_port].bytes[type] += io->scsiio.kern_total_len; - lun->stats.ports[targ_port].operations[type]++; + lun->legacy_stats.ports[targ_port].operations[type] ++; + lun->legacy_stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; #ifdef CTL_TIME_IO - bintime_add(&lun->stats.ports[targ_port].dma_time[type], + bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); + bintime_add(&lun->legacy_stats.ports[targ_port].time[type], + &bt); #endif - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; +#endif /* CTL_LEGACY_STATS */ + + lun->stats.bytes[type] += io->scsiio.kern_total_len; + lun->stats.operations[type] ++; + lun->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&lun->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&lun->stats.time[type], &bt); +#endif + + mtx_lock(&port->port_lock); + port->stats.bytes[type] += io->scsiio.kern_total_len; + port->stats.operations[type] ++; + port->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&port->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&port->stats.time[type], &bt); +#endif + mtx_unlock(&port->port_lock); } /* Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_backend.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,54 +40,7 @@ #ifndef _CTL_BACKEND_H_ #define _CTL_BACKEND_H_ -/* - * XXX KDM move this to another header file? - */ -#define CTL_BE_NAME_LEN 32 - -/* - * The ID_REQ flag is used to say that the caller has requested a - * particular LUN ID in the req_lun_id field. If we cannot allocate that - * LUN ID, the ctl_add_lun() call will fail. - * - * The STOPPED flag tells us that the LUN should default to the powered - * off state. It will return 0x04,0x02 until it is powered up. ("Logical - * unit not ready, initializing command required.") - * - * The NO_MEDIA flag tells us that the LUN has no media inserted. - * - * The PRIMARY flag tells us that this LUN is registered as a Primary LUN - * which is accessible via the Master shelf controller in an HA. This flag - * being set indicates a Primary LUN. This flag being reset represents a - * Secondary LUN controlled by the Secondary controller in an HA - * configuration. Flag is applicable at this time to T_DIRECT types. - * - * The SERIAL_NUM flag tells us that the serial_num field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x80. - * - * The DEVID flag tells us that the device_id field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x83. - * - * The DEV_TYPE flag tells us that the device_type field is filled in. - * - * The EJECTED flag tells us that the removable LUN has tray open. - * - * The UNMAP flag tells us that this LUN supports UNMAP. - * - * The OFFLINE flag tells us that this LUN can not access backing store. - */ -typedef enum { - CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_STOPPED = 0x02, - CTL_LUN_FLAG_NO_MEDIA = 0x04, - CTL_LUN_FLAG_PRIMARY = 0x08, - CTL_LUN_FLAG_SERIAL_NUM = 0x10, - CTL_LUN_FLAG_DEVID = 0x20, - CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_EJECTED = 0x100, - CTL_LUN_FLAG_READONLY = 0x200 -} ctl_backend_lun_flags; +#include typedef enum { CTL_LUN_SERSEQ_OFF, Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,13 +193,14 @@ error: mtx_unlock(&softc->ctl_lock); return (retval); } + port->targ_port = port_num; port->ctl_pool_ref = pool; - if (port->options.stqh_first == NULL) STAILQ_INIT(&port->options); + port->stats.item = port_num; + mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF); mtx_lock(&softc->ctl_lock); - port->targ_port = port_num; STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); for (tport = NULL, nport = STAILQ_FIRST(&softc->port_list); nport != NULL && nport->targ_port < port_num; @@ -218,17 +220,11 @@ int ctl_port_deregister(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; - struct ctl_io_pool *pool; - int retval, i; - - retval = 0; - - pool = (struct ctl_io_pool *)port->ctl_pool_ref; + struct ctl_io_pool *pool = (struct ctl_io_pool *)port->ctl_pool_ref; + int i; - if (port->targ_port == -1) { - retval = 1; - goto bailout; - } + if (port->targ_port == -1) + return (1); mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->port_list, port, ctl_port, links); @@ -251,9 +247,9 @@ ctl_port_deregister(struct ctl_port *por for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); + mtx_destroy(&port->port_lock); -bailout: - return (retval); + return (0); } void Modified: stable/10/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_frontend.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +40,8 @@ #ifndef _CTL_FRONTEND_H_ #define _CTL_FRONTEND_H_ +#include + typedef enum { CTL_PORT_STATUS_NONE = 0x00, CTL_PORT_STATUS_ONLINE = 0x01, @@ -243,6 +246,8 @@ struct ctl_port { struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ struct ctl_devid *init_devid; /* passed to CTL */ + struct ctl_io_stats stats; /* used by CTL */ + struct mtx port_lock; /* used by CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2011 Spectra Logic Corporation + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +81,9 @@ /* Hopefully this won't conflict with new misc devices that pop up */ #define CTL_MINOR 225 +/* Legacy statistics accumulated for every port for every LU. */ +#define CTL_LEGACY_STATS 1 + typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -117,6 +121,18 @@ typedef enum { #define CTL_STATS_NUM_TYPES 3 typedef enum { + CTL_SS_OK, + CTL_SS_NEED_MORE_SPACE, + CTL_SS_ERROR +} ctl_stats_status; + +typedef enum { + CTL_STATS_FLAG_NONE = 0x00, + CTL_STATS_FLAG_TIME_VALID = 0x01 +} ctl_stats_flags; + +#ifdef CTL_LEGACY_STATS +typedef enum { CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 } ctl_lun_stats_flags; @@ -137,17 +153,6 @@ struct ctl_lun_io_stats { struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; -typedef enum { - CTL_SS_OK, - CTL_SS_NEED_MORE_SPACE, - CTL_SS_ERROR -} ctl_stats_status; - -typedef enum { - CTL_STATS_FLAG_NONE = 0x00, - CTL_STATS_FLAG_TIME_VALID = 0x01 -} ctl_stats_flags; - struct ctl_stats { int alloc_len; /* passed to kernel */ struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ @@ -157,6 +162,27 @@ struct ctl_stats { ctl_stats_flags flags; /* passed to userland */ struct timespec timestamp; /* passed to userland */ }; +#endif /* CTL_LEGACY_STATS */ + +struct ctl_io_stats { + uint32_t item; + uint64_t bytes[CTL_STATS_NUM_TYPES]; + uint64_t operations[CTL_STATS_NUM_TYPES]; + uint64_t dmas[CTL_STATS_NUM_TYPES]; + struct bintime time[CTL_STATS_NUM_TYPES]; + struct bintime dma_time[CTL_STATS_NUM_TYPES]; +}; + +struct ctl_get_io_stats { + struct ctl_io_stats *stats; /* passed to/from kernel */ + size_t alloc_len; /* passed to kernel */ + size_t fill_len; /* passed to userland */ + int first_item; /* passed to kernel */ + int num_items; /* passed to userland */ + ctl_stats_status status; /* passed to userland */ + ctl_stats_flags flags; /* passed to userland */ + struct timespec timestamp; /* passed to userland */ +}; /* * The types of errors that can be injected: @@ -342,12 +368,54 @@ typedef enum { CTL_LUNREQ_MODIFY, } ctl_lunreq_type; +/* + * The ID_REQ flag is used to say that the caller has requested a + * particular LUN ID in the req_lun_id field. If we cannot allocate that + * LUN ID, the ctl_add_lun() call will fail. + * + * The STOPPED flag tells us that the LUN should default to the powered + * off state. It will return 0x04,0x02 until it is powered up. ("Logical + * unit not ready, initializing command required.") + * + * The NO_MEDIA flag tells us that the LUN has no media inserted. + * + * The PRIMARY flag tells us that this LUN is registered as a Primary LUN + * which is accessible via the Master shelf controller in an HA. This flag + * being set indicates a Primary LUN. This flag being reset represents a + * Secondary LUN controlled by the Secondary controller in an HA + * configuration. Flag is applicable at this time to T_DIRECT types. + * + * The SERIAL_NUM flag tells us that the serial_num field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x80. + * + * The DEVID flag tells us that the device_id field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x83. + * + * The DEV_TYPE flag tells us that the device_type field is filled in. + * + * The EJECTED flag tells us that the removable LUN has tray open. + * + * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. + */ +typedef enum { + CTL_LUN_FLAG_ID_REQ = 0x01, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, + CTL_LUN_FLAG_PRIMARY = 0x08, + CTL_LUN_FLAG_SERIAL_NUM = 0x10, + CTL_LUN_FLAG_DEVID = 0x20, + CTL_LUN_FLAG_DEV_TYPE = 0x40, + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_EJECTED = 0x100, + CTL_LUN_FLAG_READONLY = 0x200 +} ctl_backend_lun_flags; /* * LUN creation parameters: * - * flags: Various LUN flags, see ctl_backend.h for a - * description of the flag values and meanings. + * flags: Various LUN flags, see above. * * device_type: The SCSI device type. e.g. 0 for Direct Access, * 3 for Processor, etc. Only certain backends may @@ -465,6 +533,7 @@ union ctl_lunreq_data { * kern_be_args: For kernel use only. */ struct ctl_lun_req { +#define CTL_BE_NAME_LEN 32 char backend[CTL_BE_NAME_LEN]; ctl_lunreq_type reqtype; union ctl_lunreq_data reqdata; @@ -761,6 +830,8 @@ struct ctl_lun_map { #define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) #define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map) +#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats) +#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats) #endif /* _CTL_IOCTL_H_ */ Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 26 21:00:49 2017 (r312841) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -404,7 +404,10 @@ struct ctl_lun { struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; - struct ctl_lun_io_stats stats; +#ifdef CTL_LEGACY_STATS + struct ctl_lun_io_stats legacy_stats; +#endif /* CTL_LEGACY_STATS */ + struct ctl_io_stats stats; uint32_t res_idx; uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; Modified: stable/10/usr.bin/ctlstat/ctlstat.8 ============================================================================== --- stable/10/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/usr.bin/ctlstat/ctlstat.8 Thu Jan 26 21:00:49 2017 (r312841) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $ .\" $FreeBSD$ .\" -.Dd September 21, 2015 +.Dd January 9, 2017 .Dt CTLSTAT 8 .Os .Sh NAME @@ -118,5 +118,6 @@ every 10 seconds. .Xr ctld 8 , .Xr iostat 8 .Sh AUTHORS -.An Ken Merry Aq ken@FreeBSD.org -.An Will Andrews Aq will@FreeBSD.org +.An Ken Merry Aq Mt ken@FreeBSD.org +.An Will Andrews Aq Mt will@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org Modified: stable/10/usr.bin/ctlstat/ctlstat.c ============================================================================== --- stable/10/usr.bin/ctlstat/ctlstat.c Thu Jan 26 20:59:36 2017 (r312840) +++ stable/10/usr.bin/ctlstat/ctlstat.c Thu Jan 26 21:00:49 2017 (r312841) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp. + * Copyright (c) 2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,17 +67,17 @@ __FBSDID("$FreeBSD$"); #include /* - * The default amount of space we allocate for LUN storage space. We - * dynamically allocate more if needed. + * The default amount of space we allocate for stats storage space. + * We dynamically allocate more if needed. */ -#define CTL_STAT_NUM_LUNS 30 +#define CTL_STAT_NUM_ITEMS 256 /* * The default number of LUN selection bits we allocate. This is large * because we don't currently increase it if the user specifies a LUN * number of 1024 or larger. */ -#define CTL_STAT_LUN_BITS 1024L +#define CTL_STAT_BITS 1024L static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:"; static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]" @@ -101,31 +102,32 @@ typedef enum { #define CTLSTAT_FLAG_FIRST_RUN (1 << 2) #define CTLSTAT_FLAG_TOTALS (1 << 3) #define CTLSTAT_FLAG_DMA_TIME (1 << 4) -#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5) -#define CTLSTAT_FLAG_LUN_MASK (1 << 6) -#define CTLSTAT_FLAG_PORT_MASK (1 << 7) +#define CTLSTAT_FLAG_TIME_VALID (1 << 5) +#define CTLSTAT_FLAG_MASK (1 << 6) +#define CTLSTAT_FLAG_LUNS (1 << 7) +#define CTLSTAT_FLAG_PORTS (1 << 8) #define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU) #define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER) #define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN) #define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS) #define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME) -#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID) -#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK) -#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK) +#define F_TIMEVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_TIME_VALID) +#define F_MASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_MASK) +#define F_LUNS(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUNS) +#define F_PORTS(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORTS) struct ctlstat_context { ctlstat_mode_types mode; int flags; - struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats, - *tmp_lun_stats; - struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3]; + struct ctl_io_stats *cur_stats, *prev_stats; + struct ctl_io_stats cur_total_stats[3], prev_total_stats[3]; struct timespec cur_time, prev_time; struct ctl_cpu_stats cur_cpu, prev_cpu; uint64_t cur_total_jiffies, prev_total_jiffies; uint64_t cur_idle, prev_idle; - bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS); - bitstr_t bit_decl(port_mask, CTL_MAX_PORTS); - int num_luns; + bitstr_t bit_decl(item_mask, CTL_STAT_BITS); + int cur_items, prev_items; + int cur_alloc, prev_alloc; int numdevs; int header_interval; }; @@ -135,12 +137,11 @@ struct ctlstat_context { #endif static void usage(int error); -static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, - struct timespec *cur_time, int *lun_time_valid); +static int getstats(int fd, int *alloc_items, int *num_items, + struct ctl_io_stats **xstats, struct timespec *cur_time, int *time_valid); static int getcpu(struct ctl_cpu_stats *cpu_stats); -static void compute_stats(struct ctlstat_context *ctx, - struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, +static void compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, @@ -155,64 +156,55 @@ usage(int error) } static int -getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, +getstats(int fd, int *alloc_items, int *num_items, struct ctl_io_stats **stats, struct timespec *cur_time, int *flags) { - struct ctl_lun_io_stats *lun_stats; - struct ctl_stats stats; - int more_space_count; + struct ctl_get_io_stats get_stats; + int more_space_count = 0; - more_space_count = 0; - - if (*num_luns == 0) - *num_luns = CTL_STAT_NUM_LUNS; - - lun_stats = *xlun_stats; + if (*alloc_items == 0) + *alloc_items = CTL_STAT_NUM_ITEMS; retry: + if (*stats == NULL) + *stats = malloc(sizeof(**stats) * *alloc_items); - if (lun_stats == NULL) { - lun_stats = (struct ctl_lun_io_stats *)malloc( - sizeof(*lun_stats) * *num_luns); - } - - memset(&stats, 0, sizeof(stats)); - stats.alloc_len = *num_luns * sizeof(*lun_stats); - memset(lun_stats, 0, stats.alloc_len); - stats.lun_stats = lun_stats; - - if (ioctl(fd, CTL_GETSTATS, &stats) == -1) - err(1, "error returned from CTL_GETSTATS ioctl"); + memset(&get_stats, 0, sizeof(get_stats)); + get_stats.alloc_len = *alloc_items * sizeof(**stats); + memset(*stats, 0, get_stats.alloc_len); + get_stats.stats = *stats; + + if (ioctl(fd, (*flags & CTLSTAT_FLAG_PORTS) ? CTL_GET_PORT_STATS : + CTL_GET_LUN_STATS, &get_stats) == -1) + err(1, "CTL_GET_*_STATS ioctl returned error"); - switch (stats.status) { + switch (get_stats.status) { case CTL_SS_OK: break; case CTL_SS_ERROR: - err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl"); + err(1, "CTL_GET_*_STATS ioctl returned CTL_SS_ERROR"); break; case CTL_SS_NEED_MORE_SPACE: - if (more_space_count > 0) { - errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again"); - } - *num_luns = stats.num_luns; - free(lun_stats); - lun_stats = NULL; + if (more_space_count >= 2) + errx(1, "CTL_GET_*_STATS returned NEED_MORE_SPACE again"); + *alloc_items = get_stats.num_items * 5 / 4; + free(*stats); + *stats = NULL; more_space_count++; goto retry; break; /* NOTREACHED */ default: - errx(1, "unknown status %d returned from CTL_GETSTATS ioctl", - stats.status); + errx(1, "CTL_GET_*_STATS ioctl returned unknown status %d", + get_stats.status); break; } - *xlun_stats = lun_stats; - *num_luns = stats.num_luns; - cur_time->tv_sec = stats.timestamp.tv_sec; - cur_time->tv_nsec = stats.timestamp.tv_nsec; - if (stats.flags & CTL_STATS_FLAG_TIME_VALID) - *flags |= CTLSTAT_FLAG_LUN_TIME_VALID; + *num_items = get_stats.fill_len / sizeof(**stats); + cur_time->tv_sec = get_stats.timestamp.tv_sec; + cur_time->tv_nsec = get_stats.timestamp.tv_nsec; + if (get_stats.flags & CTL_STATS_FLAG_TIME_VALID) + *flags |= CTLSTAT_FLAG_TIME_VALID; else - *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID; + *flags &= ~CTLSTAT_FLAG_TIME_VALID; return (0); } @@ -240,14 +232,13 @@ getcpu(struct ctl_cpu_stats *cpu_stats) } static void -compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, long double etime, +compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, long double *ms_per_transfer, long double *ms_per_dma, long double *dmas_per_second) { uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0; - uint32_t port; struct bintime total_time_bt, total_dma_bt; struct timespec total_time_ts, total_dma_ts; int i; @@ -256,31 +247,18 @@ compute_stats(struct ctlstat_context *ct bzero(&total_dma_bt, sizeof(total_dma_bt)); bzero(&total_time_ts, sizeof(total_time_ts)); bzero(&total_dma_ts, sizeof(total_dma_ts)); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { - total_bytes += cur_stats->ports[port].bytes[i]; - total_operations += - cur_stats->ports[port].operations[i]; - total_dmas += cur_stats->ports[port].num_dmas[i]; - bintime_add(&total_time_bt, - &cur_stats->ports[port].time[i]); - bintime_add(&total_dma_bt, - &cur_stats->ports[port].dma_time[i]); - if (prev_stats != NULL) { - total_bytes -= - prev_stats->ports[port].bytes[i]; - total_operations -= - prev_stats->ports[port].operations[i]; - total_dmas -= - prev_stats->ports[port].num_dmas[i]; - bintime_sub(&total_time_bt, - &prev_stats->ports[port].time[i]); - bintime_sub(&total_dma_bt, - &prev_stats->ports[port].dma_time[i]); - } + for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { + total_bytes += cur_stats->bytes[i]; + total_operations += cur_stats->operations[i]; + total_dmas += cur_stats->dmas[i]; + bintime_add(&total_time_bt, &cur_stats->time[i]); + bintime_add(&total_dma_bt, &cur_stats->dma_time[i]); + if (prev_stats != NULL) { + total_bytes -= prev_stats->bytes[i]; + total_operations -= prev_stats->operations[i]; + total_dmas -= prev_stats->dmas[i]; + bintime_sub(&total_time_bt, &prev_stats->time[i]); + bintime_sub(&total_dma_bt, &prev_stats->dma_time[i]); } } @@ -340,35 +318,25 @@ compute_stats(struct ctlstat_context *ct static const char *iotypes[] = {"NO IO", "READ", "WRITE"}; static void -ctlstat_dump(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; +ctlstat_dump(struct ctlstat_context *ctx) +{ + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - for (lun = 0; lun < ctx->num_luns;lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + for (i = 0; i < ctx->cur_items;i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("lun %d\n", lun); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf(" port %d\n", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf(" io type %d (%s)\n", iotype, - iotypes[iotype]); - printf(" bytes %ju\n", (uintmax_t) - stats[lun].ports[port].bytes[iotype]); - printf(" operations %ju\n", (uintmax_t) - stats[lun].ports[port].operations[iotype]); - PRINT_BINTIME(" io time", - stats[lun].ports[port].time[iotype]); - printf(" num dmas %ju\n", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - PRINT_BINTIME(" dma time", - stats[lun].ports[port].dma_time[iotype]); - } + printf("%s %d\n", F_PORTS(ctx) ? "port" : "lun", stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf(" io type %d (%s)\n", iotype, iotypes[iotype]); + printf(" bytes %ju\n", (uintmax_t) + stats[i].bytes[iotype]); + printf(" operations %ju\n", (uintmax_t) + stats[i].operations[iotype]); + printf(" dmas %ju\n", (uintmax_t) + stats[i].dmas[iotype]); + PRINT_BINTIME(" io time", stats[i].time[iotype]); + PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]); } } } @@ -378,63 +346,49 @@ ctlstat_dump(struct ctlstat_context *ctx (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32)) static void ctlstat_json(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - printf("{\"luns\":["); - for (lun = 0; lun < ctx->num_luns; lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + printf("{\"%s\":[", F_PORTS(ctx) ? "ports" : "luns"); + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("{\"ports\":["); - for (port = 0; port < CTL_MAX_PORTS;port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf("{\"num\":%d,\"io\":[", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf("{\"type\":\"%s\",", iotypes[iotype]); - printf("\"bytes\":%ju,", (uintmax_t)stats[ - lun].ports[port].bytes[iotype]); - printf("\"operations\":%ju,", (uintmax_t)stats[ - lun].ports[port].operations[iotype]); - JSON_BINTIME("io time", - stats[lun].ports[port].time[iotype]); - JSON_BINTIME("dma time", - stats[lun].ports[port].dma_time[iotype]); - printf("\"num dmas\":%ju}", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - if (iotype < (CTL_STATS_NUM_TYPES - 1)) - printf(","); /* continue io array */ - } - printf("]}"); /* close port */ - if (port < (CTL_MAX_PORTS - 1)) - printf(","); /* continue port array */ + printf("{\"num\":%d,\"io\":[", + stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 26 21:01: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 CD061CC17C7; Thu, 26 Jan 2017 21:01:39 +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 8006A1D80; Thu, 26 Jan 2017 21:01: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 v0QL1cpG006457; Thu, 26 Jan 2017 21:01:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL1cKb006456; Thu, 26 Jan 2017 21:01:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262101.v0QL1cKb006456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:01: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: r312842 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:01:39 -0000 Author: mav Date: Thu Jan 26 21:01:38 2017 New Revision: 312842 URL: https://svnweb.freebsd.org/changeset/base/312842 Log: MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:00:49 2017 (r312841) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017 (r312842) @@ -4593,6 +4593,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft printf("ctl: requested LUN ID %d is already " "in use\n", be_lun->req_lun_id); } +fail: + free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); be_lun->lun_config_status(be_lun->be_lun, @@ -4605,14 +4607,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (lun_number == -1) { mtx_unlock(&ctl_softc->ctl_lock); printf("ctl: can't allocate LUN, out of LUNs\n"); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - return (ENOSPC); + goto fail; } } ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number); + mtx_unlock(&ctl_softc->ctl_lock); mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF); lun->lun = lun_number; @@ -4664,22 +4663,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_init_page_index(lun); ctl_init_log_page_index(lun); - /* - * Now, before we insert this lun on the lun list, set the lun - * inventory changed UA for all other luns. - */ - STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { - mtx_lock(&nlun->lun_lock); - ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); - mtx_unlock(&nlun->lun_lock); - } - - STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); - - ctl_softc->ctl_luns[lun_number] = lun; - - ctl_softc->num_luns++; - /* Setup statistics gathering */ #ifdef CTL_LEGACY_STATS lun->legacy_stats.device_type = be_lun->lun_type; @@ -4692,6 +4675,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft #endif /* CTL_LEGACY_STATS */ lun->stats.item = lun_number; + /* + * Now, before we insert this lun on the lun list, set the lun + * inventory changed UA for all other luns. + */ + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { + mtx_lock(&nlun->lun_lock); + ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); + mtx_unlock(&nlun->lun_lock); + } + STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); + ctl_softc->ctl_luns[lun_number] = lun; + ctl_softc->num_luns++; mtx_unlock(&ctl_softc->ctl_lock); lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK); From owner-svn-src-all@freebsd.org Thu Jan 26 21:02: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 394B9CC1984; Thu, 26 Jan 2017 21:02: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 E05211F34; Thu, 26 Jan 2017 21:02: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 v0QL263w006530; Thu, 26 Jan 2017 21:02:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL26CW006529; Thu, 26 Jan 2017 21:02:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262102.v0QL26CW006529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:02:06 +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: r312843 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:02:08 -0000 Author: mav Date: Thu Jan 26 21:02:06 2017 New Revision: 312843 URL: https://svnweb.freebsd.org/changeset/base/312843 Log: MFC r311873: Fix malloc(M_WAITOK) under mutex, introduced at r311787. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:01:38 2017 (r312842) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 26 21:02:06 2017 (r312843) @@ -4584,6 +4584,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft printf("ctl: requested LUN ID %d is already " "in use\n", be_lun->req_lun_id); } +fail: + free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); be_lun->lun_config_status(be_lun->be_lun, @@ -4596,14 +4598,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (lun_number == -1) { mtx_unlock(&ctl_softc->ctl_lock); printf("ctl: can't allocate LUN, out of LUNs\n"); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - return (ENOSPC); + goto fail; } } ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number); + mtx_unlock(&ctl_softc->ctl_lock); mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF); lun->lun = lun_number; @@ -4655,22 +4654,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft ctl_init_page_index(lun); ctl_init_log_page_index(lun); - /* - * Now, before we insert this lun on the lun list, set the lun - * inventory changed UA for all other luns. - */ - STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { - mtx_lock(&nlun->lun_lock); - ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); - mtx_unlock(&nlun->lun_lock); - } - - STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); - - ctl_softc->ctl_luns[lun_number] = lun; - - ctl_softc->num_luns++; - /* Setup statistics gathering */ #ifdef CTL_LEGACY_STATS lun->legacy_stats.device_type = be_lun->lun_type; @@ -4683,6 +4666,19 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft #endif /* CTL_LEGACY_STATS */ lun->stats.item = lun_number; + /* + * Now, before we insert this lun on the lun list, set the lun + * inventory changed UA for all other luns. + */ + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { + mtx_lock(&nlun->lun_lock); + ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); + mtx_unlock(&nlun->lun_lock); + } + STAILQ_INSERT_TAIL(&ctl_softc->lun_list, lun, links); + ctl_softc->ctl_luns[lun_number] = lun; + ctl_softc->num_luns++; mtx_unlock(&ctl_softc->ctl_lock); lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK); From owner-svn-src-all@freebsd.org Thu Jan 26 21:07: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 A0030CC1AF4; Thu, 26 Jan 2017 21:07:01 +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 5E18C29C; Thu, 26 Jan 2017 21:07:01 +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 v0QL70Gm006760; Thu, 26 Jan 2017 21:07:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL6xq2006751; Thu, 26 Jan 2017 21:06:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262106.v0QL6xq2006751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:06: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: r312844 - in stable/11/sys/cam: . ctl scsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:07:01 -0000 Author: mav Date: Thu Jan 26 21:06:59 2017 New Revision: 312844 URL: https://svnweb.freebsd.org/changeset/base/312844 Log: MFC r312026: Improve CAM_CDB_POINTER support. Modified: stable/11/sys/cam/cam_ccb.h stable/11/sys/cam/cam_periph.c stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/scsi_ctl.c stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_ccb.h ============================================================================== --- stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017 (r312844) @@ -780,6 +780,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/cam_periph.c Thu Jan 26 21:06:59 2017 (r312844) @@ -1925,10 +1925,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:06:59 2017 (r312844) @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:06:59 2017 (r312844) @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:02:06 2017 (r312843) +++ stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:06:59 2017 (r312844) @@ -3617,15 +3617,9 @@ scsi_command_string(struct cam_device *d #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5030,7 +5024,6 @@ scsi_sense_sbuf(struct cam_device *devic struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5128,14 +5121,9 @@ scsi_sense_sbuf(struct cam_device *devic sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ From owner-svn-src-all@freebsd.org Thu Jan 26 21:07: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 3E3DCCC1C1D; Thu, 26 Jan 2017 21:07: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 F05B46A9; Thu, 26 Jan 2017 21:07: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 v0QL7leU006845; Thu, 26 Jan 2017 21:07:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL7ksv006840; Thu, 26 Jan 2017 21:07:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262107.v0QL7ksv006840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:07: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: r312845 - in stable/10/sys/cam: . ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:07:48 -0000 Author: mav Date: Thu Jan 26 21:07:46 2017 New Revision: 312845 URL: https://svnweb.freebsd.org/changeset/base/312845 Log: MFC r312026: Improve CAM_CDB_POINTER support. Modified: stable/10/sys/cam/cam_ccb.h stable/10/sys/cam/cam_periph.c stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_all.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_ccb.h ============================================================================== --- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:07:46 2017 (r312845) @@ -760,6 +760,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; Modified: stable/10/sys/cam/cam_periph.c ============================================================================== --- stable/10/sys/cam/cam_periph.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/cam_periph.c Thu Jan 26 21:07:46 2017 (r312845) @@ -1909,10 +1909,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:07:46 2017 (r312845) @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:07:46 2017 (r312845) @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Thu Jan 26 21:06:59 2017 (r312844) +++ stable/10/sys/cam/scsi/scsi_all.c Thu Jan 26 21:07:46 2017 (r312845) @@ -3616,15 +3616,9 @@ scsi_command_string(struct cam_device *d #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5029,7 +5023,6 @@ scsi_sense_sbuf(struct cam_device *devic struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5127,14 +5120,9 @@ scsi_sense_sbuf(struct cam_device *devic sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ From owner-svn-src-all@freebsd.org Thu Jan 26 21:08: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 1E8B5CC1CC8; Thu, 26 Jan 2017 21:08: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 DF4BA86C; Thu, 26 Jan 2017 21:08: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 v0QL8Raw006927; Thu, 26 Jan 2017 21:08:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL8RAE006925; Thu, 26 Jan 2017 21:08:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262108.v0QL8RAE006925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:08: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: r312846 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:08:29 -0000 Author: mav Date: Thu Jan 26 21:08:27 2017 New Revision: 312846 URL: https://svnweb.freebsd.org/changeset/base/312846 Log: MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io(). Modified: stable/11/sys/cam/ctl/ctl_util.c stable/11/sys/cam/ctl/ctl_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_util.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_util.c Thu Jan 26 21:07:46 2017 (r312845) +++ stable/11/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:27 2017 (r312846) @@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io) free(io); } -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io) { @@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io) return; pool_ref = io->io_hdr.pool; - memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; } +#endif /* !_KERNEL */ const char * ctl_scsi_task_string(struct ctl_taskio *taskio) Modified: stable/11/sys/cam/ctl/ctl_util.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_util.h Thu Jan 26 21:07:46 2017 (r312845) +++ stable/11/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:27 2017 (r312846) @@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i #ifndef _KERNEL union ctl_io *ctl_scsi_alloc_io(uint32_t initid); void ctl_scsi_free_io(union ctl_io *io); -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); +#else +#define ctl_scsi_zero_io(io) ctl_zero_io(io) +#endif /* !_KERNEL */ const char *ctl_scsi_task_string(struct ctl_taskio *taskio); void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb); void ctl_io_error_sbuf(union ctl_io *io, From owner-svn-src-all@freebsd.org Thu Jan 26 21:08: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 D9410CC1D4C; Thu, 26 Jan 2017 21:08: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 A34819AF; Thu, 26 Jan 2017 21:08: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 v0QL8wn7007001; Thu, 26 Jan 2017 21:08:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QL8wFt006999; Thu, 26 Jan 2017 21:08:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262108.v0QL8wFt006999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:08:58 +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: r312847 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:09:00 -0000 Author: mav Date: Thu Jan 26 21:08:58 2017 New Revision: 312847 URL: https://svnweb.freebsd.org/changeset/base/312847 Log: MFC r312231: When in kernel, map ctl_scsi_zero_io() to ctl_zero_io(). Modified: stable/10/sys/cam/ctl/ctl_util.c stable/10/sys/cam/ctl/ctl_util.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_util.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:27 2017 (r312846) +++ stable/10/sys/cam/ctl/ctl_util.c Thu Jan 26 21:08:58 2017 (r312847) @@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io) free(io); } -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io) { @@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io) return; pool_ref = io->io_hdr.pool; - memset(io, 0, sizeof(*io)); - io->io_hdr.pool = pool_ref; } +#endif /* !_KERNEL */ const char * ctl_scsi_task_string(struct ctl_taskio *taskio) Modified: stable/10/sys/cam/ctl/ctl_util.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:27 2017 (r312846) +++ stable/10/sys/cam/ctl/ctl_util.h Thu Jan 26 21:08:58 2017 (r312847) @@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i #ifndef _KERNEL union ctl_io *ctl_scsi_alloc_io(uint32_t initid); void ctl_scsi_free_io(union ctl_io *io); -#endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); +#else +#define ctl_scsi_zero_io(io) ctl_zero_io(io) +#endif /* !_KERNEL */ const char *ctl_scsi_task_string(struct ctl_taskio *taskio); void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb); void ctl_io_error_sbuf(union ctl_io *io, From owner-svn-src-all@freebsd.org Thu Jan 26 21:21: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 E8D60CC22C5; Thu, 26 Jan 2017 21:21:27 +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 A708E7A; Thu, 26 Jan 2017 21:21:27 +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 v0QLLQWQ014141; Thu, 26 Jan 2017 21:21:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLLQh8014139; Thu, 26 Jan 2017 21:21:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262121.v0QLLQh8014139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:21:26 +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: r312848 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:21:28 -0000 Author: mav Date: Thu Jan 26 21:21:26 2017 New Revision: 312848 URL: https://svnweb.freebsd.org/changeset/base/312848 Log: MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends. Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:08:58 2017 (r312847) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:26 2017 (r312848) @@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io) int ctl_watermark, cam_watermark; int i, j; - - cam_sg_offset = 0; - cam_sg_start = 0; - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; /* @@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io) cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; cam_sg_count = ccb->csio.sglist_cnt; + cam_sg_start = cam_sg_count; + cam_sg_offset = 0; for (i = 0, len_seen = 0; i < cam_sg_count; i++) { if ((len_seen + cam_sglist[i].ds_len) >= @@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io) io->scsiio.ext_data_filled += len_copied; + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < ctl_sg_count) { + io->io_hdr.port_status = 43; + } else + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; io->io_hdr.flags |= CTL_FLAG_STATUS_SENT; + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(ccb); @@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io) /* * Translate CTL status to CAM status. */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; + } ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (io->io_hdr.status & CTL_STATUS_MASK) { case CTL_SUCCESS: Modified: stable/11/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:08:58 2017 (r312847) +++ stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:26 2017 (r312848) @@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int ext_sglist_malloced; int i, j; - ext_sglist_malloced = 0; - ext_sg_start = 0; - ext_offset = 0; - CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n")); /* * If this flag is set, fake the data transfer. */ if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) { + ext_sglist_malloced = 0; ctsio->ext_data_filled = ctsio->ext_data_len; goto bailout; } @@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int len_seen; ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist); - ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); ext_sglist_malloced = 1; @@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio goto bailout; } ext_sg_entries = ctsio->ext_sg_entries; + ext_sg_start = ext_sg_entries; + ext_offset = 0; len_seen = 0; for (i = 0; i < ext_sg_entries; i++) { if ((len_seen + ext_sglist[i].len) >= @@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio } } else { ext_sglist = &ext_entry; + ext_sglist_malloced = 0; ext_sglist->addr = ctsio->ext_data_ptr; ext_sglist->len = ctsio->ext_data_len; ext_sg_entries = 1; @@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_sg_entries = 1; } - kern_watermark = 0; ext_watermark = ext_offset; len_copied = 0; @@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio "kern_data_len = %d\n", ctsio->ext_data_len, ctsio->kern_data_len)); + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < kern_sg_entries) { + ctsio->io_hdr.port_status = 43; + } - /* XXX KDM set residual?? */ bailout: - if (ext_sglist_malloced != 0) free(ext_sglist, M_CTL); @@ -397,7 +401,7 @@ ctl_ioctl_io(struct cdev *dev, u_long cm struct thread *td) { union ctl_io *io; - void *pool_tmp; + void *pool_tmp, *sc_tmp; int retval = 0; /* @@ -414,8 +418,10 @@ ctl_ioctl_io(struct cdev *dev, u_long cm * spammed by the user's ctl_io. */ pool_tmp = io->io_hdr.pool; + sc_tmp = CTL_SOFTC(io); memcpy(io, (void *)addr, sizeof(*io)); io->io_hdr.pool = pool_tmp; + CTL_SOFTC(io) = sc_tmp; /* * No status yet, so make sure the status is set properly. From owner-svn-src-all@freebsd.org Thu Jan 26 21:22: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 4E26ECC235E; Thu, 26 Jan 2017 21:22:01 +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 0DBBC303; Thu, 26 Jan 2017 21:22:00 +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 v0QLM0mQ014899; Thu, 26 Jan 2017 21:22:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLLxB4014875; Thu, 26 Jan 2017 21:21:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262121.v0QLLxB4014875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:21:59 +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: r312849 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:22:01 -0000 Author: mav Date: Thu Jan 26 21:21:59 2017 New Revision: 312849 URL: https://svnweb.freebsd.org/changeset/base/312849 Log: MFC r312232: Add under-/overrun support to IOCTL and CAM SIM frontends. Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:26 2017 (r312848) +++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:21:59 2017 (r312849) @@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io) int ctl_watermark, cam_watermark; int i, j; - - cam_sg_offset = 0; - cam_sg_start = 0; - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; /* @@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io) cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; cam_sg_count = ccb->csio.sglist_cnt; + cam_sg_start = cam_sg_count; + cam_sg_offset = 0; for (i = 0, len_seen = 0; i < cam_sg_count; i++) { if ((len_seen + cam_sglist[i].ds_len) >= @@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io) io->scsiio.ext_data_filled += len_copied; + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < ctl_sg_count) { + io->io_hdr.port_status = 43; + } else + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; io->io_hdr.flags |= CTL_FLAG_STATUS_SENT; + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; ccb->ccb_h.status &= ~CAM_STATUS_MASK; ccb->ccb_h.status |= CAM_REQ_CMP; xpt_done(ccb); @@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io) /* * Translate CTL status to CAM status. */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + ccb->csio.resid = ccb->csio.dxfer_len - + io->scsiio.ext_data_filled; + } ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (io->io_hdr.status & CTL_STATUS_MASK) { case CTL_SUCCESS: Modified: stable/10/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:26 2017 (r312848) +++ stable/10/sys/cam/ctl/ctl_frontend_ioctl.c Thu Jan 26 21:21:59 2017 (r312849) @@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int ext_sglist_malloced; int i, j; - ext_sglist_malloced = 0; - ext_sg_start = 0; - ext_offset = 0; - CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n")); /* * If this flag is set, fake the data transfer. */ if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) { + ext_sglist_malloced = 0; ctsio->ext_data_filled = ctsio->ext_data_len; goto bailout; } @@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio int len_seen; ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist); - ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); ext_sglist_malloced = 1; @@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio goto bailout; } ext_sg_entries = ctsio->ext_sg_entries; + ext_sg_start = ext_sg_entries; + ext_offset = 0; len_seen = 0; for (i = 0; i < ext_sg_entries; i++) { if ((len_seen + ext_sglist[i].len) >= @@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio } } else { ext_sglist = &ext_entry; + ext_sglist_malloced = 0; ext_sglist->addr = ctsio->ext_data_ptr; ext_sglist->len = ctsio->ext_data_len; ext_sg_entries = 1; @@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_sg_entries = 1; } - kern_watermark = 0; ext_watermark = ext_offset; len_copied = 0; @@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio "kern_data_len = %d\n", ctsio->ext_data_len, ctsio->kern_data_len)); + /* + * Report write underflow as error, since CTL and backends don't + * really support it. + */ + if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + j < kern_sg_entries) { + ctsio->io_hdr.port_status = 43; + } - /* XXX KDM set residual?? */ bailout: - if (ext_sglist_malloced != 0) free(ext_sglist, M_CTL); @@ -397,7 +401,7 @@ ctl_ioctl_io(struct cdev *dev, u_long cm struct thread *td) { union ctl_io *io; - void *pool_tmp; + void *pool_tmp, *sc_tmp; int retval = 0; /* @@ -414,8 +418,10 @@ ctl_ioctl_io(struct cdev *dev, u_long cm * spammed by the user's ctl_io. */ pool_tmp = io->io_hdr.pool; + sc_tmp = CTL_SOFTC(io); memcpy(io, (void *)addr, sizeof(*io)); io->io_hdr.pool = pool_tmp; + CTL_SOFTC(io) = sc_tmp; /* * No status yet, so make sure the status is set properly. From owner-svn-src-all@freebsd.org Thu Jan 26 21:36: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 507D0CC27F2; Thu, 26 Jan 2017 21:36:00 +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 0E358DE2; Thu, 26 Jan 2017 21:35: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 v0QLZxJ2019148; Thu, 26 Jan 2017 21:35:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QLZw4J019142; Thu, 26 Jan 2017 21:35:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701262135.v0QLZw4J019142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Jan 2017 21:35:58 +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: r312850 - in stable/10/sys: cam dev/arcmsr dev/iir dev/isci dev/ppbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:36:00 -0000 Author: mav Date: Thu Jan 26 21:35:58 2017 New Revision: 312850 URL: https://svnweb.freebsd.org/changeset/base/312850 Log: MFC r296891 (by imp): Make sure we check for CAM_CDB_POINTER for all drivers. Also, for the drivers I've touched, filter out CAM_CDB_PHYS. Differential Revision: https://reviews.freebsd.org/D5585 Modified: stable/10/sys/cam/cam_ccb.h stable/10/sys/dev/arcmsr/arcmsr.c stable/10/sys/dev/iir/iir.c stable/10/sys/dev/isci/isci_controller.c stable/10/sys/dev/isci/isci_io_request.c stable/10/sys/dev/ppbus/vpo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_ccb.h ============================================================================== --- stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/cam/cam_ccb.h Thu Jan 26 21:35:58 2017 (r312850) @@ -727,6 +727,13 @@ struct ccb_scsiio { u_int init_id; /* initiator id of who selected */ }; +static __inline uint8_t * +scsiio_cdb_ptr(struct ccb_scsiio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* * ATA I/O Request CCB used for the XPT_ATA_IO function code. */ Modified: stable/10/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/10/sys/dev/arcmsr/arcmsr.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/arcmsr/arcmsr.c Thu Jan 26 21:35:58 2017 (r312850) @@ -872,7 +872,7 @@ static void arcmsr_srb_timeout(void *arg ARCMSR_LOCK_ACQUIRE(&acb->isr_lock); if(srb->srb_state == ARCMSR_SRB_START) { - cmd = srb->pccb->csio.cdb_io.cdb_bytes[0]; + cmd = scsiio_cdb_ptr(&srb->pccb->csio)[0]; srb->srb_state = ARCMSR_SRB_TIMEOUT; srb->pccb->ccb_h.status |= CAM_CMD_TIMEOUT; arcmsr_srb_complete(srb, 1); @@ -997,7 +997,7 @@ static void arcmsr_build_srb(struct Comm arcmsr_cdb->LUN = pccb->ccb_h.target_lun; arcmsr_cdb->Function = 1; arcmsr_cdb->CdbLength = (u_int8_t)pcsio->cdb_len; - bcopy(pcsio->cdb_io.cdb_bytes, arcmsr_cdb->Cdb, pcsio->cdb_len); + bcopy(scsiio_cdb_ptr(pcsio), arcmsr_cdb->Cdb, pcsio->cdb_len); if(nseg != 0) { struct AdapterControlBlock *acb = srb->acb; bus_dmasync_op_t op; @@ -2453,10 +2453,11 @@ static int arcmsr_iop_message_xfer(struc struct CMD_MESSAGE_FIELD *pcmdmessagefld; int retvalue = 0, transfer_len = 0; char *buffer; - u_int32_t controlcode = (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[5] << 24 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[6] << 16 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[7] << 8 | - (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[8]; + uint8_t *ptr = scsiio_cdb_ptr(&pccb->csio); + u_int32_t controlcode = (u_int32_t ) ptr[5] << 24 | + (u_int32_t ) ptr[6] << 16 | + (u_int32_t ) ptr[7] << 8 | + (u_int32_t ) ptr[8]; /* 4 bytes: Areca io control code */ if ((pccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) { buffer = pccb->csio.data_ptr; @@ -2683,7 +2684,7 @@ static void arcmsr_execute_srb(void *arg if(acb->devstate[target][lun] == ARECA_RAID_GONE) { u_int8_t block_cmd, cmd; - cmd = pccb->csio.cdb_io.cdb_bytes[0]; + cmd = scsiio_cdb_ptr(&pccb->csio)[0]; block_cmd = cmd & 0x0f; if(block_cmd == 0x08 || block_cmd == 0x0a) { printf("arcmsr%d:block 'read/write' command " @@ -2800,7 +2801,7 @@ static void arcmsr_handle_virtual_comman return; } pccb->ccb_h.status |= CAM_REQ_CMP; - switch (pccb->csio.cdb_io.cdb_bytes[0]) { + switch (scsiio_cdb_ptr(&pccb->csio)[0]) { case INQUIRY: { unsigned char inqdata[36]; char *buffer = pccb->csio.data_ptr; @@ -2853,6 +2854,12 @@ static void arcmsr_action(struct cam_sim int target = pccb->ccb_h.target_id; int error; + if (pccb->ccb_h.flags & CAM_CDB_PHYS) { + pccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(pccb); + return; + } + if(target == 16) { /* virtual device for iop message transfer */ arcmsr_handle_virtual_command(acb, pccb); Modified: stable/10/sys/dev/iir/iir.c ============================================================================== --- stable/10/sys/dev/iir/iir.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/iir/iir.c Thu Jan 26 21:35:58 2017 (r312850) @@ -744,9 +744,9 @@ gdt_next(struct gdt_softc *gdt) ccb->ccb_h.flags)); csio = &ccb->csio; ccbh = &ccb->ccb_h; - cmd = csio->cdb_io.cdb_bytes[0]; - /* Max CDB length is 12 bytes */ - if (csio->cdb_len > 12) { + cmd = scsiio_cdb_ptr(csio)[0]; + /* Max CDB length is 12 bytes, can't be phys addr */ + if (csio->cdb_len > 12 || (ccbh->flags & CAM_CDB_PHYS)) { ccbh->status = CAM_REQ_INVALID; --gdt_stat.io_count_act; xpt_done(ccb); Modified: stable/10/sys/dev/isci/isci_controller.c ============================================================================== --- stable/10/sys/dev/isci/isci_controller.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/isci/isci_controller.c Thu Jan 26 21:35:58 2017 (r312850) @@ -740,6 +740,11 @@ void isci_action(struct cam_sim *sim, un } break; case XPT_SCSI_IO: + if (ccb->ccb_h.flags & CAM_CDB_PHYS) { + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + } isci_io_request_execute_scsi_io(ccb, controller); break; #if __FreeBSD_version >= 900026 @@ -802,6 +807,7 @@ isci_controller_release_queued_ccbs(stru { struct ISCI_REMOTE_DEVICE *dev; struct ccb_hdr *ccb_h; + uint8_t *ptr; int dev_idx; KASSERT(mtx_owned(&controller->lock), ("controller lock not owned")); @@ -821,8 +827,8 @@ isci_controller_release_queued_ccbs(stru if (ccb_h == NULL) continue; - isci_log_message(1, "ISCI", "release %p %x\n", ccb_h, - ((union ccb *)ccb_h)->csio.cdb_io.cdb_bytes[0]); + ptr = scsiio_cdb_ptr(&((union ccb *)ccb_h)->csio); + isci_log_message(1, "ISCI", "release %p %x\n", ccb_h, *ptr); dev->queued_ccb_in_progress = (union ccb *)ccb_h; isci_io_request_execute_scsi_io( Modified: stable/10/sys/dev/isci/isci_io_request.c ============================================================================== --- stable/10/sys/dev/isci/isci_io_request.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/isci/isci_io_request.c Thu Jan 26 21:35:58 2017 (r312850) @@ -86,6 +86,7 @@ isci_io_request_complete(SCI_CONTROLLER_ struct ISCI_REMOTE_DEVICE *isci_remote_device; union ccb *ccb; BOOL complete_ccb; + struct ccb_scsiio *csio; complete_ccb = TRUE; isci_controller = (struct ISCI_CONTROLLER *) sci_object_get_association(scif_controller); @@ -93,7 +94,7 @@ isci_io_request_complete(SCI_CONTROLLER_ (struct ISCI_REMOTE_DEVICE *) sci_object_get_association(remote_device); ccb = isci_request->ccb; - + csio = &ccb->csio; ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (completion_status) { @@ -124,7 +125,6 @@ isci_io_request_complete(SCI_CONTROLLER_ SCI_SSP_RESPONSE_IU_T * response_buffer; uint32_t sense_length; int error_code, sense_key, asc, ascq; - struct ccb_scsiio *csio = &ccb->csio; response_buffer = (SCI_SSP_RESPONSE_IU_T *) scif_io_request_get_response_iu_address( @@ -146,7 +146,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(1, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x status=%x key=%x asc=%x ascq=%x\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, csio->cdb_io.cdb_bytes[0], + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), csio->scsi_status, sense_key, asc, ascq); break; } @@ -157,7 +157,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(0, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x remote device reset required\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]); + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); break; case SCI_IO_FAILURE_TERMINATED: @@ -165,7 +165,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(0, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x terminated\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]); + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); break; case SCI_IO_FAILURE_INVALID_STATE: @@ -208,7 +208,7 @@ isci_io_request_complete(SCI_CONTROLLER_ isci_log_message(1, "ISCI", "isci: bus=%x target=%x lun=%x cdb[0]=%x completion status=%x\n", ccb->ccb_h.path_id, ccb->ccb_h.target_id, - ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0], + ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), completion_status); ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; @@ -285,13 +285,13 @@ isci_io_request_complete(SCI_CONTROLLER_ * get a ready notification for this device. */ isci_log_message(1, "ISCI", "already queued %p %x\n", - ccb, ccb->csio.cdb_io.cdb_bytes[0]); + ccb, scsiio_cdb_ptr(csio)); isci_remote_device->queued_ccb_in_progress = NULL; } else { isci_log_message(1, "ISCI", "queue %p %x\n", ccb, - ccb->csio.cdb_io.cdb_bytes[0]); + scsiio_cdb_ptr(csio)); ccb->ccb_h.status |= CAM_SIM_QUEUED; TAILQ_INSERT_TAIL(&isci_remote_device->queued_ccbs, @@ -373,7 +373,7 @@ scif_cb_io_request_get_cdb_address(void struct ISCI_IO_REQUEST *isci_request = (struct ISCI_IO_REQUEST *)scif_user_io_request; - return (isci_request->ccb->csio.cdb_io.cdb_bytes); + return (scsiio_cdb_ptr(&isci_request->ccb->csio)); } /** Modified: stable/10/sys/dev/ppbus/vpo.c ============================================================================== --- stable/10/sys/dev/ppbus/vpo.c Thu Jan 26 21:21:59 2017 (r312849) +++ stable/10/sys/dev/ppbus/vpo.c Thu Jan 26 21:35:58 2017 (r312850) @@ -187,17 +187,19 @@ vpo_intr(struct vpo_data *vpo, struct cc #ifdef VP0_DEBUG int i; #endif + uint8_t *ptr; + ptr = scsiio_cdb_ptr(csio); if (vpo->vpo_isplus) { errno = imm_do_scsi(&vpo->vpo_io, VP0_INITIATOR, csio->ccb_h.target_id, - (char *)&csio->cdb_io.cdb_bytes, csio->cdb_len, + ptr, csio->cdb_len, (char *)csio->data_ptr, csio->dxfer_len, &vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error); } else { errno = vpoio_do_scsi(&vpo->vpo_io, VP0_INITIATOR, csio->ccb_h.target_id, - (char *)&csio->cdb_io.cdb_bytes, csio->cdb_len, + ptr, csio->cdb_len, (char *)csio->data_ptr, csio->dxfer_len, &vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error); } @@ -208,7 +210,7 @@ vpo_intr(struct vpo_data *vpo, struct cc /* dump of command */ for (i=0; icdb_len; i++) - printf("%x ", ((char *)&csio->cdb_io.cdb_bytes)[i]); + printf("%x ", ((char *)ptr)[i]); printf("\n"); #endif @@ -307,11 +309,15 @@ vpo_action(struct cam_sim *sim, union cc csio = &ccb->csio; + if (ccb->ccb_h.flags & CAM_CDB_PHYS) { + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + break; + } #ifdef VP0_DEBUG device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n", - csio->cdb_io.cdb_bytes[0]); + scsiio_cdb_ptr(csio)); #endif - vpo_intr(vpo, csio); xpt_done(ccb); From owner-svn-src-all@freebsd.org Thu Jan 26 21:59: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 07843CC315F; Thu, 26 Jan 2017 21:59:35 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E08BFDBC; Thu, 26 Jan 2017 21:59:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v0QLxRT4030394 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 Jan 2017 13:59:27 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v0QLxR39030393; Thu, 26 Jan 2017 13:59:27 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 26 Jan 2017 13:59:27 -0800 From: Gleb Smirnoff To: Bruce Evans Cc: Konstantin Belousov , Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 Message-ID: <20170126215927.GL2611@FreeBSD.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> <20170125222632.GQ2349@kib.kiev.ua> <20170126133341.V1087@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170126133341.V1087@besplex.bde.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 21:59:35 -0000 On Thu, Jan 26, 2017 at 02:03:05PM +1100, Bruce Evans wrote: B> On Thu, 26 Jan 2017, Konstantin Belousov wrote: B> B> > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: B> >> Thanks, Luiz! B> >> B> >> One stylistic nit that I missed in review: B> >> B> >> L> static int B> >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) B> >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) B> >> L> { B> >> L> const struct ifreq *ifr = (struct ifreq *)data; B> >> L> const struct sockaddr_in *addr = (const struct sockaddr_in *) B> >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if B> >> L> in_ifadown(&ia->ia_ifa, 1); B> >> L> B> >> L> if (ia->ia_ifa.ifa_carp) B> >> L> - (*carp_detach_p)(&ia->ia_ifa); B> >> L> + (*carp_detach_p)(&ia->ia_ifa, B> >> L> + (cmd == SIOCDIFADDR) ? false : true); B> >> B> >> Can we change the very last line to: B> >> B> >> (cmd == SIOCAIFADDR) ? true : false); B> B> That is not stylistic, but invert the result. Perhaps you meant to B> reverse the test to avoid negative logic for the result. It uses different ioctl value, so it doesn't invert result. Instead of !SIOCDIFADDR I want more explicit SIOCAIFADDR. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Thu Jan 26 23: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 47147CC39E8; Thu, 26 Jan 2017 23:29:32 +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 12972812; Thu, 26 Jan 2017 23:29:31 +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 v0QNTVcP062808; Thu, 26 Jan 2017 23:29:31 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QNTUR9062799; Thu, 26 Jan 2017 23:29:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701262329.v0QNTUR9062799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 23:29:30 +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: r312851 - stable/10/secure/lib/libcrypto X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 26 Jan 2017 23:29:32 -0000 Author: jkim Date: Thu Jan 26 23:29:30 2017 New Revision: 312851 URL: https://svnweb.freebsd.org/changeset/base/312851 Log: Disable assembly sources when compiler/assembler cannot compile certain instructions. Note this is a direct commit because head and stable/11 has OpenSSL 1.0.2 branch. However, it is based on r304320. Requested by: julian Added: stable/10/secure/lib/libcrypto/opensslconf-arm.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-arm.h stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-ia64.h stable/10/secure/lib/libcrypto/opensslconf-mips.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-mips.h stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-powerpc.h stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-sparc64.h stable/10/secure/lib/libcrypto/opensslconf-x86.h.in - copied, changed from r312850, stable/10/secure/lib/libcrypto/opensslconf-x86.h Deleted: stable/10/secure/lib/libcrypto/opensslconf-arm.h stable/10/secure/lib/libcrypto/opensslconf-ia64.h stable/10/secure/lib/libcrypto/opensslconf-mips.h stable/10/secure/lib/libcrypto/opensslconf-powerpc.h stable/10/secure/lib/libcrypto/opensslconf-sparc64.h stable/10/secure/lib/libcrypto/opensslconf-x86.h Modified: stable/10/secure/lib/libcrypto/Makefile stable/10/secure/lib/libcrypto/Makefile.asm stable/10/secure/lib/libcrypto/Makefile.inc Modified: stable/10/secure/lib/libcrypto/Makefile ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile Thu Jan 26 23:29:30 2017 (r312851) @@ -22,9 +22,9 @@ MAN+= config.5 des_modes.7 # base sources SRCS= cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \ o_fips.c o_init.c o_str.c o_time.c uid.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= x86_64cpuid.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= x86cpuid.S .else SRCS+= mem_clr.c @@ -33,10 +33,10 @@ INCS+= crypto.h ebcdic.h opensslv.h ossl # aes SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= aes-x86_64.S aesni-sha1-x86_64.S aesni-x86_64.S bsaes-x86_64.S \ vpaes-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= aes-586.S aesni-x86.S vpaes-x86.S .else SRCS+= aes_cbc.c aes_core.c @@ -60,7 +60,7 @@ INCS+= asn1.h asn1_mac.h asn1t.h # bf SRCS+= bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) .if ${MACHINE_CPU:Mi686} SRCS+= bf-686.S .else @@ -82,10 +82,10 @@ SRCS+= bn_add.c bn_blind.c bn_const.c bn bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c bn_lib.c bn_mod.c \ bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \ bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= modexp512-x86_64.S x86_64-gcc.c x86_64-gf2m.S x86_64-mont.S \ x86_64-mont5.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= bn-586.S co-586.S x86-gf2m.S x86-mont.S .else SRCS+= bn_asm.c @@ -98,9 +98,9 @@ INCS+= buffer.h # camellia SRCS+= cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= cmll_misc.c cmll-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= cmll-x86.S .else SRCS+= camellia.c cmll_cbc.c cmll_misc.c @@ -134,7 +134,7 @@ SRCS+= cbc_cksm.c cbc_enc.c cfb64ede.c c des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \ fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \ rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= crypt586.S des-586.S .else SRCS+= des_enc.c fcrypt_b.c @@ -215,9 +215,9 @@ INCS+= md4.h # md5 SRCS+= md5_dgst.c md5_one.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= md5-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= md5-586.S .endif INCS+= md5.h @@ -228,9 +228,9 @@ INCS+= mdc2.h # modes SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c xts128.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= ghash-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= ghash-x86.S .endif INCS+= modes.h @@ -274,9 +274,9 @@ INCS+= rc2.h # rc4 SRCS+= rc4_utl.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= rc4-md5-x86_64.S rc4-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= rc4-586.S .else SRCS+= rc4_enc.c rc4_skey.c @@ -285,7 +285,7 @@ INCS+= rc4.h # rc5 SRCS+= rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= rc5-586.S .else SRCS+= rc5_enc.c @@ -294,7 +294,7 @@ INCS+= rc5.h # ripemd SRCS+= rmd_dgst.c rmd_one.c -.if ${MACHINE_CPUARCH} == "i386" +.if defined(ASM_i386) SRCS+= rmd-586.S .endif INCS+= ripemd.h @@ -312,9 +312,9 @@ INCS+= seed.h # sha SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= sha1-x86_64.S sha256-x86_64.S sha512-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= sha1-586.S sha256-586.S sha512-586.S .endif INCS+= sha.h @@ -343,9 +343,9 @@ INCS+= ui.h ui_compat.h # whrlpool SRCS+= wp_dgst.c -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) SRCS+= wp-x86_64.S -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) SRCS+= wp-mmx.S wp_block.c .else SRCS+= wp_block.c @@ -382,7 +382,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/crypto/modes ACFLAGS+= -Wa,--noexecstack .endif -CLEANFILES= buildinf.h opensslconf.h +CLEANFILES= buildinf.h opensslconf.h opensslconf.h.tmp buildinf.h: ${.CURDIR}/Makefile ( echo "#ifndef MK1MF_BUILD"; \ @@ -391,23 +391,21 @@ buildinf.h: ${.CURDIR}/Makefile echo " #define PLATFORM \"platform: FreeBSD-${MACHINE_ARCH}\""; \ echo "#endif" ) > ${.TARGET} -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" -opensslconf.h: opensslconf-x86.h +opensslconf.h: opensslconf-${MACHINE_CPUARCH:C/^(amd64|i386)$/x86/}.h.in +.if defined(ASM_${MACHINE_CPUARCH}) + sed 's/%%ASM%%//; /%%NO_ASM%%/d' ${.ALLSRC} > ${.TARGET}.tmp .else -opensslconf.h: opensslconf-${MACHINE_CPUARCH}.h + sed '/%%ASM%%/d; s/%%NO_ASM%%//' ${.ALLSRC} > ${.TARGET}.tmp .endif - cp -f ${.ALLSRC} ${.TARGET} + cp -f ${.TARGET}.tmp ${.TARGET} .include -.if ${MACHINE_CPUARCH} == "amd64" -.PATH: ${.CURDIR}/amd64 -.elif ${MACHINE_CPUARCH} == "i386" -.PATH: ${.CURDIR}/i386 +.if defined(ASM_${MACHINE_CPUARCH}) +.PATH: ${.CURDIR}/${MACHINE_CPUARCH} +.if defined(ASM_amd64) +.PATH: ${LCRYPTO_SRC}/crypto/bn/asm .endif - -.if ${MACHINE_CPUARCH} == "amd64" -_bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/asm .endif .PATH: ${LCRYPTO_SRC}/crypto \ @@ -416,7 +414,6 @@ _bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/as ${LCRYPTO_SRC}/crypto/bf \ ${LCRYPTO_SRC}/crypto/bio \ ${LCRYPTO_SRC}/crypto/bn \ - ${_bn_asmpath} \ ${LCRYPTO_SRC}/crypto/buffer \ ${LCRYPTO_SRC}/crypto/camellia \ ${LCRYPTO_SRC}/crypto/cast \ Modified: stable/10/secure/lib/libcrypto/Makefile.asm ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile.asm Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile.asm Thu Jan 26 23:29:30 2017 (r312851) @@ -6,7 +6,7 @@ .include "Makefile.inc" -.if ${MACHINE_CPUARCH} == "amd64" +.if defined(ASM_amd64) .PATH: ${LCRYPTO_SRC}/crypto \ ${LCRYPTO_SRC}/crypto/aes/asm \ @@ -73,7 +73,7 @@ ${s}.S: ${s}.s cat ${s}.s ) > ${.TARGET} .endfor -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) .PATH: ${LCRYPTO_SRC}/crypto \ ${LCRYPTO_SRC}/crypto/aes/asm \ Modified: stable/10/secure/lib/libcrypto/Makefile.inc ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile.inc Thu Jan 26 21:35:58 2017 (r312850) +++ stable/10/secure/lib/libcrypto/Makefile.inc Thu Jan 26 23:29:30 2017 (r312851) @@ -21,7 +21,17 @@ CFLAGS+=-DL_ENDIAN CFLAGS+=-DB_ENDIAN .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +_ASM_AVX!= { \ + echo vzeroall | \ + ${CC} -x assembler -o /dev/null -c - 2> /dev/null; \ + } && echo yes || echo no +.if ${_ASM_AVX} == yes +ASM_${MACHINE_CPUARCH}= +.endif +.endif + +.if defined(ASM_amd64) CFLAGS+=-DOPENSSL_IA32_SSE2 CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m @@ -29,7 +39,7 @@ CFLAGS+=-DMD5_ASM CFLAGS+=-DGHASH_ASM CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM CFLAGS+=-DWHIRLPOOL_ASM -.elif ${MACHINE_CPUARCH} == "i386" +.elif defined(ASM_i386) CFLAGS+=-DOPENSSL_IA32_SSE2 CFLAGS+=-DAES_ASM -DVPAES_ASM CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-arm.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-arm.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-arm.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-arm.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-ia64.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-ia64.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-ia64.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -36,9 +36,9 @@ #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-mips.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-mips.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-mips.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-mips.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-powerpc.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-powerpc.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-powerpc.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-sparc64.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-sparc64.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-sparc64.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,9 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif -#ifndef OPENSSL_NO_ASM -# define OPENSSL_NO_ASM -#endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -83,6 +83,8 @@ extern "C" { # endif #endif +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ Copied and modified: stable/10/secure/lib/libcrypto/opensslconf-x86.h.in (from r312850, stable/10/secure/lib/libcrypto/opensslconf-x86.h) ============================================================================== --- stable/10/secure/lib/libcrypto/opensslconf-x86.h Thu Jan 26 21:35:58 2017 (r312850, copy source) +++ stable/10/secure/lib/libcrypto/opensslconf-x86.h.in Thu Jan 26 23:29:30 2017 (r312851) @@ -42,6 +42,9 @@ extern "C" { #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif +%%NO_ASM%%#ifndef OPENSSL_NO_ASM +%%NO_ASM%%# define OPENSSL_NO_ASM +%%NO_ASM%%#endif #ifndef OPENSSL_NO_STATIC_ENGINE # define OPENSSL_NO_STATIC_ENGINE #endif @@ -80,8 +83,8 @@ extern "C" { # endif #endif -#define OPENSSL_CPUID_OBJ - +%%ASM%%#define OPENSSL_CPUID_OBJ +%%ASM%% /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ From owner-svn-src-all@freebsd.org Fri Jan 27 00:17: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 232C5CC2F25; Fri, 27 Jan 2017 00:17:09 +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 E46F2808; Fri, 27 Jan 2017 00:17:08 +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 v0R0H7GG083200; Fri, 27 Jan 2017 00:17:07 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R0H7qb083199; Fri, 27 Jan 2017 00:17:07 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701270017.v0R0H7qb083199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 27 Jan 2017 00:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312852 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 00:17:09 -0000 Author: jkim Date: Fri Jan 27 00:17:07 2017 New Revision: 312852 URL: https://svnweb.freebsd.org/changeset/base/312852 Log: Fix libcam build. It was broken with r312827. Modified: head/sys/cam/cam_xpt.h Modified: head/sys/cam/cam_xpt.h ============================================================================== --- head/sys/cam/cam_xpt.h Thu Jan 26 23:29:30 2017 (r312851) +++ head/sys/cam/cam_xpt.h Fri Jan 27 00:17:07 2017 (r312852) @@ -32,8 +32,10 @@ #ifndef _CAM_CAM_XPT_H #define _CAM_CAM_XPT_H 1 +#ifdef _KERNEL #include #include "opt_printf.h" +#endif /* Forward Declarations */ union ccb; From owner-svn-src-all@freebsd.org Fri Jan 27 01:17: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 B27BDCC312B; Fri, 27 Jan 2017 01:17:01 +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 70882ACA; Fri, 27 Jan 2017 01:17:01 +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 v0R1H0Wn007382; Fri, 27 Jan 2017 01:17:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R1H0qU007381; Fri, 27 Jan 2017 01:17:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701270117.v0R1H0qU007381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 27 Jan 2017 01:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312853 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 01:17:01 -0000 Author: adrian Date: Fri Jan 27 01:17:00 2017 New Revision: 312853 URL: https://svnweb.freebsd.org/changeset/base/312853 Log: [ath] fix "doing stuff before wakeup" warning; add comments for ACK/CTS handling during DFS/PASSIVE channels * Although the hardware is awake, the power state handling doesn't think so. So just explicitly wake it up early in setup so ath_hal calls don't complain. * We shouldn't be transmitting or ACKing frames during DFS CAC or on passive channels before we hear a beacon. So, start laying down comments in the places where this work has to be done. Note: * The main bit missing from finishing this particular bit of work is a state call to transition a VAP from passive to non-passive when a beacon is heard. CAC is easy, it's an interface state. So, I'll go and add a method to control that soon. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Jan 27 00:17:07 2017 (r312852) +++ head/sys/dev/ath/if_ath.c Fri Jan 27 01:17:00 2017 (r312853) @@ -634,6 +634,17 @@ ath_attach(u_int16_t devid, struct ath_s #endif /* + * Force the chip awake during setup, just to keep + * the HAL/driver power tracking happy. + * + * There are some methods (eg ath_hal_setmac()) + * that poke the hardware. + */ + ATH_LOCK(sc); + ath_power_setpower(sc, HAL_PM_AWAKE, 1); + ATH_UNLOCK(sc); + + /* * Setup the DMA/EDMA functions based on the current * hardware support. * @@ -1010,6 +1021,28 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_rx_lnamixer = ath_hal_hasrxlnamixer(ah); sc->sc_hasdivcomb = ath_hal_hasdivantcomb(ah); + /* + * Some WB335 cards do not support antenna diversity. Since + * we use a hardcoded value for AR9565 instead of using the + * EEPROM/OTP data, remove the combining feature from + * the HW capabilities bitmap. + */ + /* + * XXX TODO: check reference driver and ath9k for what to do + * here for WB335. I think we have to actually disable the + * LNA div processing in the HAL and instead use the hard + * coded values; and then use BT diversity. + * + * .. but also need to setup MCI too for WB335.. + */ +#if 0 + if (sc->sc_pci_devinfo & (ATH9K_PCI_AR9565_1ANT | ATH9K_PCI_AR9565_2ANT)) { + device_printf(sc->sc_dev, "%s: WB335: disabling LNA mixer diversity\n", + __func__); + sc->sc_dolnadiv = 0; + } +#endif + if (ath_hal_hasfastframes(ah)) ic->ic_caps |= IEEE80211_C_FF; wmodes = ath_hal_getwirelessmodes(ah); @@ -1351,6 +1384,7 @@ bad2: ath_desc_free(sc); ath_txdma_teardown(sc); ath_rxdma_teardown(sc); + bad: if (ah) ath_hal_detach(ah); @@ -3611,6 +3645,8 @@ ath_mode_init(struct ath_softc *sc) struct ath_hal *ah = sc->sc_ah; u_int32_t rfilt; + /* XXX power state? */ + /* configure rx filter */ rfilt = ath_calcrxfilter(sc); ath_hal_setrxfilter(ah, rfilt); @@ -5654,6 +5690,56 @@ ath_newstate(struct ieee80211vap *vap, e */ IEEE80211_LOCK_ASSERT(ic); + /* + * XXX TODO: if nstate is _S_CAC, then we should disable + * ACK processing until CAC is completed. + */ + + /* + * XXX TODO: if we're on a passive channel, then we should + * not allow any ACKs or self-generated frames until we hear + * a beacon. Unfortunately there isn't a notification from + * net80211 so perhaps we could slot that particular check + * into the mgmt receive path and just ensure that we clear + * it on RX of beacons in passive mode (and only clear it + * once, obviously.) + */ + + /* + * XXX TODO: net80211 should be tracking whether channels + * have heard beacons and are thus considered "OK" for + * transmitting - and then inform the driver about this + * state change. That way if we hear an AP go quiet + * (and nothing else is beaconing on a channel) the + * channel can go back to being passive until another + * beacon is heard. + */ + + /* + * XXX TODO: if nstate is _S_CAC, then we should disable + * ACK processing until CAC is completed. + */ + + /* + * XXX TODO: if we're on a passive channel, then we should + * not allow any ACKs or self-generated frames until we hear + * a beacon. Unfortunately there isn't a notification from + * net80211 so perhaps we could slot that particular check + * into the mgmt receive path and just ensure that we clear + * it on RX of beacons in passive mode (and only clear it + * once, obviously.) + */ + + /* + * XXX TODO: net80211 should be tracking whether channels + * have heard beacons and are thus considered "OK" for + * transmitting - and then inform the driver about this + * state change. That way if we hear an AP go quiet + * (and nothing else is beaconing on a channel) the + * channel can go back to being passive until another + * beacon is heard. + */ + if (nstate == IEEE80211_S_RUN) { /* NB: collect bss node again, it may have changed */ ieee80211_free_node(ni); @@ -5675,6 +5761,14 @@ ath_newstate(struct ieee80211vap *vap, e case IEEE80211_M_HOSTAP: case IEEE80211_M_IBSS: case IEEE80211_M_MBSS: + + /* + * TODO: Enable ACK processing (ie, clear AR_DIAG_ACK_DIS.) + * For channels that are in CAC, we may have disabled + * this during CAC to ensure we don't ACK frames + * sent to us. + */ + /* * Allocate and setup the beacon frame. * @@ -6279,6 +6373,15 @@ ath_dfs_tasklet(void *p, int npending) */ if (ath_dfs_process_radar_event(sc, sc->sc_curchan)) { /* DFS event found, initiate channel change */ + + /* + * XXX TODO: immediately disable ACK processing + * on the current channel. This would be done + * by setting AR_DIAG_ACK_DIS (AR5212; may be + * different for others) until we are out of + * CAC. + */ + /* * XXX doesn't currently tell us whether the event * XXX was found in the primary or extension From owner-svn-src-all@freebsd.org Fri Jan 27 01:24: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 4A9B2CC334E; Fri, 27 Jan 2017 01:24:26 +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 F32CEF50; Fri, 27 Jan 2017 01:24:25 +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 v0R1OP48011345; Fri, 27 Jan 2017 01:24:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R1OPp5011344; Fri, 27 Jan 2017 01:24:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701270124.v0R1OPp5011344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 27 Jan 2017 01:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312854 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 01:24:26 -0000 Author: adrian Date: Fri Jan 27 01:24:24 2017 New Revision: 312854 URL: https://svnweb.freebsd.org/changeset/base/312854 Log: [net80211] prepare configuration checks for VHT, fragment-offload and seqno-offload. * allocate an ext bit for fragment offload. Some NICs (like the ath10k hardware in native wifi or 802.3 mode) support doing packet fragmentation in firmware/hardware, so we don't have to do it here. * allocate an ext bit for VHT and start using it. Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Fri Jan 27 01:17:00 2017 (r312853) +++ head/sys/net80211/ieee80211_var.h Fri Jan 27 01:24:24 2017 (r312854) @@ -93,10 +93,13 @@ * says that VHT is supported - and then this macro can be * changed. */ -#define IEEE80211_CONF_VHT(ic) ((ic)->ic_vhtcaps != 0) +#define IEEE80211_CONF_VHT(ic) \ + ((ic)->ic_flags_ext & IEEE80211_FEXT_VHT) #define IEEE80211_CONF_SEQNO_OFFLOAD(ic) \ ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD) +#define IEEE80211_CONF_FRAG_OFFLOAD(ic) \ + ((ic)->ic_flags_ext & IEEE80211_FEXT_FRAG_OFFLOAD) /* * 802.11 control state is split into a common portion that maps @@ -633,11 +636,14 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_UNIQMAC 0x00040000 /* CONF: user or computed mac */ #define IEEE80211_FEXT_SCAN_OFFLOAD 0x00080000 /* CONF: scan is fully offloaded */ #define IEEE80211_FEXT_SEQNO_OFFLOAD 0x00100000 /* CONF: driver does seqno insertion/allocation */ +#define IEEE80211_FEXT_FRAG_OFFLOAD 0x00200000 /* CONF: hardware does 802.11 fragmentation + assignment */ +#define IEEE80211_FEXT_VHT 0x00400000 /* CONF: VHT support */ #define IEEE80211_FEXT_BITS \ "\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ "\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \ - "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" + "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" \ + "\26VHT" /* ic_flags_ht/iv_flags_ht */ #define IEEE80211_FHT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */ From owner-svn-src-all@freebsd.org Fri Jan 27 01:59: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 F0A68CC39EA; Fri, 27 Jan 2017 01:59: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 C8464F13; Fri, 27 Jan 2017 01:59: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 v0R1xDiV023551; Fri, 27 Jan 2017 01:59:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R1xDEX023543; Fri, 27 Jan 2017 01:59:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701270159.v0R1xDEX023543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Jan 2017 01:59:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312855 - in head: . gnu/usr.bin/binutils/ld share/mk tools/build/options usr.bin/clang/lld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 01:59:15 -0000 Author: emaste Date: Fri Jan 27 01:59:12 2017 New Revision: 312855 URL: https://svnweb.freebsd.org/changeset/base/312855 Log: Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC Reported by: Dan McGregor Added: head/tools/build/options/WITHOUT_LLD_IS_LD - copied unchanged from r312854, head/tools/build/options/WITHOUT_LLD_AS_LD head/tools/build/options/WITH_LLD_IS_LD - copied unchanged from r312854, head/tools/build/options/WITH_LLD_AS_LD Deleted: head/tools/build/options/WITHOUT_LLD_AS_LD head/tools/build/options/WITH_LLD_AS_LD Modified: head/Makefile.inc1 head/UPDATING head/gnu/usr.bin/binutils/ld/Makefile head/share/mk/src.opts.mk head/usr.bin/clang/lld/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jan 27 01:24:24 2017 (r312854) +++ head/Makefile.inc1 Fri Jan 27 01:59:12 2017 (r312855) @@ -516,7 +516,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MK_GDB=no MK_TESTS=no MK_LLD_AS_LD=no + MK_GDB=no MK_TESTS=no MK_LLD_IS_LD=no # kernel-tools stage KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jan 27 01:24:24 2017 (r312854) +++ head/UPDATING Fri Jan 27 01:59:12 2017 (r312855) @@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 ****************************** SPECIAL WARNING: ****************************** +20170127: + The WITH_LLD_AS_LD / WITHOUT_LLD_AS_LD build knobs have been renamed + WITH_LLD_IS_LD / WITHOUT_LLD_IS_LD, for consistency with CLANG_IS_CC. + 20170112: The EM_MULTIQUEUE kernel configuration option is deprecated now that the em(4) driver conforms to iflib specifications. Modified: head/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/ld/Makefile Fri Jan 27 01:24:24 2017 (r312854) +++ head/gnu/usr.bin/binutils/ld/Makefile Fri Jan 27 01:59:12 2017 (r312855) @@ -49,7 +49,7 @@ CLEANFILES+= ldemul-list.h stringify.sed FILES= ${LDSCRIPTS:S|^|ldscripts/|} FILESDIR= ${SCRIPTDIR} -.if ${MK_LLD_AS_LD} == "no" +.if ${MK_LLD_IS_LD} == "no" LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jan 27 01:24:24 2017 (r312854) +++ head/share/mk/src.opts.mk Fri Jan 27 01:59:12 2017 (r312855) @@ -251,9 +251,9 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" -__DEFAULT_YES_OPTIONS+=LLD_AS_LD +__DEFAULT_YES_OPTIONS+=LLD_IS_LD .else -__DEFAULT_NO_OPTIONS+=LLD_AS_LD +__DEFAULT_NO_OPTIONS+=LLD_IS_LD .endif .if ${__T} == "aarch64" || ${__T} == "amd64" __DEFAULT_YES_OPTIONS+=LLD LLDB Copied: head/tools/build/options/WITHOUT_LLD_IS_LD (from r312854, head/tools/build/options/WITHOUT_LLD_AS_LD) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_LLD_IS_LD Fri Jan 27 01:59:12 2017 (r312855, copy of r312854, head/tools/build/options/WITHOUT_LLD_AS_LD) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. Copied: head/tools/build/options/WITH_LLD_IS_LD (from r312854, head/tools/build/options/WITH_LLD_AS_LD) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_LLD_IS_LD Fri Jan 27 01:59:12 2017 (r312855, copy of r312854, head/tools/build/options/WITH_LLD_AS_LD) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. Modified: head/usr.bin/clang/lld/Makefile ============================================================================== --- head/usr.bin/clang/lld/Makefile Fri Jan 27 01:24:24 2017 (r312854) +++ head/usr.bin/clang/lld/Makefile Fri Jan 27 01:59:12 2017 (r312855) @@ -8,7 +8,7 @@ LLD_SRCS= ${LLVM_SRCS}/tools/lld PACKAGE= lld PROG_CXX= ld.lld MAN= -.if ${MK_LLD_AS_LD} != "no" +.if ${MK_LLD_IS_LD} != "no" SYMLINKS= ${PROG_CXX} ${BINDIR}/ld .endif From owner-svn-src-all@freebsd.org Fri Jan 27 02:35: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 8A6ACCC349B; Fri, 27 Jan 2017 02:35:06 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 564DB1356; Fri, 27 Jan 2017 02:35:06 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R2Z53g039298; Fri, 27 Jan 2017 02:35:05 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R2Z5LD039297; Fri, 27 Jan 2017 02:35:05 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201701270235.v0R2Z5LD039297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 27 Jan 2017 02:35: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: r312856 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 02:35:06 -0000 Author: araujo Date: Fri Jan 27 02:35:05 2017 New Revision: 312856 URL: https://svnweb.freebsd.org/changeset/base/312856 Log: MFC r310698: Print hostcache usage counts with TCP statistics. PR: 196252 Submitted by: Anton Yuzhaninov MFC after: 3 weeks. Modified: stable/11/usr.bin/netstat/inet.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/inet.c ============================================================================== --- stable/11/usr.bin/netstat/inet.c Fri Jan 27 01:59:12 2017 (r312855) +++ stable/11/usr.bin/netstat/inet.c Fri Jan 27 02:35:05 2017 (r312856) @@ -750,6 +750,12 @@ tcp_stats(u_long off, const char *name, "{N:/ignored RSTs in the window%s}\n"); p(tcps_connects, "\t{:connections-established/%ju} " "{N:/connection%s established (including accepts)}\n"); + p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} " + "{N:/time%s used RTT from hostcache}\n"); + p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} " + "{N:/time%s used RTT variance from hostcache}\n"); + p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} " + "{N:/time%s used slow-start threshold from hostcache}\n"); p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} " "{N:/connection%s closed (including} " "{:connection-drops/%ju} {N:/drop%s})\n"); From owner-svn-src-all@freebsd.org Fri Jan 27 03:43: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 2DA6BCC3726; Fri, 27 Jan 2017 03:43:20 +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 E6B00F78; Fri, 27 Jan 2017 03:43: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 v0R3hI1i068403; Fri, 27 Jan 2017 03:43:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R3hIww068402; Fri, 27 Jan 2017 03:43:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701270343.v0R3hIww068402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Jan 2017 03:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312857 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 03:43:20 -0000 Author: emaste Date: Fri Jan 27 03:43:18 2017 New Revision: 312857 URL: https://svnweb.freebsd.org/changeset/base/312857 Log: 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. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Fri Jan 27 02:35:05 2017 (r312856) +++ head/Makefile.libcompat Fri Jan 27 03:43:18 2017 (r312857) @@ -50,6 +50,8 @@ LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsm LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}" .endif +LIB32WMAKEFLAGS+= NM="${XNM}" + LIB32CFLAGS= -DCOMPAT_32BIT LIB32DTRACE= ${DTRACE} -32 From owner-svn-src-all@freebsd.org Fri Jan 27 03:44: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 9E362CC37A3; Fri, 27 Jan 2017 03:44:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF2410F9; Fri, 27 Jan 2017 03:44:51 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R3iowN068514; Fri, 27 Jan 2017 03:44:50 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R3iosH068513; Fri, 27 Jan 2017 03:44:50 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201701270344.v0R3iosH068513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 27 Jan 2017 03:44: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: r312858 - stable/11/sys/dev/nand X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 03:44:51 -0000 Author: kan Date: Fri Jan 27 03:44:50 2017 New Revision: 312858 URL: https://svnweb.freebsd.org/changeset/base/312858 Log: MFC r311993: Fix typo in r311971 and now in r312405 too. Modified: stable/11/sys/dev/nand/nand_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nand/nand_geom.c ============================================================================== --- stable/11/sys/dev/nand/nand_geom.c Fri Jan 27 03:43:18 2017 (r312857) +++ stable/11/sys/dev/nand/nand_geom.c Fri Jan 27 03:44:50 2017 (r312858) @@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); - disk->d_rotation_rate = DISK_RR_NON_ROTATING; + rdisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(rdisk, DISK_VERSION); From owner-svn-src-all@freebsd.org Fri Jan 27 04:08: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 AA7AACC3CB6; Fri, 27 Jan 2017 04:08: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 5D6C11A43; Fri, 27 Jan 2017 04:08: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 v0R48O7C076346; Fri, 27 Jan 2017 04:08:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R48OcL076344; Fri, 27 Jan 2017 04:08:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201701270408.v0R48OcL076344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 27 Jan 2017 04:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312859 - head/sys/arm/ti/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 04:08:25 -0000 Author: ian Date: Fri Jan 27 04:08:24 2017 New Revision: 312859 URL: https://svnweb.freebsd.org/changeset/base/312859 Log: Configure the timer capture pin to input mode in the timer control register, in addition to configuring it as input with the pinmux driver. There was a control register bit commented as "no desc in datasheet". A later revision of the manual reveals the bit to be an input/output control for the timer pin. In addition to configuring capture or pulse mode, you apparently have to separately configure the pin direction in the timer control register. Before this change, the timer block was apparently driving a signal onto a pad configured by pinmux as input. Capture mode still accidentally worked for me during testing because I was using a very strong signal source that just out-muscled the weaker drive from the misconfigured pin. Modified: head/sys/arm/ti/am335x/am335x_dmtpps.c head/sys/arm/ti/am335x/am335x_dmtreg.h Modified: head/sys/arm/ti/am335x/am335x_dmtpps.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_dmtpps.c Fri Jan 27 03:44:50 2017 (r312858) +++ head/sys/arm/ti/am335x/am335x_dmtpps.c Fri Jan 27 04:08:24 2017 (r312859) @@ -463,6 +463,14 @@ dmtpps_attach(device_t dev) sc->tmr_num = ti_hwmods_get_unit(dev, "timer"); snprintf(sc->tmr_name, sizeof(sc->tmr_name), "DMTimer%d", sc->tmr_num); + /* + * Configure the timer pulse/capture pin to input/capture mode. This is + * required in addition to configuring the pin as input with the pinmux + * controller (which was done via fdt data or tunable at probe time). + */ + sc->tclr = DMT_TCLR_GPO_CFG; + DMTIMER_WRITE4(sc, DMT_TCLR, sc->tclr); + /* Set up timecounter hardware, start it. */ DMTIMER_WRITE4(sc, DMT_TSICR, DMT_TSICR_RESET); while (DMTIMER_READ4(sc, DMT_TIOCP_CFG) & DMT_TIOCP_RESET) Modified: head/sys/arm/ti/am335x/am335x_dmtreg.h ============================================================================== --- head/sys/arm/ti/am335x/am335x_dmtreg.h Fri Jan 27 03:44:50 2017 (r312858) +++ head/sys/arm/ti/am335x/am335x_dmtreg.h Fri Jan 27 04:08:24 2017 (r312859) @@ -62,7 +62,7 @@ #define DMT_TCLR_TRGMODE_BOTH (2 << 10) /* Trigger on match + ovflow */ #define DMT_TCLR_PWM_PTOGGLE (1 << 12) /* PWM toggles */ #define DMT_TCLR_CAP_MODE_2ND (1 << 13) /* Capture second event mode */ -#define DMT_TCLR_GPO_CFG (1 << 14) /* (no descr in datasheet) */ +#define DMT_TCLR_GPO_CFG (1 << 14) /* Tmr pin conf, 0=out, 1=in */ #define DMT_TCRR 0x3C /* Counter Register */ #define DMT_TLDR 0x40 /* Load Reg */ #define DMT_TTGR 0x44 /* Trigger Reg */ From owner-svn-src-all@freebsd.org Fri Jan 27 04:52: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 3BFCFCC396D; Fri, 27 Jan 2017 04:52:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08AFA238; Fri, 27 Jan 2017 04:52:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R4qSkg096822; Fri, 27 Jan 2017 04:52:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R4qS2M096821; Fri, 27 Jan 2017 04:52:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701270452.v0R4qS2M096821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 27 Jan 2017 04:52: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: r312860 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 04:52:29 -0000 Author: pfg Date: Fri Jan 27 04:52:27 2017 New Revision: 312860 URL: https://svnweb.freebsd.org/changeset/base/312860 Log: MFC r312538: Addition of clang nullability qualifiers. For consistency with the qualifiers added in r310977, define a new qualifier _Null_unspecified which is also defined in clang 3.7+. Add two new macros: __NULLABILITY_PRAGMA_PUSH __NULLABILITY_PRAGMA_POP These are for use in headers when we want avoid noisy warnings if some pointers are left without nullability annotations. These are added with way ahead of their first use to teach the GCC ports headers of their existance before their first use. Modified: stable/11/sys/sys/cdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Fri Jan 27 04:08:24 2017 (r312859) +++ stable/11/sys/sys/cdefs.h Fri Jan 27 04:52:27 2017 (r312860) @@ -793,6 +793,13 @@ #if !(defined(__clang__) && __has_feature(nullability)) #define _Nonnull #define _Nullable +#define _Null_unspecified +#define __NULLABILITY_PRAGMA_PUSH +#define __NULLABILITY_PRAGMA_POP +#else +#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") +#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop") #endif /* From owner-svn-src-all@freebsd.org Fri Jan 27 05:58: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 B0014CC379B; Fri, 27 Jan 2017 05:58: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 75C6B1BC2; Fri, 27 Jan 2017 05:58: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 v0R5wrWi020998; Fri, 27 Jan 2017 05:58:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R5wrLd020997; Fri, 27 Jan 2017 05:58:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701270558.v0R5wrLd020997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Jan 2017 05:58: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: r312861 - stable/11/sys/geom/multipath X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 05:58:54 -0000 Author: mav Date: Fri Jan 27 05:58:53 2017 New Revision: 312861 URL: https://svnweb.freebsd.org/changeset/base/312861 Log: MFC r312533: Report disk addition errors on `add` or `create` subcommand. Modified: stable/11/sys/geom/multipath/g_multipath.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/11/sys/geom/multipath/g_multipath.c Fri Jan 27 04:52:27 2017 (r312860) +++ stable/11/sys/geom/multipath/g_multipath.c Fri Jan 27 05:58:53 2017 (r312861) @@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req struct g_provider *pp; const char *mpname; static const char devpf[6] = "/dev/"; + int error; g_topology_assert(); @@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req return; } - /* - * Now add.... - */ - (void) g_multipath_add_disk(gp, pp); + error = g_multipath_add_disk(gp, pp); + if (error != 0) + gctl_error(req, "Provider addition error: %d", error); } static void From owner-svn-src-all@freebsd.org Fri Jan 27 05:59: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 373E4CC3803; Fri, 27 Jan 2017 05:59: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 03F901D14; Fri, 27 Jan 2017 05:59:27 +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 v0R5xRuN021081; Fri, 27 Jan 2017 05:59:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R5xRH9021080; Fri, 27 Jan 2017 05:59:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701270559.v0R5xRH9021080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Jan 2017 05:59: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: r312862 - stable/10/sys/geom/multipath X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 05:59:28 -0000 Author: mav Date: Fri Jan 27 05:59:26 2017 New Revision: 312862 URL: https://svnweb.freebsd.org/changeset/base/312862 Log: MFC r312533: Report disk addition errors on `add` or `create` subcommand. Modified: stable/10/sys/geom/multipath/g_multipath.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/10/sys/geom/multipath/g_multipath.c Fri Jan 27 05:58:53 2017 (r312861) +++ stable/10/sys/geom/multipath/g_multipath.c Fri Jan 27 05:59:26 2017 (r312862) @@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req struct g_provider *pp; const char *mpname; static const char devpf[6] = "/dev/"; + int error; g_topology_assert(); @@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req return; } - /* - * Now add.... - */ - (void) g_multipath_add_disk(gp, pp); + error = g_multipath_add_disk(gp, pp); + if (error != 0) + gctl_error(req, "Provider addition error: %d", error); } static void From owner-svn-src-all@freebsd.org Fri Jan 27 06:34: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 79D1ECC30BA; Fri, 27 Jan 2017 06:34:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 382FAE79; Fri, 27 Jan 2017 06:34:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 8A054D48547; Fri, 27 Jan 2017 17:34:46 +1100 (AEDT) Date: Fri, 27 Jan 2017 17:34:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff cc: Bruce Evans , Konstantin Belousov , Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 In-Reply-To: <20170126215927.GL2611@FreeBSD.org> Message-ID: <20170127171655.V2822@besplex.bde.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> <20170125222632.GQ2349@kib.kiev.ua> <20170126133341.V1087@besplex.bde.org> <20170126215927.GL2611@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=BKLDlBYG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=00JBZ9lbMtr6G8hdbWEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 06:34:55 -0000 On Thu, 26 Jan 2017, Gleb Smirnoff wrote: > On Thu, Jan 26, 2017 at 02:03:05PM +1100, Bruce Evans wrote: > B> On Thu, 26 Jan 2017, Konstantin Belousov wrote: > B> > B> > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: > B> >> Thanks, Luiz! > B> >> > B> >> One stylistic nit that I missed in review: > B> >> > B> >> L> static int > B> >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) > B> >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) > B> >> L> { > B> >> L> const struct ifreq *ifr = (struct ifreq *)data; > B> >> L> const struct sockaddr_in *addr = (const struct sockaddr_in *) > B> >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if > B> >> L> in_ifadown(&ia->ia_ifa, 1); > B> >> L> > B> >> L> if (ia->ia_ifa.ifa_carp) > B> >> L> - (*carp_detach_p)(&ia->ia_ifa); > B> >> L> + (*carp_detach_p)(&ia->ia_ifa, > B> >> L> + (cmd == SIOCDIFADDR) ? false : true); > B> >> > B> >> Can we change the very last line to: > B> >> > B> >> (cmd == SIOCAIFADDR) ? true : false); > B> > B> That is not stylistic, but invert the result. Perhaps you meant to > B> reverse the test to avoid negative logic for the result. > > It uses different ioctl value, so it doesn't invert result. Instead > of !SIOCDIFADDR I want more explicit SIOCAIFADDR. Oops. So it is non-stylistic in a different way. cmd can only be SIOCDIFADDR, or one or both of SIOCAIFADDR. Than is unclear. Assuming that the original code is correct and that all 3 cases can occur, inversion would break all 3 cases, while the non-stylistic change breaks only the O_SIOCAIFADDR case. Since there can be more than 2 cases and it isn't clear that there are at most 3, any boolean test on 1 of the cases is going to be unclear. Positive logic will be clearer, but that requires comparison with 2 cases. The current code use negative logic to select these 2 cases as the complement of the other case. Bruce From owner-svn-src-all@freebsd.org Fri Jan 27 07:45: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 F1202CC317C; Fri, 27 Jan 2017 07:45:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0144EA3; Fri, 27 Jan 2017 07:45:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R7j6jW065130; Fri, 27 Jan 2017 07:45:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R7j6Yk065129; Fri, 27 Jan 2017 07:45:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201701270745.v0R7j6Yk065129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 27 Jan 2017 07:45:06 +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: r312863 - stable/10/crypto/openssl/crypto/evp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 07:45:08 -0000 Author: delphij Date: Fri Jan 27 07:45:06 2017 New Revision: 312863 URL: https://svnweb.freebsd.org/changeset/base/312863 Log: Backport OpenSSL commit 56336b6c7a75ed28067cadedd8ac46572348bc2f: crypto/evp: harden RC4_MD5 cipher. Originally a crash in 32-bit build was reported CHACHA20-POLY1305 cipher. The crash is triggered by truncated packet and is result of excessive hashing to the edge of accessible memory (or bogus MAC value is produced if x86 MD5 assembly module is involved). Since hash operation is read-only it is not considered to be exploitable beyond a DoS condition. Thanks to Robert Święcki for report. This is a direct commit to stable/10. Security: CVE-2017-3731 Modified: stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Modified: stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c ============================================================================== --- stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Fri Jan 27 05:59:26 2017 (r312862) +++ stable/10/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c Fri Jan 27 07:45:06 2017 (r312863) @@ -267,6 +267,8 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_ len = p[arg - 2] << 8 | p[arg - 1]; if (!ctx->encrypt) { + if (len < MD5_DIGEST_LENGTH) + return -1; len -= MD5_DIGEST_LENGTH; p[arg - 2] = len >> 8; p[arg - 1] = len; From owner-svn-src-all@freebsd.org Fri Jan 27 08:30: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 90F9CCC28EE; Fri, 27 Jan 2017 08:30:44 +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 52C2F1078; Fri, 27 Jan 2017 08:30:44 +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 v0R8Uh9M081549; Fri, 27 Jan 2017 08:30:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R8UhcI081548; Fri, 27 Jan 2017 08:30:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201701270830.v0R8UhcI081548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 27 Jan 2017 08:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312864 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 08:30:44 -0000 Author: imp Date: Fri Jan 27 08:30:43 2017 New Revision: 312864 URL: https://svnweb.freebsd.org/changeset/base/312864 Log: Remove nested #ifdef that can't possibly be false. Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Fri Jan 27 07:45:06 2017 (r312863) +++ head/sys/cam/cam_iosched.c Fri Jan 27 08:30:43 2017 (r312864) @@ -1629,7 +1629,6 @@ cam_iosched_update(struct iop_stats *iop iop->sd = (int64_t)var < 0 ? 0 : isqrt64(var); } -#ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_io_metric_update(struct cam_iosched_softc *isc, sbintime_t sim_latency, int cmd, size_t size) @@ -1649,7 +1648,6 @@ cam_iosched_io_metric_update(struct cam_ break; } } -#endif #ifdef DDB static int biolen(struct bio_queue_head *bq) From owner-svn-src-all@freebsd.org Fri Jan 27 08:32: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 79E92CC2B53; Fri, 27 Jan 2017 08:32:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4953E15F1; Fri, 27 Jan 2017 08:32:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R8WoQE085362; Fri, 27 Jan 2017 08:32:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R8WoGG085361; Fri, 27 Jan 2017 08:32:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701270832.v0R8WoGG085361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 08:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312865 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 08:32:51 -0000 Author: hselasky Date: Fri Jan 27 08:32:50 2017 New Revision: 312865 URL: https://svnweb.freebsd.org/changeset/base/312865 Log: Enforce reading the consumer and producer counters once to ensure consistent return values from the mlx5e_sq_has_room_for() function. The two counters are incremented by different threads under different locks. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Fri Jan 27 08:30:43 2017 (r312864) +++ head/sys/dev/mlx5/mlx5_en/en.h Fri Jan 27 08:32:50 2017 (r312865) @@ -546,8 +546,10 @@ struct mlx5e_sq { static inline bool mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) { - return ((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n || - sq->cc == sq->pc); + u16 cc = sq->cc; + u16 pc = sq->pc; + + return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } struct mlx5e_channel { From owner-svn-src-all@freebsd.org Fri Jan 27 08:51: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 13871CC3174; Fri, 27 Jan 2017 08:51:50 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D73AA1E4B; Fri, 27 Jan 2017 08:51:49 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R8pm6L091306; Fri, 27 Jan 2017 08:51:48 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R8pmDZ091177; Fri, 27 Jan 2017 08:51:48 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701270851.v0R8pmDZ091177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 08:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312866 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 08:51:50 -0000 Author: arybchik Date: Fri Jan 27 08:51:48 2017 New Revision: 312866 URL: https://svnweb.freebsd.org/changeset/base/312866 Log: sfxge(4): cleanup: remove unused txq_index TxQ control structure member Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/sfxge_tx.c head/sys/dev/sfxge/sfxge_tx.h Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Fri Jan 27 08:32:50 2017 (r312865) +++ head/sys/dev/sfxge/sfxge_tx.c Fri Jan 27 08:51:48 2017 (r312866) @@ -1838,7 +1838,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u txq->type = type; txq->evq_index = evq_index; - txq->txq_index = txq_index; txq->init_state = SFXGE_TXQ_INITIALIZED; txq->hw_vlan_tci = 0; Modified: head/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.h Fri Jan 27 08:32:50 2017 (r312865) +++ head/sys/dev/sfxge/sfxge_tx.h Fri Jan 27 08:51:48 2017 (r312866) @@ -172,7 +172,6 @@ struct sfxge_txq { enum sfxge_flush_state flush_state; unsigned int tso_fw_assisted; enum sfxge_txq_type type; - unsigned int txq_index; unsigned int evq_index; efsys_mem_t mem; unsigned int buf_base_id; From owner-svn-src-all@freebsd.org Fri Jan 27 08:53: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 CC099CC334F; Fri, 27 Jan 2017 08:53:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B8BB1FF; Fri, 27 Jan 2017 08:53:12 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R8rBKj093568; Fri, 27 Jan 2017 08:53:11 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R8rBYn093567; Fri, 27 Jan 2017 08:53:11 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701270853.v0R8rBYn093567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 08:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312867 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 08:53:12 -0000 Author: arybchik Date: Fri Jan 27 08:53:11 2017 New Revision: 312867 URL: https://svnweb.freebsd.org/changeset/base/312867 Log: sfxge(4): cleanup: remvoe trailing tab Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/sfxge_rx.c Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Fri Jan 27 08:51:48 2017 (r312866) +++ head/sys/dev/sfxge/sfxge_rx.c Fri Jan 27 08:53:11 2017 (r312867) @@ -1096,7 +1096,7 @@ sfxge_rx_start(struct sfxge_softc *sc) encp = efx_nic_cfg_get(sc->enp); sc->rx_buffer_size = EFX_MAC_PDU(sc->ifnet->if_mtu); - /* Calculate the receive packet buffer size. */ + /* Calculate the receive packet buffer size. */ sc->rx_prefix_size = encp->enc_rx_prefix_size; /* Ensure IP headers are 32bit aligned */ From owner-svn-src-all@freebsd.org Fri Jan 27 08:54: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 E10BACC33D1; Fri, 27 Jan 2017 08:54:34 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0A193A4; Fri, 27 Jan 2017 08:54:34 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R8sX6W093666; Fri, 27 Jan 2017 08:54:33 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R8sXsT093665; Fri, 27 Jan 2017 08:54:33 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701270854.v0R8sXsT093665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 08:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312868 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 08:54:35 -0000 Author: arybchik Date: Fri Jan 27 08:54:33 2017 New Revision: 312868 URL: https://svnweb.freebsd.org/changeset/base/312868 Log: sfxge(4): cleanup: remove unused soft context struct member rxq_cache Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/sfxge.h Modified: head/sys/dev/sfxge/sfxge.h ============================================================================== --- head/sys/dev/sfxge/sfxge.h Fri Jan 27 08:53:11 2017 (r312867) +++ head/sys/dev/sfxge/sfxge.h Fri Jan 27 08:54:33 2017 (r312868) @@ -302,7 +302,6 @@ struct sfxge_softc { #endif unsigned int max_rss_channels; - uma_zone_t rxq_cache; struct sfxge_rxq *rxq[SFXGE_RX_SCALE_MAX]; unsigned int rx_indir_table[EFX_RSS_TBL_SIZE]; From owner-svn-src-all@freebsd.org Fri Jan 27 09: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 03B52CC3845; Fri, 27 Jan 2017 09:04:31 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7197B19; Fri, 27 Jan 2017 09:04:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R94Tng098124; Fri, 27 Jan 2017 09:04:29 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R94TTT098123; Fri, 27 Jan 2017 09:04:29 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270904.v0R94TTT098123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:04: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: r312869 - stable/10/share/zoneinfo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 09:04:31 -0000 Author: julian Date: Fri Jan 27 09:04:29 2017 New Revision: 312869 URL: https://svnweb.freebsd.org/changeset/base/312869 Log: MFH: r308671 When you select make OLDTIMEZONES=1 then you need a few added directories to be made or the command fails Sponsored by: panzura Modified: stable/10/share/zoneinfo/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/zoneinfo/Makefile ============================================================================== --- stable/10/share/zoneinfo/Makefile Fri Jan 27 08:54:33 2017 (r312868) +++ stable/10/share/zoneinfo/Makefile Fri Jan 27 09:04:29 2017 (r312869) @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV +.if defined(OLDTIMEZONES) +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil +.endif + all: zoneinfo .PHONY: zoneinfo From owner-svn-src-all@freebsd.org Fri Jan 27 09:07: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 C1B13CC38C0; Fri, 27 Jan 2017 09:07:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 860FCCAA; Fri, 27 Jan 2017 09:07:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R97BEQ098311; Fri, 27 Jan 2017 09:07:11 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R97Bo5098310; Fri, 27 Jan 2017 09:07:11 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270907.v0R97Bo5098310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:07: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: r312870 - stable/10/share/zoneinfo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 09:07:12 -0000 Author: julian Date: Fri Jan 27 09:07:11 2017 New Revision: 312870 URL: https://svnweb.freebsd.org/changeset/base/312870 Log: MFH: r310426 If you are going to be run individually to make a new timezone set then ensure the destination directories exist. Especially if you define OLDTIMEZONES because the mtree pass doesn't do it for you. MFC after: 1 week Sponsored by: Panzura Modified: stable/10/share/zoneinfo/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/zoneinfo/Makefile ============================================================================== --- stable/10/share/zoneinfo/Makefile Fri Jan 27 09:04:29 2017 (r312869) +++ stable/10/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) @@ -82,6 +82,8 @@ zoneinfo: yearistype ${TDATA} ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES} beforeinstall: + mkdir -p ${DESTDIR}/usr/share/zoneinfo + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} cd ${TZBUILDDIR} && \ find -s * -type f -print -exec ${INSTALL} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ From owner-svn-src-all@freebsd.org Fri Jan 27 09:11: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 05444CC3975; Fri, 27 Jan 2017 09:11:46 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8884FF6; Fri, 27 Jan 2017 09:11:45 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0R9BiYp000148; Fri, 27 Jan 2017 09:11:44 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0R9BiQr000147; Fri, 27 Jan 2017 09:11:44 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201701270911.v0R9BiQr000147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 27 Jan 2017 09:11: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: r312871 - stable/11/share/zoneinfo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 09:11:46 -0000 Author: julian Date: Fri Jan 27 09:11:44 2017 New Revision: 312871 URL: https://svnweb.freebsd.org/changeset/base/312871 Log: MFH: r308671 When you select make OLDTIMEZONES=1 then you need a few added directories to be made or the command fails Sponsored by: panzura MFH: r310426 If you are going to be run individually to make a new timezone set then ensure the destination directories exist. Especially if you define OLDTIMEZONES because the mtree pass doesn't do it for you. Sponsored by: Panzura Modified: stable/11/share/zoneinfo/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/zoneinfo/Makefile ============================================================================== --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV +.if defined(OLDTIMEZONES) +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil +.endif + .if !defined(_SKIP_BUILD) all: zoneinfo .endif @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} beforeinstall: install-zoneinfo install-zoneinfo: + mkdir -p ${DESTDIR}/usr/share/zoneinfo + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} cd ${TZBUILDDIR} && \ find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ From owner-svn-src-all@freebsd.org Fri Jan 27 10: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 9742ACC2A5B; Fri, 27 Jan 2017 10:03:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FEECC0A; Fri, 27 Jan 2017 10:03:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RA3pJS022493; Fri, 27 Jan 2017 10:03:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RA3o9Q022486; Fri, 27 Jan 2017 10:03:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271003.v0RA3o9Q022486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 10:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312872 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:03:52 -0000 Author: hselasky Date: Fri Jan 27 10:03:50 2017 New Revision: 312872 URL: https://svnweb.freebsd.org/changeset/base/312872 Log: Add support for reading advanced diagnostic counters. By default reading the diagnostic counters is disabled. The firmware decides which counters are supported and only those supported show up in the dev.mce.X.diagnostics sysctl tree. To enable reading of diagnostic counters set one or more of the following sysctls to one: dev.mce.X.conf.diag_general_enable=1 dev.mce.X.conf.diag_pci_enable=1 MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/diagnostics.h (contents, props changed) head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jan 27 09:11:44 2017 (r312871) +++ head/sys/conf/files Fri Jan 27 10:03:50 2017 (r312872) @@ -4462,6 +4462,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_flow_table.c optional mlx5 pci \ Added: head/sys/dev/mlx5/diagnostics.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/diagnostics.h Fri Jan 27 10:03:50 2017 (r312872) @@ -0,0 +1,138 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. 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 AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef MLX5_CORE_DIAGNOSTICS_H +#define MLX5_CORE_DIAGNOSTICS_H + +#define MLX5_CORE_DIAGNOSTICS_NUM(n, s, t) n +#define MLX5_CORE_DIAGNOSTICS_STRUCT(n, s, t) s, +#define MLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, + +struct mlx5_core_diagnostics_entry { + const char *const desc; + u16 counter_id; +}; + +#define MLX5_CORE_PCI_DIAGNOSTICS(m) \ +m(+1, pxd_ready_bp, 0x0401) \ +m(+1, pci_write_bp, 0x0402) \ +m(+1, pci_read_bp, 0x0403) \ +m(+1, pci_read_stuck_no_completion_buffer, 0x0404) \ +m(+1, max_pci_bw, 0x0405) \ +m(+1, used_pci_bw, 0x0406) \ +m(+1, rx_pci_errors, 0) \ +m(+1, tx_pci_errors, 0) \ +m(+1, tx_pci_correctable_errors, 0) \ +m(+1, tx_pci_non_fatal_errors, 0) \ +m(+1, tx_pci_fatal_errors, 0) + +#define MLX5_CORE_PCI_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_pci_diagnostics { + u64 array[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_PCI_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + +#define MLX5_CORE_GENERAL_DIAGNOSTICS(m) \ +m(+1, l0_mtt_miss, 0x0801) \ +m(+1, l0_mtt_hit, 0x0802) \ +m(+1, l1_mtt_miss, 0x0803) \ +m(+1, l1_mtt_hit, 0x0804) \ +m(+1, l0_mpt_miss, 0x0805) \ +m(+1, l0_mpt_hit, 0x0806) \ +m(+1, l1_mpt_miss, 0x0807) \ +m(+1, l1_mpt_hit, 0x0808) \ +m(+1, rxb_no_slow_path_credits, 0x0c01) \ +m(+1, rxb_no_fast_path_credits, 0x0c02) \ +m(+1, rxb_rxt_no_slow_path_cred_perf_count, 0x0c03) \ +m(+1, rxb_rxt_no_fast_path_cred_perf_count, 0x0c04) \ +m(+1, rxt_ctrl_perf_slice_load_slow, 0x1001) \ +m(+1, rxt_ctrl_perf_slice_load_fast, 0x1002) \ +m(+1, rxt_steering_perf_count_steering0_rse_work_rate, 0x1003) \ +m(+1, rxt_steering_perf_count_steering1_rse_work_rate, 0x1004) \ +m(+1, perf_count_tpt_credit, 0x1401) \ +m(+1, perf_wb_miss, 0x1402) \ +m(+1, perf_wb_hit, 0x1403) \ +m(+1, rxw_perf_rx_l1_slow_miss_ldb, 0x1404) \ +m(+1, rxw_perf_rx_l1_slow_hit_ldb, 0x1405) \ +m(+1, rxw_perf_rx_l1_fast_miss_ldb, 0x1406) \ +m(+1, rxw_perf_rx_l1_fast_hit_ldb, 0x1407) \ +m(+1, rxw_perf_l2_cache_read_miss_ldb, 0x1408) \ +m(+1, rxw_perf_l2_cache_read_hit_ldb, 0x1409) \ +m(+1, rxw_perf_rx_l1_slow_miss_reqsl, 0x140a) \ +m(+1, rxw_perf_rx_l1_slow_hit_reqsl, 0x140b) \ +m(+1, rxw_perf_rx_l1_fast_miss_reqsl, 0x140c) \ +m(+1, rxw_perf_rx_l1_fast_hit_reqsl, 0x140d) \ +m(+1, rxw_perf_l2_cache_read_miss_reqsl, 0x140e) \ +m(+1, rxw_perf_l2_cache_read_hit_reqsl, 0x140f) \ +m(+1, rxs_no_pxt_credits, 0x1801) \ +m(+1, rxc_eq_all_slices_busy, 0x1c01) \ +m(+1, rxc_cq_all_slices_busy, 0x1c02) \ +m(+1, rxc_msix_all_slices_busy, 0x1c03) \ +m(+1, sxw_qp_done_due_to_vl_limited, 0x2001) \ +m(+1, sxw_qp_done_due_to_desched, 0x2002) \ +m(+1, sxw_qp_done_due_to_work_done, 0x2003) \ +m(+1, sxw_qp_done_due_to_limited, 0x2004) \ +m(+1, sxw_qp_done_due_to_e2e_credits, 0x2005) \ +m(+1, sxw_packet_send_sxw2sxp_go_vld, 0x2006) \ +m(+1, sxw_perf_count_steering_hit, 0x2007) \ +m(+1, sxw_perf_count_steering_miss, 0x2008) \ +m(+1, sxw_perf_count_steering_rse_0, 0x2009) \ +m(+1, sxd_no_sched_credits, 0x2401) \ +m(+1, sxd_no_slow_path_sched_credits, 0x2402) \ +m(+1, tpt_indirect_mem_key, 0x2801) + +#define MLX5_CORE_GENERAL_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_general_diagnostics { + u64 array[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_GENERAL_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + +/* function prototypes */ +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *mdev, + u8 enable_pci, u8 enable_general); +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *mdev, + union mlx5_core_pci_diagnostics *ppci, + union mlx5_core_general_diagnostics *pgen); +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *mdev, u16 counter_id); + +#endif /* MLX5_CORE_DIAGNOSTICS_H */ Added: head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Fri Jan 27 10:03:50 2017 (r312872) @@ -0,0 +1,286 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. 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 AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[ + MLX5_CORE_PCI_DIAGNOSTICS_NUM] = { + MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[ + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM] = { + MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +static int mlx5_core_get_index_of_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + int size, u16 counter_id) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return -1; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) + return x; + } + return -1; +} + +static void mlx5_core_put_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + u64 *array, int size, u16 counter_id, u64 value) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) { + array[x] = value; + break; + } + } +} + +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *dev, + u8 enable_pci, u8 enable_general) +{ + void *diag_params_ctx; + void *in; + int numcounters; + int inlen; + int err; + int x; + int y; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + diag_params_ctx = MLX5_ADDR_OF(set_diagnostic_params_in, in, + diagnostic_params_ctx); + + MLX5_SET(diagnostic_params_context, diag_params_ctx, + enable, enable_pci || enable_general); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + single, 1); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + on_demand, 1); + + /* collect the counters we want to enable */ + for (x = y = 0; x != numcounters; x++) { + u16 counter_id = + MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id); + int index = -1; + + if (index < 0 && enable_pci != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_pci_diagnostics_table, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0 && enable_general != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_general_diagnostics_table, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0) + continue; + + MLX5_SET(diagnostic_params_context, + diag_params_ctx, + counter_id[y].counter_id, + counter_id); + y++; + } + + /* recompute input length */ + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * y; + + /* set number of counters */ + MLX5_SET(diagnostic_params_context, diag_params_ctx, + num_of_counters, y); + + /* execute firmware command */ + err = mlx5_set_diagnostic_params(dev, in, inlen); + + kvfree(in); + + return err; +} + +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *dev, + union mlx5_core_pci_diagnostics *pdiag, + union mlx5_core_general_diagnostics *pgen) +{ + void *out; + void *in; + int numcounters; + int outlen; + int inlen; + int err; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + outlen = MLX5_ST_SZ_BYTES(query_diagnostic_counters_out) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + + out = mlx5_vzalloc(outlen); + if (out == NULL) + return -ENOMEM; + + err = mlx5_query_diagnostic_counters(dev, 1, 0, out, outlen); + if (err == 0) { + for (x = 0; x != numcounters; x++) { + u16 counter_id = MLX5_GET( + query_diagnostic_counters_out, + out, diag_counter[x].counter_id); + u64 counter_value = MLX5_GET64( + query_diagnostic_counters_out, + out, diag_counter[x].counter_value_h); + + if (pdiag != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_pci_diagnostics_table, + pdiag->array, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + if (pgen != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_general_diagnostics_table, + pgen->array, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + } + } + kvfree(out); + + if (pdiag != NULL) { + inlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + outlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + out = mlx5_vzalloc(outlen); + if (out == NULL) { + kvfree(in); + return -ENOMEM; + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_performance_counters_data_layout); + + pdiag->counter.rx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, rx_errors); + pdiag->counter.tx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, tx_errors); + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_timers_and_states_data_layout); + + pdiag->counter.tx_pci_non_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, non_fatal_err_msg_sent); + pdiag->counter.tx_pci_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, fatal_err_msg_sent); + } + kvfree(in); + kvfree(out); + } + return 0; +} + +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *dev, u16 counter_id) +{ + int numcounters; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + /* check for any counter */ + if (counter_id == 0) + return 1; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + + /* check if counter ID exists in debug capability */ + for (x = 0; x != numcounters; x++) { + if (MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id) == + counter_id) + return 1; + } + return 0; /* not supported counter */ +} Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Fri Jan 27 09:11:44 2017 (r312871) +++ head/sys/dev/mlx5/mlx5_en/en.h Fri Jan 27 10:03:50 2017 (r312872) @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -406,7 +407,9 @@ struct mlx5e_params { m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ - m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") + m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ + m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ + m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) @@ -660,6 +663,8 @@ struct mlx5e_priv { struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; + union mlx5_core_pci_diagnostics params_pci; + union mlx5_core_general_diagnostics params_general; struct mtx async_events_mtx; /* sync hw events */ struct work_struct update_stats_work; struct work_struct update_carrier_work; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 27 09:11:44 2017 (r312871) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 27 10:03:50 2017 (r312872) @@ -377,6 +377,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(diag_pci_enable): + priv->params_ethtool.diag_pci_enable = + priv->params_ethtool.diag_pci_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + + case MLX5_PARAM_OFFSET(diag_general_enable): + priv->params_ethtool.diag_general_enable = + priv->params_ethtool.diag_general_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + default: break; } @@ -624,6 +642,45 @@ mlx5e_ethtool_debug_stats(SYSCTL_HANDLER return (error); } +static void +mlx5e_create_diagnostics(struct mlx5e_priv *priv) +{ + struct mlx5_core_diagnostics_entry entry; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *node; + int x; + + /* sysctl context we are using */ + ctx = &priv->sysctl_ctx; + + /* create root node */ + node = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, + "diagnostics", CTLFLAG_RD, NULL, "Diagnostics"); + if (node == NULL) + return; + + /* create PCI diagnostics */ + for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_pci_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_pci.array + x, + "PCI diagnostics counter"); + } + + /* create general diagnostics */ + for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_general_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_general.array + x, + "General diagnostics counter"); + } +} + void mlx5e_create_ethtool(struct mlx5e_priv *priv) { @@ -705,4 +762,7 @@ mlx5e_create_ethtool(struct mlx5e_priv * SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, mlx5e_read_eeprom, "I", "EEPROM information"); + + /* Diagnostics support */ + mlx5e_create_diagnostics(priv); } Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Jan 27 09:11:44 2017 (r312871) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri Jan 27 10:03:50 2017 (r312872) @@ -559,6 +559,16 @@ mlx5e_update_stats_work(struct work_stru free_out: kvfree(out); + + /* Update diagnostics, if any */ + if (priv->params_ethtool.diag_pci_enable || + priv->params_ethtool.diag_general_enable) { + int error = mlx5_core_get_diagnostics_full(mdev, + priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, + priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); + if (error != 0) + if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); + } PRIV_UNLOCK(priv); } Modified: head/sys/modules/mlx5/Makefile ============================================================================== --- head/sys/modules/mlx5/Makefile Fri Jan 27 09:11:44 2017 (r312871) +++ head/sys/modules/mlx5/Makefile Fri Jan 27 10:03:50 2017 (r312872) @@ -6,6 +6,7 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ +mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_eswitch_vacl.c \ mlx5_flow_table.c \ From owner-svn-src-all@freebsd.org Fri Jan 27 10:05: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 E1BE7CC2B08; Fri, 27 Jan 2017 10:05:18 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1073D98; Fri, 27 Jan 2017 10:05:18 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RA5HZg022589; Fri, 27 Jan 2017 10:05:17 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RA5H45022588; Fri, 27 Jan 2017 10:05:17 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201701271005.v0RA5H45022588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 27 Jan 2017 10:05:17 +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: r312873 - stable/10/sys/amd64/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:05:19 -0000 Author: tijl Date: Fri Jan 27 10:05:17 2017 New Revision: 312873 URL: https://svnweb.freebsd.org/changeset/base/312873 Log: MFC r312699: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 Modified: stable/10/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:03:50 2017 (r312872) +++ stable/10/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:05:17 2017 (r312873) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) From owner-svn-src-all@freebsd.org Fri Jan 27 10: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 F0A0ACC2C19; Fri, 27 Jan 2017 10:06:21 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCA18F4E; Fri, 27 Jan 2017 10:06:21 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RA6KI6022683; Fri, 27 Jan 2017 10:06:20 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RA6K2c022682; Fri, 27 Jan 2017 10:06:20 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201701271006.v0RA6K2c022682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 27 Jan 2017 10:06: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: r312874 - stable/11/sys/amd64/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:06:22 -0000 Author: tijl Date: Fri Jan 27 10:06:20 2017 New Revision: 312874 URL: https://svnweb.freebsd.org/changeset/base/312874 Log: MFC r312699: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 Modified: stable/11/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:05:17 2017 (r312873) +++ stable/11/sys/amd64/linux/linux_sysvec.c Fri Jan 27 10:06:20 2017 (r312874) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) From owner-svn-src-all@freebsd.org Fri Jan 27 10:20: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 4DEB8CC4163; Fri, 27 Jan 2017 10:20:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D4F51AD5; Fri, 27 Jan 2017 10:20:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RAKcO2027081; Fri, 27 Jan 2017 10:20:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RAKcC8027080; Fri, 27 Jan 2017 10:20:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271020.v0RAKcC8027080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 10:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312875 - head/sys/dev/mlx5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:20:39 -0000 Author: hselasky Date: Fri Jan 27 10:20:38 2017 New Revision: 312875 URL: https://svnweb.freebsd.org/changeset/base/312875 Log: Make fw_pages statistics counter 64-bit to avoid overflow. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Jan 27 10:06:20 2017 (r312874) +++ head/sys/dev/mlx5/driver.h Fri Jan 27 10:20:38 2017 (r312875) @@ -518,7 +518,7 @@ struct mlx5_priv { /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; - int fw_pages; + s64 fw_pages; atomic_t reg_pages; struct list_head free_list; From owner-svn-src-all@freebsd.org Fri Jan 27 10:36: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 D4343CC4847; Fri, 27 Jan 2017 10:36:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96ACC9EB; Fri, 27 Jan 2017 10:36:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RAanXO034656; Fri, 27 Jan 2017 10:36:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RAansB034654; Fri, 27 Jan 2017 10:36:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271036.v0RAansB034654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 10:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312876 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:36:50 -0000 Author: hselasky Date: Fri Jan 27 10:36:49 2017 New Revision: 312876 URL: https://svnweb.freebsd.org/changeset/base/312876 Log: Use ffs() to scan for first bit instead of using a for() loop. Minor code refactor while at it. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Jan 27 10:20:38 2017 (r312875) +++ head/sys/dev/mlx5/driver.h Fri Jan 27 10:36:49 2017 (r312876) @@ -859,7 +859,7 @@ void mlx5_cq_completion(struct mlx5_core void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:20:38 2017 (r312875) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:36:49 2017 (r312876) @@ -760,7 +760,7 @@ static void cmd_work_handler(struct work poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ rmb(); - mlx5_cmd_comp_handler(dev, 1UL << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1104,7 +1104,7 @@ static void free_msg(struct mlx5_core_de } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -1112,60 +1112,63 @@ void mlx5_cmd_comp_handler(struct mlx5_c void *context; int err; int i; + struct semaphore *sem; s64 ds; struct mlx5_cmd_stats *stats; unsigned long flags; - for (i = 0; i < (1 << cmd->log_sz); i++) { - if (test_bit(i, &vector)) { - struct semaphore *sem; - - ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; + while (vector != 0) { + i = ffs(vector) - 1; + vector &= ~(1U << i); + ent = cmd->ent_arr[i]; + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + ent->ts2 = ktime_get_ns(); + memcpy(ent->out->first.data, ent->lay->out, + sizeof(ent->lay->out)); + dump_command(dev, ent, 0); + if (!ent->ret) { + if (!cmd->checksum_disabled) + ent->ret = verify_signature(ent); else - sem = &cmd->sem; - ent->ts2 = ktime_get_ns(); - memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); - dump_command(dev, ent, 0); - if (!ent->ret) { - if (!cmd->checksum_disabled) - ent->ret = verify_signature(ent); - else - ent->ret = 0; - ent->status = ent->lay->status_own >> 1; - mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n", - ent->ret, deliv_status_to_str(ent->status), ent->status); - } - free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); - - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); - - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); + ent->ret = 0; + ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, + "FW command ret 0x%x, status %s(0x%x)\n", + ent->ret, + deliv_status_to_str(ent->status), + ent->status); + } + free_ent(cmd, ent->idx); + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); } - up(sem); + + callback = ent->callback; + context = ent->context; + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); + + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); + + free_cmd(ent); + callback(err, context); + } else { + complete(&ent->done); } + up(sem); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-all@freebsd.org Fri Jan 27 10:47: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 0FD7DCC4A48; Fri, 27 Jan 2017 10:47:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6A2F103D; Fri, 27 Jan 2017 10:47:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RAlrWu039212; Fri, 27 Jan 2017 10:47:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RAlrAl039211; Fri, 27 Jan 2017 10:47:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271047.v0RAlrAl039211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 10:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312877 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:47:55 -0000 Author: hselasky Date: Fri Jan 27 10:47:53 2017 New Revision: 312877 URL: https://svnweb.freebsd.org/changeset/base/312877 Log: Minor code refactor as a preparation step for suprise removal of CX-4 PCI device(s), changes: - alloc_entry() now clears bit for page slot entry aswell - update of cmd->ent_arr[] is now under cmd->alloc_lock - complete command if alloc_entry() fails MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:36:49 2017 (r312876) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:47:53 2017 (r312877) @@ -39,6 +39,11 @@ #include "mlx5_core.h" +static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size); +static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, + struct mlx5_cmd_msg *msg); +static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); + enum { CMD_IF_REV = 5, }; @@ -110,18 +115,27 @@ static u8 alloc_token(struct mlx5_cmd *c return token; } -static int alloc_ent(struct mlx5_cmd *cmd) +static int alloc_ent(struct mlx5_cmd_work_ent *ent) { unsigned long flags; - int ret; + struct mlx5_cmd *cmd = ent->cmd; + int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); - ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); - if (ret < cmd->max_reg_cmds) - clear_bit(ret, &cmd->bitmask); + if (!ent->page_queue) { + ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); + if (ret >= cmd->max_reg_cmds) + ret = -1; + } + + if (ret != -1) { + ent->idx = ret; + clear_bit(ent->idx, &cmd->bitmask); + cmd->ent_arr[ent->idx] = ent; + } spin_unlock_irqrestore(&cmd->alloc_lock, flags); - return ret < cmd->max_reg_cmds ? ret : -1; + return ret; } static void free_ent(struct mlx5_cmd *cmd, int idx) @@ -704,6 +718,49 @@ static void dump_command(struct mlx5_cor pr_debug("\n"); } +static void complete_command(struct mlx5_cmd_work_ent *ent) +{ + struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, + cmd); + s64 ds; + struct mlx5_cmd_stats *stats; + unsigned long flags; + int err; + struct semaphore *sem; + + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); + } + + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); + + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); + + free_cmd(ent); + ent->callback(err, ent->context); + } else { + complete(&ent->done); + } + up(sem); +} + static void cmd_work_handler(struct work_struct *work) { struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); @@ -719,19 +776,13 @@ static void cmd_work_handler(struct work } down(sem); - if (!ent->page_queue) { - ent->idx = alloc_ent(cmd); - if (ent->idx < 0) { - mlx5_core_err(dev, "failed to allocate command entry\n"); - up(sem); - return; - } - } else { - ent->idx = cmd->max_reg_cmds; + + if (alloc_ent(ent) < 0) { + complete_command(ent); + return; } ent->token = alloc_token(cmd); - cmd->ent_arr[ent->idx] = ent; lay = get_inst(cmd, ent->idx); ent->lay = lay; memset(lay, 0, sizeof(*lay)); @@ -1108,23 +1159,12 @@ void mlx5_cmd_comp_handler(struct mlx5_c { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; - mlx5_cmd_cbk_t callback; - void *context; - int err; int i; - struct semaphore *sem; - s64 ds; - struct mlx5_cmd_stats *stats; - unsigned long flags; while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; - else - sem = &cmd->sem; ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); @@ -1142,33 +1182,7 @@ void mlx5_cmd_comp_handler(struct mlx5_c ent->status); } free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); - - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); - - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); - } - up(sem); + complete_command(ent); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-all@freebsd.org Fri Jan 27 10: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 7ECC8CC4D1F; Fri, 27 Jan 2017 10:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E2F51725; Fri, 27 Jan 2017 10:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RAu3E5043024; Fri, 27 Jan 2017 10:56:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RAu3iC043023; Fri, 27 Jan 2017 10:56:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271056.v0RAu3iC043023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 10:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312878 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:56:04 -0000 Author: hselasky Date: Fri Jan 27 10:56:03 2017 New Revision: 312878 URL: https://svnweb.freebsd.org/changeset/base/312878 Log: Fix command completion with callback scenario. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:47:53 2017 (r312877) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 10:56:03 2017 (r312878) @@ -723,6 +723,9 @@ static void complete_command(struct mlx5 struct mlx5_cmd *cmd = ent->cmd; struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd); + mlx5_cmd_cbk_t callback; + void *context; + s64 ds; struct mlx5_cmd_stats *stats; unsigned long flags; @@ -744,6 +747,8 @@ static void complete_command(struct mlx5 spin_unlock_irqrestore(&stats->lock, flags); } + callback = ent->callback; + context = ent->context; err = ent->ret; if (!err) err = mlx5_copy_from_msg(ent->uout, @@ -754,7 +759,7 @@ static void complete_command(struct mlx5 free_msg(dev, ent->in); free_cmd(ent); - ent->callback(err, ent->context); + callback(err, context); } else { complete(&ent->done); } From owner-svn-src-all@freebsd.org Fri Jan 27 10:57: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 64539CC4D83; Fri, 27 Jan 2017 10:57:32 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 0203A18C2; Fri, 27 Jan 2017 10:57:32 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id d140so57625241wmd.2; Fri, 27 Jan 2017 02:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:references:to:reply-to:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=P44pRlq9rA1Zw4DIntShZPTX4fXyX/DG8QgOyYnx7EI=; b=KqCc4OpJngurjSFvgzQeIx+HaQko6Lnsi1GDpDCsBMSOCTe6qH5Y4hYO6qDkmjsMyq RoXmyaspklzAC3tlx1IOHAoVmHHBxXStZz1e8048bePT5Fg8cjfmyyvpAkPWZJDTpwDl Pt9MnEgaaNBcLOdXRwEG4TcGzuKGaoAQgvcW3lSvjoduHSWFNBeQftjz1Kq0xlgcCkCr 28XjINySre5vr2BECJT6UNLlG6C17wzSCuuI23JCm9caDgbuGQdTuk+YMQ9jcazYUxMA C8NdmX497Pos8o7N04ri7pvKwaPLU0udQjOp/KWii63z/JWVYpNb1OWtQyo0EuMz8xUL m4Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:references:to:reply-to:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=P44pRlq9rA1Zw4DIntShZPTX4fXyX/DG8QgOyYnx7EI=; b=IwAdqgH5StK8mx69YfLutibwP5YvlSWOz1qKkGfJ5UHsyoWWNUkHJI2gkWzk2IWFMY NRhV3nulbF+VxTW9e1EH+uLwh1PqSSjjHRzuDqior3E+F0wooiERLOqvhcPMd1fmvvJj olVHgSfZfN10WkSMniXqu0HqCmChlsFeCx+lwPafQB8il2rPYeiMaC5Wd9J9Cn3hqLZu t6YF2IjsZJqLveFU5/IrfuRtxw89h02UWQFrzrP6vRtoPxjvF8hzIloYK0ZPzvDE1Nl0 ZSwntY4+uDgCgD3Lp8tJELA++bO4yJRiYYDbIU2QUsAOy+YzKoyXyhmoudotkxtiGSFv hcZw== X-Gm-Message-State: AIkVDXLBSWeNSNyd9QiSgqN9UeYcl6cMp9ITr6Ghi4pcRHB4y2A2QefmJUvedQ06vngs3A== X-Received: by 10.28.50.135 with SMTP id y129mr2448504wmy.2.1485514649664; Fri, 27 Jan 2017 02:57:29 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id e74sm3264244wmd.2.2017.01.27.02.57.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jan 2017 02:57:29 -0800 (PST) From: Michal Meloun X-Google-Original-From: Michal Meloun Subject: Re: svn commit: r312743 - head/sys/dev/cesa References: <201701251022.v0PAM70M046189@repo.freebsd.org> To: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: mmel@freebsd.org Message-ID: <06845374-0a4d-dc59-ee6f-39f76422a445@freebsd.org> Date: Fri, 27 Jan 2017 11:57:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <201701251022.v0PAM70M046189@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 10:57:32 -0000 This breaks DB-88F6XXX kernel with: --- cesa.o --- ... /usr2/Meloun/git/tegra/sys/dev/cesa/cesa.c:960:57: error: use of undeclared identifier 'CESA_SA_CMD_SHA2' CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2); ^ /usr2/Meloun/git/tegra/sys/dev/cesa/cesa.c:1209:10: error: use of undeclared identifier 'CESA_TDMA_NUM_OUTSTAND' val |= CESA_TDMA_NUM_OUTSTAND; ^ 2 errors generated. *** [cesa.o] Error code 1 Michal On 25.01.2017 11:22, Wojciech Macek wrote: > Author: wma > Date: Wed Jan 25 10:22:07 2017 > New Revision: 312743 > URL: https://svnweb.freebsd.org/changeset/base/312743 > > Log: > Use SoC ID - based detection in CESA > > This commit introduces following changes in order to get rid of > ifdef's from all around the driver. > * Introduce sc_soc_id field in cesa_softc structure - this value is > obtained in cesa_attach() anyway, so make use of it. > * Replace ifdefs with SoC ID checks. > * Perform PM control status only for relevant SoC's. > > Submitted by: Marcin Wojtas > Obtained from: Semihalf > Sponsored by: Stormshield > Reviewed by: zbb > Differential revision: https://reviews.freebsd.org/D9247 > > Modified: > head/sys/dev/cesa/cesa.c > head/sys/dev/cesa/cesa.h > > Modified: head/sys/dev/cesa/cesa.c > ============================================================================== > --- head/sys/dev/cesa/cesa.c Wed Jan 25 07:51:53 2017 (r312742) > +++ head/sys/dev/cesa/cesa.c Wed Jan 25 10:22:07 2017 (r312743) > @@ -953,11 +953,13 @@ cesa_execute(struct cesa_softc *sc) > ctd = STAILQ_FIRST(&cr->cr_tdesc); > > CESA_TDMA_WRITE(sc, CESA_TDMA_ND, ctd->ctd_cthd_paddr); > -#if defined (SOC_MV_ARMADA38X) > - CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2); > -#else > - CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE); > -#endif > + > + if (sc->sc_soc_id == MV_DEV_88F6828 || > + sc->sc_soc_id == MV_DEV_88F6820 || > + sc->sc_soc_id == MV_DEV_88F6810) > + CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2); > + else > + CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE); > > CESA_UNLOCK(sc, requests); > } > @@ -968,6 +970,7 @@ cesa_setup_sram(struct cesa_softc *sc) > phandle_t sram_node; > ihandle_t sram_ihandle; > pcell_t sram_handle, sram_reg[2]; > + void *sram_va; > int rv; > > rv = OF_getencprop(ofw_bus_get_node(sc->sc_dev), "sram-handle", > @@ -986,15 +989,17 @@ cesa_setup_sram(struct cesa_softc *sc) > /* Store SRAM size to be able to unmap in detach() */ > sc->sc_sram_size = sram_reg[1]; > > -#if defined(SOC_MV_ARMADA38X) > - void *sram_va; > + if (sc->sc_soc_id != MV_DEV_88F6828 && > + sc->sc_soc_id != MV_DEV_88F6820 && > + sc->sc_soc_id != MV_DEV_88F6810) > + return (0); > > /* SRAM memory was not mapped in platform_sram_devmap(), map it now */ > sram_va = pmap_mapdev(sc->sc_sram_base_pa, sc->sc_sram_size); > if (sram_va == NULL) > return (ENOMEM); > sc->sc_sram_base_va = (vm_offset_t)sram_va; > -#endif > + > return (0); > } > > @@ -1018,7 +1023,7 @@ static int > cesa_attach(device_t dev) > { > struct cesa_softc *sc; > - uint32_t d, r; > + uint32_t d, r, val; > int error; > int i; > > @@ -1027,23 +1032,19 @@ cesa_attach(device_t dev) > sc->sc_error = 0; > sc->sc_dev = dev; > > - /* Check if CESA peripheral device has power turned on */ > -#if defined(SOC_MV_KIRKWOOD) > - if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) == CPU_PM_CTRL_CRYPTO) { > - device_printf(dev, "not powered on\n"); > - return (ENXIO); > - } > -#else > - if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != CPU_PM_CTRL_CRYPTO) { > - device_printf(dev, "not powered on\n"); > - return (ENXIO); > - } > -#endif > soc_id(&d, &r); > > switch (d) { > case MV_DEV_88F6281: > case MV_DEV_88F6282: > + /* Check if CESA peripheral device has power turned on */ > + if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) == > + CPU_PM_CTRL_CRYPTO) { > + device_printf(dev, "not powered on\n"); > + return (ENXIO); > + } > + sc->sc_tperr = 0; > + break; > case MV_DEV_88F6828: > case MV_DEV_88F6820: > case MV_DEV_88F6810: > @@ -1051,12 +1052,20 @@ cesa_attach(device_t dev) > break; > case MV_DEV_MV78100: > case MV_DEV_MV78100_Z0: > + /* Check if CESA peripheral device has power turned on */ > + if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != > + CPU_PM_CTRL_CRYPTO) { > + device_printf(dev, "not powered on\n"); > + return (ENXIO); > + } > sc->sc_tperr = CESA_ICR_TPERR; > break; > default: > return (ENXIO); > } > > + sc->sc_soc_id = d; > + > /* Initialize mutexes */ > mtx_init(&sc->sc_sc_lock, device_get_nameunit(dev), > "CESA Shared Data", MTX_DEF); > @@ -1191,12 +1200,15 @@ cesa_attach(device_t dev) > * - Outstanding reads enabled, > * - No byte-swap. > */ > - CESA_TDMA_WRITE(sc, CESA_TDMA_CR, CESA_TDMA_CR_DBL128 | > - CESA_TDMA_CR_SBL128 | CESA_TDMA_CR_ORDEN | CESA_TDMA_CR_NBS | > -#if defined (SOC_MV_ARMADA38X) > - CESA_TDMA_NUM_OUTSTAND | > -#endif > - CESA_TDMA_CR_ENABLE); > + val = CESA_TDMA_CR_DBL128 | CESA_TDMA_CR_SBL128 | > + CESA_TDMA_CR_ORDEN | CESA_TDMA_CR_NBS | CESA_TDMA_CR_ENABLE; > + > + if (sc->sc_soc_id == MV_DEV_88F6828 || > + sc->sc_soc_id == MV_DEV_88F6820 || > + sc->sc_soc_id == MV_DEV_88F6810) > + val |= CESA_TDMA_NUM_OUTSTAND; > + > + CESA_TDMA_WRITE(sc, CESA_TDMA_CR, val); > > /* > * Initialize SA: > @@ -1248,9 +1260,10 @@ err4: > err3: > bus_teardown_intr(dev, sc->sc_res[RES_CESA_IRQ], sc->sc_icookie); > err2: > -#if defined(SOC_MV_ARMADA38X) > - pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); > -#endif > + if (sc->sc_soc_id == MV_DEV_88F6828 || > + sc->sc_soc_id == MV_DEV_88F6820 || > + sc->sc_soc_id == MV_DEV_88F6810) > + pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); > err1: > bus_release_resources(dev, cesa_res_spec, sc->sc_res); > err0: > @@ -1298,10 +1311,12 @@ cesa_detach(device_t dev) > /* Relase I/O and IRQ resources */ > bus_release_resources(dev, cesa_res_spec, sc->sc_res); > > -#if defined(SOC_MV_ARMADA38X) > /* Unmap SRAM memory */ > - pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); > -#endif > + if (sc->sc_soc_id == MV_DEV_88F6828 || > + sc->sc_soc_id == MV_DEV_88F6820 || > + sc->sc_soc_id == MV_DEV_88F6810) > + pmap_unmapdev(sc->sc_sram_base_va, sc->sc_sram_size); > + > /* Destroy mutexes */ > mtx_destroy(&sc->sc_sessions_lock); > mtx_destroy(&sc->sc_requests_lock); > > Modified: head/sys/dev/cesa/cesa.h > ============================================================================== > --- head/sys/dev/cesa/cesa.h Wed Jan 25 07:51:53 2017 (r312742) > +++ head/sys/dev/cesa/cesa.h Wed Jan 25 10:22:07 2017 (r312743) > @@ -231,6 +231,7 @@ struct cesa_packet { > struct cesa_softc { > device_t sc_dev; > int32_t sc_cid; > + uint32_t sc_soc_id; > struct resource *sc_res[RES_CESA_NUM]; > void *sc_icookie; > bus_dma_tag_t sc_data_dtag; > From owner-svn-src-all@freebsd.org Fri Jan 27 11:03: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 A1347CC4F7B; Fri, 27 Jan 2017 11:03:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BFB21EA9; Fri, 27 Jan 2017 11:03:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RB3w7e046831; Fri, 27 Jan 2017 11:03:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RB3w8P046830; Fri, 27 Jan 2017 11:03:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271103.v0RB3w8P046830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 11:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312879 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:03:59 -0000 Author: hselasky Date: Fri Jan 27 11:03:58 2017 New Revision: 312879 URL: https://svnweb.freebsd.org/changeset/base/312879 Log: Rename struct fw_page into struct mlx5_fw_page as a preparation step for adding busdma support. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 10:56:03 2017 (r312878) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 11:03:58 2017 (r312879) @@ -37,7 +37,7 @@ struct mlx5_pages_req { struct work_struct work; }; -struct fw_page { +struct mlx5_fw_page { struct rb_node rb_node; u64 addr; struct page *page; @@ -76,13 +76,13 @@ static int insert_page(struct mlx5_core_ struct rb_root *root = &dev->priv.page_root; struct rb_node **new = &root->rb_node; struct rb_node *parent = NULL; - struct fw_page *nfp; - struct fw_page *tfp; + struct mlx5_fw_page *nfp; + struct mlx5_fw_page *tfp; int i; while (*new) { parent = *new; - tfp = rb_entry(parent, struct fw_page, rb_node); + tfp = rb_entry(parent, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) new = &parent->rb_left; else if (tfp->addr > addr) @@ -107,15 +107,15 @@ static int insert_page(struct mlx5_core_ return 0; } -static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) +static struct mlx5_fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) { struct rb_root *root = &dev->priv.page_root; struct rb_node *tmp = root->rb_node; - struct fw_page *result = NULL; - struct fw_page *tfp; + struct mlx5_fw_page *result = NULL; + struct mlx5_fw_page *tfp; while (tmp) { - tfp = rb_entry(tmp, struct fw_page, rb_node); + tfp = rb_entry(tmp, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) { tmp = tmp->rb_left; } else if (tfp->addr > addr) { @@ -155,13 +155,13 @@ static int mlx5_cmd_query_pages(struct m static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) { - struct fw_page *fp; + struct mlx5_fw_page *fp; unsigned n; if (list_empty(&dev->priv.free_list)) return -ENOMEM; - fp = list_entry(dev->priv.free_list.next, struct fw_page, list); + fp = list_entry(dev->priv.free_list.next, struct mlx5_fw_page, list); n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask)); if (n >= MLX5_NUM_4K_IN_PAGE) { mlx5_core_warn(dev, "alloc 4k bug\n"); @@ -179,7 +179,7 @@ static int alloc_4k(struct mlx5_core_dev static void free_4k(struct mlx5_core_dev *dev, u64 addr) { - struct fw_page *fwp; + struct mlx5_fw_page *fwp; int n; fwp = find_fw_page(dev, addr & PAGE_MASK); @@ -439,7 +439,7 @@ static int optimal_reclaimed_pages(void) int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev) { int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); - struct fw_page *fwp; + struct mlx5_fw_page *fwp; struct rb_node *p; int nclaimed = 0; int err; @@ -447,7 +447,7 @@ int mlx5_reclaim_startup_pages(struct ml do { p = rb_first(&dev->priv.page_root); if (p) { - fwp = rb_entry(p, struct fw_page, rb_node); + fwp = rb_entry(p, struct mlx5_fw_page, rb_node); err = reclaim_pages(dev, fwp->func_id, optimal_reclaimed_pages(), &nclaimed); From owner-svn-src-all@freebsd.org Fri Jan 27 11:19: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 48B1ECC3335; Fri, 27 Jan 2017 11:19:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 236C28EB; Fri, 27 Jan 2017 11:19:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBJ77w051171; Fri, 27 Jan 2017 11:19:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBJ7P9051168; Fri, 27 Jan 2017 11:19:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271119.v0RBJ7P9051168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 11:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312880 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:19:08 -0000 Author: hselasky Date: Fri Jan 27 11:19:06 2017 New Revision: 312880 URL: https://svnweb.freebsd.org/changeset/base/312880 Log: Wait for all VFs pages to be reclaimed before closing EQ pages. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Jan 27 11:03:58 2017 (r312879) +++ head/sys/dev/mlx5/driver.h Fri Jan 27 11:19:06 2017 (r312880) @@ -43,6 +43,7 @@ #include #define MLX5_QCOUNTER_SETS_NETDEV 64 +#define MLX5_MAX_NUMBER_OF_VFS 128 enum { MLX5_BOARD_ID_LEN = 64, @@ -521,7 +522,7 @@ struct mlx5_priv { s64 fw_pages; atomic_t reg_pages; struct list_head free_list; - + s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; struct mlx5_srq_table srq_table; @@ -850,6 +851,7 @@ void mlx5_core_req_pages_handler(struct s32 npages); int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev); void mlx5_register_debugfs(void); void mlx5_unregister_debugfs(void); int mlx5_eq_init(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Jan 27 11:03:58 2017 (r312879) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Jan 27 11:19:06 2017 (r312880) @@ -853,6 +853,7 @@ static void mlx5_dev_cleanup(struct mlx5 mlx5_cleanup_qp_table(dev); mlx5_cleanup_cq_table(dev); unmap_bf_area(dev); + mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); mlx5_free_uuars(dev, &priv->uuari); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 11:03:58 2017 (r312879) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 11:19:06 2017 (r312880) @@ -27,6 +27,7 @@ #include #include +#include #include #include "mlx5_core.h" @@ -282,6 +283,7 @@ retry: goto out_alloc; } dev->priv.fw_pages += npages; + dev->priv.pages_per_func[func_id] += npages; if (out.hdr.status) { err = mlx5_cmd_status_to_err(&out.hdr); @@ -355,7 +357,7 @@ static int reclaim_pages(struct mlx5_cor *nclaimed = num_claimed; dev->priv.fw_pages -= num_claimed; - + dev->priv.pages_per_func[func_id] -= num_claimed; for (i = 0; i < num_claimed; i++) { addr = be64_to_cpu(out->pas[i]); free_4k(dev, addr); @@ -423,6 +425,31 @@ enum { MLX5_BLKS_FOR_RECLAIM_PAGES = 12 }; +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev) +{ + int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); + s64 prevpages = 0; + s64 npages = 0; + + while (!time_after(jiffies, end)) { + /* exclude own function, VFs only */ + npages = dev->priv.fw_pages - dev->priv.pages_per_func[0]; + if (!npages) + break; + + if (npages != prevpages) + end = end + msecs_to_jiffies(100); + + prevpages = npages; + msleep(1); + } + + if (npages) + mlx5_core_warn(dev, "FW did not return all VFs pages, will cause to memory leak\n"); + + return -npages; +} + static int optimal_reclaimed_pages(void) { struct mlx5_cmd_prot_block *block; From owner-svn-src-all@freebsd.org Fri Jan 27 11:29: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 2A76FCC3707; Fri, 27 Jan 2017 11:29:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED9B4EF6; Fri, 27 Jan 2017 11:29:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBTY9C055374; Fri, 27 Jan 2017 11:29:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBTXQ5055368; Fri, 27 Jan 2017 11:29:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271129.v0RBTXQ5055368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 11:29:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312881 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:29:35 -0000 Author: hselasky Date: Fri Jan 27 11:29:33 2017 New Revision: 312881 URL: https://svnweb.freebsd.org/changeset/base/312881 Log: Add support for device surprise removal and other PCI errors. - When device disappears from PCI indicate error device state and: 1) Trigger command completion for all pending commands 2) Prevent new commands from executing and return: - success for modify and remove/cleanup commands - failure for create/query commands 3) When reclaiming pages for a device in error state don't ask FW to return all given pages, just release the allocated memory MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Jan 27 11:19:06 2017 (r312880) +++ head/sys/dev/mlx5/driver.h Fri Jan 27 11:29:33 2017 (r312881) @@ -713,6 +713,7 @@ struct mlx5_cmd_work_ent { u64 ts1; u64 ts2; u16 op; + u8 busy; }; struct mlx5_pas { @@ -791,6 +792,7 @@ static inline void *mlx5_vmalloc(unsigne return rtn; } +void mlx5_enter_error_state(struct mlx5_core_dev *dev); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); @@ -862,6 +864,7 @@ void mlx5_rsc_event(struct mlx5_core_dev void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 11:19:06 2017 (r312880) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 11:29:33 2017 (r312881) @@ -119,6 +119,8 @@ static int alloc_ent(struct mlx5_cmd_wor { unsigned long flags; struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = + container_of(cmd, struct mlx5_core_dev, cmd); int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); @@ -128,7 +130,11 @@ static int alloc_ent(struct mlx5_cmd_wor ret = -1; } + if (dev->state != MLX5_DEVICE_STATE_UP) + ret = -1; + if (ret != -1) { + ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, &cmd->bitmask); cmd->ent_arr[ent->idx] = ent; @@ -205,12 +211,16 @@ static void set_signature(struct mlx5_cm static void poll_timeout(struct mlx5_cmd_work_ent *ent) { - int poll_end = jiffies + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); + struct mlx5_core_dev *dev = container_of(ent->cmd, + struct mlx5_core_dev, cmd); + int poll_end = jiffies + + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); u8 own; do { own = ent->lay->status_own; - if (!(own & CMD_OWNER_HW)) { + if (!(own & CMD_OWNER_HW) || + dev->state != MLX5_DEVICE_STATE_UP) { ent->ret = 0; return; } @@ -718,6 +728,173 @@ static void dump_command(struct mlx5_cor pr_debug("\n"); } +static int set_internal_err_outbox(struct mlx5_core_dev *dev, u16 opcode, + struct mlx5_outbox_hdr *hdr) +{ + hdr->status = 0; + hdr->syndrome = 0; + + switch (opcode) { + case MLX5_CMD_OP_TEARDOWN_HCA: + case MLX5_CMD_OP_DISABLE_HCA: + case MLX5_CMD_OP_MANAGE_PAGES: + case MLX5_CMD_OP_DESTROY_MKEY: + case MLX5_CMD_OP_DESTROY_EQ: + case MLX5_CMD_OP_DESTROY_CQ: + case MLX5_CMD_OP_DESTROY_QP: + case MLX5_CMD_OP_DESTROY_PSV: + case MLX5_CMD_OP_DESTROY_SRQ: + case MLX5_CMD_OP_DESTROY_XRC_SRQ: + case MLX5_CMD_OP_DESTROY_DCT: + case MLX5_CMD_OP_DEALLOC_Q_COUNTER: + case MLX5_CMD_OP_DEALLOC_PD: + case MLX5_CMD_OP_DEALLOC_UAR: + case MLX5_CMD_OP_DETACH_FROM_MCG: + case MLX5_CMD_OP_DEALLOC_XRCD: + case MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY: + case MLX5_CMD_OP_DESTROY_LAG: + case MLX5_CMD_OP_DESTROY_VPORT_LAG: + case MLX5_CMD_OP_DESTROY_TIR: + case MLX5_CMD_OP_DESTROY_SQ: + case MLX5_CMD_OP_DESTROY_RQ: + case MLX5_CMD_OP_DESTROY_RMP: + case MLX5_CMD_OP_DESTROY_TIS: + case MLX5_CMD_OP_DESTROY_RQT: + case MLX5_CMD_OP_DESTROY_FLOW_TABLE: + case MLX5_CMD_OP_DESTROY_FLOW_GROUP: + case MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_DEALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_2ERR_QP: + case MLX5_CMD_OP_2RST_QP: + case MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_FLOW_TABLE: + case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT: + case MLX5_CMD_OP_DEALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_DESTROY_QOS_PARA_VPORT: + case MLX5_CMD_OP_MODIFY_VPORT_STATE: + case MLX5_CMD_OP_MODIFY_SQ: + case MLX5_CMD_OP_MODIFY_RQ: + case MLX5_CMD_OP_MODIFY_TIS: + case MLX5_CMD_OP_MODIFY_LAG: + case MLX5_CMD_OP_MODIFY_TIR: + case MLX5_CMD_OP_MODIFY_RMP: + case MLX5_CMD_OP_MODIFY_RQT: + case MLX5_CMD_OP_MODIFY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_MODIFY_CONG_PARAMS: + case MLX5_CMD_OP_MODIFY_CONG_STATUS: + case MLX5_CMD_OP_MODIFY_CQ: + case MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP: + case MLX5_CMD_OP_ACCESS_REG: + case MLX5_CMD_OP_DRAIN_DCT: + return 0; + + case MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_ALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_ALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_ALLOC_PD: + case MLX5_CMD_OP_ALLOC_Q_COUNTER: + case MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_ALLOC_UAR: + case MLX5_CMD_OP_ALLOC_XRCD: + case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION: + case MLX5_CMD_OP_ARM_RQ: + case MLX5_CMD_OP_ARM_XRC_SRQ: + case MLX5_CMD_OP_ATTACH_TO_MCG: + case MLX5_CMD_OP_CONFIG_INT_MODERATION: + case MLX5_CMD_OP_CREATE_CQ: + case MLX5_CMD_OP_CREATE_DCT: + case MLX5_CMD_OP_CREATE_EQ: + case MLX5_CMD_OP_CREATE_FLOW_GROUP: + case MLX5_CMD_OP_CREATE_FLOW_TABLE: + case MLX5_CMD_OP_CREATE_LAG: + case MLX5_CMD_OP_CREATE_MKEY: + case MLX5_CMD_OP_CREATE_PSV: + case MLX5_CMD_OP_CREATE_QOS_PARA_VPORT: + case MLX5_CMD_OP_CREATE_QP: + case MLX5_CMD_OP_CREATE_RMP: + case MLX5_CMD_OP_CREATE_RQ: + case MLX5_CMD_OP_CREATE_RQT: + case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_CREATE_SQ: + case MLX5_CMD_OP_CREATE_SRQ: + case MLX5_CMD_OP_CREATE_TIR: + case MLX5_CMD_OP_CREATE_TIS: + case MLX5_CMD_OP_CREATE_VPORT_LAG: + case MLX5_CMD_OP_CREATE_XRC_SRQ: + case MLX5_CMD_OP_ENABLE_HCA: + case MLX5_CMD_OP_GEN_EQE: + case MLX5_CMD_OP_GET_DROPPED_PACKET_LOG: + case MLX5_CMD_OP_INIT2INIT_QP: + case MLX5_CMD_OP_INIT2RTR_QP: + case MLX5_CMD_OP_INIT_HCA: + case MLX5_CMD_OP_MAD_IFC: + case MLX5_CMD_OP_NOP: + case MLX5_CMD_OP_PAGE_FAULT_RESUME: + case MLX5_CMD_OP_QUERY_ADAPTER: + case MLX5_CMD_OP_QUERY_CONG_PARAMS: + case MLX5_CMD_OP_QUERY_CONG_STATISTICS: + case MLX5_CMD_OP_QUERY_CONG_STATUS: + case MLX5_CMD_OP_QUERY_CQ: + case MLX5_CMD_OP_QUERY_DCT: + case MLX5_CMD_OP_QUERY_EQ: + case MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_FLOW_COUNTER: + case MLX5_CMD_OP_QUERY_FLOW_GROUP: + case MLX5_CMD_OP_QUERY_FLOW_TABLE: + case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_HCA_CAP: + case MLX5_CMD_OP_QUERY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_HCA_VPORT_GID: + case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY: + case MLX5_CMD_OP_QUERY_ISSI: + case MLX5_CMD_OP_QUERY_L2_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_LAG: + case MLX5_CMD_OP_QUERY_MAD_DEMUX: + case MLX5_CMD_OP_QUERY_MKEY: + case MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_OTHER_HCA_CAP: + case MLX5_CMD_OP_QUERY_PAGES: + case MLX5_CMD_OP_QUERY_QP: + case MLX5_CMD_OP_QUERY_Q_COUNTER: + case MLX5_CMD_OP_QUERY_RMP: + case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: + case MLX5_CMD_OP_QUERY_RQ: + case MLX5_CMD_OP_QUERY_RQT: + case MLX5_CMD_OP_QUERY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS: + case MLX5_CMD_OP_QUERY_SQ: + case MLX5_CMD_OP_QUERY_SRQ: + case MLX5_CMD_OP_QUERY_TIR: + case MLX5_CMD_OP_QUERY_TIS: + case MLX5_CMD_OP_QUERY_VPORT_COUNTER: + case MLX5_CMD_OP_QUERY_VPORT_STATE: + case MLX5_CMD_OP_QUERY_XRC_SRQ: + case MLX5_CMD_OP_RST2INIT_QP: + case MLX5_CMD_OP_RTR2RTS_QP: + case MLX5_CMD_OP_RTS2RTS_QP: + case MLX5_CMD_OP_SET_DC_CNAK_TRACE: + case MLX5_CMD_OP_SET_HCA_CAP: + case MLX5_CMD_OP_SET_ISSI: + case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: + case MLX5_CMD_OP_SET_MAD_DEMUX: + case MLX5_CMD_OP_SET_ROCE_ADDRESS: + case MLX5_CMD_OP_SQD_RTS_QP: + case MLX5_CMD_OP_SQERR2RTS_QP: + hdr->status = MLX5_CMD_STAT_INT_ERR; + hdr->syndrome = 0xFFFFFFFF; + return -ECANCELED; + default: + mlx5_core_err(dev, "Unknown FW command (%d)\n", opcode); + return -EINVAL; + } +} + static void complete_command(struct mlx5_cmd_work_ent *ent) { struct mlx5_cmd *cmd = ent->cmd; @@ -737,6 +914,18 @@ static void complete_command(struct mlx5 else sem = &cmd->sem; + if (dev->state != MLX5_DEVICE_STATE_UP) { + struct mlx5_outbox_hdr *out_hdr = + (struct mlx5_outbox_hdr *)ent->out; + struct mlx5_inbox_hdr *in_hdr = + (struct mlx5_inbox_hdr *)(ent->in->first.data); + u16 opcode = be16_to_cpu(in_hdr->opcode); + + ent->ret = set_internal_err_outbox(dev, + opcode, + out_hdr); + } + if (ent->callback) { ds = ent->ts2 - ent->ts1; if (ent->op < ARRAY_SIZE(cmd->stats)) { @@ -805,7 +994,7 @@ static void cmd_work_handler(struct work set_signature(ent, !cmd->checksum_disabled); dump_command(dev, ent, 1); ent->ts1 = ktime_get_ns(); - + ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); wmb(); @@ -872,6 +1061,7 @@ static int wait_func(struct mlx5_core_de else err = 0; } + if (err == -ETIMEDOUT) { mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), @@ -1180,6 +1370,7 @@ void mlx5_cmd_comp_handler(struct mlx5_c else ent->ret = 0; ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, "FW command ret 0x%x, status %s(0x%x)\n", ent->ret, @@ -1192,6 +1383,33 @@ void mlx5_cmd_comp_handler(struct mlx5_c } EXPORT_SYMBOL(mlx5_cmd_comp_handler); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) +{ + unsigned long vector; + int i = 0; + unsigned long flags; + synchronize_irq(dev->priv.eq_table.cmd_eq.irqn); + spin_lock_irqsave(&dev->cmd.alloc_lock, flags); + vector = ~dev->cmd.bitmask & ((1ul << (1 << dev->cmd.log_sz)) - 1); + spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); + + if (!vector) + return; + + for (i = 0; i < (1 << dev->cmd.log_sz); i++) { + struct mlx5_cmd_work_ent *ent = dev->cmd.ent_arr[i]; + + if (!test_bit(i, &vector)) + continue; + + while (ent->busy) + usleep_range(1000, 1100); + free_ent(&dev->cmd, i); + complete_command(ent); + } +} +EXPORT_SYMBOL(mlx5_trigger_cmd_completions); + static int status_to_err(u8 status) { return status ? -1 : 0; /* TBD more meaningful codes */ @@ -1234,8 +1452,10 @@ static int is_manage_pages(struct mlx5_i return be16_to_cpu(in->opcode) == MLX5_CMD_OP_MANAGE_PAGES; } -static int cmd_exec_helper(struct mlx5_core_dev *dev, void *in, int in_size, void *out, - int out_size, mlx5_cmd_cbk_t callback, void *context) +static int cmd_exec_helper(struct mlx5_core_dev *dev, + void *in, int in_size, + void *out, int out_size, + mlx5_cmd_cbk_t callback, void *context) { struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; @@ -1603,3 +1823,4 @@ int mlx5_cmd_status_to_err_v2(void *ptr) return cmd_status_to_err_helper(status); } + Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Jan 27 11:19:06 2017 (r312880) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Fri Jan 27 11:29:33 2017 (r312881) @@ -122,6 +122,9 @@ static void poll_health(unsigned long da int next; u32 count; + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Jan 27 11:19:06 2017 (r312880) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Jan 27 11:29:33 2017 (r312881) @@ -1140,3 +1140,13 @@ static void __exit cleanup(void) module_init(init); module_exit(cleanup); + +void mlx5_enter_error_state(struct mlx5_core_dev *dev) +{ + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + + dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; + mlx5_trigger_cmd_completions(dev); +} +EXPORT_SYMBOL(mlx5_enter_error_state); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 11:19:06 2017 (r312880) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Fri Jan 27 11:29:33 2017 (r312881) @@ -475,14 +475,21 @@ int mlx5_reclaim_startup_pages(struct ml p = rb_first(&dev->priv.page_root); if (p) { fwp = rb_entry(p, struct mlx5_fw_page, rb_node); - err = reclaim_pages(dev, fwp->func_id, - optimal_reclaimed_pages(), - &nclaimed); - if (err) { - mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", - err); - return err; + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + --dev->priv.fw_pages; + free_4k(dev, fwp->addr); + nclaimed = 1; + } else { + err = reclaim_pages(dev, fwp->func_id, + optimal_reclaimed_pages(), + &nclaimed); + if (err) { + mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", + err); + return err; + } } + if (nclaimed) end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); } From owner-svn-src-all@freebsd.org Fri Jan 27 11:46: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 754E9CC3B54; Fri, 27 Jan 2017 11:46:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D7A91768; Fri, 27 Jan 2017 11:46:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBku4m063181; Fri, 27 Jan 2017 11:46:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBkuZp063176; Fri, 27 Jan 2017 11:46:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201701271146.v0RBkuZp063176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 27 Jan 2017 11:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312882 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:46:57 -0000 Author: hselasky Date: Fri Jan 27 11:46:55 2017 New Revision: 312882 URL: https://svnweb.freebsd.org/changeset/base/312882 Log: Use the busdma API to allocate all DMA-able memory. The MLX5 driver has four different types of DMA allocations which are now allocated using busdma: 1) The 4K firmware DMA-able blocks. One busdma object per 4K allocation. 2) Data for firmware commands use the 4K firmware blocks split into four 1K blocks. 3) The 4K firmware blocks are also used for doorbell pages. 4) The RQ-, SQ- and CQ- DMA rings. One busdma object per allocation. After this patch the mlx5en driver can be used with DMAR enabled in the FreeBSD kernel. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_alloc.c head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Fri Jan 27 11:29:33 2017 (r312881) +++ head/sys/dev/mlx5/device.h Fri Jan 27 11:46:55 2017 (r312882) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,6 +103,7 @@ __mlx5_mask(typ, fld)) enum { MLX5_MAX_COMMANDS = 32, MLX5_CMD_DATA_BLOCK_SIZE = 512, + MLX5_CMD_MBOX_SIZE = 1024, MLX5_PCI_CMD_XPORT = 7, MLX5_MKEY_BSF_OCTO_SIZE = 4, MLX5_MAX_PSVS = 4, @@ -523,6 +524,11 @@ struct mlx5_cmd_prot_block { u8 sig; }; +#define MLX5_NUM_CMDS_IN_ADAPTER_PAGE \ + (MLX5_ADAPTER_PAGE_SIZE / MLX5_CMD_MBOX_SIZE) +CTASSERT(MLX5_CMD_MBOX_SIZE >= sizeof(struct mlx5_cmd_prot_block)); +CTASSERT(MLX5_CMD_MBOX_SIZE <= MLX5_ADAPTER_PAGE_SIZE); + enum { MLX5_CQE_SYND_FLUSHED_IN_ERROR = 5, }; Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Fri Jan 27 11:29:33 2017 (r312881) +++ head/sys/dev/mlx5/driver.h Fri Jan 27 11:46:55 2017 (r312882) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -258,13 +258,26 @@ struct mlx5_cmd_first { __be32 data[4]; }; -struct mlx5_cmd_msg { - struct list_head list; - struct cache_ent *cache; - u32 len; - struct mlx5_cmd_first first; - struct mlx5_cmd_mailbox *next; +struct cache_ent; +struct mlx5_fw_page { + union { + struct rb_node rb_node; + struct list_head list; + }; + struct mlx5_cmd_first first; + struct mlx5_core_dev *dev; + bus_dmamap_t dma_map; + bus_addr_t dma_addr; + void *virt_addr; + struct cache_ent *cache; + u32 numpages; + u16 load_done; +#define MLX5_LOAD_ST_NONE 0 +#define MLX5_LOAD_ST_SUCCESS 1 +#define MLX5_LOAD_ST_FAILURE 2 + u16 func_id; }; +#define mlx5_cmd_msg mlx5_fw_page struct mlx5_cmd_debug { struct dentry *dbg_root; @@ -304,9 +317,16 @@ struct mlx5_cmd_stats { }; struct mlx5_cmd { - void *cmd_alloc_buf; - dma_addr_t alloc_dma; - int alloc_size; + struct mlx5_fw_page *cmd_page; + bus_dma_tag_t dma_tag; + struct sx dma_sx; + struct mtx dma_mtx; +#define MLX5_DMA_OWNED(dev) mtx_owned(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_LOCK(dev) mtx_lock(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_UNLOCK(dev) mtx_unlock(&(dev)->cmd.dma_mtx) + struct cv dma_cv; +#define MLX5_DMA_DONE(dev) cv_broadcast(&(dev)->cmd.dma_cv) +#define MLX5_DMA_WAIT(dev) cv_wait(&(dev)->cmd.dma_cv, &(dev)->cmd.dma_mtx) void *cmd_buf; dma_addr_t dma; u16 cmdif_rev; @@ -331,7 +351,6 @@ struct mlx5_cmd { struct semaphore pages_sem; int mode; struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; - struct pci_pool *pool; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -345,24 +364,18 @@ struct mlx5_port_caps { u8 ext_port_cap; }; -struct mlx5_cmd_mailbox { - void *buf; - dma_addr_t dma; - struct mlx5_cmd_mailbox *next; -}; - -struct mlx5_buf_list { - void *buf; - dma_addr_t map; -}; - struct mlx5_buf { - struct mlx5_buf_list direct; - struct mlx5_buf_list *page_list; - int nbufs; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + struct mlx5_core_dev *dev; + struct { + void *buf; + } direct; + u64 *page_list; int npages; int size; u8 page_shift; + u8 load_done; }; struct mlx5_eq { @@ -521,7 +534,6 @@ struct mlx5_priv { struct rb_root page_root; s64 fw_pages; atomic_t reg_pages; - struct list_head free_list; s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; @@ -664,7 +676,7 @@ struct mlx5_vport_counters { }; enum { - MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES, + MLX5_DB_PER_PAGE = MLX5_ADAPTER_PAGE_SIZE / L1_CACHE_BYTES, }; struct mlx5_core_dct { @@ -688,6 +700,7 @@ enum { struct mlx5_db_pgdir { struct list_head list; DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE); + struct mlx5_fw_page *fw_page; __be32 *db_page; dma_addr_t db_dma; }; @@ -697,6 +710,7 @@ typedef void (*mlx5_cmd_cbk_t)(int statu struct mlx5_cmd_work_ent { struct mlx5_cmd_msg *in; struct mlx5_cmd_msg *out; + int uin_size; void *uout; int uout_size; mlx5_cmd_cbk_t callback; @@ -721,13 +735,10 @@ struct mlx5_pas { u8 log_sz; }; -static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset) +static inline void * +mlx5_buf_offset(struct mlx5_buf *buf, int offset) { - if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1)) - return buf->direct.buf + offset; - else - return buf->page_list[offset >> PAGE_SHIFT].buf + - (offset & (PAGE_SIZE - 1)); + return ((char *)buf->direct.buf + offset); } @@ -816,8 +827,9 @@ void mlx5_health_cleanup(void); void __init mlx5_health_init(void); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node); + +#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ + mlx5_buf_alloc(dev, size, direct, buf) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -845,6 +857,12 @@ int mlx5_core_alloc_pd(struct mlx5_core_ int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, u16 opmod, u8 port); +void mlx5_fwp_flush(struct mlx5_fw_page *fwp); +void mlx5_fwp_invalidate(struct mlx5_fw_page *fwp); +struct mlx5_fw_page *mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags, unsigned num); +void mlx5_fwp_free(struct mlx5_fw_page *fwp); +u64 mlx5_fwp_get_dma(struct mlx5_fw_page *fwp, size_t offset); +void *mlx5_fwp_get_virt(struct mlx5_fw_page *fwp, size_t offset); void mlx5_pagealloc_init(struct mlx5_core_dev *dev); void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); int mlx5_pagealloc_start(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_alloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Fri Jan 27 11:29:33 2017 (r312881) +++ head/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Fri Jan 27 11:46:55 2017 (r312882) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,106 +40,110 @@ * multiple pages, so we don't require too much contiguous memory. */ -static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, - size_t size, dma_addr_t *dma_handle, - int node) +static void +mlx5_buf_load_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - void *cpu_handle; - - cpu_handle = dma_zalloc_coherent(&dev->pdev->dev, size, - dma_handle, GFP_KERNEL); - return cpu_handle; -} - -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node) -{ - dma_addr_t t; - - buf->size = size; - if (size <= max_direct) { - buf->nbufs = 1; - buf->npages = 1; - buf->page_shift = (u8)get_order(size) + PAGE_SHIFT; - buf->direct.buf = mlx5_dma_zalloc_coherent_node(dev, size, - &t, node); - if (!buf->direct.buf) - return -ENOMEM; - - buf->direct.map = t; - - while (t & ((1 << buf->page_shift) - 1)) { - --buf->page_shift; - buf->npages *= 2; + struct mlx5_buf *buf; + uint8_t owned; + int x; + + buf = (struct mlx5_buf *)arg; + owned = MLX5_DMA_OWNED(buf->dev); + + if (!owned) + MLX5_DMA_LOCK(buf->dev); + + if (error == 0) { + for (x = 0; x != nseg; x++) { + buf->page_list[x] = segs[x].ds_addr; + KASSERT(segs[x].ds_len == PAGE_SIZE, ("Invalid segment size")); } + buf->load_done = MLX5_LOAD_ST_SUCCESS; } else { - int i; - - buf->direct.buf = NULL; - buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE; - buf->npages = buf->nbufs; - buf->page_shift = PAGE_SHIFT; - buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list), - GFP_KERNEL); - - for (i = 0; i < buf->nbufs; i++) { - buf->page_list[i].buf = - mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &t, node); + buf->load_done = MLX5_LOAD_ST_FAILURE; + } + MLX5_DMA_DONE(buf->dev); - buf->page_list[i].map = t; - } + if (!owned) + MLX5_DMA_UNLOCK(buf->dev); +} - if (BITS_PER_LONG == 64) { - struct page **pages; +int +mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, + int max_direct, struct mlx5_buf *buf) +{ + int err; - pages = kmalloc(sizeof(*pages) * (buf->nbufs + 1), - GFP_KERNEL); - for (i = 0; i < buf->nbufs; i++) - pages[i] = virt_to_page(buf->page_list[i].buf); - pages[buf->nbufs] = pages[0]; - buf->direct.buf = vmap(pages, buf->nbufs + 1, VM_MAP, - PAGE_KERNEL); - kfree(pages); - if (!buf->direct.buf) - goto err_free; - } + buf->npages = howmany(size, PAGE_SIZE); + buf->page_shift = PAGE_SHIFT; + buf->load_done = MLX5_LOAD_ST_NONE; + buf->dev = dev; + buf->page_list = kcalloc(buf->npages, sizeof(*buf->page_list), + GFP_KERNEL); + + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + PAGE_SIZE * buf->npages, /* maxsize */ + buf->npages, /* nsegments */ + PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &buf->dma_tag); + + if (err != 0) + goto err_dma_tag; + + /* allocate memory */ + err = -bus_dmamem_alloc(buf->dma_tag, &buf->direct.buf, + BUS_DMA_WAITOK | BUS_DMA_COHERENT, &buf->dma_map); + if (err != 0) + goto err_dma_alloc; + + /* load memory into DMA */ + MLX5_DMA_LOCK(dev); + err = bus_dmamap_load( + buf->dma_tag, buf->dma_map, buf->direct.buf, + PAGE_SIZE * buf->npages, &mlx5_buf_load_mem_cb, + buf, BUS_DMA_WAITOK | BUS_DMA_COHERENT); + + while (buf->load_done == MLX5_LOAD_ST_NONE) + MLX5_DMA_WAIT(dev); + MLX5_DMA_UNLOCK(dev); + + /* check for error */ + if (buf->load_done != MLX5_LOAD_ST_SUCCESS) { + err = -ENOMEM; + goto err_dma_load; } - return 0; - -err_free: - mlx5_buf_free(dev, buf); + /* clean memory */ + memset(buf->direct.buf, 0, PAGE_SIZE * buf->npages); - return -ENOMEM; + /* flush memory to RAM */ + bus_dmamap_sync(buf->dev->cmd.dma_tag, buf->dma_map, BUS_DMASYNC_PREWRITE); + return (0); + +err_dma_load: + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); +err_dma_alloc: + bus_dma_tag_destroy(buf->dma_tag); +err_dma_tag: + kfree(buf->page_list); + return (err); } -int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf) -{ - return mlx5_buf_alloc_node(dev, size, max_direct, - buf, dev->priv.numa_node); -} -EXPORT_SYMBOL_GPL(mlx5_buf_alloc); - - void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) { - if (buf->nbufs == 1) - dma_free_coherent(&dev->pdev->dev, buf->size, buf->direct.buf, - buf->direct.map); - else { - int i; - if (BITS_PER_LONG == 64 && buf->direct.buf) - vunmap(buf->direct.buf); - - for (i = 0; i < buf->nbufs; i++) - if (buf->page_list[i].buf) - dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, - buf->page_list[i].buf, - buf->page_list[i].map); - kfree(buf->page_list); - } + + bus_dmamap_unload(buf->dma_tag, buf->dma_map); + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); + bus_dma_tag_destroy(buf->dma_tag); + kfree(buf->page_list); } EXPORT_SYMBOL_GPL(mlx5_buf_free); @@ -152,8 +156,17 @@ static struct mlx5_db_pgdir *mlx5_alloc_ bitmap_fill(pgdir->bitmap, MLX5_DB_PER_PAGE); - pgdir->db_page = mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &pgdir->db_dma, node); + pgdir->fw_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (pgdir->fw_page != NULL) { + pgdir->db_page = pgdir->fw_page->virt_addr; + pgdir->db_dma = pgdir->fw_page->dma_addr; + + /* clean allocated memory */ + memset(pgdir->db_page, 0, MLX5_ADAPTER_PAGE_SIZE); + + /* flush memory to RAM */ + mlx5_fwp_flush(pgdir->fw_page); + } if (!pgdir->db_page) { kfree(pgdir); return NULL; @@ -228,8 +241,7 @@ void mlx5_db_free(struct mlx5_core_dev * __set_bit(db->index, db->u.pgdir->bitmap); if (bitmap_full(db->u.pgdir->bitmap, MLX5_DB_PER_PAGE)) { - dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, - db->u.pgdir->db_page, db->u.pgdir->db_dma); + mlx5_fwp_free(db->u.pgdir->fw_page); list_del(&db->u.pgdir->list); kfree(db->u.pgdir); } @@ -238,19 +250,12 @@ void mlx5_db_free(struct mlx5_core_dev * } EXPORT_SYMBOL_GPL(mlx5_db_free); - -void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) +void +mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) { - u64 addr; int i; - for (i = 0; i < buf->npages; i++) { - if (buf->nbufs == 1) - addr = buf->direct.map + ((u64)i << buf->page_shift); - else - addr = buf->page_list[i].map; - - pas[i] = cpu_to_be64(addr); - } + for (i = 0; i != buf->npages; i++) + pas[i] = cpu_to_be64(buf->page_list[i]); } EXPORT_SYMBOL_GPL(mlx5_fill_page_array); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 11:29:33 2017 (r312881) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Fri Jan 27 11:46:55 2017 (r312882) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,6 +77,7 @@ enum { static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t cbk, @@ -90,6 +91,7 @@ static struct mlx5_cmd_work_ent *alloc_c return ERR_PTR(-ENOMEM); ent->in = in; + ent->uin_size = uin_size; ent->out = out; ent->uout = uout; ent->uout_size = uout_size; @@ -192,14 +194,26 @@ static void calc_block_sig(struct mlx5_c } } -static void calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) +static void +calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) { - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; - while (next) { - calc_block_sig(next->buf, token, csum); - next = next->next; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + + /* compute signature */ + calc_block_sig(block, token, csum); + + /* check for last block */ + if (block->next == 0) + break; } + + /* make sure data gets written to RAM */ + mlx5_fwp_flush(msg); } static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) @@ -235,10 +249,11 @@ static void free_cmd(struct mlx5_cmd_wor kfree(ent); } - -static int verify_signature(struct mlx5_cmd_work_ent *ent) +static int +verify_signature(struct mlx5_cmd_work_ent *ent) { - struct mlx5_cmd_mailbox *next = ent->out->next; + struct mlx5_cmd_msg *msg = ent->out; + size_t i; int err; u8 sig; @@ -246,15 +261,21 @@ static int verify_signature(struct mlx5_ if (sig != 0xff) return -EINVAL; - while (next) { - err = verify_block_sig(next->buf); - if (err) - return err; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; - next = next->next; - } + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); - return 0; + /* compute signature */ + err = verify_block_sig(block); + if (err != 0) + return (err); + + /* check for last block */ + if (block->next == 0) + break; + } + return (0); } static void dump_buf(void *buf, int size, int data_only, int offset) @@ -681,9 +702,10 @@ static void dump_command(struct mlx5_cor { u16 op = be16_to_cpu(((struct mlx5_inbox_hdr *)(ent->lay->in))->opcode); struct mlx5_cmd_msg *msg = input ? ent->in : ent->out; - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; int data_only; - u32 offset = 0; + int offset = 0; + int msg_len = input ? ent->uin_size : ent->uout_size; int dump_len; data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA)); @@ -711,17 +733,28 @@ static void dump_command(struct mlx5_cor offset += sizeof(*ent->lay); } - while (next && offset < msg->len) { + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + if (data_only) { - dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset); - dump_buf(next->buf, dump_len, 1, offset); + if (offset >= msg_len) + break; + dump_len = min_t(int, + MLX5_CMD_DATA_BLOCK_SIZE, msg_len - offset); + + dump_buf(block->data, dump_len, 1, offset); offset += MLX5_CMD_DATA_BLOCK_SIZE; } else { mlx5_core_dbg(dev, "command block:\n"); - dump_buf(next->buf, sizeof(struct mlx5_cmd_prot_block), 0, offset); - offset += sizeof(struct mlx5_cmd_prot_block); + dump_buf(block, sizeof(*block), 0, offset); + offset += sizeof(*block); } - next = next->next; + + /* check for last block */ + if (block->next == 0) + break; } if (data_only) @@ -982,12 +1015,12 @@ static void cmd_work_handler(struct work memset(lay, 0, sizeof(*lay)); memcpy(lay->in, ent->in->first.data, sizeof(lay->in)); ent->op = be32_to_cpu(lay->in[0]) >> 16; - if (ent->in->next) - lay->in_ptr = cpu_to_be64(ent->in->next->dma); - lay->inlen = cpu_to_be32(ent->in->len); - if (ent->out->next) - lay->out_ptr = cpu_to_be64(ent->out->next->dma); - lay->outlen = cpu_to_be32(ent->out->len); + if (ent->in->numpages != 0) + lay->in_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->in, 0)); + if (ent->out->numpages != 0) + lay->out_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->out, 0)); + lay->inlen = cpu_to_be32(ent->uin_size); + lay->outlen = cpu_to_be32(ent->uout_size); lay->type = MLX5_PCI_CMD_XPORT; lay->token = ent->token; lay->status_own = CMD_OWNER_HW; @@ -997,14 +1030,14 @@ static void cmd_work_handler(struct work ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); - wmb(); + /* make sure data is written to RAM */ + mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); /* if not in polling don't use ent after this point*/ if (cmd->mode == CMD_MODE_POLLING) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - rmb(); mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1078,6 +1111,7 @@ static int wait_func(struct mlx5_core_de * 2. page queue commands do not support asynchrous completion */ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t callback, void *context, int page_queue, u8 *status) @@ -1092,8 +1126,8 @@ static int mlx5_cmd_invoke(struct mlx5_c if (callback && page_queue) return -EINVAL; - ent = alloc_cmd(cmd, in, out, uout, uout_size, callback, context, - page_queue); + ent = alloc_cmd(cmd, in, uin_size, out, uout, uout_size, callback, + context, page_queue); if (IS_ERR(ent)) return PTR_ERR(ent); @@ -1138,159 +1172,98 @@ out: return err; } -static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) +static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, size_t size) { - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; - - if (!to || !from) - return -ENOMEM; - - copy = min_t(int, size, sizeof(to->first.data)); - memcpy(to->first.data, from, copy); - size -= copy; - from += copy; - - next = to->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + size_t delta; + size_t i; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; - memcpy(block->data, from, copy); - from += copy; - size -= copy; - next = next->next; - } + if (to == NULL || from == NULL) + return (-ENOMEM); - return 0; -} + delta = min_t(size_t, size, sizeof(to->first.data)); + memcpy(to->first.data, from, delta); + from = (char *)from + delta; + size -= delta; -static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size) -{ - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; - - if (!to || !from) - return -ENOMEM; - - copy = min_t(int, size, sizeof(from->first.data)); - memcpy(to, from->first.data, copy); - size -= copy; - to += copy; - - next = from->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; + block = mlx5_fwp_get_virt(to, i * MLX5_CMD_MBOX_SIZE); - memcpy(to, block->data, copy); - to += copy; - size -= copy; - next = next->next; + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(block->data, from, delta); + from = (char *)from + delta; + size -= delta; } - - return 0; + return (0); } -static struct mlx5_cmd_mailbox *alloc_cmd_box(struct mlx5_core_dev *dev, - gfp_t flags) +static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size) { - struct mlx5_cmd_mailbox *mailbox; + size_t delta; + size_t i; - mailbox = kmalloc(sizeof(*mailbox), flags); - if (!mailbox) - return ERR_PTR(-ENOMEM); + if (to == NULL || from == NULL) + return (-ENOMEM); - mailbox->buf = pci_pool_alloc(dev->cmd.pool, flags, - &mailbox->dma); - if (!mailbox->buf) { - mlx5_core_dbg(dev, "failed allocation\n"); - kfree(mailbox); - return ERR_PTR(-ENOMEM); - } - memset(mailbox->buf, 0, sizeof(struct mlx5_cmd_prot_block)); - mailbox->next = NULL; + delta = min_t(size_t, size, sizeof(from->first.data)); + memcpy(to, from->first.data, delta); + to = (char *)to + delta; + size -= delta; - return mailbox; -} + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; -static void free_cmd_box(struct mlx5_core_dev *dev, - struct mlx5_cmd_mailbox *mailbox) -{ - pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma); - kfree(mailbox); + block = mlx5_fwp_get_virt(from, i * MLX5_CMD_MBOX_SIZE); + + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(to, block->data, delta); + to = (char *)to + delta; + size -= delta; + } + return (0); } -static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, - gfp_t flags, int size) +static struct mlx5_cmd_msg * +mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, gfp_t flags, size_t size) { - struct mlx5_cmd_mailbox *tmp, *head = NULL; - struct mlx5_cmd_prot_block *block; struct mlx5_cmd_msg *msg; - int blen; - int err; - int n; - int i; + size_t blen; + size_t n; + size_t i; - msg = kzalloc(sizeof(*msg), flags); - if (!msg) - return ERR_PTR(-ENOMEM); + blen = size - min_t(size_t, sizeof(msg->first.data), size); + n = howmany(blen, MLX5_CMD_DATA_BLOCK_SIZE); - blen = size - min_t(int, sizeof(msg->first.data), size); - n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) / MLX5_CMD_DATA_BLOCK_SIZE; + msg = mlx5_fwp_alloc(dev, flags, howmany(n, MLX5_NUM_CMDS_IN_ADAPTER_PAGE)); + if (msg == NULL) + return (ERR_PTR(-ENOMEM)); - for (i = 0; i < n; i++) { - tmp = alloc_cmd_box(dev, flags); - if (IS_ERR(tmp)) { - mlx5_core_warn(dev, "failed allocating block\n"); - err = PTR_ERR(tmp); - goto err_alloc; - } + for (i = 0; i != n; i++) { + struct mlx5_cmd_prot_block *block; - block = tmp->buf; - tmp->next = head; - block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); - block->block_num = cpu_to_be32(n - i - 1); - head = tmp; - } - msg->next = head; - msg->len = size; - return msg; + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); -err_alloc: - while (head) { - tmp = head->next; - free_cmd_box(dev, head); - head = tmp; + memset(block, 0, MLX5_CMD_MBOX_SIZE); + + if (i != (n - 1)) { + u64 dma = mlx5_fwp_get_dma(msg, (i + 1) * MLX5_CMD_MBOX_SIZE); + block->next = cpu_to_be64(dma); + } + block->block_num = cpu_to_be32(i); } - kfree(msg); - return ERR_PTR(err); + /* make sure initial data is written to RAM */ + mlx5_fwp_flush(msg); + + return (msg); } -static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, - struct mlx5_cmd_msg *msg) +static void +mlx5_free_cmd_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) { - struct mlx5_cmd_mailbox *head = msg->next; - struct mlx5_cmd_mailbox *next; - while (head) { - next = head->next; - free_cmd_box(dev, head); - head = next; - } - kfree(msg); + mlx5_fwp_free(msg); } static void set_wqname(struct mlx5_core_dev *dev) @@ -1356,6 +1329,9 @@ void mlx5_cmd_comp_handler(struct mlx5_c struct mlx5_cmd_work_ent *ent; int i; + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(cmd->cmd_page); + while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); @@ -1363,6 +1339,8 @@ void mlx5_cmd_comp_handler(struct mlx5_c ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(ent->out); dump_command(dev, ent, 0); if (!ent->ret) { if (!cmd->checksum_disabled) @@ -1432,10 +1410,6 @@ static struct mlx5_cmd_msg *alloc_msg(st if (!list_empty(&ent->head)) { msg = list_entry(ent->head.next, struct mlx5_cmd_msg, list); - /* For cached lists, we must explicitly state what is - * the real size - */ - msg->len = in_size; list_del(&msg->list); } spin_unlock_irq(&ent->lock); @@ -1485,8 +1459,8 @@ static int cmd_exec_helper(struct mlx5_c goto out_in; } - err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, - pages_queue, &status); + err = mlx5_cmd_invoke(dev, inb, in_size, outb, out, out_size, callback, + context, pages_queue, &status); if (err) { if (err == -ETIMEDOUT) return err; @@ -1583,44 +1557,67 @@ ex_err: return err; } -static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) +static int +alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) { - struct device *ddev = &dev->pdev->dev; - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; - - /* make sure it is aligned to 4K */ - if (!((uintptr_t)cmd->cmd_alloc_buf & (MLX5_ADAPTER_PAGE_SIZE - 1))) { - cmd->cmd_buf = cmd->cmd_alloc_buf; - cmd->dma = cmd->alloc_dma; - cmd->alloc_size = MLX5_ADAPTER_PAGE_SIZE; - return 0; + int err; + + sx_init(&cmd->dma_sx, "MLX5-DMA-SX"); + mtx_init(&cmd->dma_mtx, "MLX5-DMA-MTX", NULL, MTX_DEF); + cv_init(&cmd->dma_cv, "MLX5-DMA-CV"); + + /* + * Create global DMA descriptor tag for allocating + * 4K firmware pages: + */ + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + MLX5_ADAPTER_PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsize */ + 1, /* nsegments */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &cmd->dma_tag); + if (err != 0) + goto failure_destroy_sx; + + cmd->cmd_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (cmd->cmd_page == NULL) { + err = -ENOMEM; + goto failure_alloc_page; } + cmd->dma = mlx5_fwp_get_dma(cmd->cmd_page, 0); + cmd->cmd_buf = mlx5_fwp_get_virt(cmd->cmd_page, 0); + return (0); - dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf, cmd->alloc_dma); - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, 2 * MLX5_ADAPTER_PAGE_SIZE - 1, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; - - cmd->cmd_buf = PTR_ALIGN(cmd->cmd_alloc_buf, MLX5_ADAPTER_PAGE_SIZE); - cmd->dma = ALIGN(cmd->alloc_dma, MLX5_ADAPTER_PAGE_SIZE); - cmd->alloc_size = 2 * MLX5_ADAPTER_PAGE_SIZE - 1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jan 27 11:56: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 BE444CC3DD5; Fri, 27 Jan 2017 11:56:19 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DBA71CB7; Fri, 27 Jan 2017 11:56:19 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBuII0067035; Fri, 27 Jan 2017 11:56:18 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBuIrT067034; Fri, 27 Jan 2017 11:56:18 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701271156.v0RBuIrT067034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 11:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312883 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:56:19 -0000 Author: arybchik Date: Fri Jan 27 11:56:18 2017 New Revision: 312883 URL: https://svnweb.freebsd.org/changeset/base/312883 Log: sfxge(4): fix invalid VLAN tagging after stop/start TxQ is destroyed on stop and last used tag should be reset to default 0 on the next start. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9358 Modified: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Fri Jan 27 11:46:55 2017 (r312882) +++ head/sys/dev/sfxge/sfxge_tx.c Fri Jan 27 11:56:18 2017 (r312883) @@ -1623,6 +1623,8 @@ sfxge_tx_qstart(struct sfxge_softc *sc, txq->max_pkt_desc = sfxge_tx_max_pkt_desc(sc, txq->type, tso_fw_assisted); + txq->hw_vlan_tci = 0; + SFXGE_TXQ_UNLOCK(txq); return (0); @@ -1839,7 +1841,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u txq->type = type; txq->evq_index = evq_index; txq->init_state = SFXGE_TXQ_INITIALIZED; - txq->hw_vlan_tci = 0; return (0); From owner-svn-src-all@freebsd.org Fri Jan 27 11:57: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 48F3ECC3EC5; Fri, 27 Jan 2017 11:57:21 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15C0C1F10; Fri, 27 Jan 2017 11:57:21 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBvKA9067110; Fri, 27 Jan 2017 11:57:20 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBvKLV067109; Fri, 27 Jan 2017 11:57:20 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701271157.v0RBvKLV067109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 11:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312884 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:57:21 -0000 Author: arybchik Date: Fri Jan 27 11:57:19 2017 New Revision: 312884 URL: https://svnweb.freebsd.org/changeset/base/312884 Log: sfxge(4): fix RxQ structure layout vs usage on datapath Recent changes in the pseudo header accessor prototypes start to use common code RxQ handle on datapath. The handle was located at the end of the structure with members not used on datapath. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9359 Modified: head/sys/dev/sfxge/sfxge_rx.h Modified: head/sys/dev/sfxge/sfxge_rx.h ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.h Fri Jan 27 11:56:18 2017 (r312883) +++ head/sys/dev/sfxge/sfxge_rx.h Fri Jan 27 11:57:19 2017 (r312884) @@ -159,6 +159,7 @@ struct sfxge_rxq { enum sfxge_rxq_state init_state; unsigned int entries; unsigned int ptr_mask; + efx_rxq_t *common; struct sfxge_rx_sw_desc *queue __aligned(CACHE_LINE_SIZE); unsigned int added; @@ -173,8 +174,7 @@ struct sfxge_rxq { struct callout refill_callout; unsigned int refill_delay; - efx_rxq_t *common __aligned(CACHE_LINE_SIZE); - volatile enum sfxge_flush_state flush_state; + volatile enum sfxge_flush_state flush_state __aligned(CACHE_LINE_SIZE); }; /* From owner-svn-src-all@freebsd.org Fri Jan 27 11:59: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 0EBE8CC207B; Fri, 27 Jan 2017 11:59:04 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2572207; Fri, 27 Jan 2017 11:59:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RBx2oG067206; Fri, 27 Jan 2017 11:59:02 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RBx2pT067205; Fri, 27 Jan 2017 11:59:02 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701271159.v0RBx2pT067205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 27 Jan 2017 11:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312885 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 11:59:04 -0000 Author: arybchik Date: Fri Jan 27 11:59:02 2017 New Revision: 312885 URL: https://svnweb.freebsd.org/changeset/base/312885 Log: sfxge(4): compact the first hot part of RxQ control buf_base_id is used on RxQ control operations only and not used on datapath. Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Modified: head/sys/dev/sfxge/sfxge_rx.h Modified: head/sys/dev/sfxge/sfxge_rx.h ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.h Fri Jan 27 11:57:19 2017 (r312884) +++ head/sys/dev/sfxge/sfxge_rx.h Fri Jan 27 11:59:02 2017 (r312885) @@ -155,7 +155,6 @@ struct sfxge_rxq { struct sfxge_softc *sc __aligned(CACHE_LINE_SIZE); unsigned int index; efsys_mem_t mem; - unsigned int buf_base_id; enum sfxge_rxq_state init_state; unsigned int entries; unsigned int ptr_mask; @@ -175,6 +174,7 @@ struct sfxge_rxq { unsigned int refill_delay; volatile enum sfxge_flush_state flush_state __aligned(CACHE_LINE_SIZE); + unsigned int buf_base_id; }; /* From owner-svn-src-all@freebsd.org Fri Jan 27 14:12: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 EC773CC35F3; Fri, 27 Jan 2017 14:12:35 +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 B66CAD6D; Fri, 27 Jan 2017 14:12:35 +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 v0RECYF9022978; Fri, 27 Jan 2017 14:12:34 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RECYwL022976; Fri, 27 Jan 2017 14:12:34 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201701271412.v0RECYwL022976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 27 Jan 2017 14:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312886 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 14:12:36 -0000 Author: cy Date: Fri Jan 27 14:12:34 2017 New Revision: 312886 URL: https://svnweb.freebsd.org/changeset/base/312886 Log: Fix lookup of original destination address when using a redirect rule. Transparent proxying, e.g. to squid, is an example of this. Obtained from: NetBSD ip_nat.c r1.17, ip_nat6.c r1.10 MFC after: 6 weeks Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c head/sys/contrib/ipfilter/netinet/ip_nat6.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Fri Jan 27 11:59:02 2017 (r312885) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Fri Jan 27 14:12:34 2017 (r312886) @@ -4704,8 +4704,8 @@ ipf_nat_lookupredir(np) } } - np->nl_realip = nat->nat_ndstip; - np->nl_realport = nat->nat_ndport; + np->nl_realip = nat->nat_odstip; + np->nl_realport = nat->nat_odport; } } Modified: head/sys/contrib/ipfilter/netinet/ip_nat6.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat6.c Fri Jan 27 11:59:02 2017 (r312885) +++ head/sys/contrib/ipfilter/netinet/ip_nat6.c Fri Jan 27 14:12:34 2017 (r312886) @@ -2521,8 +2521,8 @@ ipf_nat6_lookupredir(np) } } - np->nl_realip6 = nat->nat_ndst6.in6; - np->nl_realport = nat->nat_ndport; + np->nl_realip6 = nat->nat_odst6.in6; + np->nl_realport = nat->nat_odport; } } From owner-svn-src-all@freebsd.org Fri Jan 27 14:17: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 EE940CC369B; Fri, 27 Jan 2017 14:17:49 +0000 (UTC) (envelope-from akiyama@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B358FF1E; Fri, 27 Jan 2017 14:17:49 +0000 (UTC) (envelope-from akiyama@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0REHm99023186; Fri, 27 Jan 2017 14:17:48 GMT (envelope-from akiyama@FreeBSD.org) Received: (from akiyama@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0REHmtW023185; Fri, 27 Jan 2017 14:17:48 GMT (envelope-from akiyama@FreeBSD.org) Message-Id: <201701271417.v0REHmtW023185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: akiyama set sender to akiyama@FreeBSD.org using -f From: Shunsuke Akiyama Date: Fri, 27 Jan 2017 14:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312887 - head/sys/dev/acpi_support X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 14:17:50 -0000 Author: akiyama Date: Fri Jan 27 14:17:48 2017 New Revision: 312887 URL: https://svnweb.freebsd.org/changeset/base/312887 Log: Hide unneeded message under bootverbose. MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_panasonic.c Modified: head/sys/dev/acpi_support/acpi_panasonic.c ============================================================================== --- head/sys/dev/acpi_support/acpi_panasonic.c Fri Jan 27 14:12:34 2017 (r312886) +++ head/sys/dev/acpi_support/acpi_panasonic.c Fri Jan 27 14:17:48 2017 (r312887) @@ -493,6 +493,10 @@ acpi_panasonic_notify(ACPI_HANDLE h, UIN } ACPI_SERIAL_END(panasonic); break; + case 0x81: + if (!bootverbose) + break; + /* FALLTHROUGH */ default: device_printf(sc->dev, "unknown notify: %#x\n", notify); break; From owner-svn-src-all@freebsd.org Fri Jan 27 14:53: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 29C76CC33F5; Fri, 27 Jan 2017 14:53:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 046A36C5; Fri, 27 Jan 2017 14:53:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RErALK038988; Fri, 27 Jan 2017 14:53:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0REr93P038984; Fri, 27 Jan 2017 14:53:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701271453.v0REr93P038984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Jan 2017 14:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312888 - in head/sys: compat/linuxkpi/common/include/linux conf dev/drm2 sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 14:53:11 -0000 Author: mjg Date: Fri Jan 27 14:53:09 2017 New Revision: 312888 URL: https://svnweb.freebsd.org/changeset/base/312888 Log: Introduce __read_mostly and __exclusive_cache_line macros. The intended use is to annotate frequently used globals which either rarely change (and thus can be grouped in the same cacheline) or are an atomic counter (which means it may benefit from being the only variable in the cacheline). Linker script support is provided only for amd64. Architectures without it risk having other variables put in, i.e. as if they were not annotated. This is harmless from correctness point of view. Reviewed by: bde (previous version) MFC after: 1 month Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h head/sys/conf/ldscript.amd64 head/sys/dev/drm2/drm_os_freebsd.h head/sys/sys/systm.h Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Jan 27 14:17:48 2017 (r312887) +++ head/sys/compat/linuxkpi/common/include/linux/compiler.h Fri Jan 27 14:53:09 2017 (r312888) @@ -67,7 +67,6 @@ #define typeof(x) __typeof(x) #define uninitialized_var(x) x = x -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) #define __always_unused __unused #define __must_check __result_use_check Modified: head/sys/conf/ldscript.amd64 ============================================================================== --- head/sys/conf/ldscript.amd64 Fri Jan 27 14:17:48 2017 (r312887) +++ head/sys/conf/ldscript.amd64 Fri Jan 27 14:53:09 2017 (r312888) @@ -145,6 +145,17 @@ SECTIONS .got : { *(.got) } . = DATA_SEGMENT_RELRO_END (24, .); .got.plt : { *(.got.plt) } + . = ALIGN(64); + .data.read_mostly : + { + *(.data.read_mostly) + } + . = ALIGN(64); + .data.exclusive_cache_line : + { + *(.data.exclusive_cache_line) + } + . = ALIGN(64); .data : { *(.data .data.* .gnu.linkonce.d.*) Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Fri Jan 27 14:17:48 2017 (r312887) +++ head/sys/dev/drm2/drm_os_freebsd.h Fri Jan 27 14:53:09 2017 (r312888) @@ -80,7 +80,6 @@ typedef void irqreturn_t; #define __init #define __exit -#define __read_mostly #define BUILD_BUG_ON(x) CTASSERT(!(x)) #define BUILD_BUG_ON_NOT_POWER_OF_2(x) Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Jan 27 14:17:48 2017 (r312887) +++ head/sys/sys/systm.h Fri Jan 27 14:53:09 2017 (r312888) @@ -129,6 +129,12 @@ void kassert_panic(const char *fmt, ...) #define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched) /* + * Align variables. + */ +#define __read_mostly __section(".data.read_mostly") +#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \ + __section(".data.exclusive_cache_line") +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files. From owner-svn-src-all@freebsd.org Fri Jan 27 14:56: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 49E19CC3572; Fri, 27 Jan 2017 14:56:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C43697B; Fri, 27 Jan 2017 14:56:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0REubNA039182; Fri, 27 Jan 2017 14:56:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0REubn5039181; Fri, 27 Jan 2017 14:56:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701271456.v0REubn5039181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Jan 2017 14:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312889 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 14:56:38 -0000 Author: mjg Date: Fri Jan 27 14:56:36 2017 New Revision: 312889 URL: https://svnweb.freebsd.org/changeset/base/312889 Log: cache: annotate with __read_mostly and __exclusive_cache_line MFC after: 1 month Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Fri Jan 27 14:53:09 2017 (r312888) +++ head/sys/kern/vfs_cache.c Fri Jan 27 14:56:36 2017 (r312889) @@ -200,48 +200,47 @@ struct namecache_ts { */ #define NCHHASH(hash) \ (&nchashtbl[(hash) & nchash]) -static LIST_HEAD(nchashhead, namecache) *nchashtbl; /* Hash Table */ -static u_long nchash; /* size of hash table */ +static __read_mostly LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash Table */ +static u_long __read_mostly nchash; /* size of hash table */ SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, "Size of namecache hash table"); -static u_long ncnegfactor = 16; /* ratio of negative entries */ +static u_long __read_mostly ncnegfactor = 16; /* ratio of negative entries */ SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, "Ratio of negative namecache entries"); -static u_long numneg; /* number of negative entries allocated */ +static u_long __exclusive_cache_line numneg; /* number of negative entries allocated */ SYSCTL_ULONG(_debug, OID_AUTO, numneg, CTLFLAG_RD, &numneg, 0, "Number of negative entries in namecache"); -static u_long numcache; /* number of cache entries allocated */ +static u_long __exclusive_cache_line numcache;/* number of cache entries allocated */ SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, "Number of namecache entries"); -static u_long numcachehv; /* number of cache entries with vnodes held */ +static u_long __exclusive_cache_line numcachehv;/* number of cache entries with vnodes held */ SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, "Number of namecache entries with vnodes held"); -u_int ncsizefactor = 2; +u_int __read_mostly ncsizefactor = 2; SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0, "Size factor for namecache"); -static u_int ncpurgeminvnodes; +static u_int __read_mostly ncpurgeminvnodes; SYSCTL_UINT(_vfs, OID_AUTO, ncpurgeminvnodes, CTLFLAG_RW, &ncpurgeminvnodes, 0, "Number of vnodes below which purgevfs ignores the request"); -static u_int ncneghitsrequeue = 8; +static u_int __read_mostly ncneghitsrequeue = 8; SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsrequeue, CTLFLAG_RW, &ncneghitsrequeue, 0, "Number of hits to requeue a negative entry in the LRU list"); struct nchstats nchstats; /* cache effectiveness statistics */ static struct mtx ncneg_shrink_lock; +static int shrink_list_turn; struct neglist { struct mtx nl_lock; TAILQ_HEAD(, namecache) nl_list; } __aligned(CACHE_LINE_SIZE); -static struct neglist *neglists; +static struct neglist __read_mostly *neglists; static struct neglist ncneg_hot; -static int shrink_list_turn; - #define numneglists (ncneghash + 1) -static u_int ncneghash; +static u_int __read_mostly ncneghash; static inline struct neglist * NCP2NEGLIST(struct namecache *ncp) { @@ -250,14 +249,14 @@ NCP2NEGLIST(struct namecache *ncp) } #define numbucketlocks (ncbuckethash + 1) -static u_int ncbuckethash; -static struct rwlock_padalign *bucketlocks; +static u_int __read_mostly ncbuckethash; +static struct rwlock_padalign __read_mostly *bucketlocks; #define HASH2BUCKETLOCK(hash) \ ((struct rwlock *)(&bucketlocks[((hash) & ncbuckethash)])) #define numvnodelocks (ncvnodehash + 1) -static u_int ncvnodehash; -static struct mtx *vnodelocks; +static u_int __read_mostly ncvnodehash; +static struct mtx __read_mostly *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { @@ -272,10 +271,10 @@ VP2VNODELOCK(struct vnode *vp) * most common. The large cache is used for entries which are too big to * fit in the small cache. */ -static uma_zone_t cache_zone_small; -static uma_zone_t cache_zone_small_ts; -static uma_zone_t cache_zone_large; -static uma_zone_t cache_zone_large_ts; +static uma_zone_t __read_mostly cache_zone_small; +static uma_zone_t __read_mostly cache_zone_small_ts; +static uma_zone_t __read_mostly cache_zone_large; +static uma_zone_t __read_mostly cache_zone_large_ts; #define CACHE_PATH_CUTOFF 35 @@ -341,7 +340,7 @@ cache_out_ts(struct namecache *ncp, stru *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; } -static int doingcache = 1; /* 1 => enable the cache */ +static int __read_mostly doingcache = 1; /* 1 => enable the cache */ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, "VFS namecache enabled"); @@ -357,7 +356,7 @@ static SYSCTL_NODE(_vfs, OID_AUTO, cache #define STATNODE_ULONG(name, descr) \ SYSCTL_ULONG(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, &name, 0, descr); #define STATNODE_COUNTER(name, descr) \ - static counter_u64_t name; \ + static counter_u64_t __read_mostly name; \ SYSCTL_COUNTER_U64(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, &name, descr); STATNODE_ULONG(numneg, "Number of negative cache entries"); STATNODE_ULONG(numcache, "Number of cache entries"); @@ -2032,7 +2031,7 @@ vfs_cache_lookup(struct vop_lookup_args /* * XXX All of these sysctls would probably be more productive dead. */ -static int disablecwd; +static int __read_mostly disablecwd; SYSCTL_INT(_debug, OID_AUTO, disablecwd, CTLFLAG_RW, &disablecwd, 0, "Disable the getcwd syscall"); @@ -2091,7 +2090,7 @@ kern___getcwd(struct thread *td, char *b * Thus begins the fullpath magic. */ -static int disablefullpath; +static int __read_mostly disablefullpath; SYSCTL_INT(_debug, OID_AUTO, disablefullpath, CTLFLAG_RW, &disablefullpath, 0, "Disable the vn_fullpath function"); From owner-svn-src-all@freebsd.org Fri Jan 27 15: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 E3F8FCC37C3; Fri, 27 Jan 2017 15:03:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE8F6C; Fri, 27 Jan 2017 15:03:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RF3pPD043488; Fri, 27 Jan 2017 15:03:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RF3puM043483; Fri, 27 Jan 2017 15:03:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701271503.v0RF3puM043483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Jan 2017 15:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312890 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 15:03:53 -0000 Author: mjg Date: Fri Jan 27 15:03:51 2017 New Revision: 312890 URL: https://svnweb.freebsd.org/changeset/base/312890 Log: Sprinkle __read_mostly on backoff and lock profiling code. MFC after: 1 month Modified: head/sys/kern/kern_lockstat.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/kern/subr_lock.c Modified: head/sys/kern/kern_lockstat.c ============================================================================== --- head/sys/kern/kern_lockstat.c Fri Jan 27 14:56:36 2017 (r312889) +++ head/sys/kern/kern_lockstat.c Fri Jan 27 15:03:51 2017 (r312890) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -61,7 +62,7 @@ SDT_PROBE_DEFINE1(lockstat, , , sx__down SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t"); -int lockstat_enabled = 0; +int __read_mostly lockstat_enabled; uint64_t lockstat_nsecs(struct lock_object *lo) Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Fri Jan 27 14:56:36 2017 (r312889) +++ head/sys/kern/kern_mutex.c Fri Jan 27 15:03:51 2017 (r312890) @@ -140,7 +140,7 @@ struct lock_class lock_class_mtx_spin = #ifdef ADAPTIVE_MUTEXES static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging"); -static struct lock_delay_config mtx_delay = { +static struct lock_delay_config __read_mostly mtx_delay = { .initial = 1000, .step = 500, .min = 100, @@ -171,7 +171,7 @@ LOCK_DELAY_SYSINIT(mtx_delay_sysinit); static SYSCTL_NODE(_debug, OID_AUTO, mtx_spin, CTLFLAG_RD, NULL, "mtx spin debugging"); -static struct lock_delay_config mtx_spin_delay = { +static struct lock_delay_config __read_mostly mtx_spin_delay = { .initial = 1000, .step = 500, .min = 100, Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Fri Jan 27 14:56:36 2017 (r312889) +++ head/sys/kern/kern_rwlock.c Fri Jan 27 15:03:51 2017 (r312890) @@ -100,7 +100,7 @@ static SYSCTL_NODE(_debug, OID_AUTO, rwl SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, ""); SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, ""); -static struct lock_delay_config rw_delay = { +static struct lock_delay_config __read_mostly rw_delay = { .initial = 1000, .step = 500, .min = 100, Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Fri Jan 27 14:56:36 2017 (r312889) +++ head/sys/kern/kern_sx.c Fri Jan 27 15:03:51 2017 (r312890) @@ -148,7 +148,7 @@ static SYSCTL_NODE(_debug, OID_AUTO, sx, SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, ""); SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, ""); -static struct lock_delay_config sx_delay = { +static struct lock_delay_config __read_mostly sx_delay = { .initial = 1000, .step = 500, .min = 100, Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Fri Jan 27 14:56:36 2017 (r312889) +++ head/sys/kern/subr_lock.c Fri Jan 27 15:03:51 2017 (r312890) @@ -213,7 +213,7 @@ struct lock_prof_cpu { struct lock_prof_cpu *lp_cpu[MAXCPU]; -volatile int lock_prof_enable = 0; +volatile int __read_mostly lock_prof_enable; static volatile int lock_prof_resetting; #define LPROF_SBUF_SIZE 256 From owner-svn-src-all@freebsd.org Fri Jan 27 15:26: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 5B308CC3E6E; Fri, 27 Jan 2017 15:26:04 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (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 DB907E74; Fri, 27 Jan 2017 15:26:03 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v0RFPsx4025333; Fri, 27 Jan 2017 07:25:54 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v0RFPmVq025332; Fri, 27 Jan 2017 07:25:48 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r312871 - stable/11/share/zoneinfo In-Reply-To: <201701270911.v0R9BiQr000147@repo.freebsd.org> To: Julian Elischer Date: Fri, 27 Jan 2017 07:25:48 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 15:26:04 -0000 > Author: julian > Date: Fri Jan 27 09:11:44 2017 > New Revision: 312871 > URL: https://svnweb.freebsd.org/changeset/base/312871 > > Log: > MFH: r308671 > > When you select make OLDTIMEZONES=1 then you need a few added directories > to be made or the command fails > > Sponsored by: panzura > > MFH: r310426 > > If you are going to be run individually to make a new timezone set > then ensure the destination directories exist. > Especially if you define OLDTIMEZONES because the mtree pass > doesn't do it for you. Perhaps it is time to start pre-processing mtree files so this would no longer be the case? > Sponsored by: Panzura > > Modified: > stable/11/share/zoneinfo/Makefile > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/zoneinfo/Makefile > ============================================================================== > --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) > +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) > @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ > Pacific \ > SystemV > > +.if defined(OLDTIMEZONES) > +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil > +.endif > + > .if !defined(_SKIP_BUILD) > all: zoneinfo > .endif > @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} > > beforeinstall: install-zoneinfo > install-zoneinfo: > + mkdir -p ${DESTDIR}/usr/share/zoneinfo > + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} This has the failure mode that your current uid and umask, etc are used in creating the directories. Please add appropriate chown/chmod commands to reflect what mtree would of done had it done this. > cd ${TZBUILDDIR} && \ > find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ > -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Jan 27 17:54: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 418DCCBFBAB; Fri, 27 Jan 2017 17:54:26 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B1BD4A; Fri, 27 Jan 2017 17:54:25 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RHsPNc011648; Fri, 27 Jan 2017 17:54:25 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RHsPLj011647; Fri, 27 Jan 2017 17:54:25 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201701271754.v0RHsPLj011647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Fri, 27 Jan 2017 17:54: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: r312892 - stable/11/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 17:54:26 -0000 Author: wblock (doc committer) Date: Fri Jan 27 17:54:24 2017 New Revision: 312892 URL: https://svnweb.freebsd.org/changeset/base/312892 Log: MFC r312547: Mention sendfile(2) by popular demand. Sponsored by: iXsystems Modified: stable/11/lib/libc/sys/shm_open.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/shm_open.2 ============================================================================== --- stable/11/lib/libc/sys/shm_open.2 Fri Jan 27 16:53:53 2017 (r312891) +++ stable/11/lib/libc/sys/shm_open.2 Fri Jan 27 17:54:24 2017 (r312892) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 13, 2017 +.Dd January 20, 2017 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -187,6 +187,11 @@ kernel implementation explicitly include and .Xr write 2 . .Pp +.Fx +also supports zero-copy transmission of data from shared memory +objects with +.Xr sendfile 2 . +.Pp Neither shared memory objects nor their contents persist across reboots. .Pp Writes do not extend shared memory objects, so @@ -281,7 +286,8 @@ requires write permission to the shared .Xr fstat 2 , .Xr ftruncate 2 , .Xr mmap 2 , -.Xr munmap 2 +.Xr munmap 2 , +.Xr sendfile 2 .Sh STANDARDS The .Fn shm_open From owner-svn-src-all@freebsd.org Fri Jan 27 17:58: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 8FD1DCBFCB0; Fri, 27 Jan 2017 17:58: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 5F189FC2; Fri, 27 Jan 2017 17:58: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 v0RHwflR011853; Fri, 27 Jan 2017 17:58:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RHwf36011852; Fri, 27 Jan 2017 17:58:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201701271758.v0RHwf36011852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 27 Jan 2017 17:58:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312893 - head/sys/cddl/contrib/opensolaris/uts/intel/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 17:58:42 -0000 Author: markj Date: Fri Jan 27 17:58:41 2017 New Revision: 312893 URL: https://svnweb.freebsd.org/changeset/base/312893 Log: Fix an off-by-one in an assertion on fasttrap tracepoint sizes. FASTTRAP_MAX_INSTR_SIZE is the largest valid value of a tracepoint, so correct the assertion accordingly. This limit was hit with a 15-byte NOP. Reported by: bdrewery MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Fri Jan 27 17:54:24 2017 (r312892) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Fri Jan 27 17:58:41 2017 (r312893) @@ -1616,7 +1616,7 @@ fasttrap_pid_probe(struct reg *rp) * a signal we can reset the value of the scratch register. */ - ASSERT(tp->ftt_size < FASTTRAP_MAX_INSTR_SIZE); + ASSERT(tp->ftt_size <= FASTTRAP_MAX_INSTR_SIZE); curthread->t_dtrace_scrpc = addr; bcopy(tp->ftt_instr, &scratch[i], tp->ftt_size); From owner-svn-src-all@freebsd.org Fri Jan 27 19:47: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 C32FBCC4622; Fri, 27 Jan 2017 19:47:56 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3927FDD; Fri, 27 Jan 2017 19:47:56 +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 A097710A7B9; Fri, 27 Jan 2017 14:47:55 -0500 (EST) From: John Baldwin To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312755 - head/sys/net Date: Fri, 27 Jan 2017 11:28:23 -0800 Message-ID: <6817684.C985jk9qCN@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201701251437.v0PEb5D7047773@repo.freebsd.org> References: <201701251437.v0PEb5D7047773@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); Fri, 27 Jan 2017 14:47:55 -0500 (EST) 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: Fri, 27 Jan 2017 19:47:56 -0000 On Wednesday, January 25, 2017 02:37:05 PM Sean Bruno wrote: > Author: sbruno > Date: Wed Jan 25 14:37:05 2017 > New Revision: 312755 > URL: https://svnweb.freebsd.org/changeset/base/312755 > > Log: > Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns > success and a good value. Only then try to use it and set the MSIX_ENABLE > bit. > > With the current em(4) driver we have observed failures in this case in a > specific environment when pci_find_cap() would not return the assumed > value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID) > which is read-only. Why is this writing directly to the MSIX registers at all? pci_alloc_msix() etc. handle those registers for all other drivers and proper suspend/resume depends on drivers using the existing PCI API for managing MSI and MSI-X. > Modified: head/sys/net/iflib.c > ============================================================================== > --- head/sys/net/iflib.c Wed Jan 25 13:42:38 2017 (r312754) > +++ head/sys/net/iflib.c Wed Jan 25 14:37:05 2017 (r312755) > @@ -4779,15 +4783,20 @@ iflib_msix_init(if_ctx_t ctx) > uint16_t pci_cmd_word; > int msix_ctrl, rid; > > - rid = 0; > pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); > pci_cmd_word |= PCIM_CMD_BUSMASTEREN; > pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2); This should use 'pci_enable_busmaster()' like other drivers rather than manipulating registers directly. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Jan 27 19:47: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 9BCDACC461C; Fri, 27 Jan 2017 19:47:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7959DFDB; Fri, 27 Jan 2017 19:47:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 55B7310A791; Fri, 27 Jan 2017 14:47:54 -0500 (EST) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312857 - head Date: Fri, 27 Jan 2017 11:38:06 -0800 Message-ID: <5921766.B6ayWRhOVb@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201701270343.v0R3hIww068402@repo.freebsd.org> References: <201701270343.v0R3hIww068402@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); Fri, 27 Jan 2017 14:47:54 -0500 (EST) 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: Fri, 27 Jan 2017 19:47:55 -0000 On Friday, January 27, 2017 03:43:18 AM Ed Maste wrote: > Author: emaste > Date: Fri Jan 27 03:43:18 2017 > New Revision: 312857 > URL: https://svnweb.freebsd.org/changeset/base/312857 > > Log: > 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. > > MFC after: 1 month > Sponsored by: The FreeBSD Foundation Which external toolchain? Building with GCC 6 and binutils from ports worked fine for me? OTOH, it seems that trying to use clang (in HEAD) with external binutils might be buggy as it doesn't pass the '-m ' down to ld like GCC does. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Jan 27 20:28: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 99C0BCC4127; Fri, 27 Jan 2017 20:28:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 84658CF4; Fri, 27 Jan 2017 20:28:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v0RKS3a1039132 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 27 Jan 2017 12:28:04 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v0RKS3AB039131; Fri, 27 Jan 2017 12:28:03 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 27 Jan 2017 12:28:03 -0800 From: Gleb Smirnoff To: Bruce Evans Cc: Konstantin Belousov , Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312770 - in head/sys: net netinet netinet6 Message-ID: <20170127202803.GU2611@FreeBSD.org> References: <201701251904.v0PJ48YF061428@repo.freebsd.org> <20170125222006.GH2611@FreeBSD.org> <20170125222632.GQ2349@kib.kiev.ua> <20170126133341.V1087@besplex.bde.org> <20170126215927.GL2611@FreeBSD.org> <20170127171655.V2822@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170127171655.V2822@besplex.bde.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 20:28:05 -0000 On Fri, Jan 27, 2017 at 05:34:45PM +1100, Bruce Evans wrote: B> > On Thu, Jan 26, 2017 at 02:03:05PM +1100, Bruce Evans wrote: B> > B> On Thu, 26 Jan 2017, Konstantin Belousov wrote: B> > B> B> > B> > On Wed, Jan 25, 2017 at 02:20:06PM -0800, Gleb Smirnoff wrote: B> > B> >> Thanks, Luiz! B> > B> >> B> > B> >> One stylistic nit that I missed in review: B> > B> >> B> > B> >> L> static int B> > B> >> L> -in_difaddr_ioctl(caddr_t data, struct ifnet *ifp, struct thread *td) B> > B> >> L> +in_difaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) B> > B> >> L> { B> > B> >> L> const struct ifreq *ifr = (struct ifreq *)data; B> > B> >> L> const struct sockaddr_in *addr = (const struct sockaddr_in *) B> > B> >> L> @@ -618,7 +618,8 @@ in_difaddr_ioctl(caddr_t data, struct if B> > B> >> L> in_ifadown(&ia->ia_ifa, 1); B> > B> >> L> B> > B> >> L> if (ia->ia_ifa.ifa_carp) B> > B> >> L> - (*carp_detach_p)(&ia->ia_ifa); B> > B> >> L> + (*carp_detach_p)(&ia->ia_ifa, B> > B> >> L> + (cmd == SIOCDIFADDR) ? false : true); B> > B> >> B> > B> >> Can we change the very last line to: B> > B> >> B> > B> >> (cmd == SIOCAIFADDR) ? true : false); B> > B> B> > B> That is not stylistic, but invert the result. Perhaps you meant to B> > B> reverse the test to avoid negative logic for the result. B> > B> > It uses different ioctl value, so it doesn't invert result. Instead B> > of !SIOCDIFADDR I want more explicit SIOCAIFADDR. B> B> Oops. So it is non-stylistic in a different way. cmd can only be B> SIOCDIFADDR, or one or both of SIOCAIFADDR. Than is unclear. Assuming B> that the original code is correct and that all 3 cases can occur, B> inversion would break all 3 cases, while the non-stylistic change breaks B> only the O_SIOCAIFADDR case. B> B> Since there can be more than 2 cases and it isn't clear that there are B> at most 3, any boolean test on 1 of the cases is going to be unclear. B> Positive logic will be clearer, but that requires comparison with 2 B> cases. The current code use negative logic to select these 2 cases as B> the complement of the other case. O_SIOCAIFADDR should just be deleted. My suggestion is not only convert to positive logic, but also outline that SIOCAIFADDR is an exceptional case, in all other cases in_difaddr_ioctl() which is named "delete ifaddr" should do delete everything. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Fri Jan 27 20:36: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 708AFCC456F; Fri, 27 Jan 2017 20:36:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::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 2C03C15F6; Fri, 27 Jan 2017 20:36:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x243.google.com with SMTP id 203so9483487ith.2; Fri, 27 Jan 2017 12:36:22 -0800 (PST) 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=uREFFKQJYWJO1/sBefCkXnDwWSdIsCcjvW4ypg5GwPs=; b=kd+XDGIbAIDYxCSDXstChULr+X+UEefk3ZH+QrEFbFXASQCuAXG5uYg2JtE5M26407 WYsIssdldfUOsOXogfEcSVajBWYLrXmJmnVV5OPmyKOeXgT/tMJY0tUra3KVKqfq/8/w fveJZQDas6nWg8Xkd2c2r83Oq925i1Uk01ik5/K6PTRskh+X1vzUGSJMIbJtY2FaDYuW DZhQhLniE/6/JFqA6W1E+/6DLmV0nTJzrKbMTmWLCfrHw3qLQX+cvGXLxSgm9U5Xd/LJ 1iX0bEDgXNCb4cQOfDNkqKK/dSPW3d45cDirJ4KHRLTMpQh2jOSGG8JHw9l52VkvWtYt jFcg== 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=uREFFKQJYWJO1/sBefCkXnDwWSdIsCcjvW4ypg5GwPs=; b=EBZaTsZIrImum14I5aizEU1JTyJQCPNkkUrYEdzSfid9luDWV9X/3ofH8mihvPvGrP QDGk/VafgcIPrcAkjNDm7TpiOpBt51lHcOpUUEZXM4w6th+evkjJ8rUioXuV8E4zCM+w +UtFhgZtVzALNgi22ygWgyDzcROSp7zF+w1vFmdrDkGABL9jtZcUSpahFalfRF4CT/et ZhF9UlTM6/tRcAhq2HwzaKabM65FGcQp8bQDVrkzhphQdu7/85bKMe0gUXxiFX7wE+GG aJtz+UD5YT9UhAWwpuJ6VXi3uBWzEpgF2TKbFBZNRHiOw/XnN9whICPf0EqnmmLfJTuE 5aXA== X-Gm-Message-State: AIkVDXIvAEcjeUJ+ckOGhoIx1sPm9gaZFdfUEE4X4PFwA9Lcc58Riwjq+ZAupgPG3NkKVZkqv47JSFerGgx7wg== X-Received: by 10.36.117.148 with SMTP id y142mr4406512itc.14.1485549381497; Fri, 27 Jan 2017 12:36:21 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.159 with HTTP; Fri, 27 Jan 2017 12:36:01 -0800 (PST) In-Reply-To: <5921766.B6ayWRhOVb@ralph.baldwin.cx> References: <201701270343.v0R3hIww068402@repo.freebsd.org> <5921766.B6ayWRhOVb@ralph.baldwin.cx> From: Ed Maste Date: Fri, 27 Jan 2017 15:36:01 -0500 X-Google-Sender-Auth: 0LxfycWLiVOgDwLA9phNEt8B38Q Message-ID: Subject: Re: svn commit: r312857 - head To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 20:36:22 -0000 On 27 January 2017 at 14:38, John Baldwin wrote: > > Which external toolchain? Building with GCC 6 and binutils from ports worked > fine for me? This was using the mips64-xtoolchain-gcc package and CROSS_TOOLCHAIN=mips64-gcc. It appears that it picked up the host's nm while building compat32. If you are building on a FreeBSD 11 or -CURRENT host it will work even if it gets the host nm, because /usr/bin/nm is ELF Tool Chain's and includes support for all architectures, but I'm building on 10.x and the GNU nm there only handles x86 objects. From owner-svn-src-all@freebsd.org Fri Jan 27 21:18: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 23CB9CC4370; Fri, 27 Jan 2017 21:18:25 +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 E79B7982; Fri, 27 Jan 2017 21:18:24 +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 v0RLIO4X096264; Fri, 27 Jan 2017 21:18:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RLIOrx096263; Fri, 27 Jan 2017 21:18:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701272118.v0RLIOrx096263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Jan 2017 21:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312897 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 21:18:25 -0000 Author: emaste Date: Fri Jan 27 21:18:23 2017 New Revision: 312897 URL: https://svnweb.freebsd.org/changeset/base/312897 Log: Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC An additional case missed in r312855 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Jan 27 21:14:42 2017 (r312896) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Jan 27 21:18:23 2017 (r312897) @@ -221,7 +221,7 @@ OLD_DIRS+=usr/share/examples/bhyve .if ${MK_BINUTILS} == no OLD_FILES+=usr/bin/as -.if ${MK_LLD_AS_LD} == no +.if ${MK_LLD_IS_LD} == no OLD_FILES+=usr/bin/ld .endif OLD_FILES+=usr/bin/ld.bfd From owner-svn-src-all@freebsd.org Fri Jan 27 21:31: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 B92B6CC471F; Fri, 27 Jan 2017 21:31:33 +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 68B92233; Fri, 27 Jan 2017 21:31:33 +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 v0RLVWID003960; Fri, 27 Jan 2017 21:31:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RLVWdo003957; Fri, 27 Jan 2017 21:31:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701272131.v0RLVWdo003957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Jan 2017 21:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312899 - in head/contrib: binutils/gas/config gcc/config/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 21:31:33 -0000 Author: emaste Date: Fri Jan 27 21:31:32 2017 New Revision: 312899 URL: https://svnweb.freebsd.org/changeset/base/312899 Log: add octeon+ as an alias for octeon in GCC & binutils In r208737 jmallett@ added support for the "mips64r2" architecture and "octeon" CPU, and the saa/saad instructions. Upstream binutils also added the "octeon+" CPU, and the saa/saad instructions are only available in octeon+, not octeon. Since our base system tool chain already accepts saa/saad with -march=octeon, just allow octeon+ as an alias. This allows the use of octeon+ in kernel config files, for use with both external tool chain and in-tree GCC/binutils. PR: 216516 MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/contrib/binutils/gas/config/tc-mips.c head/contrib/gcc/config/mips/mips.c head/contrib/gcc/config/mips/mips.h Modified: head/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- head/contrib/binutils/gas/config/tc-mips.c Fri Jan 27 21:26:23 2017 (r312898) +++ head/contrib/binutils/gas/config/tc-mips.c Fri Jan 27 21:31:32 2017 (r312899) @@ -15156,6 +15156,7 @@ static const struct mips_cpu_info mips_c /* Cavium Networks Octeon CPU core */ { "octeon", 0, ISA_MIPS64R2, CPU_OCTEON }, + { "octeon+", 0, ISA_MIPS64R2, CPU_OCTEON }, /* End marker */ { NULL, 0, 0, 0 } Modified: head/contrib/gcc/config/mips/mips.c ============================================================================== --- head/contrib/gcc/config/mips/mips.c Fri Jan 27 21:26:23 2017 (r312898) +++ head/contrib/gcc/config/mips/mips.c Fri Jan 27 21:31:32 2017 (r312899) @@ -765,6 +765,7 @@ const struct mips_cpu_info mips_cpu_info /* MIPS64R2 */ { "octeon", PROCESSOR_OCTEON, 65 }, + { "octeon+", PROCESSOR_OCTEON, 65 }, /* End marker */ { 0, 0, 0 } Modified: head/contrib/gcc/config/mips/mips.h ============================================================================== --- head/contrib/gcc/config/mips/mips.h Fri Jan 27 21:26:23 2017 (r312898) +++ head/contrib/gcc/config/mips/mips.h Fri Jan 27 21:31:32 2017 (r312899) @@ -285,7 +285,10 @@ extern const struct mips_rtx_cost_data * \ macro = concat ((PREFIX), "_", (INFO)->name, NULL); \ for (p = macro; *p != 0; p++) \ - *p = TOUPPER (*p); \ + if (*p == '+') \ + *p = 'P'; \ + else \ + *p = TOUPPER (*p); \ \ builtin_define (macro); \ builtin_define_with_value ((PREFIX), (INFO)->name, 1); \ From owner-svn-src-all@freebsd.org Fri Jan 27 21:39: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 709A4CC48AF; Fri, 27 Jan 2017 21:39:50 +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 4E570904; Fri, 27 Jan 2017 21:39:49 +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 9E33810A791; Fri, 27 Jan 2017 16:39:48 -0500 (EST) From: John Baldwin To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r312857 - head Date: Fri, 27 Jan 2017 13:39:21 -0800 Message-ID: <1890872.SdRWTz4Mbe@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201701270343.v0R3hIww068402@repo.freebsd.org> <5921766.B6ayWRhOVb@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 27 Jan 2017 16:39:48 -0500 (EST) 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: Fri, 27 Jan 2017 21:39:50 -0000 On Friday, January 27, 2017 03:36:01 PM Ed Maste wrote: > On 27 January 2017 at 14:38, John Baldwin wrote: > > > > Which external toolchain? Building with GCC 6 and binutils from ports worked > > fine for me? > > This was using the mips64-xtoolchain-gcc package and > CROSS_TOOLCHAIN=mips64-gcc. It appears that it picked up the host's nm > while building compat32. > > If you are building on a FreeBSD 11 or -CURRENT host it will work even > if it gets the host nm, because /usr/bin/nm is ELF Tool Chain's and > includes support for all architectures, but I'm building on 10.x and > the GNU nm there only handles x86 objects. Ah, yes I am testing on 11. Good catch then. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Jan 27 21:55: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 BF800CC31D7; Fri, 27 Jan 2017 21:55:48 +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 8F32386E; Fri, 27 Jan 2017 21:55:48 +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 v0RLtlDT012473; Fri, 27 Jan 2017 21:55:47 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RLtlJ3012472; Fri, 27 Jan 2017 21:55:47 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201701272155.v0RLtlJ3012472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 27 Jan 2017 21:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312900 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 21:55:48 -0000 Author: scottl Date: Fri Jan 27 21:55:47 2017 New Revision: 312900 URL: https://svnweb.freebsd.org/changeset/base/312900 Log: Squash a couple of uses of xpt_print_path() Sponsored by: Netflix Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Jan 27 21:31:32 2017 (r312899) +++ head/sys/cam/cam_xpt.c Fri Jan 27 21:55:47 2017 (r312900) @@ -3062,8 +3062,8 @@ call_sim: case XPT_TERM_IO: case XPT_ENG_INQ: /* XXX Implement */ - xpt_print_path(start_ccb->ccb_h.path); - printf("%s: CCB type %#x %s not supported\n", __func__, + xpt_print(start_ccb->ccb_h.path, + "%s: CCB type %#x %s not supported\n", __func__, start_ccb->ccb_h.func_code, xpt_action_name(start_ccb->ccb_h.func_code)); start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; @@ -3944,8 +3944,8 @@ xpt_bus_register(struct cam_sim *sim, de } } if (new_bus->xport == NULL) { - xpt_print_path(path); - printf("No transport found for %d\n", cpi.transport); + xpt_print(path, + "No transport found for %d\n", cpi.transport); xpt_release_bus(new_bus); free(path, M_CAMXPT); return (CAM_RESRC_UNAVAIL); From owner-svn-src-all@freebsd.org Fri Jan 27 22:13: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 9D992CC3877; Fri, 27 Jan 2017 22:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69D1D12FA; Fri, 27 Jan 2017 22:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RMDFWw020297; Fri, 27 Jan 2017 22:13:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RMDFLd020296; Fri, 27 Jan 2017 22:13:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701272213.v0RMDFLd020296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Jan 2017 22:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312901 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 22:13:16 -0000 Author: mjg Date: Fri Jan 27 22:13:15 2017 New Revision: 312901 URL: https://svnweb.freebsd.org/changeset/base/312901 Log: hwpmc: partially depessimize mmap handling if the module is not loaded In particular this means the pmc sx lock is no longer taken when an executable mapping succeeds. MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Jan 27 21:55:47 2017 (r312900) +++ head/sys/kern/vfs_vnops.c Fri Jan 27 22:13:15 2017 (r312901) @@ -2460,10 +2460,12 @@ vn_mmap(struct file *fp, vm_map_t map, v } #ifdef HWPMC_HOOKS /* Inform hwpmc(4) if an executable is being mapped. */ - if (error == 0 && (prot & VM_PROT_EXECUTE) != 0) { - pkm.pm_file = vp; - pkm.pm_address = (uintptr_t) *addr; - PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + if (PMC_HOOK_INSTALLED(PMC_FN_MMAP)) { + if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) { + pkm.pm_file = vp; + pkm.pm_address = (uintptr_t) *addr; + PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + } } #endif return (error); From owner-svn-src-all@freebsd.org Fri Jan 27 22:14: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 293CCCC38ED; Fri, 27 Jan 2017 22:14:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED6A414D6; Fri, 27 Jan 2017 22:14:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RMEhuD020393; Fri, 27 Jan 2017 22:14:43 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RMEhvG020392; Fri, 27 Jan 2017 22:14:43 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701272214.v0RMEhvG020392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 27 Jan 2017 22:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312902 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 22:14:44 -0000 Author: mjg Date: Fri Jan 27 22:14:42 2017 New Revision: 312902 URL: https://svnweb.freebsd.org/changeset/base/312902 Log: hwpmc: annotate pmc_hook and pmc_intr as __read_mostly MFC after: 1 month Modified: head/sys/kern/kern_pmc.c Modified: head/sys/kern/kern_pmc.c ============================================================================== --- head/sys/kern/kern_pmc.c Fri Jan 27 22:13:15 2017 (r312901) +++ head/sys/kern/kern_pmc.c Fri Jan 27 22:14:42 2017 (r312902) @@ -59,10 +59,10 @@ MALLOC_DEFINE(M_PMCHOOKS, "pmchooks", "M const int pmc_kernel_version = PMC_KERNEL_VERSION; /* Hook variable. */ -int (*pmc_hook)(struct thread *td, int function, void *arg) = NULL; +int __read_mostly (*pmc_hook)(struct thread *td, int function, void *arg) = NULL; /* Interrupt handler */ -int (*pmc_intr)(int cpu, struct trapframe *tf) = NULL; +int __read_mostly (*pmc_intr)(int cpu, struct trapframe *tf) = NULL; /* Bitmask of CPUs requiring servicing at hardclock time */ volatile cpuset_t pmc_cpumask; From owner-svn-src-all@freebsd.org Fri Jan 27 22: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 07039CC3C38; Fri, 27 Jan 2017 22:30:29 +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 CA9961B67; Fri, 27 Jan 2017 22:30:28 +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 v0RMURJe024663; Fri, 27 Jan 2017 22:30:27 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RMURCZ024662; Fri, 27 Jan 2017 22:30:27 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701272230.v0RMURCZ024662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 27 Jan 2017 22:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312903 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 22:30:29 -0000 Author: sbruno Date: Fri Jan 27 22:30:27 2017 New Revision: 312903 URL: https://svnweb.freebsd.org/changeset/base/312903 Log: Replace customized busmaster code with standardized setup call. Reported by: jhb Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Fri Jan 27 22:14:42 2017 (r312902) +++ head/sys/net/iflib.c Fri Jan 27 22:30:27 2017 (r312903) @@ -4781,12 +4781,9 @@ iflib_msix_init(if_ctx_t ctx) ** successfully initialize us. */ { - uint16_t pci_cmd_word; int msix_ctrl, rid; - pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); - pci_cmd_word |= PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2); + pci_enable_busmaster(dev); rid = 0; if (pci_find_cap(dev, PCIY_MSIX, &rid) == 0 && rid != 0) { rid += PCIR_MSIX_CTRL; From owner-svn-src-all@freebsd.org Fri Jan 27 23:03: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 3916FCC479D; Fri, 27 Jan 2017 23:03:30 +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 08DD6129C; Fri, 27 Jan 2017 23:03:29 +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 v0RN3Toj040745; Fri, 27 Jan 2017 23:03:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RN3TuX040744; Fri, 27 Jan 2017 23:03:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201701272303.v0RN3TuX040744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 27 Jan 2017 23:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312904 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 23:03:30 -0000 Author: jhb Date: Fri Jan 27 23:03:28 2017 New Revision: 312904 URL: https://svnweb.freebsd.org/changeset/base/312904 Log: Don't drop a reference to the TOE PCB in undo_offload_socket(). undo_offload_socket() is only called by t4_connect() during a connection setup failure, but t4_connect() still owns the TOE PCB and frees ita after undo_offload_socket() returns. Release a reference in undo_offload_socket() resulted in a double-free which panicked when t4_connect() performed the second free. The reference release was added to undo_offload_socket() incorrectly in r299210. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Jan 27 22:30:27 2017 (r312903) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Jan 27 23:03:28 2017 (r312904) @@ -273,8 +273,6 @@ undo_offload_socket(struct socket *so) mtx_lock(&td->toep_list_lock); TAILQ_REMOVE(&td->toep_list, toep, link); mtx_unlock(&td->toep_list_lock); - - free_toepcb(toep); } static void From owner-svn-src-all@freebsd.org Fri Jan 27 23:08: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 4BDE8CC482D; Fri, 27 Jan 2017 23:08: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 1B00E149E; Fri, 27 Jan 2017 23:08: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 v0RN86El040957; Fri, 27 Jan 2017 23:08:06 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RN86Fx040955; Fri, 27 Jan 2017 23:08:06 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701272308.v0RN86Fx040955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 27 Jan 2017 23:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312905 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 23:08:07 -0000 Author: sbruno Date: Fri Jan 27 23:08:06 2017 New Revision: 312905 URL: https://svnweb.freebsd.org/changeset/base/312905 Log: IFLIB updates: We found routing performance dropped significantly when configuring FreeBSD as a router, we are applying the following changes in order to resolve those issues and hopefully perform better. - don't prefetch the flags array, we usually don't need it - prefetch the next cache line of each of the software descriptor arrays as well as the first cache line of each of the next four packets' mbufs and clusters - reduce max copy size to 63 bytes - convert rx soft descriptors from array of structures to a structure of arrays - update copyrights Submitted by: Matt Macy Modified: head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Fri Jan 27 23:03:28 2017 (r312904) +++ head/sys/net/iflib.c Fri Jan 27 23:08:06 2017 (r312905) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2016, Matthew Macy + * Copyright (c) 2014-2017, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -264,18 +264,12 @@ iflib_get_sctx(if_ctx_t ctx) #define RX_SW_DESC_INUSE (1 << 3) #define TX_SW_DESC_MAPPED (1 << 4) -typedef struct iflib_sw_rx_desc { - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ - struct mbuf *ifsd_m; /* rx: uninitialized mbuf */ - caddr_t ifsd_cl; /* direct cluster pointer for rx */ - uint16_t ifsd_flags; -} *iflib_rxsd_t; - -typedef struct iflib_sw_tx_desc_val { - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ - struct mbuf *ifsd_m; /* pkthdr mbuf */ - uint8_t ifsd_flags; -} *iflib_txsd_val_t; +typedef struct iflib_sw_rx_desc_array { + bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ + struct mbuf **ifsd_m; /* pkthdr mbufs */ + caddr_t *ifsd_cl; /* direct cluster pointer for rx */ + uint8_t *ifsd_flags; +} iflib_rxsd_array_t; typedef struct iflib_sw_tx_desc_array { bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ @@ -287,7 +281,7 @@ typedef struct iflib_sw_tx_desc_array { /* magic number that should be high enough for any hardware */ #define IFLIB_MAX_TX_SEGS 128 #define IFLIB_MAX_RX_SEGS 32 -#define IFLIB_RX_COPY_THRESH 128 +#define IFLIB_RX_COPY_THRESH 63 #define IFLIB_MAX_RX_REFRESH 32 #define IFLIB_QUEUE_IDLE 0 #define IFLIB_QUEUE_HUNG 1 @@ -383,7 +377,7 @@ struct iflib_fl { uint16_t ifl_buf_size; uint16_t ifl_cltype; uma_zone_t ifl_zone; - iflib_rxsd_t ifl_sds; + iflib_rxsd_array_t ifl_sds; iflib_rxq_t ifl_rxq; uint8_t ifl_id; bus_dma_tag_t ifl_desc_tag; @@ -909,7 +903,7 @@ iflib_netmap_rxsync(struct netmap_kring ring->slot[nm_i].len = ri.iri_len - crclen; ring->slot[nm_i].flags = slot_flags; bus_dmamap_sync(fl->ifl_ifdi->idi_tag, - fl->ifl_sds[nic_i].ifsd_map, BUS_DMASYNC_POSTREAD); + fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } @@ -949,14 +943,14 @@ iflib_netmap_rxsync(struct netmap_kring vaddr = addr; if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ - netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_i].ifsd_map, addr); + netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd_map[nic_i], addr); slot->flags &= ~NS_BUF_CHANGED; } /* * XXX we should be batching this operation - TODO */ ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i, &paddr, &vaddr, 1, fl->ifl_buf_size); - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_i].ifsd_map, + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_PREREAD); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); @@ -1030,22 +1024,22 @@ iflib_netmap_rxq_init(if_ctx_t ctx, ifli { struct netmap_adapter *na = NA(ctx->ifc_ifp); struct netmap_slot *slot; - iflib_rxsd_t sd; + bus_dmamap_t *map; int nrxd; slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); if (slot == 0) return; - sd = rxq->ifr_fl[0].ifl_sds; + map = rxq->ifr_fl[0].ifl_sds.ifsd_map; nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; - for (int i = 0; i < nrxd; i++, sd++) { + for (int i = 0; i < nrxd; i++, map++) { int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); uint64_t paddr; void *addr; caddr_t vaddr; vaddr = addr = PNMB(na, slot + sj, &paddr); - netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, sd->ifsd_map, addr); + netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, *map, addr); /* Update descriptor and the cached value */ ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, 0 /* fl_id */, i, &paddr, &vaddr, 1, rxq->ifr_fl[0].ifl_buf_size); } @@ -1476,7 +1470,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; device_t dev = ctx->ifc_dev; iflib_fl_t fl; - iflib_rxsd_t rxsd; int err; MPASS(scctx->isc_nrxd[0] > 0); @@ -1484,13 +1477,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) fl = rxq->ifr_fl; for (int i = 0; i < rxq->ifr_nfl; i++, fl++) { - fl->ifl_sds = malloc(sizeof(struct iflib_sw_rx_desc) * - scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, - M_WAITOK | M_ZERO); - if (fl->ifl_sds == NULL) { - device_printf(dev, "Unable to allocate rx sw desc memory\n"); - return (ENOMEM); - } fl->ifl_size = scctx->isc_nrxd[rxq->ifr_fl_offset]; /* this isn't necessarily the same */ err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* alignment, bounds */ @@ -1509,17 +1495,49 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) __func__, err); goto fail; } + if (!(fl->ifl_sds.ifsd_flags = + (uint8_t *) malloc(sizeof(uint8_t) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } + if (!(fl->ifl_sds.ifsd_m = + (struct mbuf **) malloc(sizeof(struct mbuf *) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } + if (!(fl->ifl_sds.ifsd_cl = + (caddr_t *) malloc(sizeof(caddr_t) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } - rxsd = fl->ifl_sds; - for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++, rxsd++) { - err = bus_dmamap_create(fl->ifl_desc_tag, 0, &rxsd->ifsd_map); - if (err) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, err); + /* Create the descriptor buffer dma maps */ +#if defined(ACPI_DMAR) || (!(defined(__i386__) && !defined(__amd64__))) + if ((ctx->ifc_flags & IFC_DMAR) == 0) + continue; + + if (!(fl->ifl_sds.ifsd_map = + (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer map memory\n"); + err = ENOMEM; + goto fail; + } + + for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++) { + err = bus_dmamap_create(fl->ifl_desc_tag, 0, &fl->ifl_sds.ifsd_map[i]); + if (err != 0) { + device_printf(dev, "Unable to create TX DMA map\n"); goto fail; } } } +#endif return (0); fail: @@ -1568,13 +1586,21 @@ static void _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { struct mbuf *m; - int pidx = fl->ifl_pidx; - iflib_rxsd_t rxsd = &fl->ifl_sds[pidx]; - caddr_t cl; + int idx, pidx = fl->ifl_pidx; + caddr_t cl, *sd_cl; + struct mbuf **sd_m; + uint8_t *sd_flags; + bus_dmamap_t *sd_map; int n, i = 0; uint64_t bus_addr; int err; + sd_m = fl->ifl_sds.ifsd_m; + sd_map = fl->ifl_sds.ifsd_map; + sd_cl = fl->ifl_sds.ifsd_cl; + sd_flags = fl->ifl_sds.ifsd_flags; + idx = pidx; + n = count; MPASS(n > 0); MPASS(fl->ifl_credits + n <= fl->ifl_size); @@ -1597,8 +1623,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ * * If the cluster is still set then we know a minimum sized packet was received */ - if ((cl = rxsd->ifsd_cl) == NULL) { - if ((cl = rxsd->ifsd_cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) + if ((cl = sd_cl[idx]) == NULL) { + if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) break; #if MEMORY_LOGGING fl->ifl_cl_enqueued++; @@ -1613,16 +1639,16 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ DBG_COUNTER_INC(rx_allocs); #ifdef notyet - if ((rxsd->ifsd_flags & RX_SW_DESC_MAP_CREATED) == 0) { + if ((sd_flags[pidx] & RX_SW_DESC_MAP_CREATED) == 0) { int err; - if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, &rxsd->ifsd_map))) { + if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, &sd_map[idx]))) { log(LOG_WARNING, "bus_dmamap_create failed %d\n", err); uma_zfree(fl->ifl_zone, cl); n = 0; goto done; } - rxsd->ifsd_flags |= RX_SW_DESC_MAP_CREATED; + sd_flags[idx] |= RX_SW_DESC_MAP_CREATED; } #endif #if defined(__i386__) || defined(__amd64__) @@ -1636,7 +1662,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ cb_arg.error = 0; q = fl->ifl_rxq; - err = bus_dmamap_load(fl->ifl_desc_tag, rxsd->ifsd_map, + err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); if (err != 0 || cb_arg.error) { @@ -1651,28 +1677,28 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ } bus_addr = cb_arg.seg.ds_addr; } - rxsd->ifsd_flags |= RX_SW_DESC_INUSE; + sd_flags[idx] |= RX_SW_DESC_INUSE; - MPASS(rxsd->ifsd_m == NULL); - rxsd->ifsd_cl = cl; - rxsd->ifsd_m = m; + MPASS(sd_m[idx] == NULL); + sd_cl[idx] = cl; + sd_m[idx] = m; fl->ifl_bus_addrs[i] = bus_addr; fl->ifl_vm_addrs[i] = cl; - rxsd++; fl->ifl_credits++; i++; MPASS(fl->ifl_credits <= fl->ifl_size); - if (++fl->ifl_pidx == fl->ifl_size) { - fl->ifl_pidx = 0; + if (++idx == fl->ifl_size) { fl->ifl_gen = 1; - rxsd = fl->ifl_sds; + idx = 0; } if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { ctx->isc_rxd_refill(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx, fl->ifl_bus_addrs, fl->ifl_vm_addrs, i, fl->ifl_buf_size); i = 0; - pidx = fl->ifl_pidx; + pidx = idx; } + fl->ifl_pidx = idx; + } done: DBG_COUNTER_INC(rxd_flush); @@ -1706,28 +1732,33 @@ iflib_fl_bufs_free(iflib_fl_t fl) uint32_t i; for (i = 0; i < fl->ifl_size; i++) { - iflib_rxsd_t d = &fl->ifl_sds[i]; - - if (d->ifsd_flags & RX_SW_DESC_INUSE) { - bus_dmamap_unload(fl->ifl_desc_tag, d->ifsd_map); - bus_dmamap_destroy(fl->ifl_desc_tag, d->ifsd_map); - if (d->ifsd_m != NULL) { - m_init(d->ifsd_m, M_NOWAIT, MT_DATA, 0); - uma_zfree(zone_mbuf, d->ifsd_m); + struct mbuf **sd_m = &fl->ifl_sds.ifsd_m[i]; + uint8_t *sd_flags = &fl->ifl_sds.ifsd_flags[i]; + caddr_t *sd_cl = &fl->ifl_sds.ifsd_cl[i]; + + if (*sd_flags & RX_SW_DESC_INUSE) { + if (fl->ifl_sds.ifsd_map != NULL) { + bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; + bus_dmamap_unload(fl->ifl_desc_tag, sd_map); + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); + } + if (*sd_m != NULL) { + m_init(*sd_m, M_NOWAIT, MT_DATA, 0); + uma_zfree(zone_mbuf, *sd_m); } - if (d->ifsd_cl != NULL) - uma_zfree(fl->ifl_zone, d->ifsd_cl); - d->ifsd_flags = 0; + if (*sd_cl != NULL) + uma_zfree(fl->ifl_zone, *sd_cl); + *sd_flags = 0; } else { - MPASS(d->ifsd_cl == NULL); - MPASS(d->ifsd_m == NULL); + MPASS(*sd_cl == NULL); + MPASS(*sd_m == NULL); } #if MEMORY_LOGGING fl->ifl_m_dequeued++; fl->ifl_cl_dequeued++; #endif - d->ifsd_cl = NULL; - d->ifsd_m = NULL; + *sd_cl = NULL; + *sd_m = NULL; } /* * Reset free list values @@ -1807,10 +1838,14 @@ iflib_rx_sds_free(iflib_rxq_t rxq) bus_dma_tag_destroy(fl->ifl_desc_tag); fl->ifl_desc_tag = NULL; } + free(fl->ifl_sds.ifsd_m, M_IFLIB); + free(fl->ifl_sds.ifsd_cl, M_IFLIB); + /* XXX destroy maps first */ + free(fl->ifl_sds.ifsd_map, M_IFLIB); + fl->ifl_sds.ifsd_m = NULL; + fl->ifl_sds.ifsd_cl = NULL; + fl->ifl_sds.ifsd_map = NULL; } - if (rxq->ifr_fl->ifl_sds != NULL) - free(rxq->ifr_fl->ifl_sds, M_IFLIB); - free(rxq->ifr_fl, M_IFLIB); rxq->ifr_fl = NULL; rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; @@ -1995,13 +2030,33 @@ iflib_stop(if_ctx_t ctx) } } -static iflib_rxsd_t -rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload) +static inline void +prefetch_pkts(iflib_fl_t fl, int cidx) +{ + int nextptr; + int nrxd = fl->ifl_size; + + nextptr = (cidx + CACHE_PTR_INCREMENT) & (nrxd-1); + prefetch(&fl->ifl_sds.ifsd_m[nextptr]); + prefetch(&fl->ifl_sds.ifsd_cl[nextptr]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 1) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 2) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 3) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 4) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 1) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 2) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 3) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]); +} + +static void +rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload, iflib_fl_t *pfl, int *pcidx) { int flid, cidx; - iflib_rxsd_t sd; + bus_dmamap_t map; iflib_fl_t fl; iflib_dma_info_t di; + int next; flid = irf->irf_flid; cidx = irf->irf_idx; @@ -2012,16 +2067,22 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f if (cltype) fl->ifl_cl_dequeued++; #endif - sd = &fl->ifl_sds[cidx]; - di = fl->ifl_ifdi; - bus_dmamap_sync(di->idi_tag, di->idi_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + prefetch_pkts(fl, cidx); + if (fl->ifl_sds.ifsd_map != NULL) { + next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); + prefetch(&fl->ifl_sds.ifsd_map[next]); + map = fl->ifl_sds.ifsd_map[cidx]; + di = fl->ifl_ifdi; + next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); + prefetch(&fl->ifl_sds.ifsd_flags[next]); + bus_dmamap_sync(di->idi_tag, di->idi_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* not valid assert if bxe really does SGE from non-contiguous elements */ - MPASS(fl->ifl_cidx == cidx); - if (unload) - bus_dmamap_unload(fl->ifl_desc_tag, sd->ifsd_map); - + MPASS(fl->ifl_cidx == cidx); + if (unload) + bus_dmamap_unload(fl->ifl_desc_tag, map); + } if (__predict_false(++fl->ifl_cidx == fl->ifl_size)) { fl->ifl_cidx = 0; fl->ifl_gen = 0; @@ -2029,35 +2090,38 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f /* YES ick */ if (cltype) *cltype = fl->ifl_cltype; - return (sd); + *pfl = fl; + *pcidx = cidx; } static struct mbuf * assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) { int i, padlen , flags, cltype; - struct mbuf *m, *mh, *mt; - iflib_rxsd_t sd; - caddr_t cl; + struct mbuf *m, *mh, *mt, *sd_m; + iflib_fl_t fl; + int cidx; + caddr_t cl, sd_cl; i = 0; mh = NULL; do { - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE); + rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE, &fl, &cidx); + sd_m = fl->ifl_sds.ifsd_m[cidx]; + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; - MPASS(sd->ifsd_cl != NULL); - MPASS(sd->ifsd_m != NULL); + MPASS(sd_cl != NULL); + MPASS(sd_m != NULL); /* Don't include zero-length frags */ if (ri->iri_frags[i].irf_len == 0) { /* XXX we can save the cluster here, but not the mbuf */ - m_init(sd->ifsd_m, M_NOWAIT, MT_DATA, 0); - m_free(sd->ifsd_m); - sd->ifsd_m = NULL; + m_init(sd_m, M_NOWAIT, MT_DATA, 0); + m_free(sd_m); + fl->ifl_sds.ifsd_m[cidx] = NULL; continue; } - - m = sd->ifsd_m; + m = sd_m; if (mh == NULL) { flags = M_PKTHDR|M_EXT; mh = mt = m; @@ -2069,9 +2133,9 @@ assemble_segments(iflib_rxq_t rxq, if_rx /* assuming padding is only on the first fragment */ padlen = 0; } - sd->ifsd_m = NULL; - cl = sd->ifsd_cl; - sd->ifsd_cl = NULL; + fl->ifl_sds.ifsd_m[cidx] = NULL; + cl = fl->ifl_sds.ifsd_cl[cidx]; + fl->ifl_sds.ifsd_cl[cidx] = NULL; /* Can these two be made one ? */ m_init(m, M_NOWAIT, MT_DATA, flags); @@ -2094,16 +2158,19 @@ static struct mbuf * iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) { struct mbuf *m; - iflib_rxsd_t sd; + iflib_fl_t fl; + caddr_t sd_cl; + int cidx; /* should I merge this back in now that the two paths are basically duplicated? */ if (ri->iri_nfrags == 1 && ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE); - m = sd->ifsd_m; - sd->ifsd_m = NULL; + rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE, &fl, &cidx); + m = fl->ifl_sds.ifsd_m[cidx]; + fl->ifl_sds.ifsd_m[cidx] = NULL; + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR); - memcpy(m->m_data, sd->ifsd_cl, ri->iri_len); + memcpy(m->m_data, sd_cl, ri->iri_len); m->m_len = ri->iri_frags[0].irf_len; } else { m = assemble_segments(rxq, ri); Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Fri Jan 27 23:03:28 2017 (r312904) +++ head/sys/net/iflib.h Fri Jan 27 23:08:06 2017 (r312905) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015, Matthew Macy (mmacy@nextbsd.org) + * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Fri Jan 27 23:08: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 D2DFBCC4891; Fri, 27 Jan 2017 23:08:31 +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 AD7741637; Fri, 27 Jan 2017 23:08:31 +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 v0RN8Uu2041023; Fri, 27 Jan 2017 23:08:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RN8Ulf041018; Fri, 27 Jan 2017 23:08:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201701272308.v0RN8Ulf041018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 27 Jan 2017 23:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312906 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 23:08:31 -0000 Author: jhb Date: Fri Jan 27 23:08:30 2017 New Revision: 312906 URL: https://svnweb.freebsd.org/changeset/base/312906 Log: Unregister CPL handlers for TOE-related messages when unloading TOM. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Fri Jan 27 23:08:06 2017 (r312905) +++ head/sys/dev/cxgbe/tom/t4_connect.c Fri Jan 27 23:08:30 2017 (r312906) @@ -275,6 +275,14 @@ t4_init_connect_cpl_handlers(void) t4_register_cpl_handler(CPL_ACT_OPEN_RPL, do_act_open_rpl); } +void +t4_uninit_connect_cpl_handlers(void) +{ + + t4_register_cpl_handler(CPL_ACT_ESTABLISH, NULL); + t4_register_cpl_handler(CPL_ACT_OPEN_RPL, NULL); +} + #define DONT_OFFLOAD_ACTIVE_OPEN(x) do { \ reason = __LINE__; \ rc = (x); \ Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jan 27 23:08:06 2017 (r312905) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Jan 27 23:08:30 2017 (r312906) @@ -1848,12 +1848,12 @@ void t4_uninit_cpl_io_handlers(void) { - t4_register_cpl_handler(CPL_PEER_CLOSE, do_peer_close); - t4_register_cpl_handler(CPL_CLOSE_CON_RPL, do_close_con_rpl); - t4_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req); - t4_register_cpl_handler(CPL_ABORT_RPL_RSS, do_abort_rpl); - t4_register_cpl_handler(CPL_RX_DATA, do_rx_data); - t4_register_cpl_handler(CPL_FW4_ACK, do_fw4_ack); + t4_register_cpl_handler(CPL_PEER_CLOSE, NULL); + t4_register_cpl_handler(CPL_CLOSE_CON_RPL, NULL); + t4_register_cpl_handler(CPL_ABORT_REQ_RSS, NULL); + t4_register_cpl_handler(CPL_ABORT_RPL_RSS, NULL); + t4_register_cpl_handler(CPL_RX_DATA, NULL); + t4_register_cpl_handler(CPL_FW4_ACK, NULL); } /* Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Fri Jan 27 23:08:06 2017 (r312905) +++ head/sys/dev/cxgbe/tom/t4_listen.c Fri Jan 27 23:08:30 2017 (r312906) @@ -1622,4 +1622,14 @@ t4_init_listen_cpl_handlers(void) t4_register_cpl_handler(CPL_PASS_ACCEPT_REQ, do_pass_accept_req); t4_register_cpl_handler(CPL_PASS_ESTABLISH, do_pass_establish); } + +void +t4_uninit_listen_cpl_handlers(void) +{ + + t4_register_cpl_handler(CPL_PASS_OPEN_RPL, NULL); + t4_register_cpl_handler(CPL_CLOSE_LISTSRV_RPL, NULL); + t4_register_cpl_handler(CPL_PASS_ACCEPT_REQ, NULL); + t4_register_cpl_handler(CPL_PASS_ESTABLISH, NULL); +} #endif Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Jan 27 23:08:06 2017 (r312905) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Jan 27 23:08:30 2017 (r312906) @@ -1227,6 +1227,10 @@ t4_tom_mod_unload(void) t4_ddp_mod_unload(); + t4_uninit_connect_cpl_handlers(); + t4_uninit_listen_cpl_handlers(); + t4_uninit_cpl_io_handlers(); + return (0); } #endif /* TCP_OFFLOAD */ Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Jan 27 23:08:06 2017 (r312905) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Jan 27 23:08:30 2017 (r312906) @@ -326,12 +326,14 @@ void release_lip(struct tom_data *, stru /* t4_connect.c */ void t4_init_connect_cpl_handlers(void); +void t4_uninit_connect_cpl_handlers(void); int t4_connect(struct toedev *, struct socket *, struct rtentry *, struct sockaddr *); void act_open_failure_cleanup(struct adapter *, u_int, u_int); /* t4_listen.c */ void t4_init_listen_cpl_handlers(void); +void t4_uninit_listen_cpl_handlers(void); int t4_listen_start(struct toedev *, struct tcpcb *); int t4_listen_stop(struct toedev *, struct tcpcb *); void t4_syncache_added(struct toedev *, void *); From owner-svn-src-all@freebsd.org Fri Jan 27 23:10: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 AA7E9CC4A06; Fri, 27 Jan 2017 23:10:47 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A3931961; Fri, 27 Jan 2017 23:10:47 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0RNAkY6044118; Fri, 27 Jan 2017 23:10:46 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0RNAkdg044117; Fri, 27 Jan 2017 23:10:46 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201701272310.v0RNAkdg044117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 27 Jan 2017 23:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312907 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Jan 2017 23:10:47 -0000 Author: hiren Date: Fri Jan 27 23:10:46 2017 New Revision: 312907 URL: https://svnweb.freebsd.org/changeset/base/312907 Log: Add a knob to change default behavior of inheriting listen socket's tcp stack regardless of what the default stack for the system is set to. With current/default behavior, after changing the default tcp stack, the application needs to be restarted to pick up that change. Setting this new knob net.inet.tcp.functions_inherit_listen_socket_stack to '0' would change that behavior and make any new connection use the newly selected default tcp stack. Reviewed by: rrs MFC after: 2 weeks Sponsored by: Limelight Networks Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Fri Jan 27 23:08:30 2017 (r312906) +++ head/sys/netinet/tcp_syncache.c Fri Jan 27 23:10:46 2017 (r312907) @@ -120,6 +120,14 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, sync &VNET_NAME(tcp_syncookiesonly), 0, "Use only TCP SYN cookies"); +static VNET_DEFINE(int, functions_inherit_listen_socket_stack) = 1; +#define V_functions_inherit_listen_socket_stack \ + VNET(functions_inherit_listen_socket_stack) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, functions_inherit_listen_socket_stack, + CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(functions_inherit_listen_socket_stack), 0, + "Inherit listen socket's stack"); + #ifdef TCP_OFFLOAD #define ADDED_BY_TOE(sc) ((sc)->sc_tod != NULL) #endif @@ -830,7 +838,7 @@ syncache_socket(struct syncache *sc, str tcp_rcvseqinit(tp); tcp_sendseqinit(tp); blk = sototcpcb(lso)->t_fb; - if (blk != tp->t_fb) { + if (V_functions_inherit_listen_socket_stack && blk != tp->t_fb) { /* * Our parents t_fb was not the default, * we need to release our ref on tp->t_fb and From owner-svn-src-all@freebsd.org Sat Jan 28 00:00: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 D078BCC483A; Sat, 28 Jan 2017 00:00: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 92E9C8DD; Sat, 28 Jan 2017 00:00:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S00At9061786; Sat, 28 Jan 2017 00:00:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S00ApC061785; Sat, 28 Jan 2017 00:00:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201701280000.v0S00ApC061785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 28 Jan 2017 00:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312908 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 00:00:12 -0000 Author: emaste Date: Sat Jan 28 00:00:10 2017 New Revision: 312908 URL: https://svnweb.freebsd.org/changeset/base/312908 Log: ERL: set -march=octeon+ for use with external toolchain Upstream GCC and devel/mips64-gcc use "octeon+" as the CPU setting for the Octeon processor in the EdgeRouter Lite. As of r312899 the base system GCC 4.2.1 accepts octeon+ as an alias for the Octeon support added in r208737 for the same CPU. Sponsored by: The FreeBSD Foundation Modified: head/sys/mips/conf/ERL Modified: head/sys/mips/conf/ERL ============================================================================== --- head/sys/mips/conf/ERL Fri Jan 27 23:10:46 2017 (r312907) +++ head/sys/mips/conf/ERL Sat Jan 28 00:00:10 2017 (r312908) @@ -21,7 +21,7 @@ ident ERL -makeoptions ARCH_FLAGS="-march=octeon -mabi=64" +makeoptions ARCH_FLAGS="-march=octeon+ -mabi=64" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 makeoptions KERNLOADADDR=0xffffffff80100000 From owner-svn-src-all@freebsd.org Sat Jan 28 00:40: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 76089CC3080; Sat, 28 Jan 2017 00:40:38 +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 3EAAA190E; Sat, 28 Jan 2017 00:40:38 +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 v0S0ebxG078238; Sat, 28 Jan 2017 00:40:37 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S0ebsW078234; Sat, 28 Jan 2017 00:40:37 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701280040.v0S0ebsW078234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sat, 28 Jan 2017 00:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312909 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 00:40:38 -0000 Author: sbruno Date: Sat Jan 28 00:40:36 2017 New Revision: 312909 URL: https://svnweb.freebsd.org/changeset/base/312909 Log: Add iflib man pages for developers. Doc review is probably waranted here for editing. Submitted by: Nicole Graziano Added: head/share/man/man9/iflibdd.9 (contents, props changed) head/share/man/man9/iflibdi.9 (contents, props changed) head/share/man/man9/iflibtxrx.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Jan 28 00:00:10 2017 (r312908) +++ head/share/man/man9/Makefile Sat Jan 28 00:40:36 2017 (r312909) @@ -158,6 +158,9 @@ MAN= accept_filter.9 \ ieee80211_regdomain.9 \ ieee80211_scan.9 \ ieee80211_vap.9 \ + iflibdd.9 \ + iflibdi.9 \ + iflibtxrx.9 \ ifnet.9 \ inittodr.9 \ insmntque.9 \ Added: head/share/man/man9/iflibdd.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/iflibdd.9 Sat Jan 28 00:40:36 2017 (r312909) @@ -0,0 +1,181 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBDD(9) +.Os +.Sh NAME +.Nm iflibdd +.Nd Device Dependent Configuration Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Soft Queue Setup and Teardown Functions" +.Ss "Mandatory Functions" +.Ft int +.Fn ifdi_queues_alloc "if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nqs" +.Ft int +.Fn ifdi_queues_free "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft int +.Fn ifdi_txq_setup "if_ctx_t ctx, uint16_t qid" +.Ft int +.Fn ifdi_rxq_setup "if_ctx_t ctx, uint16_t qid" +.Ss "Device Setup and Teardown Functions" +.Ss "Mandatory Functions" +.Ft int +.Fn ifdi_attach_pre "if_ctx_t ctx" +.Ft int +.Fn ifdi_attach_post "if_ctx_t ctx" +.Ft int +.Fn ifdi_detach "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_vlan_register "if_ctx_t ctx, uint16_t vtag" +.Ft void +.Fn ifdi_vlan_unregister "if_ctx_t ctx, uint16_t vtag" +.Ft int +.Fn ifdi_suspend "if_ctx_t ctx" +.Ft int +.Fn ifdi_resume "if_ctx_t ctx" +.Ss "Device Configuration Functions" +.Ss "Mandatory Functions" +.Ft void +.Fn ifdi_init "if_ctx_t ctx" +.Ft void +.Fn ifdi_stop "if_ctx_t ctx" +.Ft void +.Fn ifdi_multi_set "if_ctx_t ctx" +.Ft int +.Fn ifdi_mtu_set "if_ctx_t ctx, uint32_t mtu" +.Ft void +.Fn ifdi_media_status "if_ctx_t ctx, struct ifmediareq *ifr" +.Ft int +.Fn ifdi_media_change "if_ctx_t ctx" +.Ft void +.Fn ifdi_promisc_set "if_ctx_t ctx, int flags" +.Ft uint64_t +.Fn ifdi_get_counter "if_ctx_t ctx, ift_counter cnt" +.Ft void +.Fn ifdi_update_admin_status "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_media_set "if_ctx_t ctx" +.Ss "Interrupt enable/disable" +.Ss "Mandatory Functions" +.Ft void +.Fn ifdi_intr_enable "if_ctx_t ctx" +.Ft void +.Fn ifdi_queue_intr_enable "if_ctx_t ctx, uint16_t qid" +.Ft void +.Fn ifdi_intr_disable "if_ctx_t ctx" +.Ss IOV Support +.Ft init +.Fn iov_init "if_ctx_t, uint16_t num_vfs, const nvlist_t *params" +.Ft void +.Fn iov_uinit "if_ctx_t ctx" +.Ft void +.Fn ifdi_vflr_handle "if_ctx_t ctx" +.Ft int +.Fn ifdi_vf_add "if_ctx_t ctx, uint16_t vfnum, const nvlist_t *params" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_link_intr_enable "if_ctx_t ctx" +.Ss "Optional Service Routines" +.Ft void +.Fn ifdi_timer "if_ctx_t ctx" +.Ft void +.Fn ifdi_watchdog_reset "if_ctx_t ctx" +.Ss "Additional Functions" +.Ft void +.Fn ifdi_led_func "if_ctx_t ctx, int onoff" +.Ft int +.Fn ifdi_sysctl_int_delay "if_ctx_t ctx, if_int_delay_info_t iidi" +.Ft int +.Fn ifdi_i2c_req "if_ctx_t ctx, struct ifi2creq *req" +.Sh FUNCTIONS +The above named functions are device dependent configuration functions. These routines are registerd with iflib by the driver and are called from the corresponding iflib function to configure device specific functions and registers. +.Ss Device Dependent Functions +.Ss Soft Queue Setup and Teardown +.Bl -ohang -offset indent +.It Fn ifdi_queues_alloc +Manditory queues allocation function that is called during iflib_attach. vaddrs and paddrs are arrays of virtual and physical addresses respectively of the hardware transmit and receive queues, and if relevany, any command completion queues. nqs is the number of queues per qset. For example, a driver with a single receive and transmit queue would have a nqs equal to 2. +.It Fn ifdi_queues_free +Mandatory function that frees the allocated queues and associated transmit buffers. +.It Fn ifdi_txq_setup +Optional function for each transmit queue that handles device specific initialization. +.It Fn ifdi_rxq_setup +Optional function for each receive queue that handles device specific initialization. +.El +.Ss Device Setup and Teardown +.Bl -ohang -offset indent +.It Fn ifdi_attach_pre +Mandatory function implemented by the driver to perform any attach logic that procedes interrupt and queue allocation, queue setup, and interrupt assignment. +.It Fn ifdi_attach_post +Mandatory function implemented by the driver to perform any attach logic that occurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy interrupt assignment. +.It Fn ifdi_detach +Mandatory function that frees any resources allocated by the driver in ifdi_attach_pre and ifdi_attach_post. +.It Fn ifdi_vlan_register +Optional function called by the VLAN config eventhandler. _vtag is the new VLAN tag. +.It Fn ifdi_vlan_unregister +Optional function called by the VLAN unconfig eventhandler. +.It Fn ifdi_suspend +Optional function that suspends the driver. +.It Fn ifdi_resume +Optional function that resumes a driver. +.El +.Ss Device Configuration Functions +.Bl -ohang -offset indent +.It Fn ifdi_init +Mandatory function that will initialize and bring up the hardware. For example, it will reset the chip and enable the receiver unit. It should mark the interface running, but not active (IFF_DRV_RUNNING, ~IIF_DRV_OACTIVE). +.It Fn ifdi_stop +Mandatory function that should disable all traffic on the interface by issuing a global reset on the MAC and deallocating the TX and RX buffers. +.It Fn ifdi_multi_set +Programs the interfaces multicast addresses +.It Fn ifdi_media_status +Media Ioctl Callback. Function is called whenever the user queries the status of the interface using ifconfig. The driver sets the appropriate link type and speed in ifmr->ifm_active. +.It Fn ifdi_mtu_set +Sets the mtu interface to the value of the second function parameter mtu. +.It Fn ifdi_media_change +Function is called when the user changes speed/duplex using the media/mediaopt option with ifconfig. +.It Fn ifdi_promisc_set +Enables or disables promisc settings depending upon the flags value. Flags contains the interfaces' ifnet flags. +.It Fn ifdi_get_counter +Returns the value for counter cnt depending upon counter type. +.It Fn ifdi_update_admin_status +Sets the link_up state to TRUE or FALSE depending upon the OS link state. A real check of the hardware only happens with a link interrupt. +.It Fn ifdi_media_set +Need to define +.El +.Ss Interrupt Enable/Disable +.Bl -ohang -offset indent +.It Fn ifdi_intr_enable +Mandatory function that enables all interrupts. +.It Fn ifdi_intr_disable +Mandatory function that disables all interrupts. +.It Fn ifdi_queue_intr_enable +Mandatory function that enables interrupts on queue qid. +.It Fn iov_init +Initialize num_vfs VFs. +.It Fn io_uninit +Tear down the context for all VFs. +.It Fn ifdi_vflr_handle +Handle any VFs that have reset themselves via a Function Level Reset(FLR). +.It Fn ifdi_vf_add +Set parameters in params in VF vfnum. +.El +.Ss Service Routines +.Bl -ohang -offset indent +.It ifdi_timer +Optional timer routine that will be run every 500ms. +.It ifdi_watchdog_reset +Optional function to run when a transmit queue is hung. +.El +.Ss Additional Functions +.Bl -ohang -offset indent +.It ifdi_led_func +.It ifdi_sysctl_int_delay +.It ifdi_i2c_req +.El +.Sh "SEE ALSO" + iflibtxrx(9), iflibdd(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano Added: head/share/man/man9/iflibdi.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/iflibdi.9 Sat Jan 28 00:40:36 2017 (r312909) @@ -0,0 +1,152 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBDI(9) +.Os +.Sh NAME +.Nm iflibdi +.Nd Device Independent Configuration Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Device Independent Functions" +.Ft int +.Fn iflib_device_attach "device_t dev" +.Ft int +.Fn iflib_device_detach "device_t dev" +.Ft int +.Fn iflib_device_suspend "device_t dev" +.Ft int +.Fn iflib_device_resume "device_t dev" +.Ft int +.Fn iflib_device_register "device_t dev, void *softc, if_shared_ctx_t sctx, if_ctx_t *ctxp" +.Ft int +.Fn iflib_device_deregister "if_ctx_t ctx" +.Ft int +.Fn iflib_irq_alloc "if_ctx_t ctx, if_irq_t irq_info, int rid, driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name" +.Ft int +.Fn iflib_irq_alloc_generic "if_ctx_t, ctx, if_irq_t irq, int rid, intr_type_t type, driver_filter_t *filter, void *filter_arg, int qid, char *name" +.Ft void +.Fn iflib_led_create "if_ctx_t ctx" +.Ft void +.Fn iflib_tx_intr_deferred "if_ctx_t ctx, int txqid" +.Ft void +.Fn iflib_rx_intr_deferred "if_ctx_t ctx, int rxqid" +.Ft void +.Fn iflib_link_intr_deferred "if_ctx_t ctx" +.Ft void +.Fn iflib_link_state_change "if_ctx_t ctx, int linkstate" +.Ft void +.Fn iflib_led_create "if_ctx_t ctx" +.Ft void +.Fn iflib_add_int_delay_sysctl "if_ctx_t ctx, const char *, const char *, if_int_delay_info_t, int, int" +.Ss "Global Variables" +.Vt extern struct if_txrx +.Sh DATA STRUCTURES +The \fIif_ctx_t\fP Structure is the device independent data structure that contains statistics and identifying information used to transmit and receive data packets. The interface is associated with an array of queues assigned sequentially. Each queu has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue. The transmit queue is used to hold packets while the interface is in the process of sending another. The receive queue is used to receive packets that are awaiting processing. +.Pp +.Ss The if_ctx_t Structure +The fields of +.Vt "struct if_ctx_t" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va if_softc +.Pq Vt "void" +A pointer to the driver's private state block. +.It Va ifc_dev +.Pq Vt "device_t" +The underlying device structure. +.It Va ifc_ip +.Pq Vt "if_t" +A link back to the interface structure +.It Va ifc_cpus +.Pq Vt "cpuset_t" +.It Va ifc_mutex +.Pq Vt "struct mtx" +Mutex lock used to maintain data integrity +.It Va ifc_mtx_name +.Pq Vt "char *" +The name of the mutex +.It Va ifc_txqs +.Pq Vt "iflib_txq_t" +Device independent transmit queue maintained internally by iflib +.It Va ifc_rxqs +.Pq Vt "iflib_rxq_t" +Device independent receive queue maintained internally by iflib +.It Va ifc_qsets +.Pq Vt "iflib_qset_t" + Output queue that contains a single transmit (ifc_txq_t) and receive (ifc_rxq_t) queue +.It Va ifc_if_flags +.Pq Vt "uint32_t" +Flags describing the operational parameter of the interface +.It Va ifc_in_detach +.Pq Vt "int" +.It Va ifc_link_state +.Pq Vt "int" +Describes the current link state of the Ethernet interface. It's possible values are either active or inactive. +.It Va ifc_link_irq +.Pq Vt "int" +.It Va ifc_vlan_attach_event +.Pq Vt "eventhandler_tag" +.It Va ifc_vlan_detach_event +.Pq Vt "eventhandler_tag" +.It Va ifc_pause_frames +.Pq Vt "int" +.It Va ifc_watchdog_events +.Pq Vt "int" +.It Va ifc_mac +.Pq Vt "uint8_t" +.It Va ifc_msix_mem +.Pq Vt "struct resource *" +.It Va ifc_legacy_irq +.Pq Vt "struct if_irq" +.It Va ifc_admin_task +.Pq Vt "struct grouptask" +Taskqueue task scheduled for link state change events of the interface +.It Va ifc_filter_info +.Pq Vt "struct iflib_filter_info" +Statistics and information relating to the interface device filter +.It Va ifc_media +.Pq Vt "struct ifmedia" +.It Va ifc_txrx +.Pq Vt "struct if_txrx" +.El +.Sh FUNCTIONS + The above named functions are found exclusively in iflib. They are independent of the underlying hardware type or configuration. +.Ss Device Independent Functions +.Bl -ohang -offset indent +.It Fn iflib_device_attach +Function initiates a device registration with the iflib framework. It calls the iflib_register function, which is responsible for allocating and initializing the \fIif_ctx_t\fP structure. +.It Fn iflib_device_detach +Shutdown and detach the device. Unregister vlan events, drain any dependent tasks, and release irq, pci, and msix memory. +.It Fn iflib_device_suspend +Suspend a device by calling the device dependent suspend function and bus_generic_suspend. +.It Fn iflib_device_resume +Resume a device by calling the device dependent resume function, the iflib_init_locked function, and bus_generic_resume. +.It Fn iflib_device_register +Register a device with the iflib framework. Allocate and initialize the \fIif_ctx_t\fP structure. Setup and initialize the MSI or MSI/X interrupt queues if necessary. Allocate memory for queues and qset structure setup. +.It Fn iflib_device_irq_alloc +Allocate an interrupt resource for a given rid value with an associated filter and handler function. +.It Fn iflib_device_irq_alloc_generic +Performs the same function as iflib_device_irq_alloc along with the additional functionality of adding a taskgroup. The data fields and callback function are determined by the type of interrupt, such as IFLIB_INTR_TX, IFLIB_INTR_RX, and IFLIB_INTR_ADMIN. +.It Fn iflib_led_create +Calls led_create to initialize the ctx->ifc_led_dev field +.It Fn iflib_tx_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task. +.It Fn iflib_rx_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task. +.It Fn iflib_link_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the link task +.It Fn iflib_link_state_change +Change the interface link status to either LINK_STATE_UP or LINK_STATE_DOWN as specified by the second argument to the function. +\fBInterface Link States\fP +The following link states are currently defined: + + LINK_STATE_UP The link is up. + LINK_STATE_DOWN The link is down. +.It Fn iflib_add_int_delay_sysctl +Modifies settings to user defined values for a given set of variables. +.El +.Sh "SEE ALSO" + iflibtxrx(9), iflibdd(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano Added: head/share/man/man9/iflibtxrx.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/iflibtxrx.9 Sat Jan 28 00:40:36 2017 (r312909) @@ -0,0 +1,165 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBTXTX(9) +.Os +.Sh NAME +.Nm iflibtxrx +.Nd Device Dependent Transmit and Receive Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Interface Manipulation Functions" +.Ft int +.Fn isc_txd_encap "void *sc, if_pkt_into_t pi" +.Ft void +.Fn isc_txd_flush "void *sc, uint16_t qid, uint32_t _pidx_or_credits_" +.Ft int * +.Fn isc_txd_credits_update "void *sc, uint16_t qid, uint32_t credits" +.Ft int * +.Fn isc_rxd_available "void *sc, uint16_t qsid, uint32_t cidx" +.Ft void * +.Fn isc_rxd_refill "void *sc, uint16_t qsid, uint8_t flid, uint32_t pidx, uint64_t *paddrs, caddr_t *vaddrs, uint16_t count" +.Ft void * +.Fn isc_rxd_flush "void *sc, uint16_t qsid, uint8_t flid, uint32_t pidx" +.Ft int +.Fn isc_rxd_pkt_get "void *sc, if_rxd_info_t ri" +.Ss "Global Variables" +.Vt extern struct if_txrx +.Sh DATA STRUCTURES +The device dependent mechanisms for handling packet transmit and receive are primarily defined by the functions named above. The if_pkt_info data structure contains statistics and identifying info necessary for packet transmission. While the data structure for packet receipt is the if_rxd_info structure. +.Pp +.Ss The if_pkt_info Structure +The fields of +.Vt "struct if_pkt_info" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va ipi_len +.Pq Vt "uint32_t" +Denotes the size of packet to be sent on the transmit queue. +.It Va ipi_segs +.Pq Vt "bus_dma_segment_t *" +A pointer to the bus_dma_segment of the device independent transfer queue defined in iflib. +.It Va ipi_qsidx +Unique index value assigned sequentially to each transmit queue. Used to reference the currently transmitting queue. +.It Va ipi_nsegs +.Pq Vt "uint16_t" +Number of descriptors to be read into the device dependent transfer descriptors. +.It Va ipi_ndescs +.Pq Vt "uint16_t" +Number of descriptors in use. Calculated by subtracting the old pidx value from the new pidx value. +.It Va ipi_flags +.Pq Vt "uint16_t" +Flags defined on a per packet basis. +.It Va ipi_pidx +.Pq Vt "uint32_t" +Value of first pidx sent to the isc_encap function for encapsulation and subsequent transmission. +.It Va ipi_new_pidx +.Pq Vt "uint32_t" +Value set after the termination of the isc_encap function. This value will become the first pidx sent to the isc-encap the next time that the function is called. +.It Va \fBThe Following Fields Are Used For Offload Handling\fP +.It Va ipi_csum_flags +.Pq Vt "uint64_t" +Flags describing the checksum values. Used on a per packet basis. +.It Va ipi_tso_segsz +.Pq Vt "uint16_t" +Size of the TSO Segment Size. +.It Va ipi_mflags +.Pq Vt "uint16_t" +Flags describing the operational parameters of the mbuf. +.It Va ipi_vtag +.Pq Vt "uint16_t" +Contains the VLAN information in the Ethernet Frame. +.It Va ipi_etype +.Pq Vt "uint16_t" +Type of ethernet header protocol as contained by the struct ether_vlan_header. +.It Va ipi_ehrdlen +.Pq Vt "uint8_t" +Length of the Ethernet Header. +.It Va ipi_ip_hlen +.Pq Vt "uint8_t" +Length of the TCP Header +.It Va ipi_tcp_hlen +.Pq Vt "uint8_t" +Length of the TCP Header. +.It Va ipi_tcp_hflags +.Pq Vt "uint8_t" +Flags describing the operational parameters of the TCP Header. +.It Va ipi_ipproto +.Pq Vt "uint8_t" +Specifies the type of IP Protocol in use. Example TCP, UDP, or SCTP. +.El +.Ss The if_rxd_info Structure +The fields of +.Vt "struct if_rxd_info" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va iri_qsidx +.Pq Vt "uint16_t" +Unique index value assigned sequentially to each receive queue. Used to reference the currently receiving queue. +.It Va iri_vtag +.Pq Vt "uint16_t" +Contains the VLAN information in the Ethernet Frame. +.It Va iri_len +.Pq Vt "uint16_t" +Denotes the size of a received packet. +.It Va iri_next_offset +.Pq Vt "uint16_t" +Denotes the offset value for the next packet to be receive. A Null value signifies the end of packet. +.It Va iri_cidx +.Pq Vt "uint32_t" +Denotes the index value of the packet currently being processed in the consumer queue. +.It Va iri_flowid +.Pq Vt "uint32_t" +Value of the RSS hash for the packet. +.It Va iri_flags +.Pq Vt "uint" + Flags describing the operational parameters of the mbuf contained in the receive packet. +.It Va iri_csum_flags +.Pq Vt "uint32_t" +Flags describing the checksum value contained in the receive packet. +.It Va iri_csum_data +.Pq Vt "uint32_t" +Checksum data contained in the mbuf packet header. +.It Va iri_m +.Pq Vt "struct mbuf *" +A mbuf for drivers that manage their own receive queues. +.It Va iri_ifp +.Pq Vt "struct ifnet *" +A link back to the interface structure. Utilized by drivers that have multiple interface per softc. +.It Va iri_rsstype +.Pq Vt "uint8_t" +The value of the RSS hash type. +.It Va iri_pad +.Pq Vt "uint8_t" +The length of any padding contained by the received data. +.It Va iri_qidx +.Pq Vt "uint8_t" +Represents the type of queue event. If value >= 0 then it is the freelist id otherwise it is a completion queue event. +.El +.Sh FUNCTIONS +All function calls are associated exclusively with either packet transmission or receipt. +The void *sc passed as the first arguement to all of the following functions repressents the driver's softc. +.Ss Transmit Packet Functions +.Bl -ohang -offset indent +.It Fn isc_txd_encap + Transmit function that sends a packet on an interface. The if_pkt_info data structure contains data information fields describing the packet. This function returns 0 if successful, otherwise an error value is returned. +.It Fn isc_txd_flush +Flush function is called immediately after the isc_txd_encap function transmits a packet. It updates the hardware producer index or increments the descriptors used to pidx_or_credits in the queue designated by the qid number. This is often referred to as poking the doorbell register. +.It Fn isc_txd_credits_update +Credit function advances the buffer ring and calculates the credits (descriptors) processed. Until the I/O is complete it cleans the range in case of multisegments and updates the count of processed packets. The function returns the number of processed credits. +.El +.Ss Receive Packet Functions +.Bl -ohang -offset indent +.It Fn isc_rxd_available +Function calculates the remaining number of descriptors from a position given by idx. The function returns this value. +.It Fn isc_rxd_refill +Starting with the physical address paddrs, the function reads a packet into the rx_ring until a value designated by count is reached. vaddrs is typically not needed and is provided for devices that place their own metadata in the packet header. +.It Fn isc_rxd_flush +Flush function updates the producer pointer on the free list flid in queue set number qid to pidx to reflect the presence of new buffers. +.It Fn isc_rxd_pkt_get +Process a single software descriptor. rxr->rx_base[i] contains a descriptor that describes a received packet. Hardware specific information about the buffer referred to by ri is returned in the data structure if_rxd_info +.El +.Sh "SEE ALSO" + iflibdd(9), iflibdi(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano From owner-svn-src-all@freebsd.org Sat Jan 28 02:22: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 5EDF7CC4A1D; Sat, 28 Jan 2017 02:22:19 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0EE917AC; Sat, 28 Jan 2017 02:22:18 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S2MI34022500; Sat, 28 Jan 2017 02:22:18 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S2MFSR022477; Sat, 28 Jan 2017 02:22:15 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201701280222.v0S2MFSR022477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 28 Jan 2017 02:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312910 - in head: . etc/etc.pc98 etc/rc.d lib/libsysdecode libexec release release/doc release/doc/en_US.ISO8859-1/hardware release/doc/en_US.ISO8859-1/readme release/doc/share/example... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 02:22:19 -0000 Author: nyan Date: Sat Jan 28 02:22:15 2017 New Revision: 312910 URL: https://svnweb.freebsd.org/changeset/base/312910 Log: Remove pc98 support completely. I thank all developers and contributors for pc98. Relnotes: yes Deleted: head/etc/etc.pc98/ head/libexec/Makefile.pc98 head/release/pc98/ head/sbin/Makefile.pc98 head/sbin/fdisk_pc98/ head/share/man/man4/man4.i386/ct.4 head/share/man/man4/man4.i386/snc.4 head/share/syscons/keymaps/jp.pc98.iso.kbd head/share/syscons/keymaps/jp.pc98.kbd head/share/vt/keymaps/jp.pc98.iso.kbd head/share/vt/keymaps/jp.pc98.kbd head/sys/boot/Makefile.pc98 head/sys/boot/pc98/ head/sys/conf/Makefile.pc98 head/sys/conf/files.pc98 head/sys/conf/options.pc98 head/sys/dev/aic/aic_cbus.c head/sys/dev/ata/ata-cbus.c head/sys/dev/ct/ head/sys/dev/ed/if_ed98.h head/sys/dev/ed/if_ed_cbus.c head/sys/dev/fdc/fdc_cbus.c head/sys/dev/fe/if_fe_cbus.c head/sys/dev/ic/i8251.h head/sys/dev/ic/wd33c93reg.h head/sys/dev/le/if_le_cbus.c head/sys/dev/mse/mse_cbus.c head/sys/dev/snc/ head/sys/dev/uart/uart_cpu_pc98.c head/sys/geom/geom_pc98.c head/sys/geom/geom_pc98_enc.c head/sys/geom/part/g_part_pc98.c head/sys/modules/canbepm/ head/sys/modules/canbus/ head/sys/modules/ct/ head/sys/modules/geom/geom_part/geom_part_pc98/ head/sys/modules/geom/geom_pc98/ head/sys/modules/pmc/ head/sys/modules/snc/ head/sys/pc98/ head/sys/sys/disk/pc98.h head/sys/sys/diskpc98.h head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu head/usr.sbin/boot98cfg/ head/usr.sbin/bsdinstall/partedit/partedit_pc98.c Modified: head/Makefile head/Makefile.inc1 head/ObsoleteFiles.inc head/etc/rc.d/syscons head/lib/libsysdecode/Makefile head/lib/libsysdecode/mkioctls head/release/doc/README head/release/doc/en_US.ISO8859-1/hardware/article.xml head/release/doc/en_US.ISO8859-1/readme/article.xml head/release/doc/share/examples/Makefile.relnotesng head/release/doc/share/misc/dev.archlist.txt head/release/doc/share/xml/release.ent head/release/rc.local head/rescue/rescue/Makefile head/sbin/bsdlabel/bsdlabel.8 head/sbin/bsdlabel/bsdlabel.c head/sbin/geom/class/part/gpart.8 head/share/examples/bootforth/frames.4th head/share/man/man4/adv.4 head/share/man/man4/ahc.4 head/share/man/man4/apic.4 head/share/man/man4/ed.4 head/share/man/man4/esp.4 head/share/man/man4/fxp.4 head/share/man/man4/geom.4 head/share/man/man4/man4.i386/Makefile head/share/man/man4/man4.i386/aic.4 head/share/man/man4/ncr.4 head/share/man/man4/ncv.4 head/share/man/man4/sym.4 head/share/mk/bsd.stand.mk head/share/mk/local.meta.sys.mk head/share/syscons/keymaps/INDEX.keymaps head/share/syscons/keymaps/Makefile head/share/vt/keymaps/INDEX.keymaps head/share/vt/keymaps/Makefile head/sys/Makefile head/sys/boot/common/Makefile.inc head/sys/boot/common/isapnp.h head/sys/boot/ficl/loader.c head/sys/boot/forth/frames.4th head/sys/cam/cam_xpt.c head/sys/conf/NOTES head/sys/conf/config.mk head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/options head/sys/crypto/aesni/aesni.h head/sys/crypto/via/padlock.c head/sys/crypto/via/padlock_hash.c head/sys/dev/ata/ata-all.h head/sys/dev/ep/if_ep_isa.c head/sys/dev/exca/excareg.h head/sys/dev/fb/fb.c head/sys/dev/fb/splash_bmp.c head/sys/dev/fdc/fdc.c head/sys/dev/fdc/fdcvar.h head/sys/dev/fe/if_fe.c head/sys/dev/fe/if_fereg.h head/sys/dev/kbd/kbd.c head/sys/dev/le/am79900.c head/sys/dev/mse/msevar.h head/sys/dev/pccbb/pccbb_isa.c head/sys/dev/pci/vga_pci.c head/sys/dev/ppc/ppc.c head/sys/dev/ppc/ppcreg.h head/sys/dev/sio/sio_pccard.c head/sys/dev/sio/sio_pci.c head/sys/dev/sio/sio_puc.c head/sys/dev/sio/siovar.h head/sys/dev/sound/isa/mss.c head/sys/dev/sound/isa/mss.h head/sys/dev/sound/isa/sbc.c head/sys/dev/syscons/daemon/daemon_saver.c head/sys/dev/syscons/dragon/dragon_saver.c head/sys/dev/syscons/fire/fire_saver.c head/sys/dev/syscons/logo/logo_saver.c head/sys/dev/syscons/plasma/plasma_saver.c head/sys/dev/syscons/rain/rain_saver.c head/sys/dev/syscons/scmouse.c head/sys/dev/syscons/scvidctl.c head/sys/dev/syscons/star/star_saver.c head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/dev/syscons/warp/warp_saver.c head/sys/dev/uart/uart.h head/sys/dev/uart/uart_bus_isa.c head/sys/geom/geom_bsd.c head/sys/i386/bios/apm.c head/sys/i386/bios/apm.h head/sys/i386/i386/genassym.c head/sys/i386/i386/initcpu.c head/sys/i386/i386/locore.s head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/mpboot.s head/sys/i386/i386/vm_machdep.c head/sys/i386/isa/elink.h head/sys/i386/isa/npx.c head/sys/i386/pci/pci_pir.c head/sys/isa/isareg.h head/sys/isa/isavar.h head/sys/isa/pnp.c head/sys/isa/pnpreg.h head/sys/modules/Makefile head/sys/modules/Makefile.inc head/sys/modules/aic/Makefile head/sys/modules/apm/Makefile head/sys/modules/ata/Makefile head/sys/modules/drm2/Makefile head/sys/modules/ed/Makefile head/sys/modules/fdc/Makefile head/sys/modules/fe/Makefile head/sys/modules/geom/geom_part/Makefile head/sys/modules/i2c/controllers/Makefile head/sys/modules/le/Makefile head/sys/modules/mse/Makefile head/sys/modules/ppc/Makefile head/sys/modules/sio/Makefile head/sys/modules/sound/sound/Makefile head/sys/sys/consio.h head/sys/sys/copyright.h head/sys/sys/fbio.h head/sys/sys/fdcio.h head/sys/x86/isa/atpic.c head/sys/x86/isa/clock.c head/sys/x86/isa/icu.h head/sys/x86/isa/isa.c head/sys/x86/x86/autoconf.c head/sys/x86/x86/cpu_machdep.c head/sys/x86/x86/intr_machdep.c head/sys/x86/x86/mptable.c head/sys/x86/x86/nexus.c head/targets/pseudo/userland/Makefile.depend head/targets/pseudo/userland/misc/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc head/tools/tools/kerninclude/kerninclude.sh head/tools/tools/sysdoc/sysdoc.sh head/tools/tools/vt/keymaps/KBDFILES.map head/tools/tools/vt/keymaps/convert-keymap.pl head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/tests/mkimg.sh head/usr.sbin/Makefile.i386 head/usr.sbin/bsdinstall/partedit/gpart_ops.c head/usr.sbin/bsdinstall/partedit/part_wizard.c head/usr.sbin/bsdinstall/partedit/scripted.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c head/usr.sbin/config/config.5 head/usr.sbin/fdcontrol/Makefile head/usr.sbin/fdformat/Makefile head/usr.sbin/fdread/Makefile head/usr.sbin/fdread/fdutil.c head/usr.sbin/kgzip/kgzip.8 head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh head/usr.sbin/pnpinfo/Makefile head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/Makefile ============================================================================== --- head/Makefile Sat Jan 28 00:40:36 2017 (r312909) +++ head/Makefile Sat Jan 28 02:22:15 2017 (r312910) @@ -236,7 +236,7 @@ _MAKE+= MK_META_MODE=no # Guess machine architecture from machine type, and vice versa. .if !defined(TARGET_ARCH) && defined(TARGET) -_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} +_TARGET_ARCH= ${TARGET:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} _TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/} @@ -417,13 +417,12 @@ worlds: .PHONY # existing system is. # .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) -TARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64 +TARGETS?=amd64 arm arm64 i386 mips powerpc sparc64 _UNIVERSE_TARGETS= ${TARGETS} TARGET_ARCHES_arm?= arm armeb armv6 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe -TARGET_ARCHES_pc98?= i386 .for target in ${TARGETS} TARGET_ARCHES_${target}?= ${target} .endfor Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Jan 28 00:40:36 2017 (r312909) +++ head/Makefile.inc1 Sat Jan 28 02:22:15 2017 (r312910) @@ -349,7 +349,6 @@ KNOWN_ARCHES?= aarch64/arm64 \ armeb/arm \ armv6/arm \ i386 \ - i386/pc98 \ mips \ mipsel/mips \ mips64el/mips \ Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Jan 28 00:40:36 2017 (r312909) +++ head/ObsoleteFiles.inc Sat Jan 28 02:22:15 2017 (r312910) @@ -38,6 +38,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20170128: remove pc98 support +OLD_FILES+=usr/include/dev/ic/i8251.h +OLD_FILES+=usr/include/dev/ic/wd33c93reg.h +OLD_FILES+=usr/include/sys/disk/pc98.h +OLD_FILES+=usr/include/sys/diskpc98.h +OLD_FILES+=usr/share/man/man4/i386/ct.4.gz +OLD_FILES+=usr/share/man/man4/i386/snc.4.gz +OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.iso.kbd +OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.kbd +OLD_FILES+=usr/share/vt/keymaps/jp.pc98.iso.kbd +OLD_FILES+=usr/share/vt/keymaps/jp.pc98.kbd # 20170110: Four files from ggate tests consolidated into one OLD_FILES+=usr/tests/sys/geom/class/gate/1_test OLD_FILES+=usr/tests/sys/geom/class/gate/2_test Modified: head/etc/rc.d/syscons ============================================================================== --- head/etc/rc.d/syscons Sat Jan 28 00:40:36 2017 (r312909) +++ head/etc/rc.d/syscons Sat Jan 28 02:22:15 2017 (r312910) @@ -112,7 +112,6 @@ icelandic.iso) echo is;; it.iso) echo it;; jp.106x) echo jp.capsctrl;; jp.106) echo jp;; -#?? jp.pc98.iso) echo jp.pc98;; kk.pt154.io) echo kz.io;; kk.pt154.kst) echo kz.kst;; latinamerican.iso.acc) echo latinamerican.acc;; Modified: head/lib/libsysdecode/Makefile ============================================================================== --- head/lib/libsysdecode/Makefile Sat Jan 28 00:40:36 2017 (r312909) +++ head/lib/libsysdecode/Makefile Sat Jan 28 02:22:15 2017 (r312910) @@ -120,7 +120,7 @@ tables.h: mktables ioctl.c: .PHONY .endif ioctl.c: mkioctls .META - env MACHINE=${MACHINE} CPP="${CPP}" \ + env CPP="${CPP}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} beforedepend: ioctl.c tables.h Modified: head/lib/libsysdecode/mkioctls ============================================================================== --- head/lib/libsysdecode/mkioctls Sat Jan 28 00:40:36 2017 (r312909) +++ head/lib/libsysdecode/mkioctls Sat Jan 28 02:22:15 2017 (r312910) @@ -24,15 +24,7 @@ ioctl_includes=$( awk '{printf("#include <%s>\\n", $1)}' ) -: ${MACHINE=$(uname -m)} -case "${MACHINE}" in -*pc98*) - ioctl_includes="$ioctl_includes#include \\n" - ;; -*) - ioctl_includes="$ioctl_includes#include \\n" - ;; -esac +ioctl_includes="$ioctl_includes#include \\n" awk -v x="$ioctl_includes" 'BEGIN {print x}' | $CPP -nostdinc -I$includedir -dM -DCOMPAT_43TTY - | Modified: head/release/doc/README ============================================================================== --- head/release/doc/README Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/README Sat Jan 28 02:22:15 2017 (r312910) @@ -99,7 +99,7 @@ element will be included. For example: SPARC64-specific text -The currently-supported architectures are amd64, arm, i386, pc98, +The currently-supported architectures are amd64, arm, i386, powerpc and sparc64. An element may appear for multiple architectures by specifying a comma-separated list of architectures (i.e. arch="sparc64,amd64"). Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Jan 28 02:22:15 2017 (r312910) @@ -252,35 +252,6 @@ more information. - - pc98 - - NEC PC-9801/9821 series with almost all &i386;-compatible - processors, including 80486, &pentium;, &pentium; Pro, - &pentium; II, and variants. All &i386;-compatible processors - by AMD, Cyrix, IBM, and IDT are also supported. - - NEC FC-9801/9821 series, and NEC SV-98 series (both of - them are compatible with PC-9801/9821 series) should be - supported. - - EPSON PC-386/486/586 series, which are compatible with NEC - PC-9801 series are supported. - - High-resolution mode is not supported. NEC - PC-98XA/XL/RL/XL^2, and NEC PC-H98 series are supported in - normal (PC-9801 compatible) mode only. - - Although there are some multi-processor systems (such as - Rs20/B20), SMP-related features of &os; are not supported - yet. - - PC-9801/9821 standard bus (called C-Bus), PC-9801NOTE - expansion bus (110pin), and PCI bus are supported. New Extend - Standard Architecture (NESA) bus (used in PC-H98, SV-H98, and - FC-H98 series) is not supported. - - powerpc @@ -636,17 +607,9 @@ Disk Controllers - [&arch.amd64;, &arch.i386;, &arch.pc98;, &arch.sparc64;] + [&arch.amd64;, &arch.i386;, &arch.sparc64;] IDE/ATA controllers (&man.ata.4; driver) - [&arch.pc98;] IDE/ATA controllers (wdc driver) - - - - On-board IDE controller - - - &hwlist.aac; &hwlist.adv; @@ -673,8 +636,6 @@ &hwlist.ciss; - &hwlist.ct; - &hwlist.dpt; @@ -894,8 +855,6 @@ &hwlist.sn; - &hwlist.snc; - &hwlist.ste; &hwlist.stge; @@ -904,7 +863,7 @@ &hwlist.tl; - [&arch.amd64;, &arch.i386;, &arch.pc98;] SMC 83c17x + [&arch.amd64;, &arch.i386;] SMC 83c17x (EPIC)-based Ethernet NICs (&man.tx.4; driver) &hwlist.txp; @@ -934,8 +893,7 @@ FDDI Interfaces - [&arch.i386;, &arch.pc98;] DEC DEFPA PCI (&man.fpa.4; - driver) + [&arch.i386;] DEC DEFPA PCI (&man.fpa.4; driver) [&arch.i386;] DEC DEFEA EISA (&man.fpa.4; driver) @@ -943,28 +901,28 @@ ATM Interfaces - [&arch.i386;, &arch.pc98;] Midway-based ATM interfaces + [&arch.i386;] Midway-based ATM interfaces (&man.en.4; driver) - [&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems, + [&arch.i386;, &arch.sparc64;] FORE Systems, Inc. PCA-200E ATM PCI Adapters (hfa and &man.fatm.4; drivers) - [&arch.i386;, &arch.pc98;] IDT NICStAR 77201/211-based ATM + [&arch.i386;] IDT NICStAR 77201/211-based ATM Adapters (&man.idt.4; driver) - [&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems, + [&arch.i386;, &arch.sparc64;] FORE Systems, Inc. HE155 and HE622 ATM interfaces (&man.hatm.4; driver) - [&arch.i386;, &arch.pc98;] IDT77252-based ATM cards + [&arch.i386;] IDT77252-based ATM cards (&man.patm.4; driver) Wireless Network Interfaces - [&arch.amd64;, &arch.i386;, &arch.pc98;] Cisco/Aironet + [&arch.amd64;, &arch.i386;] Cisco/Aironet 802.11b wireless adapters (&man.an.4; driver) &hwlist.ath; @@ -1016,7 +974,7 @@ &hwlist.urtw; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Lucent + [&arch.amd64;, &arch.i386;] Lucent Technologies WaveLAN/IEEE 802.11b wireless network adapters and workalikes using the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, Intersil Prism-3, and Symbol Spectrum24 @@ -1214,77 +1172,6 @@ &hwlist.rc; - [&arch.pc98;] Internel serial interfaces (&man.sio.4; - driver) - - - - PC-9801 on-board - - - PC-9821 2'nd CCU (flags 0x12000000) - - - - [&arch.pc98;] NEC PC-9861K, PC-9801-101 and Midori-Denshi - MDC-926Rs (&man.sio.4; driver) - - - - COM2 (flags 0x01000000) - - - - COM3 (flags 0x02000000) - - - - [&arch.pc98;] NEC PC-9801-120 (&man.sio.4; driver) - - - "flags 0x11000000" is necessary in kernel - configuration. - - - [&arch.pc98;] Microcore MC-16550, MC-16550II, MC-RS98 - (&man.sio.4; driver) - - - "flags 0x14000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Media Intelligent RSB-2000, RSB-3000 and - AIWA B98-02 (&man.sio.4; driver) - - - "flags 0x15000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Media Intelligent RSB-384 (&man.sio.4; - driver) - - - "flags 0x16000001" is necessary in kernel - configuration. - - - [&arch.pc98;] I-O DATA RSA-98III (&man.sio.4; - driver) - - - "flags 0x18000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Hayes ESP98 (&man.sio.4; driver) - - - "options COM_ESP" and "flags 0x19000000" are necessary - in kernel configuration. - - @@ -1350,35 +1237,6 @@ &hwlist.snd.vibes; - [&arch.pc98;] NEC PC-9801-73, 86 and compatibles (nss - driver) - - - - NEC A-MATE internal sound - - - - Q-Vision WaveStar, WaveMaster - - - - [&arch.pc98;] NEC X-MATE, CanBe, ValueStar internal (mss - driver) - - [&arch.pc98;] Creative Technologies SoundBlaster(98) - (&man.sb.4; driver) - - [&arch.pc98;] I-O DATA CD-BOX (&man.sb.4; driver) - - [&arch.pc98;] MPU-401 and compatible interfaces (mpu - driver) - - - - Q-Vision WaveStar - - @@ -1392,7 +1250,7 @@ USB Devices - [&arch.amd64;, &arch.i386;, &arch.pc98;] A + [&arch.amd64;, &arch.i386;] A range of USB peripherals are supported; devices known to work are listed in this section. Owing to the generic nature of most USB devices, with some exceptions any device of a given @@ -1400,14 +1258,14 @@ here. - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB Ethernet adapters can be found in the section listing Ethernet interfaces. - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB Bluetooth adapters can be found in Bluetooth section. @@ -1415,18 +1273,15 @@ &hwlist.uhci; - [&arch.amd64;, &arch.i386;, &arch.pc98;] USB + [&arch.amd64;, &arch.i386;] USB 2.0 controllers using the EHCI interface (&man.ehci.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Hubs + [&arch.amd64;, &arch.i386;] Hubs - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Keyboards (&man.ukbd.4; driver) + [&arch.amd64;, &arch.i386;] Keyboards (&man.ukbd.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Miscellaneous + [&arch.amd64;, &arch.i386;] Miscellaneous @@ -1454,8 +1309,7 @@ &hwlist.umodem; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Mice - (&man.ums.4; driver) + [&arch.amd64;, &arch.i386;] Mice (&man.ums.4; driver) &hwlist.ulpt; @@ -1471,7 +1325,7 @@ &hwlist.umass; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Audio Devices + [&arch.amd64;, &arch.i386;] Audio Devices (&man.uaudio.4; driver) &hwlist.uvisor; @@ -1507,8 +1361,7 @@ Miscellaneous - [&arch.amd64;, &arch.i386;, &arch.pc98;] - FAX-Modem/PCCARD + [&arch.amd64;, &arch.i386;] FAX-Modem/PCCARD @@ -1521,7 +1374,7 @@ - [&arch.amd64;, &arch.i386;, &arch.pc98;] Floppy drives + [&arch.amd64;, &arch.i386;] Floppy drives (&man.fdc.4; driver) [&arch.amd64;, &arch.i386;] VGA-compatible video cards @@ -1533,8 +1386,7 @@ found at http://www.x.org/. - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Keyboards including: + [&arch.amd64;, &arch.i386;] Keyboards including: @@ -1548,21 +1400,17 @@ - [&arch.pc98;] Standard keyboards - - - - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB keyboards (&man.ukbd.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] Pointing devices including: - [&arch.amd64;, &arch.i386;, &arch.pc98;] Bus mice and + [&arch.amd64;, &arch.i386;] Bus mice and compatible devices (&man.mse.4; driver) @@ -1577,7 +1425,7 @@ - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB mice (&man.ums.4; driver) @@ -1591,17 +1439,10 @@ [&arch.amd64;, &arch.i386;] PC standard parallel ports (&man.ppc.4; driver) - [&arch.pc98;] PC-9821 standard parallel - ports (&man.ppc.4; driver) - [&arch.i386;, &arch.amd64;] PC-compatible joysticks (&man.joy.4; driver) - [&arch.pc98;] Joystick port of SoundBlaster(98) - (&man.joy.4; driver) - - [&arch.i386;, &arch.pc98;] PHS Data Communication - Card/PCCARD + [&arch.i386;] PHS Data Communication Card/PCCARD @@ -1621,8 +1462,6 @@ cards compatible with the HOT1 from Virtual Computers (xrpu driver). - [&arch.pc98;] Power Management Controller of NEC PC-98 - Note (pmc driver) Modified: head/release/doc/en_US.ISO8859-1/readme/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/readme/article.xml Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/en_US.ISO8859-1/readme/article.xml Sat Jan 28 02:22:15 2017 (r312910) @@ -69,7 +69,6 @@ &os; is an operating system based on 4.4 BSD Lite for AMD64 and Intel EM64T based PC hardware (&arch.amd64;), Intel, AMD, Cyrix or NexGen x86 based PC hardware (&arch.i386;), - NEC PC-9801/9821 series PCs and compatibles (&arch.pc98;), and &ultrasparc; machines (&arch.sparc64;). Versions for the &arm; (&arch.arm;), &mips; (&arch.mips;), and &powerpc; (&arch.powerpc;) architectures are currently under @@ -324,7 +323,7 @@ On platforms that support &man.bsdinstall.8; (currently - &arch.amd64;, &arch.i386;, &arch.pc98;, and &arch.sparc64;), these documents are generally available via the + &arch.amd64;, &arch.i386;, and &arch.sparc64;), these documents are generally available via the Documentation menu during installation. Once the system is installed, you can revisit this menu by re-running the &man.bsdinstall.8; utility. Modified: head/release/doc/share/examples/Makefile.relnotesng ============================================================================== --- head/release/doc/share/examples/Makefile.relnotesng Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/share/examples/Makefile.relnotesng Sat Jan 28 02:22:15 2017 (r312910) @@ -6,7 +6,7 @@ # the build tree. # -ARCHS= amd64 i386 pc98 powerpc sparc64 +ARCHS= amd64 i386 powerpc sparc64 MULTITEXTS= UNITEXTS= hardware readme relnotes errata Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/share/misc/dev.archlist.txt Sat Jan 28 02:22:15 2017 (r312910) @@ -36,43 +36,42 @@ # [,...] # aac i386,amd64 -adv i386,pc98,amd64 -adw i386,pc98,amd64 +adv i386,amd64 +adw i386,amd64 aha i386 ahb i386 ahd i386,sparc64,amd64 -aic i386,pc98,amd64 -amd i386,pc98,amd64 +aic i386,amd64 +amd i386,amd64 arcmsr i386,amd64 asr i386 -ath i386,pc98,amd64,sparc64 -aue i386,pc98,amd64,powerpc -axe i386,pc98,amd64,powerpc +ath i386,amd64,sparc64 +aue i386,amd64,powerpc +axe i386,amd64,powerpc bce i386,amd64 -bge i386,pc98,sparc64,amd64 -bktr i386,pc98 +bge i386,sparc64,amd64 +bktr i386 bt i386,amd64 bxe i386,amd64 -cdce i386,pc98,amd64,powerpc +cdce i386,amd64,powerpc ciss i386,amd64 -ce i386,pc98 +ce i386 cm i386 -cnw i386,pc98,amd64 -cp i386,pc98 -ct pc98 +cnw i386,amd64 +cp i386 ctau i386 -cue i386,pc98,amd64,powerpc +cue i386,amd64,powerpc cx i386 cxgb i386,amd64 -de i386,pc98,amd64 +de i386,amd64 dpt i386,amd64 -ed i386,pc98 -ep i386,pc98,amd64 +ed i386 +ep i386,amd64 esp sparc64 ex i386,amd64 -fe i386,pc98,amd64 +fe i386,amd64 fwohci i386,sparc64,amd64,powerpc -hifn i386,pc98,amd64 +hifn i386,amd64 hpt27xx i386,amd64 hptiop i386,amd64 hptmv i386,amd64 @@ -83,26 +82,26 @@ iir i386,amd64 ips i386,amd64 isci i386,amd64 ixgb i386,amd64 -kue i386,pc98,amd64,powerpc -lge i386,pc98,amd64 +kue i386,amd64,powerpc +lge i386,amd64 mfi i386,amd64 mlx i386,amd64 mly i386,amd64 msk i386,amd64 mxge i386,amd64 -my i386,pc98 -ncr i386,pc98,amd64 -ncv i386,pc98 +my i386 +ncr i386,amd64 +ncv i386 nfe i386,amd64 -ng_bt3c i386,pc98,amd64 -ng_ubt i386,pc98,amd64 -nsp i386,pc98 +ng_bt3c i386,amd64 +ng_ubt i386,amd64 +nsp i386 nxge i386,amd64 oce i386,amd64 -ohci i386,pc98,amd64,powerpc +ohci i386,amd64,powerpc oltr i386 otus i386,amd64 -pcn i386,pc98,amd64 +pcn i386,amd64 pst i386 qlxgb amd64 qlxgbe amd64 @@ -110,14 +109,13 @@ qlxge amd64 rc i386 ral i386,amd64 rsu i386,amd64 -rue i386,pc98,amd64 +rue i386,amd64 rum i386,amd64 run i386,amd64 -safe i386,pc98,amd64 +safe i386,amd64 sbp i386,sparc64,amd64 sfgxe amd64 sn i386,amd64 -snc pc98 snd_ad1816 i386,amd64 snd_als4000 i386 snd_atiixp i386,amd64 @@ -148,31 +146,31 @@ snd_t4dwave i386,amd64,sparc64 snd_via8233 i386,amd64 snd_via82c686 i386,amd64 snd_vibes i386,amd64 -stg i386,pc98 -ti i386,pc98,amd64,sparc64 -tl i386,pc98,amd64 +stg i386 +ti i386,amd64,sparc64 +tl i386,amd64 trm i386,amd64 twa i386,amd64 twe i386,amd64 tws i386,amd64 -ubsa i386,pc98,amd64 -ubsec i386,pc98,amd64 -ubser i386,pc98,amd64 -ucycom i386,pc98,amd64 -udav i386,pc98,amd64 -uftdi i386,pc98,amd64 -uhci i386,pc98,amd64,powerpc -ulpt i386,pc98,amd64,powerpc -umass i386,pc98,amd64,powerpc -umodem i386,pc98,amd64 -uplcom i386,pc98,amd64 +ubsa i386,amd64 +ubsec i386,amd64 +ubser i386,amd64 +ucycom i386,amd64 +udav i386,amd64 +uftdi i386,amd64 +uhci i386,amd64,powerpc +ulpt i386,amd64,powerpc +umass i386,amd64,powerpc +umodem i386,amd64 +uplcom i386,amd64 ural i386,amd64 -urio i386,pc98,amd64,powerpc -uvisor i386,pc98,amd64 -uvscom i386,pc98,amd64 +urio i386,amd64,powerpc +uvisor i386,amd64 +uvscom i386,amd64 vpo i386 -vx i386,pc98,amd64 +vx i386,amd64 vxge i386,amd64 -wb i386,pc98,amd64 +wb i386,amd64 xe i386,amd64 zyd i386,amd64 Modified: head/release/doc/share/xml/release.ent ============================================================================== --- head/release/doc/share/xml/release.ent Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/doc/share/xml/release.ent Sat Jan 28 02:22:15 2017 (r312910) @@ -73,7 +73,6 @@ - Modified: head/release/rc.local ============================================================================== --- head/release/rc.local Sat Jan 28 00:40:36 2017 (r312909) +++ head/release/rc.local Sat Jan 28 02:22:15 2017 (r312910) @@ -16,11 +16,7 @@ mkdir /tmp/bsdinstall_etc kbdcontrol -d >/dev/null 2>&1 if [ $? -eq 0 ]; then # Syscons: use xterm, start interesting things on other VTYs - if [ ${MACHINE} = "pc98" ]; then - TERM=cons25w - else - TERM=xterm - fi + TERM=xterm # Don't send ESC on function-key 62/63 (left/right command key) kbdcontrol -f 62 '' > /dev/null 2>&1 Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Sat Jan 28 00:40:36 2017 (r312909) +++ head/rescue/rescue/Makefile Sat Jan 28 02:22:15 2017 (r312910) @@ -141,10 +141,6 @@ CRUNCH_ALIAS_bsdlabel= disklabel #CRUNCH_LIBS+= -lsmb .endif -.if ${MACHINE} == "pc98" -CRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98 -.endif - .if ${MACHINE_CPUARCH} == "sparc64" CRUNCH_PROGS_sbin+= bsdlabel sunlabel .endif Modified: head/sbin/bsdlabel/bsdlabel.8 ============================================================================== --- head/sbin/bsdlabel/bsdlabel.8 Sat Jan 28 00:40:36 2017 (r312909) +++ head/sbin/bsdlabel/bsdlabel.8 Sat Jan 28 02:22:15 2017 (r312910) @@ -109,9 +109,9 @@ argument forces .Nm to use a layout suitable for a different architecture. Current valid values are -.Cm i386 , amd64 , +.Cm i386 and -.Cm pc98 . +.Cm amd64 . If this option is omitted, .Nm will use a layout suitable for the current machine. Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Sat Jan 28 00:40:36 2017 (r312909) +++ head/sbin/bsdlabel/bsdlabel.c Sat Jan 28 02:22:15 2017 (r312910) @@ -164,8 +164,7 @@ main(int argc, char *argv[]) break; case 'm': if (!strcmp(optarg, "i386") || - !strcmp(optarg, "amd64") || - !strcmp(optarg, "pc98")) { + !strcmp(optarg, "amd64")) { labelsoffset = 1; labeloffset = 0; bbsize = 8192; Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Sat Jan 28 00:40:36 2017 (r312909) +++ head/sbin/geom/class/part/gpart.8 Sat Jan 28 02:22:15 2017 (r312910) @@ -543,11 +543,6 @@ The option enables backward compatibility for partition names in the EBR scheme. It also prevents any type of actions on such partitions. -.It Cm PC98 -An MBR variant for NEC PC-98 and compatible computers. -Requires the -.Cm GEOM_PART_PC98 -kernel option. .It Cm VTOC8 Sun's SMI Volume Table Of Contents, used by .Tn SPARC64 @@ -945,12 +940,6 @@ The scheme-specific attributes for MBR: .Bl -tag -width ".Cm active" .It Cm active .El -.Pp -The scheme-specific attributes for PC98: -.Bl -tag -width ".Cm bootable" -.It Cm active -.It Cm bootable -.El .Sh BOOTSTRAPPING .Fx supports several partitioning schemes and each scheme uses different Modified: head/share/examples/bootforth/frames.4th ============================================================================== --- head/share/examples/bootforth/frames.4th Sat Jan 28 00:40:36 2017 (r312909) +++ head/share/examples/bootforth/frames.4th Sat Jan 28 02:22:15 2017 (r312910) @@ -12,49 +12,26 @@ variable rt_el variable rb_el variable fill -s" arch-pc98" environment? [if] - \ Single frames - 149 constant sh_el - 150 constant sv_el - 152 constant slt_el - 154 constant slb_el - 153 constant srt_el - 155 constant srb_el - \ Double frames - 149 constant dh_el - 150 constant dv_el - 152 constant dlt_el - 154 constant dlb_el - 153 constant drt_el - 155 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 135 constant fill_dark - 135 constant fill_med - 135 constant fill_bright -[else] - \ Single frames - 196 constant sh_el - 179 constant sv_el - 218 constant slt_el - 192 constant slb_el - 191 constant srt_el - 217 constant srb_el - \ Double frames - 205 constant dh_el - 186 constant dv_el - 201 constant dlt_el - 200 constant dlb_el - 187 constant drt_el - 188 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 176 constant fill_dark - 177 constant fill_med - 178 constant fill_bright -[then] +\ Single frames +196 constant sh_el +179 constant sv_el +218 constant slt_el +192 constant slb_el +191 constant srt_el +217 constant srb_el +\ Double frames +205 constant dh_el +186 constant dv_el +201 constant dlt_el +200 constant dlb_el +187 constant drt_el +188 constant drb_el +\ Fillings +0 constant fill_none +32 constant fill_blank +176 constant fill_dark +177 constant fill_med +178 constant fill_bright : hline ( len x y -- ) \ Draw horizontal single line at-xy \ move cursor Modified: head/share/man/man4/adv.4 ============================================================================== --- head/share/man/man4/adv.4 Sat Jan 28 00:40:36 2017 (r312909) +++ head/share/man/man4/adv.4 Sat Jan 28 02:22:15 2017 (r312910) @@ -204,12 +204,6 @@ AdvanSys ABP950 AdvanSys ABP980, ABP980U .It AdvanSys ABP980UA/3980UA -.It -MELCO IFC-USP (PC-98) -.It -RATOC REX-PCI30 (PC-98) -.It -@Nifty FNECHARD IFC-USUP-TX (PC-98) .El .Sh SEE ALSO .Xr adw 4 , Modified: head/share/man/man4/ahc.4 ============================================================================== --- head/share/man/man4/ahc.4 Sat Jan 28 00:40:36 2017 (r312909) +++ head/share/man/man4/ahc.4 Sat Jan 28 02:22:15 2017 (r312910) @@ -349,14 +349,6 @@ Adaptec Adaptec .Tn 4944UW .It -NEC PC-9821Xt13 (PC-98) -.It -NEC RvII26 (PC-98) -.It -NEC PC-9821X-B02L/B09 (PC-98) -.It -NEC SV-98/2-B03 (PC-98) -.It Many motherboards with on-board .Tn SCSI support Modified: head/share/man/man4/apic.4 ============================================================================== --- head/share/man/man4/apic.4 Sat Jan 28 00:40:36 2017 (r312909) +++ head/share/man/man4/apic.4 Sat Jan 28 02:22:15 2017 (r312910) @@ -32,7 +32,7 @@ .Nd Advanced Programmable Interrupt Controller (APIC) driver .Sh SYNOPSIS This driver is a mandatory part of amd64 kernel. -To compile this driver into i386 or pc98 kernel, +To compile this driver into i386 kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent Modified: head/share/man/man4/ed.4 ============================================================================== --- head/share/man/man4/ed.4 Sat Jan 28 00:40:36 2017 (r312909) +++ head/share/man/man4/ed.4 Sat Jan 28 02:22:15 2017 (r312910) @@ -133,12 +133,6 @@ Accton EN2212/EN2216/UE2216 .It Allied Telesis CentreCOM LA100-PCM_V2 .It -Allied Telesis LA-98 (flags 0x000000) (PC-98) -.It -Allied Telesis SIC-98, SIC-98NOTE (110pin), SIU-98 (flags 0x600000) (PC-98) -.It -Allied Telesis SIU-98-D (flags 0x610000) (PC-98) -.It AmbiCom 10BaseT card (8002, 8002T, 8010 and 8610) .It Bay Networks NETGEAR FA410TXC Fast Ethernet @@ -163,12 +157,6 @@ Compex Net-A adapter .It Compex RL2000 .It -Contec C-NET(98), RT-1007(98), C-NET(9N) (110pin) (flags 0xa00000) (PC-98) -.It -Contec C-NET(98)E-A, C-NET(98)L-A, C-NET(98)P (flags 0x300000) (PC-98) -.It -Corega Ether98-T (flags 0x000000) (PC-98) -.It Corega Ether PCC-T/EtherII PCC-T/FEther PCC-TXF/PCC-TXD PCC-T/Fether II TXD .It Corega LAPCCTXD (TC5299J) @@ -179,16 +167,10 @@ DEC EtherWorks DE305 .It Danpex EN-6200P2 .It -D-Link DE-298, DE-298P (flags 0x500000) (PC-98) -.It D-Link DE-660, DE-660+ .It D-Link IC-CARD/IC-CARD+ Ethernet .It -ELECOM LD-98P (flags 0x500000) (PC-98) -.It -ELECOM LD-BDN, LD-NW801G (flags 0x200000) (PC-98) -.It ELECOM Laneed LD-CDL/TX, LD-CDF, LD-CDS, LD-10/100CD, LD-CDWA (DP83902A) .It Hawking PN652TX PC Card (AX88790) @@ -198,17 +180,10 @@ HP PC Lan+ 27247B and 27252A .It IBM Creditcard Ethernet I/II .It -ICM AD-ET2-T, DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET, NB-ET-T (110pin) -(flags 0x500000) (PC-98) -.It -I-O DATA LA/T-98, LA/T-98SB, LA2/T-98, ET/T-98 (flags 0x900000) (PC-98) -.It I-O DATA ET2/T-PCI .It I-O DATA PCLATE .It -Kansai KLA-98C/T (flags 0x900000) (PC-98) -.It Kingston KNE-PC2, CIO10T, KNE-PCM/x Ethernet .It KTI ET32P2 PCI @@ -217,28 +192,14 @@ Linksys EC2T/PCMPC100/PCM100, PCMLM56 .It Linksys EtherFast 10/100 PC Card, Combo PCMCIA Ethernet Card (PCMPC100 V2) .It -Logitec LAN-98T (flags 0xb00000) (PC-98) -.It MACNICA Ethernet ME1 for JEIDA .It -MACNICA ME98 (flags 0x900000) (PC-98) -.It -MACNICA NE2098 (flags 0x400000) (PC-98) -.It -MELCO EGY-98 (flags 0x300000) (PC-98) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 28 02:25: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 8F948CC4BB2; Sat, 28 Jan 2017 02:25:34 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 512FE19FA; Sat, 28 Jan 2017 02:25:34 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S2PXJj022663; Sat, 28 Jan 2017 02:25:33 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S2PXMo022662; Sat, 28 Jan 2017 02:25:33 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201701280225.v0S2PXMo022662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 28 Jan 2017 02:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312911 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 02:25:34 -0000 Author: nyan Date: Sat Jan 28 02:25:33 2017 New Revision: 312911 URL: https://svnweb.freebsd.org/changeset/base/312911 Log: Regen after r312910. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sat Jan 28 02:22:15 2017 (r312910) +++ head/share/man/man5/src.conf.5 Sat Jan 28 02:25:33 2017 (r312911) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z emaste .\" $FreeBSD$ -.Dd January 6, 2017 +.Dd January 28, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -177,7 +177,7 @@ Set to build and install binutils (as, l of the normal system build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 295490 2016-02-10 23:57:09Z emaste Set to not build binutils (as, ld, objcopy and objdump) @@ -195,7 +195,7 @@ Set build binutils (as, ld, objcopy and as part of the bootstrap process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BLACKLIST .\" from FreeBSD: head/tools/build/options/WITHOUT_BLACKLIST 301554 2016-06-07 16:35:55Z lidl Set this if you do not want to build blacklistd / blacklistctl. @@ -352,7 +352,7 @@ When set, it also enforces the following Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -367,7 +367,7 @@ mips/mipsel, mips/mips, mips/mips64el, m Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_CLANG_EXTRAS .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim Set to build additional clang and llvm tools, such as bugpoint. @@ -384,7 +384,7 @@ Set to build the ARCMigrate, Rewriter an Clang C/C++ compiler. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_IS_CC .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_IS_CC 242629 2012-11-05 21:53:23Z brooks Set to install the GCC compiler as @@ -404,7 +404,7 @@ and .Pa /usr/bin/cpp . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -652,7 +652,7 @@ and .Xr efivar 8 . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_EISA .\" from FreeBSD: head/tools/build/options/WITH_EISA 264654 2014-04-18 16:53:06Z imp Set to build EISA kernel modules. @@ -726,7 +726,7 @@ Set to not build games. Set to not build and install gcc and g++ as part of the normal build process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GCC .\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 20:49:48Z zeising Set to build and install gcc and g++. @@ -741,7 +741,7 @@ unless an alternative compiler is provid XCC. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GCC_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITH_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp Set to build gcc and g++ as part of the bootstrap process. @@ -766,7 +766,7 @@ Set to build .Xr gdb 1 . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GNU .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU 174550 2007-12-12 16:43:17Z ru Set to not build contributed GNU software as a part of the base system. @@ -787,7 +787,7 @@ Do not build the GNU C++ stack (g++, lib This is the default on platforms where clang is the system compiler. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GNUCXX .\" from FreeBSD: head/tools/build/options/WITH_GNUCXX 255321 2013-09-06 20:08:03Z theraven Build the GNU C++ stack (g++, libstdc++). @@ -1035,7 +1035,7 @@ library. Set to not build LLVM's lld linker. .Pp It is a default setting on -arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLD .\" from FreeBSD: head/tools/build/options/WITH_LLD 309124 2016-11-24 22:54:55Z dim Set to build LLVM's lld linker. @@ -1047,21 +1047,21 @@ amd64/amd64 and arm64/aarch64. Set to not build the LLDB debugger. .Pp It is a default setting on -arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLDB .\" from FreeBSD: head/tools/build/options/WITH_LLDB 255722 2013-09-20 01:52:02Z emaste Set to build the LLDB debugger. .Pp It is a default setting on amd64/amd64 and arm64/aarch64. -.It Va WITHOUT_LLD_AS_LD -.\" from FreeBSD: head/tools/build/options/WITHOUT_LLD_AS_LD 309142 2016-11-25 13:15:28Z emaste +.It Va WITHOUT_LLD_IS_LD +.\" from FreeBSD: head/tools/build/options/WITHOUT_LLD_IS_LD 312855 2017-01-27 01:59:12Z emaste Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. -.It Va WITH_LLD_AS_LD -.\" from FreeBSD: head/tools/build/options/WITH_LLD_AS_LD 309142 2016-11-25 13:15:28Z emaste +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +.It Va WITH_LLD_IS_LD +.\" from FreeBSD: head/tools/build/options/WITH_LLD_IS_LD 312855 2017-01-27 01:59:12Z emaste Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp It is a default setting on @@ -1077,7 +1077,7 @@ arm/arm, arm/armeb, arm/armv6, mips/mips Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp It is a default setting on -amd64/amd64, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LOCALES .\" from FreeBSD: head/tools/build/options/WITHOUT_LOCALES 156932 2006-03-21 07:50:50Z ru Set to not build localization files; see @@ -1454,7 +1454,7 @@ mips/mipsel, mips/mips, mips/mips64el, m Set to build world with propolice stack smashing protection. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_STAGING .\" from FreeBSD: head/tools/build/options/WITH_STAGING 290816 2015-11-14 03:24:48Z sjg Enable staging of files to a stage tree. From owner-svn-src-all@freebsd.org Sat Jan 28 02:48: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 3C24ECC47D7; Sat, 28 Jan 2017 02:48:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::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 02BD581B; Sat, 28 Jan 2017 02:48:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x241.google.com with SMTP id o185so10148889itb.1; Fri, 27 Jan 2017 18:48:20 -0800 (PST) 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=mS0QnM34TppeFrcpjtJReIqjMUMjKH4tnntT0Ymnhc4=; b=uvb0HM9G9KlghQG/uY8NG6VZx9jlo0EhkCc7Ewebe/XDN9A5XV96qwZpCxYtIG5ler Dcb9wS5+2KVPQlmyceRGo8BDRt0CDW7YWMb3WKSBzdVJAy8eBBPABPlRR8wLpV8ZAW0G 1/t7IzRK2rVI6zSZnvPauDAnCbT4ayC0mhVD6nJeDLtQQRfFXC7diemeU7DFavzH3bAR 4qNzr9399K7/m1eEWWG2I1heyVE1nVH06Xs5ZFMfYP2HziP7lBb8kPYQskUrH9S7h6g6 pUUI3yI9ez/AnO2hdo8Sbzs1u0gwHjTgfaIy6BhSriGeDJRioilvxDTk/zb38JKx8k02 aGIA== 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=mS0QnM34TppeFrcpjtJReIqjMUMjKH4tnntT0Ymnhc4=; b=KvfAHYI5356TbQnzdv/NvVYnxCNtanayH8wS1vZK++EDIxNDgfIcXW7mvXPoVY6w1u XXcoIjrbjJSFbUJKCynaFxdbjylgJEB0ORegnDp1kOPYdmmTBWiZ3ZihGVlORsQ/oZcS ry4bOUH780GAzKCHDFC6hXegFFUCv45F1w6Leyc8dY6l8BGC0yWmemRxHIrFwcsKghFT kQvS2YHlR/uc485774xjXkfbcdc4zoixGr3Dl9SExLg++ehE0BrOqNIvby5QSc/sIN1v n2DMraYoxLMHUpba/3H/KdUPym36qkTWzm2c+fbzsgQoTA2sif4hnXcL9GLfwBAy9PBy pyqw== X-Gm-Message-State: AIkVDXKBpMSSlaYLqmnSxCG0CNXX6G0sGWp2Av6nIzIZhomTMavlb0hwbs6ZlJ3ybTWx4iB6uG30rjsOy4jcsg== X-Received: by 10.36.117.148 with SMTP id y142mr5597549itc.14.1485571700200; Fri, 27 Jan 2017 18:48:20 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.159 with HTTP; Fri, 27 Jan 2017 18:47:59 -0800 (PST) In-Reply-To: <201701280222.v0S2MFSR022477@repo.freebsd.org> References: <201701280222.v0S2MFSR022477@repo.freebsd.org> From: Ed Maste Date: Fri, 27 Jan 2017 21:47:59 -0500 X-Google-Sender-Auth: 0zNx8DlmUcatYhZcVIBUUYzds1I Message-ID: Subject: Re: svn commit: r312910 - in head: . etc/etc.pc98 etc/rc.d lib/libsysdecode libexec release release/doc release/doc/en_US.ISO8859-1/hardware release/doc/en_US.ISO8859-1/readme release/doc/share/example... To: Takahashi Yoshihiro 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, 28 Jan 2017 02:48:21 -0000 On 27 January 2017 at 21:22, Takahashi Yoshihiro wrote: > Author: nyan > Date: Sat Jan 28 02:22:15 2017 > New Revision: 312910 > URL: https://svnweb.freebsd.org/changeset/base/312910 > > Log: > Remove pc98 support completely. > I thank all developers and contributors for pc98. Thank you and the rest of the pc98 team for diligently maintaining the port all of this time. From owner-svn-src-all@freebsd.org Sat Jan 28 03:53: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 77C87CC5B8B; Sat, 28 Jan 2017 03:53:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 455861365; Sat, 28 Jan 2017 03:53:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S3rrOW059787; Sat, 28 Jan 2017 03:53:53 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S3rr1X059786; Sat, 28 Jan 2017 03:53:53 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201701280353.v0S3rr1X059786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 28 Jan 2017 03:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312912 - head/sys/i386/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 03:53:54 -0000 Author: nyan Date: Sat Jan 28 03:53:53 2017 New Revision: 312912 URL: https://svnweb.freebsd.org/changeset/base/312912 Log: Garbage collect the FPU_ERROR_BROKEN option. It is for pc98 only. Modified: head/sys/i386/isa/npx.c Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Sat Jan 28 02:25:33 2017 (r312911) +++ head/sys/i386/isa/npx.c Sat Jan 28 03:53:53 2017 (r312912) @@ -304,14 +304,6 @@ npx_probe(void) */ control &= ~(1 << 2); /* enable divide by 0 trap */ fldcw(control); -#ifdef FPU_ERROR_BROKEN - /* - * FPU error signal doesn't work on some CPU - * accelerator board. - */ - hw_float = 1; - return (1); -#endif npx_traps_while_probing = 0; fp_divide_by_0(); if (npx_traps_while_probing != 0) { From owner-svn-src-all@freebsd.org Sat Jan 28 04:33: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 A0761CC3707; Sat, 28 Jan 2017 04:33:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6505DA0A; Sat, 28 Jan 2017 04:33:52 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S4Xp6n076261; Sat, 28 Jan 2017 04:33:51 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S4Xpm4076260; Sat, 28 Jan 2017 04:33:51 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201701280433.v0S4Xpm4076260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 28 Jan 2017 04:33:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312913 - head/tests/sys/aio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 04:33:52 -0000 Author: asomers Date: Sat Jan 28 04:33:51 2017 New Revision: 312913 URL: https://svnweb.freebsd.org/changeset/base/312913 Log: Improve the aio tests * Add tests for aio_suspend(2). * Add tests for polled completion notification. * Test the full matrix of file descriptor types and completion notification mechanisms. * Don't bother with mkstemp, because ATF runs every test in its own temp dir. * Fix some typos. * Remove extraneous ATF_REQUIRE_KERNEL_MODULE calls. Reviewed by: jhb MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D9045 Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Sat Jan 28 03:53:53 2017 (r312912) +++ head/tests/sys/aio/aio_test.c Sat Jan 28 04:33:51 2017 (r312913) @@ -33,7 +33,7 @@ * reading it from a second descriptor using AIO. For some targets, the same * fd is used for write and read (i.e., file, md device), but for others the * operation is performed on a peer (pty, socket, fifo, etc). A timeout is - * initiated to detect undo blocking. This test does not attempt to exercise + * initiated to detect undue blocking. This test does not attempt to exercise * error cases or more subtle asynchronous behavior, just make sure that the * basic operations work on some basic object types. */ @@ -74,6 +74,13 @@ #define GLOBAL_MAX 16384 #define BUFFER_MAX GLOBAL_MAX + +/* + * A completion function will block until the aio has completed, then return + * the result of the aio. errno will be set appropriately. + */ +typedef ssize_t (*completion)(struct aiocb*); + struct aio_context { int ac_read_fd, ac_write_fd; long ac_seed; @@ -179,6 +186,45 @@ aio_context_init(struct aio_context *ac, ac->ac_cleanup_arg = cleanup_arg; } +static ssize_t +poll(struct aiocb *aio) { + int err; + + while ((err = aio_error(aio)) == EINPROGRESS && !aio_timedout) + usleep(25000); + switch (err) { + case EINPROGRESS: + errno = EINTR; + return (-1); + case 0: + return (aio_return(aio)); + default: + return (err); + } +} + +static ssize_t +suspend(struct aiocb *aio) { + const struct aiocb *const iocbs[] = {aio}; + int err; + + err = aio_suspend(iocbs, 1, NULL); + if (err == 0) + return (aio_return(aio)); + else + return (err); +} + +static ssize_t +waitcomplete(struct aiocb *aio) { + struct aiocb *aiop; + ssize_t ret; + + ret = aio_waitcomplete(&aiop, NULL); + ATF_REQUIRE_EQ(aio, aiop); + return (ret); +} + /* * Each tester can register a callback to clean up in the event the test * fails. Preserve the value of errno so that subsequent calls to errx() @@ -201,13 +247,11 @@ aio_cleanup(struct aio_context *ac) * file descriptor. */ static void -aio_write_test(struct aio_context *ac) +aio_write_test(struct aio_context *ac, completion comp) { - struct aiocb aio, *aiop; + struct aiocb aio; ssize_t len; - ATF_REQUIRE_KERNEL_MODULE("aio"); - bzero(&aio, sizeof(aio)); aio.aio_buf = ac->ac_buffer; aio.aio_nbytes = ac->ac_buflen; @@ -227,24 +271,23 @@ aio_write_test(struct aio_context *ac) atf_tc_fail("aio_write failed: %s", strerror(errno)); } - len = aio_waitcomplete(&aiop, NULL); + len = comp(&aio); if (len < 0) { if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete timed out"); + atf_tc_fail("aio timed out"); } } aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete failed: %s", strerror(errno)); + atf_tc_fail("aio failed: %s", strerror(errno)); } aio_timeout_stop(); if (len != ac->ac_buflen) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete short write (%jd)", - (intmax_t)len); + atf_tc_fail("aio short write (%jd)", (intmax_t)len); } } @@ -253,13 +296,11 @@ aio_write_test(struct aio_context *ac) * provided file descriptor. */ static void -aio_read_test(struct aio_context *ac) +aio_read_test(struct aio_context *ac, completion comp) { - struct aiocb aio, *aiop; + struct aiocb aio; ssize_t len; - ATF_REQUIRE_KERNEL_MODULE("aio"); - bzero(ac->ac_buffer, ac->ac_buflen); bzero(&aio, sizeof(aio)); aio.aio_buf = ac->ac_buffer; @@ -273,30 +314,30 @@ aio_read_test(struct aio_context *ac) if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_write timed out"); + atf_tc_fail("aio_read timed out"); } } aio_cleanup(ac); atf_tc_fail("aio_read failed: %s", strerror(errno)); } - len = aio_waitcomplete(&aiop, NULL); + len = comp(&aio); if (len < 0) { if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete timed out"); + atf_tc_fail("aio timed out"); } } aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete failed: %s", strerror(errno)); + atf_tc_fail("aio failed: %s", strerror(errno)); } aio_timeout_stop(); if (len != ac->ac_buflen) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete short read (%jd)", + atf_tc_fail("aio short read (%jd)", (intmax_t)len); } @@ -316,9 +357,11 @@ aio_read_test(struct aio_context *ac) * Test with a classic file. Assumes we can create a moderate size temporary * file. */ +#define FILE_LEN GLOBAL_MAX +#define FILE_PATHNAME "testfile" +#define FILE_TIMEOUT 30 struct aio_file_arg { int afa_fd; - char *afa_pathname; }; static void @@ -328,15 +371,12 @@ aio_file_cleanup(void *arg) afa = arg; close(afa->afa_fd); - unlink(afa->afa_pathname); + unlink(FILE_PATHNAME); } -#define FILE_LEN GLOBAL_MAX -#define FILE_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_file_test); -ATF_TC_BODY(aio_file_test, tc) +static void +aio_file_test(completion comp) { - char pathname[PATH_MAX]; struct aio_file_arg arg; struct aio_context ac; int fd; @@ -344,25 +384,43 @@ ATF_TC_BODY(aio_file_test, tc) ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); arg.afa_fd = fd; - arg.afa_pathname = pathname; aio_context_init(&ac, fd, fd, FILE_LEN, FILE_TIMEOUT, aio_file_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_file_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(file_poll); +ATF_TC_BODY(file_poll, tc) +{ + aio_file_test(poll); +} + +ATF_TC_WITHOUT_HEAD(file_suspend); +ATF_TC_BODY(file_suspend, tc) +{ + aio_file_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(file_waitcomplete); +ATF_TC_BODY(file_waitcomplete, tc) +{ + aio_file_test(waitcomplete); +} + +#define FIFO_LEN 256 +#define FIFO_PATHNAME "testfifo" +#define FIFO_TIMEOUT 30 struct aio_fifo_arg { int afa_read_fd; int afa_write_fd; - char *afa_pathname; }; static void @@ -375,39 +433,25 @@ aio_fifo_cleanup(void *arg) close(afa->afa_read_fd); if (afa->afa_write_fd != -1) close(afa->afa_write_fd); - unlink(afa->afa_pathname); + unlink(FIFO_PATHNAME); } -#define FIFO_LEN 256 -#define FIFO_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_fifo_test); -ATF_TC_BODY(aio_fifo_test, tc) +static void +aio_fifo_test(completion comp) { int error, read_fd = -1, write_fd = -1; struct aio_fifo_arg arg; - char pathname[PATH_MAX]; struct aio_context ac; ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - /* - * In theory, mkstemp() can return a name that is then collided with. - * Because this is a regression test, we treat that as a test failure - * rather than retrying. - */ - strcpy(pathname, PATH_TEMPLATE); - ATF_REQUIRE_MSG(mkstemp(pathname) != -1, - "mkstemp failed: %s", strerror(errno)); - ATF_REQUIRE_MSG(unlink(pathname) == 0, - "unlink failed: %s", strerror(errno)); - ATF_REQUIRE_MSG(mkfifo(pathname, 0600) != -1, + ATF_REQUIRE_MSG(mkfifo(FIFO_PATHNAME, 0600) != -1, "mkfifo failed: %s", strerror(errno)); - arg.afa_pathname = pathname; arg.afa_read_fd = -1; arg.afa_write_fd = -1; - read_fd = open(pathname, O_RDONLY | O_NONBLOCK); + read_fd = open(FIFO_PATHNAME, O_RDONLY | O_NONBLOCK); if (read_fd == -1) { error = errno; aio_fifo_cleanup(&arg); @@ -417,7 +461,7 @@ ATF_TC_BODY(aio_fifo_test, tc) } arg.afa_read_fd = read_fd; - write_fd = open(pathname, O_WRONLY); + write_fd = open(FIFO_PATHNAME, O_WRONLY); if (write_fd == -1) { error = errno; aio_fifo_cleanup(&arg); @@ -429,12 +473,30 @@ ATF_TC_BODY(aio_fifo_test, tc) aio_context_init(&ac, read_fd, write_fd, FIFO_LEN, FIFO_TIMEOUT, aio_fifo_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_fifo_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(fifo_poll); +ATF_TC_BODY(fifo_poll, tc) +{ + aio_fifo_test(poll); +} + +ATF_TC_WITHOUT_HEAD(fifo_suspend); +ATF_TC_BODY(fifo_suspend, tc) +{ + aio_fifo_test(waitcomplete); +} + +ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); +ATF_TC_BODY(fifo_waitcomplete, tc) +{ + aio_fifo_test(waitcomplete); +} + struct aio_unix_socketpair_arg { int asa_sockets[2]; }; @@ -451,8 +513,8 @@ aio_unix_socketpair_cleanup(void *arg) #define UNIX_SOCKETPAIR_LEN 256 #define UNIX_SOCKETPAIR_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_unix_socketpair_test); -ATF_TC_BODY(aio_unix_socketpair_test, tc) +static void +aio_unix_socketpair_test(completion comp) { struct aio_unix_socketpair_arg arg; struct aio_context ac; @@ -471,12 +533,12 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc aio_unix_socketpair_cleanup, &arg); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, "getrusage failed: %s", strerror(errno)); - aio_write_test(&ac); + aio_write_test(&ac, comp); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); ru_before = ru_after; - aio_read_test(&ac); + aio_read_test(&ac, comp); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); @@ -484,6 +546,24 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc aio_unix_socketpair_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(socket_poll); +ATF_TC_BODY(socket_poll, tc) +{ + aio_unix_socketpair_test(poll); +} + +ATF_TC_WITHOUT_HEAD(socket_suspend); +ATF_TC_BODY(socket_suspend, tc) +{ + aio_unix_socketpair_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(socket_waitcomplete); +ATF_TC_BODY(socket_waitcomplete, tc) +{ + aio_unix_socketpair_test(waitcomplete); +} + struct aio_pty_arg { int apa_read_fd; int apa_write_fd; @@ -501,8 +581,8 @@ aio_pty_cleanup(void *arg) #define PTY_LEN 256 #define PTY_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_pty_test); -ATF_TC_BODY(aio_pty_test, tc) +static void +aio_pty_test(completion comp) { struct aio_pty_arg arg; struct aio_context ac; @@ -535,12 +615,30 @@ ATF_TC_BODY(aio_pty_test, tc) aio_context_init(&ac, read_fd, write_fd, PTY_LEN, PTY_TIMEOUT, aio_pty_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_pty_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(pty_poll); +ATF_TC_BODY(pty_poll, tc) +{ + aio_pty_test(poll); +} + +ATF_TC_WITHOUT_HEAD(pty_suspend); +ATF_TC_BODY(pty_suspend, tc) +{ + aio_pty_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(pty_waitcomplete); +ATF_TC_BODY(pty_waitcomplete, tc) +{ + aio_pty_test(waitcomplete); +} + static void aio_pipe_cleanup(void *arg) { @@ -552,8 +650,8 @@ aio_pipe_cleanup(void *arg) #define PIPE_LEN 256 #define PIPE_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_pipe_test); -ATF_TC_BODY(aio_pipe_test, tc) +static void +aio_pipe_test(completion comp) { struct aio_context ac; int pipes[2]; @@ -566,12 +664,30 @@ ATF_TC_BODY(aio_pipe_test, tc) aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN, PIPE_TIMEOUT, aio_pipe_cleanup, pipes); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_pipe_cleanup(pipes); } +ATF_TC_WITHOUT_HEAD(pipe_poll); +ATF_TC_BODY(pipe_poll, tc) +{ + aio_pipe_test(poll); +} + +ATF_TC_WITHOUT_HEAD(pipe_suspend); +ATF_TC_BODY(pipe_suspend, tc) +{ + aio_pipe_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(pipe_waitcomplete); +ATF_TC_BODY(pipe_waitcomplete, tc) +{ + aio_pipe_test(waitcomplete); +} + struct aio_md_arg { int ama_mdctl_fd; int ama_unit; @@ -608,13 +724,8 @@ aio_md_cleanup(void *arg) #define MD_LEN GLOBAL_MAX #define MD_TIMEOUT 30 -ATF_TC(aio_md_test); -ATF_TC_HEAD(aio_md_test, tc) -{ - - atf_tc_set_md_var(tc, "require.user", "root"); -} -ATF_TC_BODY(aio_md_test, tc) +static void +aio_md_test(completion comp) { int error, fd, mdctl_fd, unit; char pathname[PATH_MAX]; @@ -654,16 +765,48 @@ ATF_TC_BODY(aio_md_test, tc) aio_context_init(&ac, fd, fd, MD_LEN, MD_TIMEOUT, aio_md_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_md_cleanup(&arg); } +ATF_TC(md_poll); +ATF_TC_HEAD(md_poll, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_poll, tc) +{ + aio_md_test(poll); +} + +ATF_TC(md_suspend); +ATF_TC_HEAD(md_suspend, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_suspend, tc) +{ + aio_md_test(suspend); +} + +ATF_TC(md_waitcomplete); +ATF_TC_HEAD(md_waitcomplete, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_waitcomplete, tc) +{ + aio_md_test(waitcomplete); +} + ATF_TC_WITHOUT_HEAD(aio_large_read_test); ATF_TC_BODY(aio_large_read_test, tc) { - char pathname[PATH_MAX]; struct aiocb cb, *cbp; ssize_t nread; size_t len; @@ -689,11 +832,10 @@ ATF_TC_BODY(aio_large_read_test, tc) len = INT_MAX; #endif - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); - unlink(pathname); + unlink(FILE_PATHNAME); memset(&cb, 0, sizeof(cb)); cb.aio_nbytes = len; @@ -937,7 +1079,6 @@ ATF_TC_BODY(aio_fsync_test, tc) char *buffer; } buffers[16]; struct stat sb; - char pathname[PATH_MAX]; ssize_t rval; unsigned i; int fd; @@ -945,10 +1086,9 @@ ATF_TC_BODY(aio_fsync_test, tc) ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); - unlink(pathname); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + unlink(FILE_PATHNAME); ATF_REQUIRE(fstat(fd, &sb) == 0); ATF_REQUIRE(sb.st_blksize != 0); @@ -1009,12 +1149,24 @@ ATF_TC_BODY(aio_fsync_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, aio_file_test); - ATF_TP_ADD_TC(tp, aio_fifo_test); - ATF_TP_ADD_TC(tp, aio_unix_socketpair_test); - ATF_TP_ADD_TC(tp, aio_pty_test); - ATF_TP_ADD_TC(tp, aio_pipe_test); - ATF_TP_ADD_TC(tp, aio_md_test); + ATF_TP_ADD_TC(tp, file_poll); + ATF_TP_ADD_TC(tp, file_suspend); + ATF_TP_ADD_TC(tp, file_waitcomplete); + ATF_TP_ADD_TC(tp, fifo_poll); + ATF_TP_ADD_TC(tp, fifo_suspend); + ATF_TP_ADD_TC(tp, fifo_waitcomplete); + ATF_TP_ADD_TC(tp, socket_poll); + ATF_TP_ADD_TC(tp, socket_suspend); + ATF_TP_ADD_TC(tp, socket_waitcomplete); + ATF_TP_ADD_TC(tp, pty_poll); + ATF_TP_ADD_TC(tp, pty_suspend); + ATF_TP_ADD_TC(tp, pty_waitcomplete); + ATF_TP_ADD_TC(tp, pipe_poll); + ATF_TP_ADD_TC(tp, pipe_suspend); + ATF_TP_ADD_TC(tp, pipe_waitcomplete); + ATF_TP_ADD_TC(tp, md_poll); + ATF_TP_ADD_TC(tp, md_suspend); + ATF_TP_ADD_TC(tp, md_waitcomplete); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); From owner-svn-src-all@freebsd.org Sat Jan 28 05:07: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 0799ACC4235; Sat, 28 Jan 2017 05:07: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 CB995192F; Sat, 28 Jan 2017 05:07: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 v0S57rxq088414; Sat, 28 Jan 2017 05:07:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S57rKB088413; Sat, 28 Jan 2017 05:07:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201701280507.v0S57rKB088413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 28 Jan 2017 05:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312914 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 05:07:55 -0000 Author: imp Date: Sat Jan 28 05:07:53 2017 New Revision: 312914 URL: https://svnweb.freebsd.org/changeset/base/312914 Log: Honor LINKS=x y in dtb modules. We need this for compatibility links for old, FreeBSD names. Modified: head/sys/conf/dtb.mk Modified: head/sys/conf/dtb.mk ============================================================================== --- head/sys/conf/dtb.mk Sat Jan 28 04:33:51 2017 (r312913) +++ head/sys/conf/dtb.mk Sat Jan 28 05:07:53 2017 (r312914) @@ -76,3 +76,4 @@ _dtbinstall: .include .include +.include From owner-svn-src-all@freebsd.org Sat Jan 28 05:07: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 515CDCC423B; Sat, 28 Jan 2017 05:07:56 +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 20FE61930; Sat, 28 Jan 2017 05:07:56 +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 v0S57tbX088458; Sat, 28 Jan 2017 05:07:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S57tOC088457; Sat, 28 Jan 2017 05:07:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201701280507.v0S57tOC088457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 28 Jan 2017 05:07:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312915 - head/sys/modules/dtb/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 05:07:56 -0000 Author: imp Date: Sat Jan 28 05:07:55 2017 New Revision: 312915 URL: https://svnweb.freebsd.org/changeset/base/312915 Log: Switch to Linux / device tree upstream names. U-boot uses these by default, and the fewer changes relative to the upstream u-boot the better. Add compatibility links for the old names. Add dts file for BeagleBone Green while we're here. Modified: head/sys/modules/dtb/am335x/Makefile Modified: head/sys/modules/dtb/am335x/Makefile ============================================================================== --- head/sys/modules/dtb/am335x/Makefile Sat Jan 28 05:07:53 2017 (r312914) +++ head/sys/modules/dtb/am335x/Makefile Sat Jan 28 05:07:55 2017 (r312915) @@ -1,8 +1,13 @@ # $FreeBSD$ # All the dts files for am335x systems we support. DTS= \ - beaglebone.dts \ - beaglebone-black.dts \ + am335x-bone.dts \ + am335x-boneblack.dts \ + am335x-bonegreen.dts \ ufw.dts +LINKS= \ + ${DTBDIR}/am3335x-bone.dtb ${DTBDIR}/beaglebone.dtb \ + ${DTBDIR}/am3335x-boneblack.dtb ${DTBDIR}/beaglebone-black.dtb + .include From owner-svn-src-all@freebsd.org Sat Jan 28 07:20: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 D3C4CCC52DF; Sat, 28 Jan 2017 07:20:00 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F5FFD42; Sat, 28 Jan 2017 07:20:00 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id XNIccRy8ecWiHXNIec5ypr; Sat, 28 Jan 2017 00:19:53 -0700 X-Authority-Analysis: v=2.2 cv=JLBLi4Cb c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=6I5d2MoRAAAA:8 a=72mLzN8eAAAA:8 a=YxBL1-UpAAAA:8 a=RNorSK_xXAry7Bjlr08A:9 a=P4je8-jNhQJVX9ZU:21 a=wwbirCSPFjxl03p-:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=-7La2cLJWLV_9KNFy1_x:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id CFC741637; Fri, 27 Jan 2017 23:19:50 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0S7JnMF087437; Fri, 27 Jan 2017 23:19:49 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701280719.v0S7JnMF087437@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Sean Bruno cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net In-Reply-To: Message from Sean Bruno of "Fri, 27 Jan 2017 23:08:06 +0000." <201701272308.v0RN86Fx040955@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 27 Jan 2017 23:19:49 -0800 X-CMAE-Envelope: MS4wfGw9Dy7lupBYSEyIdszJ2A3vxYROcKzbdgi05+mQameS35vdU8PMgqBWR9hCCIPjASGwxSokfdzcBvVTn44oBL9apwqxGSD3j32sM+UuowiGfgzzjZTA 6lga9XZPnuPkZn6zQJjUzeRdVg2FhLEcluijv3BrGjfMyjht4H0yOYWpsSylNoU0k0nPNifDfAG6Ij08tEFCr4qd/QVQFuhWPMyscMPj4n7Rcu0NvnF0yix9 xDt2715mNoBd3UpaZI1ITKWsjsDsqRg8kuA5oqmw7fHw+T8a0WrBUK3ceylRbZ90 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 07:20:00 -0000 In message <201701272308.v0RN86Fx040955@repo.freebsd.org>, Sean Bruno writes: > Author: sbruno > Date: Fri Jan 27 23:08:06 2017 > New Revision: 312905 > URL: https://svnweb.freebsd.org/changeset/base/312905 > > Log: > IFLIB updates: > We found routing performance dropped significantly when configuring > FreeBSD as a router, we are applying the following changes in order to > resolve those issues and hopefully perform better. > - don't prefetch the flags array, we usually don't need it > - prefetch the next cache line of each of the software descriptor arrays a > s > well as the first cache line of each of the next four packets' mbufs and > clusters > - reduce max copy size to 63 bytes > - convert rx soft descriptors from array of structures to a structure of a > rrays > - update copyrights > > Submitted by: Matt Macy > > Modified: > head/sys/net/iflib.c > head/sys/net/iflib.h > > Modified: head/sys/net/iflib.c > ============================================================================= > = > --- head/sys/net/iflib.c Fri Jan 27 23:03:28 2017 (r312904) > +++ head/sys/net/iflib.c Fri Jan 27 23:08:06 2017 (r312905) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2014-2016, Matthew Macy > + * Copyright (c) 2014-2017, Matthew Macy > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -264,18 +264,12 @@ iflib_get_sctx(if_ctx_t ctx) > #define RX_SW_DESC_INUSE (1 << 3) > #define TX_SW_DESC_MAPPED (1 << 4) > > -typedef struct iflib_sw_rx_desc { > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > - struct mbuf *ifsd_m; /* rx: uninitialized mbuf */ > - caddr_t ifsd_cl; /* direct cluster pointer for rx */ > - uint16_t ifsd_flags; > -} *iflib_rxsd_t; > - > -typedef struct iflib_sw_tx_desc_val { > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > - struct mbuf *ifsd_m; /* pkthdr mbuf */ > - uint8_t ifsd_flags; > -} *iflib_txsd_val_t; > +typedef struct iflib_sw_rx_desc_array { > + bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > + struct mbuf **ifsd_m; /* pkthdr mbufs */ > + caddr_t *ifsd_cl; /* direct cluster pointer for rx */ > + uint8_t *ifsd_flags; > +} iflib_rxsd_array_t; > > typedef struct iflib_sw_tx_desc_array { > bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > @@ -287,7 +281,7 @@ typedef struct iflib_sw_tx_desc_array { > /* magic number that should be high enough for any hardware */ > #define IFLIB_MAX_TX_SEGS 128 > #define IFLIB_MAX_RX_SEGS 32 > -#define IFLIB_RX_COPY_THRESH 128 > +#define IFLIB_RX_COPY_THRESH 63 > #define IFLIB_MAX_RX_REFRESH 32 > #define IFLIB_QUEUE_IDLE 0 > #define IFLIB_QUEUE_HUNG 1 > @@ -383,7 +377,7 @@ struct iflib_fl { > uint16_t ifl_buf_size; > uint16_t ifl_cltype; > uma_zone_t ifl_zone; > - iflib_rxsd_t ifl_sds; > + iflib_rxsd_array_t ifl_sds; > iflib_rxq_t ifl_rxq; > uint8_t ifl_id; > bus_dma_tag_t ifl_desc_tag; > @@ -909,7 +903,7 @@ iflib_netmap_rxsync(struct netmap_kring > ring->slot[nm_i].len = ri.iri_len - crc > len; > ring->slot[nm_i].flags = slot_flags; > bus_dmamap_sync(fl->ifl_ifdi->idi_tag, > - fl->ifl_sds[nic > _i].ifsd_map, BUS_DMASYNC_POSTREAD); > + fl->ifl_sds.ifs > d_map[nic_i], BUS_DMASYNC_POSTREAD); > nm_i = nm_next(nm_i, lim); > nic_i = nm_next(nic_i, lim); > } > @@ -949,14 +943,14 @@ iflib_netmap_rxsync(struct netmap_kring > vaddr = addr; > if (slot->flags & NS_BUF_CHANGED) { > /* buffer has changed, reload map */ > - netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > ->ifl_sds[nic_i].ifsd_map, addr); > + netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > ->ifl_sds.ifsd_map[nic_i], addr); > slot->flags &= ~NS_BUF_CHANGED; > } > /* > * XXX we should be batching this operation - TODO > */ > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, fl->if > l_id, nic_i, &paddr, &vaddr, 1, fl->ifl_buf_size); > - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_ > i].ifsd_map, > + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd > _map[nic_i], > BUS_DMASYNC_PREREAD); > nm_i = nm_next(nm_i, lim); > nic_i = nm_next(nic_i, lim); > @@ -1030,22 +1024,22 @@ iflib_netmap_rxq_init(if_ctx_t ctx, ifli > { > struct netmap_adapter *na = NA(ctx->ifc_ifp); > struct netmap_slot *slot; > - iflib_rxsd_t sd; > + bus_dmamap_t *map; > int nrxd; > > slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); > if (slot == 0) > return; > - sd = rxq->ifr_fl[0].ifl_sds; > + map = rxq->ifr_fl[0].ifl_sds.ifsd_map; > nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; > - for (int i = 0; i < nrxd; i++, sd++) { > + for (int i = 0; i < nrxd; i++, map++) { > int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); > uint64_t paddr; > void *addr; > caddr_t vaddr; > > vaddr = addr = PNMB(na, slot + sj, &paddr); > - netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, s > d->ifsd_map, addr); > + netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, * > map, addr); > /* Update descriptor and the cached value */ > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, 0 /* f > l_id */, i, &paddr, &vaddr, 1, rxq->ifr_fl[0].ifl_buf_size); > } > @@ -1476,7 +1470,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; > device_t dev = ctx->ifc_dev; > iflib_fl_t fl; > - iflib_rxsd_t rxsd; > int err; > > MPASS(scctx->isc_nrxd[0] > 0); > @@ -1484,13 +1477,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > fl = rxq->ifr_fl; > for (int i = 0; i < rxq->ifr_nfl; i++, fl++) { > - fl->ifl_sds = malloc(sizeof(struct iflib_sw_rx_desc) * > - scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, > - M_WAITOK | M_ZERO); > - if (fl->ifl_sds == NULL) { > - device_printf(dev, "Unable to allocate rx sw desc memor > y\n"); > - return (ENOMEM); > - } > fl->ifl_size = scctx->isc_nrxd[rxq->ifr_fl_offset]; /* this isn > 't necessarily the same */ > err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ > 1, 0, /* alignment, b > ounds */ > @@ -1509,17 +1495,49 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > __func__, err); > goto fail; > } > + if (!(fl->ifl_sds.ifsd_flags = > + (uint8_t *) malloc(sizeof(uint8_t) * > + scctx->isc_nrxd[rxq->ifr_fl_offset], M > _IFLIB, M_NOWAIT | M_ZERO))) { > + device_printf(dev, "Unable to allocate tx_buffer memory > \n"); > + err = ENOMEM; > + goto fail; > + } > + if (!(fl->ifl_sds.ifsd_m = > + (struct mbuf **) malloc(sizeof(struct mbuf *) * > + scctx->isc_nrxd[rxq->ifr_fl_offse > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > + device_printf(dev, "Unable to allocate tx_buffer memory > \n"); > + err = ENOMEM; > + goto fail; > + } > + if (!(fl->ifl_sds.ifsd_cl = > + (caddr_t *) malloc(sizeof(caddr_t) * > + scctx->isc_nrxd[rxq->ifr_fl_offse > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > + device_printf(dev, "Unable to allocate tx_buffer memory > \n"); > + err = ENOMEM; > + goto fail; > + } > > - rxsd = fl->ifl_sds; > - for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++, r > xsd++) { > - err = bus_dmamap_create(fl->ifl_desc_tag, 0, &rxsd->ifs > d_map); > - if (err) { > - device_printf(dev, "%s: bus_dmamap_create faile > d: %d\n", > - __func__, err); > + /* Create the descriptor buffer dma maps */ > +#if defined(ACPI_DMAR) || (!(defined(__i386__) && !defined(__amd64__))) > + if ((ctx->ifc_flags & IFC_DMAR) == 0) > + continue; > + > + if (!(fl->ifl_sds.ifsd_map = > + (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc > _nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { > + device_printf(dev, "Unable to allocate tx_buffer map me > mory\n"); > + err = ENOMEM; > + goto fail; > + } > + > + for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++) { > + err = bus_dmamap_create(fl->ifl_desc_tag, 0, &fl->ifl_s > ds.ifsd_map[i]); > + if (err != 0) { > + device_printf(dev, "Unable to create TX DMA map > \n"); > goto fail; > } > } > } > +#endif > return (0); > > fail: > @@ -1568,13 +1586,21 @@ static void > _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) > { > struct mbuf *m; > - int pidx = fl->ifl_pidx; > - iflib_rxsd_t rxsd = &fl->ifl_sds[pidx]; > - caddr_t cl; > + int idx, pidx = fl->ifl_pidx; > + caddr_t cl, *sd_cl; > + struct mbuf **sd_m; > + uint8_t *sd_flags; > + bus_dmamap_t *sd_map; > int n, i = 0; > uint64_t bus_addr; > int err; > > + sd_m = fl->ifl_sds.ifsd_m; > + sd_map = fl->ifl_sds.ifsd_map; > + sd_cl = fl->ifl_sds.ifsd_cl; > + sd_flags = fl->ifl_sds.ifsd_flags; > + idx = pidx; > + > n = count; > MPASS(n > 0); > MPASS(fl->ifl_credits + n <= fl->ifl_size); > @@ -1597,8 +1623,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > * > * If the cluster is still set then we know a minimum sized pac > ket was received > */ > - if ((cl = rxsd->ifsd_cl) == NULL) { > - if ((cl = rxsd->ifsd_cl = m_cljget(NULL, M_NOWAIT, fl-> > ifl_buf_size)) == NULL) > + if ((cl = sd_cl[idx]) == NULL) { > + if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl > _buf_size)) == NULL) > break; > #if MEMORY_LOGGING > fl->ifl_cl_enqueued++; > @@ -1613,16 +1639,16 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > DBG_COUNTER_INC(rx_allocs); > #ifdef notyet > - if ((rxsd->ifsd_flags & RX_SW_DESC_MAP_CREATED) == 0) { > + if ((sd_flags[pidx] & RX_SW_DESC_MAP_CREATED) == 0) { > int err; > > - if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > &rxsd->ifsd_map))) { > + if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > &sd_map[idx]))) { > log(LOG_WARNING, "bus_dmamap_create failed %d\n > ", err); > uma_zfree(fl->ifl_zone, cl); > n = 0; > goto done; > } > - rxsd->ifsd_flags |= RX_SW_DESC_MAP_CREATED; > + sd_flags[idx] |= RX_SW_DESC_MAP_CREATED; > } > #endif > #if defined(__i386__) || defined(__amd64__) > @@ -1636,7 +1662,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > cb_arg.error = 0; > q = fl->ifl_rxq; > - err = bus_dmamap_load(fl->ifl_desc_tag, rxsd->ifsd_map, > + err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], > cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); > > if (err != 0 || cb_arg.error) { > @@ -1651,28 +1677,28 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > } > bus_addr = cb_arg.seg.ds_addr; > } > - rxsd->ifsd_flags |= RX_SW_DESC_INUSE; > + sd_flags[idx] |= RX_SW_DESC_INUSE; > > - MPASS(rxsd->ifsd_m == NULL); > - rxsd->ifsd_cl = cl; > - rxsd->ifsd_m = m; > + MPASS(sd_m[idx] == NULL); > + sd_cl[idx] = cl; > + sd_m[idx] = m; > fl->ifl_bus_addrs[i] = bus_addr; > fl->ifl_vm_addrs[i] = cl; > - rxsd++; > fl->ifl_credits++; > i++; > MPASS(fl->ifl_credits <= fl->ifl_size); > - if (++fl->ifl_pidx == fl->ifl_size) { > - fl->ifl_pidx = 0; > + if (++idx == fl->ifl_size) { > fl->ifl_gen = 1; > - rxsd = fl->ifl_sds; > + idx = 0; > } > if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { > ctx->isc_rxd_refill(ctx->ifc_softc, fl->ifl_rxq->ifr_id > , fl->ifl_id, pidx, > fl->ifl_bus_ad > drs, fl->ifl_vm_addrs, i, fl->ifl_buf_size); > i = 0; > - pidx = fl->ifl_pidx; > + pidx = idx; > } > + fl->ifl_pidx = idx; > + > } > done: > DBG_COUNTER_INC(rxd_flush); > @@ -1706,28 +1732,33 @@ iflib_fl_bufs_free(iflib_fl_t fl) > uint32_t i; > > for (i = 0; i < fl->ifl_size; i++) { > - iflib_rxsd_t d = &fl->ifl_sds[i]; > - > - if (d->ifsd_flags & RX_SW_DESC_INUSE) { > - bus_dmamap_unload(fl->ifl_desc_tag, d->ifsd_map); > - bus_dmamap_destroy(fl->ifl_desc_tag, d->ifsd_map); > - if (d->ifsd_m != NULL) { > - m_init(d->ifsd_m, M_NOWAIT, MT_DATA, 0); > - uma_zfree(zone_mbuf, d->ifsd_m); > + struct mbuf **sd_m = &fl->ifl_sds.ifsd_m[i]; > + uint8_t *sd_flags = &fl->ifl_sds.ifsd_flags[i]; > + caddr_t *sd_cl = &fl->ifl_sds.ifsd_cl[i]; > + > + if (*sd_flags & RX_SW_DESC_INUSE) { > + if (fl->ifl_sds.ifsd_map != NULL) { > + bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; > + bus_dmamap_unload(fl->ifl_desc_tag, sd_map); > + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); > + } > + if (*sd_m != NULL) { > + m_init(*sd_m, M_NOWAIT, MT_DATA, 0); > + uma_zfree(zone_mbuf, *sd_m); > } > - if (d->ifsd_cl != NULL) > - uma_zfree(fl->ifl_zone, d->ifsd_cl); > - d->ifsd_flags = 0; > + if (*sd_cl != NULL) > + uma_zfree(fl->ifl_zone, *sd_cl); > + *sd_flags = 0; > } else { > - MPASS(d->ifsd_cl == NULL); > - MPASS(d->ifsd_m == NULL); > + MPASS(*sd_cl == NULL); > + MPASS(*sd_m == NULL); > } > #if MEMORY_LOGGING > fl->ifl_m_dequeued++; > fl->ifl_cl_dequeued++; > #endif > - d->ifsd_cl = NULL; > - d->ifsd_m = NULL; > + *sd_cl = NULL; > + *sd_m = NULL; > } > /* > * Reset free list values > @@ -1807,10 +1838,14 @@ iflib_rx_sds_free(iflib_rxq_t rxq) > bus_dma_tag_destroy(fl->ifl_desc_tag); > fl->ifl_desc_tag = NULL; > } > + free(fl->ifl_sds.ifsd_m, M_IFLIB); > + free(fl->ifl_sds.ifsd_cl, M_IFLIB); > + /* XXX destroy maps first */ > + free(fl->ifl_sds.ifsd_map, M_IFLIB); > + fl->ifl_sds.ifsd_m = NULL; > + fl->ifl_sds.ifsd_cl = NULL; > + fl->ifl_sds.ifsd_map = NULL; > } > - if (rxq->ifr_fl->ifl_sds != NULL) > - free(rxq->ifr_fl->ifl_sds, M_IFLIB); > - > free(rxq->ifr_fl, M_IFLIB); > rxq->ifr_fl = NULL; > rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; > @@ -1995,13 +2030,33 @@ iflib_stop(if_ctx_t ctx) > } > } > > -static iflib_rxsd_t > -rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload) > +static inline void > +prefetch_pkts(iflib_fl_t fl, int cidx) > +{ > + int nextptr; > + int nrxd = fl->ifl_size; > + > + nextptr = (cidx + CACHE_PTR_INCREMENT) & (nrxd-1); > + prefetch(&fl->ifl_sds.ifsd_m[nextptr]); > + prefetch(&fl->ifl_sds.ifsd_cl[nextptr]); > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 1) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 2) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 3) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 4) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 1) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 2) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 3) & (nrxd-1)]); > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]); > +} > + > +static void > +rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload, > iflib_fl_t *pfl, int *pcidx) > { > int flid, cidx; > - iflib_rxsd_t sd; > + bus_dmamap_t map; > iflib_fl_t fl; > iflib_dma_info_t di; > + int next; > > flid = irf->irf_flid; > cidx = irf->irf_idx; > @@ -2012,16 +2067,22 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > if (cltype) > fl->ifl_cl_dequeued++; > #endif > - sd = &fl->ifl_sds[cidx]; > - di = fl->ifl_ifdi; > - bus_dmamap_sync(di->idi_tag, di->idi_map, > - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > + prefetch_pkts(fl, cidx); > + if (fl->ifl_sds.ifsd_map != NULL) { > + next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); > + prefetch(&fl->ifl_sds.ifsd_map[next]); > + map = fl->ifl_sds.ifsd_map[cidx]; > + di = fl->ifl_ifdi; > + next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); > + prefetch(&fl->ifl_sds.ifsd_flags[next]); > + bus_dmamap_sync(di->idi_tag, di->idi_map, > + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > > /* not valid assert if bxe really does SGE from non-contiguous elements > */ > - MPASS(fl->ifl_cidx == cidx); > - if (unload) > - bus_dmamap_unload(fl->ifl_desc_tag, sd->ifsd_map); > - > + MPASS(fl->ifl_cidx == cidx); > + if (unload) > + bus_dmamap_unload(fl->ifl_desc_tag, map); > + } > if (__predict_false(++fl->ifl_cidx == fl->ifl_size)) { > fl->ifl_cidx = 0; > fl->ifl_gen = 0; > @@ -2029,35 +2090,38 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > /* YES ick */ > if (cltype) > *cltype = fl->ifl_cltype; > - return (sd); > + *pfl = fl; > + *pcidx = cidx; > } > > static struct mbuf * > assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) > { > int i, padlen , flags, cltype; > - struct mbuf *m, *mh, *mt; > - iflib_rxsd_t sd; > - caddr_t cl; > + struct mbuf *m, *mh, *mt, *sd_m; > + iflib_fl_t fl; > + int cidx; > + caddr_t cl, sd_cl; > > i = 0; > mh = NULL; > do { > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE); > + rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE, &fl, &cid > x); > + sd_m = fl->ifl_sds.ifsd_m[cidx]; > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > > - MPASS(sd->ifsd_cl != NULL); > - MPASS(sd->ifsd_m != NULL); > + MPASS(sd_cl != NULL); > + MPASS(sd_m != NULL); > > /* Don't include zero-length frags */ > if (ri->iri_frags[i].irf_len == 0) { > /* XXX we can save the cluster here, but not the mbuf * > / > - m_init(sd->ifsd_m, M_NOWAIT, MT_DATA, 0); > - m_free(sd->ifsd_m); > - sd->ifsd_m = NULL; > + m_init(sd_m, M_NOWAIT, MT_DATA, 0); > + m_free(sd_m); > + fl->ifl_sds.ifsd_m[cidx] = NULL; > continue; > } > - > - m = sd->ifsd_m; > + m = sd_m; > if (mh == NULL) { > flags = M_PKTHDR|M_EXT; > mh = mt = m; > @@ -2069,9 +2133,9 @@ assemble_segments(iflib_rxq_t rxq, if_rx > /* assuming padding is only on the first fragment */ > padlen = 0; > } > - sd->ifsd_m = NULL; > - cl = sd->ifsd_cl; > - sd->ifsd_cl = NULL; > + fl->ifl_sds.ifsd_m[cidx] = NULL; > + cl = fl->ifl_sds.ifsd_cl[cidx]; > + fl->ifl_sds.ifsd_cl[cidx] = NULL; > > /* Can these two be made one ? */ > m_init(m, M_NOWAIT, MT_DATA, flags); > @@ -2094,16 +2158,19 @@ static struct mbuf * > iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) > { > struct mbuf *m; > - iflib_rxsd_t sd; > + iflib_fl_t fl; > + caddr_t sd_cl; > + int cidx; > > /* should I merge this back in now that the two paths are basically dup > licated? */ > if (ri->iri_nfrags == 1 && > ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE); > - m = sd->ifsd_m; > - sd->ifsd_m = NULL; > + rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE, &fl, &cidx) > ; > + m = fl->ifl_sds.ifsd_m[cidx]; > + fl->ifl_sds.ifsd_m[cidx] = NULL; > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR); > - memcpy(m->m_data, sd->ifsd_cl, ri->iri_len); > + memcpy(m->m_data, sd_cl, ri->iri_len); > m->m_len = ri->iri_frags[0].irf_len; > } else { > m = assemble_segments(rxq, ri); > > Modified: head/sys/net/iflib.h > ============================================================================= > = > --- head/sys/net/iflib.h Fri Jan 27 23:03:28 2017 (r312904) > +++ head/sys/net/iflib.h Fri Jan 27 23:08:06 2017 (r312905) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2014-2015, Matthew Macy (mmacy@nextbsd.org) > + * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org) Really? Just a copyright notice? The reason I ask is because of this: ===> ae (all) --- iflib.o --- /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1561:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1587:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1714:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1730:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1777:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1830:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1861:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1902:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1962:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1975:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1986:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2035:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2054:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2099:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2159:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2191:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2315:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2333:1: error: function definition is not allowed here { ^ /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error: function definition is not allowed here { ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 28 07:26: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 66B0FCC55FB; Sat, 28 Jan 2017 07:26:44 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D517126C; Sat, 28 Jan 2017 07:26:44 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S7Qh1T044326; Sat, 28 Jan 2017 07:26:43 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S7QhhR044323; Sat, 28 Jan 2017 07:26:43 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201701280726.v0S7QhhR044323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Sat, 28 Jan 2017 07:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312916 - in head/sys: net sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 07:26:44 -0000 Author: dexuan Date: Sat Jan 28 07:26:42 2017 New Revision: 312916 URL: https://svnweb.freebsd.org/changeset/base/312916 Log: ifnet: move the new ifnet_event EVENTHANDLER_DECLARE to net/if_var.h Thank glebius for pointing this out: "The network stuff shall not be added to sys/eventhandler.h" Reviewed by: David_A_Bright_DELL.com, sephe, glebius Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9345 Modified: head/sys/net/if.c head/sys/net/if_var.h head/sys/sys/eventhandler.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Jan 28 05:07:55 2017 (r312915) +++ head/sys/net/if.c Sat Jan 28 07:26:42 2017 (r312916) @@ -59,7 +59,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sat Jan 28 05:07:55 2017 (r312915) +++ head/sys/net/if_var.h Sat Jan 28 07:26:42 2017 (r312916) @@ -404,6 +404,11 @@ EVENTHANDLER_DECLARE(ifnet_departure_eve /* Interface link state change event */ typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int); EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t); +/* Interface up/down event */ +#define IFNET_EVENT_UP 0 +#define IFNET_EVENT_DOWN 1 +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); #endif /* _SYS_EVENTHANDLER_H_ */ /* Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Sat Jan 28 05:07:55 2017 (r312915) +++ head/sys/sys/eventhandler.h Sat Jan 28 07:26:42 2017 (r312916) @@ -284,11 +284,4 @@ typedef void (*swapoff_fn)(void *, struc EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); -/* ifup/ifdown events */ -#define IFNET_EVENT_UP 0 -#define IFNET_EVENT_DOWN 1 -struct ifnet; -typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); -EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); - #endif /* _SYS_EVENTHANDLER_H_ */ From owner-svn-src-all@freebsd.org Sat Jan 28 07:47: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 77FA6CC5A24; Sat, 28 Jan 2017 07:47:36 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 25C1B1B30; Sat, 28 Jan 2017 07:47:35 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id XNgwcS3AKcWiHXNgxc60EM; Sat, 28 Jan 2017 00:44:59 -0700 X-Authority-Analysis: v=2.2 cv=JLBLi4Cb c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=72mLzN8eAAAA:8 a=YxBL1-UpAAAA:8 a=-oEIcx5AVUFLjKJhEQwA:9 a=1xfqk5eYOQCauBCf:21 a=JnYiq_ZT9P_ZO2IP:21 a=CjuIK1q_8ugA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=-7La2cLJWLV_9KNFy1_x:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id CFFDC166F; Fri, 27 Jan 2017 23:44:57 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0S7iv6Q035041; Fri, 27 Jan 2017 23:44:57 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701280744.v0S7iv6Q035041@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net In-Reply-To: Message from Cy Schubert of "Fri, 27 Jan 2017 23:19:49 -0800." <201701280719.v0S7JnMF087437@slippy.cwsent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 27 Jan 2017 23:44:57 -0800 X-CMAE-Envelope: MS4wfMOddCJL0OcFdgiHZKSzUwX0MgeMjBMgqTUJhvkLzkR9Y5yEhZt+S6Q/tlZhyF192Rp1RDAh88MjccHU6C3tjEWQWvTZ317bHe+BN/WeMPmKIKKw9X2D 5zU4AhgkfuyAJV5Y1zfTuUj63MMcRhh2r7FBH5FJSaYC1qldm7EvCp+4/TEJGv2tBqpa96A5LNr9dQL8vPgZk4WYywcwtKfHTdZDBRtTE0RKNjis3XbepgRx D7LAsDZWkODOyquJELUDC06fD5mJshNQuZNm60G9j3RRCRGcMtbdq4A5v95YQ7c8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 07:47:36 -0000 In message <201701280719.v0S7JnMF087437@slippy.cwsent.com>, Cy Schubert writes: > In message <201701272308.v0RN86Fx040955@repo.freebsd.org>, Sean Bruno > writes: > > Author: sbruno > > Date: Fri Jan 27 23:08:06 2017 > > New Revision: 312905 > > URL: https://svnweb.freebsd.org/changeset/base/312905 > > > > Log: > > IFLIB updates: > > We found routing performance dropped significantly when configuring > > FreeBSD as a router, we are applying the following changes in order to > > resolve those issues and hopefully perform better. > > - don't prefetch the flags array, we usually don't need it > > - prefetch the next cache line of each of the software descriptor arrays > a > > s > > well as the first cache line of each of the next four packets' mbufs a > nd > > clusters > > - reduce max copy size to 63 bytes > > - convert rx soft descriptors from array of structures to a structure of > a > > rrays > > - update copyrights > > > > Submitted by: Matt Macy > > > > Modified: > > head/sys/net/iflib.c > > head/sys/net/iflib.h > > > > Modified: head/sys/net/iflib.c > > =========================================================================== > == > > = > > --- head/sys/net/iflib.c Fri Jan 27 23:03:28 2017 (r312904) > > +++ head/sys/net/iflib.c Fri Jan 27 23:08:06 2017 (r312905) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2014-2016, Matthew Macy > > + * Copyright (c) 2014-2017, Matthew Macy > > * All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > @@ -264,18 +264,12 @@ iflib_get_sctx(if_ctx_t ctx) > > #define RX_SW_DESC_INUSE (1 << 3) > > #define TX_SW_DESC_MAPPED (1 << 4) > > > > -typedef struct iflib_sw_rx_desc { > > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > > - struct mbuf *ifsd_m; /* rx: uninitialized mbuf */ > > - caddr_t ifsd_cl; /* direct cluster pointer for rx */ > > - uint16_t ifsd_flags; > > -} *iflib_rxsd_t; > > - > > -typedef struct iflib_sw_tx_desc_val { > > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > > - struct mbuf *ifsd_m; /* pkthdr mbuf */ > > - uint8_t ifsd_flags; > > -} *iflib_txsd_val_t; > > +typedef struct iflib_sw_rx_desc_array { > > + bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > > + struct mbuf **ifsd_m; /* pkthdr mbufs */ > > + caddr_t *ifsd_cl; /* direct cluster pointer for rx */ > > + uint8_t *ifsd_flags; > > +} iflib_rxsd_array_t; > > > > typedef struct iflib_sw_tx_desc_array { > > bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > > @@ -287,7 +281,7 @@ typedef struct iflib_sw_tx_desc_array { > > /* magic number that should be high enough for any hardware */ > > #define IFLIB_MAX_TX_SEGS 128 > > #define IFLIB_MAX_RX_SEGS 32 > > -#define IFLIB_RX_COPY_THRESH 128 > > +#define IFLIB_RX_COPY_THRESH 63 > > #define IFLIB_MAX_RX_REFRESH 32 > > #define IFLIB_QUEUE_IDLE 0 > > #define IFLIB_QUEUE_HUNG 1 > > @@ -383,7 +377,7 @@ struct iflib_fl { > > uint16_t ifl_buf_size; > > uint16_t ifl_cltype; > > uma_zone_t ifl_zone; > > - iflib_rxsd_t ifl_sds; > > + iflib_rxsd_array_t ifl_sds; > > iflib_rxq_t ifl_rxq; > > uint8_t ifl_id; > > bus_dma_tag_t ifl_desc_tag; > > @@ -909,7 +903,7 @@ iflib_netmap_rxsync(struct netmap_kring > > ring->slot[nm_i].len = ri.iri_len - crc > > len; > > ring->slot[nm_i].flags = slot_flags; > > bus_dmamap_sync(fl->ifl_ifdi->idi_tag, > > - fl->ifl_sds[nic > > _i].ifsd_map, BUS_DMASYNC_POSTREAD); > > + fl->ifl_sds.ifs > > d_map[nic_i], BUS_DMASYNC_POSTREAD); > > nm_i = nm_next(nm_i, lim); > > nic_i = nm_next(nic_i, lim); > > } > > @@ -949,14 +943,14 @@ iflib_netmap_rxsync(struct netmap_kring > > vaddr = addr; > > if (slot->flags & NS_BUF_CHANGED) { > > /* buffer has changed, reload map */ > > - netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > > ->ifl_sds[nic_i].ifsd_map, addr); > > + netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > > ->ifl_sds.ifsd_map[nic_i], addr); > > slot->flags &= ~NS_BUF_CHANGED; > > } > > /* > > * XXX we should be batching this operation - TODO > > */ > > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, fl->if > > l_id, nic_i, &paddr, &vaddr, 1, fl->ifl_buf_size); > > - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_ > > i].ifsd_map, > > + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd > > _map[nic_i], > > BUS_DMASYNC_PREREAD); > > nm_i = nm_next(nm_i, lim); > > nic_i = nm_next(nic_i, lim); > > @@ -1030,22 +1024,22 @@ iflib_netmap_rxq_init(if_ctx_t ctx, ifli > > { > > struct netmap_adapter *na = NA(ctx->ifc_ifp); > > struct netmap_slot *slot; > > - iflib_rxsd_t sd; > > + bus_dmamap_t *map; > > int nrxd; > > > > slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); > > if (slot == 0) > > return; > > - sd = rxq->ifr_fl[0].ifl_sds; > > + map = rxq->ifr_fl[0].ifl_sds.ifsd_map; > > nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; > > - for (int i = 0; i < nrxd; i++, sd++) { > > + for (int i = 0; i < nrxd; i++, map++) { > > int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); > > uint64_t paddr; > > void *addr; > > caddr_t vaddr; > > > > vaddr = addr = PNMB(na, slot + sj, &paddr); > > - netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, s > > d->ifsd_map, addr); > > + netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, * > > map, addr); > > /* Update descriptor and the cached value */ > > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, 0 /* f > > l_id */, i, &paddr, &vaddr, 1, rxq->ifr_fl[0].ifl_buf_size); > > } > > @@ -1476,7 +1470,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; > > device_t dev = ctx->ifc_dev; > > iflib_fl_t fl; > > - iflib_rxsd_t rxsd; > > int err; > > > > MPASS(scctx->isc_nrxd[0] > 0); > > @@ -1484,13 +1477,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > > > fl = rxq->ifr_fl; > > for (int i = 0; i < rxq->ifr_nfl; i++, fl++) { > > - fl->ifl_sds = malloc(sizeof(struct iflib_sw_rx_desc) * > > - scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, > > - M_WAITOK | M_ZERO); > > - if (fl->ifl_sds == NULL) { > > - device_printf(dev, "Unable to allocate rx sw desc memor > > y\n"); > > - return (ENOMEM); > > - } > > fl->ifl_size = scctx->isc_nrxd[rxq->ifr_fl_offset]; /* this isn > > 't necessarily the same */ > > err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ > > 1, 0, /* alignment, b > > ounds */ > > @@ -1509,17 +1495,49 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > __func__, err); > > goto fail; > > } > > + if (!(fl->ifl_sds.ifsd_flags = > > + (uint8_t *) malloc(sizeof(uint8_t) * > > + scctx->isc_nrxd[rxq->ifr_fl_offset], M > > _IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + if (!(fl->ifl_sds.ifsd_m = > > + (struct mbuf **) malloc(sizeof(struct mbuf *) * > > + scctx->isc_nrxd[rxq->ifr_fl_offse > > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + if (!(fl->ifl_sds.ifsd_cl = > > + (caddr_t *) malloc(sizeof(caddr_t) * > > + scctx->isc_nrxd[rxq->ifr_fl_offse > > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > > > - rxsd = fl->ifl_sds; > > - for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++, r > > xsd++) { > > - err = bus_dmamap_create(fl->ifl_desc_tag, 0, &rxsd->ifs > > d_map); > > - if (err) { > > - device_printf(dev, "%s: bus_dmamap_create faile > > d: %d\n", > > - __func__, err); > > + /* Create the descriptor buffer dma maps */ > > +#if defined(ACPI_DMAR) || (!(defined(__i386__) && !defined(__amd64__))) > > + if ((ctx->ifc_flags & IFC_DMAR) == 0) > > + continue; > > + > > + if (!(fl->ifl_sds.ifsd_map = > > + (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc > > _nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer map me > > mory\n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + > > + for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++) { > > + err = bus_dmamap_create(fl->ifl_desc_tag, 0, &fl->ifl_s > > ds.ifsd_map[i]); > > + if (err != 0) { > > + device_printf(dev, "Unable to create TX DMA map > > \n"); > > goto fail; > > } > > } > > } > > +#endif > > return (0); > > > > fail: > > @@ -1568,13 +1586,21 @@ static void > > _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) > > { > > struct mbuf *m; > > - int pidx = fl->ifl_pidx; > > - iflib_rxsd_t rxsd = &fl->ifl_sds[pidx]; > > - caddr_t cl; > > + int idx, pidx = fl->ifl_pidx; > > + caddr_t cl, *sd_cl; > > + struct mbuf **sd_m; > > + uint8_t *sd_flags; > > + bus_dmamap_t *sd_map; > > int n, i = 0; > > uint64_t bus_addr; > > int err; > > > > + sd_m = fl->ifl_sds.ifsd_m; > > + sd_map = fl->ifl_sds.ifsd_map; > > + sd_cl = fl->ifl_sds.ifsd_cl; > > + sd_flags = fl->ifl_sds.ifsd_flags; > > + idx = pidx; > > + > > n = count; > > MPASS(n > 0); > > MPASS(fl->ifl_credits + n <= fl->ifl_size); > > @@ -1597,8 +1623,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > * > > * If the cluster is still set then we know a minimum sized pac > > ket was received > > */ > > - if ((cl = rxsd->ifsd_cl) == NULL) { > > - if ((cl = rxsd->ifsd_cl = m_cljget(NULL, M_NOWAIT, fl-> > > ifl_buf_size)) == NULL) > > + if ((cl = sd_cl[idx]) == NULL) { > > + if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl > > _buf_size)) == NULL) > > break; > > #if MEMORY_LOGGING > > fl->ifl_cl_enqueued++; > > @@ -1613,16 +1639,16 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > > > DBG_COUNTER_INC(rx_allocs); > > #ifdef notyet > > - if ((rxsd->ifsd_flags & RX_SW_DESC_MAP_CREATED) == 0) { > > + if ((sd_flags[pidx] & RX_SW_DESC_MAP_CREATED) == 0) { > > int err; > > > > - if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > > &rxsd->ifsd_map))) { > > + if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > > &sd_map[idx]))) { > > log(LOG_WARNING, "bus_dmamap_create failed %d\n > > ", err); > > uma_zfree(fl->ifl_zone, cl); > > n = 0; > > goto done; > > } > > - rxsd->ifsd_flags |= RX_SW_DESC_MAP_CREATED; > > + sd_flags[idx] |= RX_SW_DESC_MAP_CREATED; > > } > > #endif > > #if defined(__i386__) || defined(__amd64__) > > @@ -1636,7 +1662,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > > > cb_arg.error = 0; > > q = fl->ifl_rxq; > > - err = bus_dmamap_load(fl->ifl_desc_tag, rxsd->ifsd_map, > > + err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], > > cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); > > > > if (err != 0 || cb_arg.error) { > > @@ -1651,28 +1677,28 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > } > > bus_addr = cb_arg.seg.ds_addr; > > } > > - rxsd->ifsd_flags |= RX_SW_DESC_INUSE; > > + sd_flags[idx] |= RX_SW_DESC_INUSE; > > > > - MPASS(rxsd->ifsd_m == NULL); > > - rxsd->ifsd_cl = cl; > > - rxsd->ifsd_m = m; > > + MPASS(sd_m[idx] == NULL); > > + sd_cl[idx] = cl; > > + sd_m[idx] = m; > > fl->ifl_bus_addrs[i] = bus_addr; > > fl->ifl_vm_addrs[i] = cl; > > - rxsd++; > > fl->ifl_credits++; > > i++; > > MPASS(fl->ifl_credits <= fl->ifl_size); > > - if (++fl->ifl_pidx == fl->ifl_size) { > > - fl->ifl_pidx = 0; > > + if (++idx == fl->ifl_size) { > > fl->ifl_gen = 1; > > - rxsd = fl->ifl_sds; > > + idx = 0; > > } > > if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { > > ctx->isc_rxd_refill(ctx->ifc_softc, fl->ifl_rxq->ifr_id > > , fl->ifl_id, pidx, > > fl->ifl_bus_ad > > drs, fl->ifl_vm_addrs, i, fl->ifl_buf_size); > > i = 0; > > - pidx = fl->ifl_pidx; > > + pidx = idx; > > } > > + fl->ifl_pidx = idx; > > + > > } > > done: > > DBG_COUNTER_INC(rxd_flush); > > @@ -1706,28 +1732,33 @@ iflib_fl_bufs_free(iflib_fl_t fl) > > uint32_t i; > > > > for (i = 0; i < fl->ifl_size; i++) { > > - iflib_rxsd_t d = &fl->ifl_sds[i]; > > - > > - if (d->ifsd_flags & RX_SW_DESC_INUSE) { > > - bus_dmamap_unload(fl->ifl_desc_tag, d->ifsd_map); > > - bus_dmamap_destroy(fl->ifl_desc_tag, d->ifsd_map); > > - if (d->ifsd_m != NULL) { > > - m_init(d->ifsd_m, M_NOWAIT, MT_DATA, 0); > > - uma_zfree(zone_mbuf, d->ifsd_m); > > + struct mbuf **sd_m = &fl->ifl_sds.ifsd_m[i]; > > + uint8_t *sd_flags = &fl->ifl_sds.ifsd_flags[i]; > > + caddr_t *sd_cl = &fl->ifl_sds.ifsd_cl[i]; > > + > > + if (*sd_flags & RX_SW_DESC_INUSE) { > > + if (fl->ifl_sds.ifsd_map != NULL) { > > + bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; > > + bus_dmamap_unload(fl->ifl_desc_tag, sd_map); > > + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); > > + } > > + if (*sd_m != NULL) { > > + m_init(*sd_m, M_NOWAIT, MT_DATA, 0); > > + uma_zfree(zone_mbuf, *sd_m); > > } > > - if (d->ifsd_cl != NULL) > > - uma_zfree(fl->ifl_zone, d->ifsd_cl); > > - d->ifsd_flags = 0; > > + if (*sd_cl != NULL) > > + uma_zfree(fl->ifl_zone, *sd_cl); > > + *sd_flags = 0; > > } else { > > - MPASS(d->ifsd_cl == NULL); > > - MPASS(d->ifsd_m == NULL); > > + MPASS(*sd_cl == NULL); > > + MPASS(*sd_m == NULL); > > } > > #if MEMORY_LOGGING > > fl->ifl_m_dequeued++; > > fl->ifl_cl_dequeued++; > > #endif > > - d->ifsd_cl = NULL; > > - d->ifsd_m = NULL; > > + *sd_cl = NULL; > > + *sd_m = NULL; > > } > > /* > > * Reset free list values > > @@ -1807,10 +1838,14 @@ iflib_rx_sds_free(iflib_rxq_t rxq) > > bus_dma_tag_destroy(fl->ifl_desc_tag); > > fl->ifl_desc_tag = NULL; > > } > > + free(fl->ifl_sds.ifsd_m, M_IFLIB); > > + free(fl->ifl_sds.ifsd_cl, M_IFLIB); > > + /* XXX destroy maps first */ > > + free(fl->ifl_sds.ifsd_map, M_IFLIB); > > + fl->ifl_sds.ifsd_m = NULL; > > + fl->ifl_sds.ifsd_cl = NULL; > > + fl->ifl_sds.ifsd_map = NULL; > > } > > - if (rxq->ifr_fl->ifl_sds != NULL) > > - free(rxq->ifr_fl->ifl_sds, M_IFLIB); > > - > > free(rxq->ifr_fl, M_IFLIB); > > rxq->ifr_fl = NULL; > > rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; > > @@ -1995,13 +2030,33 @@ iflib_stop(if_ctx_t ctx) > > } > > } > > > > -static iflib_rxsd_t > > -rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload > ) > > +static inline void > > +prefetch_pkts(iflib_fl_t fl, int cidx) > > +{ > > + int nextptr; > > + int nrxd = fl->ifl_size; > > + > > + nextptr = (cidx + CACHE_PTR_INCREMENT) & (nrxd-1); > > + prefetch(&fl->ifl_sds.ifsd_m[nextptr]); > > + prefetch(&fl->ifl_sds.ifsd_cl[nextptr]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 1) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 2) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 3) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 4) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 1) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 2) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 3) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]); > > +} > > + > > +static void > > +rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload > , > > iflib_fl_t *pfl, int *pcidx) > > { > > int flid, cidx; > > - iflib_rxsd_t sd; > > + bus_dmamap_t map; > > iflib_fl_t fl; > > iflib_dma_info_t di; > > + int next; > > > > flid = irf->irf_flid; > > cidx = irf->irf_idx; > > @@ -2012,16 +2067,22 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > > if (cltype) > > fl->ifl_cl_dequeued++; > > #endif > > - sd = &fl->ifl_sds[cidx]; > > - di = fl->ifl_ifdi; > > - bus_dmamap_sync(di->idi_tag, di->idi_map, > > - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > > + prefetch_pkts(fl, cidx); > > + if (fl->ifl_sds.ifsd_map != NULL) { > > + next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); > > + prefetch(&fl->ifl_sds.ifsd_map[next]); > > + map = fl->ifl_sds.ifsd_map[cidx]; > > + di = fl->ifl_ifdi; > > + next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); > > + prefetch(&fl->ifl_sds.ifsd_flags[next]); > > + bus_dmamap_sync(di->idi_tag, di->idi_map, > > + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > > > > /* not valid assert if bxe really does SGE from non-contiguous elements > > */ > > - MPASS(fl->ifl_cidx == cidx); > > - if (unload) > > - bus_dmamap_unload(fl->ifl_desc_tag, sd->ifsd_map); > > - > > + MPASS(fl->ifl_cidx == cidx); > > + if (unload) > > + bus_dmamap_unload(fl->ifl_desc_tag, map); > > + } > > if (__predict_false(++fl->ifl_cidx == fl->ifl_size)) { > > fl->ifl_cidx = 0; > > fl->ifl_gen = 0; > > @@ -2029,35 +2090,38 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > > /* YES ick */ > > if (cltype) > > *cltype = fl->ifl_cltype; > > - return (sd); > > + *pfl = fl; > > + *pcidx = cidx; > > } > > > > static struct mbuf * > > assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) > > { > > int i, padlen , flags, cltype; > > - struct mbuf *m, *mh, *mt; > > - iflib_rxsd_t sd; > > - caddr_t cl; > > + struct mbuf *m, *mh, *mt, *sd_m; > > + iflib_fl_t fl; > > + int cidx; > > + caddr_t cl, sd_cl; > > > > i = 0; > > mh = NULL; > > do { > > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE); > > + rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE, &fl, &cid > > x); > > + sd_m = fl->ifl_sds.ifsd_m[cidx]; > > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > > > > - MPASS(sd->ifsd_cl != NULL); > > - MPASS(sd->ifsd_m != NULL); > > + MPASS(sd_cl != NULL); > > + MPASS(sd_m != NULL); > > > > /* Don't include zero-length frags */ > > if (ri->iri_frags[i].irf_len == 0) { > > /* XXX we can save the cluster here, but not the mbuf * > > / > > - m_init(sd->ifsd_m, M_NOWAIT, MT_DATA, 0); > > - m_free(sd->ifsd_m); > > - sd->ifsd_m = NULL; > > + m_init(sd_m, M_NOWAIT, MT_DATA, 0); > > + m_free(sd_m); > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > continue; > > } > > - > > - m = sd->ifsd_m; > > + m = sd_m; > > if (mh == NULL) { > > flags = M_PKTHDR|M_EXT; > > mh = mt = m; > > @@ -2069,9 +2133,9 @@ assemble_segments(iflib_rxq_t rxq, if_rx > > /* assuming padding is only on the first fragment */ > > padlen = 0; > > } > > - sd->ifsd_m = NULL; > > - cl = sd->ifsd_cl; > > - sd->ifsd_cl = NULL; > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > + cl = fl->ifl_sds.ifsd_cl[cidx]; > > + fl->ifl_sds.ifsd_cl[cidx] = NULL; > > > > /* Can these two be made one ? */ > > m_init(m, M_NOWAIT, MT_DATA, flags); > > @@ -2094,16 +2158,19 @@ static struct mbuf * > > iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) > > { > > struct mbuf *m; > > - iflib_rxsd_t sd; > > + iflib_fl_t fl; > > + caddr_t sd_cl; > > + int cidx; > > > > /* should I merge this back in now that the two paths are basically dup > > licated? */ > > if (ri->iri_nfrags == 1 && > > ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { > > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE); > > - m = sd->ifsd_m; > > - sd->ifsd_m = NULL; > > + rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE, &fl, &cidx) > > ; > > + m = fl->ifl_sds.ifsd_m[cidx]; > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > > m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR); > > - memcpy(m->m_data, sd->ifsd_cl, ri->iri_len); > > + memcpy(m->m_data, sd_cl, ri->iri_len); > > m->m_len = ri->iri_frags[0].irf_len; > > } else { > > m = assemble_segments(rxq, ri); > > > > Modified: head/sys/net/iflib.h > > =========================================================================== > == > > = > > --- head/sys/net/iflib.h Fri Jan 27 23:03:28 2017 (r312904) > > +++ head/sys/net/iflib.h Fri Jan 27 23:08:06 2017 (r312905) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2014-2015, Matthew Macy (mmacy@nextbsd.org) > > + * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org) > > Really? Just a copyright notice? > > The reason I ask is because of this: > > ===> ae (all) > --- iflib.o --- > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1561:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1587:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1714:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1730:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1777:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1830:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1861:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1902:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1962:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1975:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1986:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2035:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2054:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2099:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2159:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2191:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2315:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2333:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error: > function definition is not allowed here > { > ^ > fatal error: too many errors emitted, stopping now [-ferror-limit=] Please ignore the SPAM. This may be related to -DNO_CLEAN. I've deleted everything and have started from scratch. Sorry for the noise. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 28 07: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 C07B8CC5C6D; Sat, 28 Jan 2017 07:53:41 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id B1AAF1FB1; Sat, 28 Jan 2017 07:53:41 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id ADF9217559; Fri, 27 Jan 2017 23:53:36 -0800 (PST) Date: Fri, 27 Jan 2017 23:53:36 -0800 From: hiren panchasara To: Cy Schubert Cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net Message-ID: <20170128075336.GF84308@strugglingcoder.info> References: <201701272308.v0RN86Fx040955@repo.freebsd.org> <201701280719.v0S7JnMF087437@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yH1ZJFh+qWm+VodA" Content-Disposition: inline In-Reply-To: <201701280719.v0S7JnMF087437@slippy.cwsent.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 07:53:41 -0000 --yH1ZJFh+qWm+VodA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 01/27/17 at 11:19P, Cy Schubert wrote: > Really? Just a copyright notice? >=20 > The reason I ask is because of this: >=20 > =3D=3D=3D> ae (all) > --- iflib.o --- > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1561:1: error:=20 > function definition is not allowed here > { > Should these 2 lines be swapped? https://svnweb.freebsd.org/base/head/sys/net/iflib.c?annotate=3D312905#l1539 https://svnweb.freebsd.org/base/head/sys/net/iflib.c?annotate=3D312905#l1540 seems like #if #endif block has an extra '}'?=20 Cheers, Hiren --yH1ZJFh+qWm+VodA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYjE39XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lrDcH/jkxTUDSBxOX1cfL7mkNuEKL 2kzfUE1xcx6qiEpj0G7byQYvvpyOfZ5w76WZT6OW0PsP0Ftd9MhvJnMH5EGfzQ83 squMhfF0xKHNYZi4CB7VP1xcp24heTWkocF98i4umDTDBTO3KSKTU18XU1pV0XGU XzDF3GZ9kFIURJCNwN7TmBAoLOpxLr0Y0NxBLqGqjrKdnNGauKdERYxfwd4bpG91 4WZNU7pRVdrTCpLWmzv6H1rWjPkjO7BZBOaz/kIOvgorrRSm4oHr2U3wU8ifmnpO UjNuf/3AA1NUnn6suC6M0v6uuhgT/FejOS3EwDPIfONfQpQWG6PnGX07yaoiBpM= =BM3f -----END PGP SIGNATURE----- --yH1ZJFh+qWm+VodA-- From owner-svn-src-all@freebsd.org Sat Jan 28 09: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 2F894CC58B3; Sat, 28 Jan 2017 09:58:02 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D897A1B7D; Sat, 28 Jan 2017 09:58:01 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0S9w07W004831; Sat, 28 Jan 2017 09:58:00 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0S9w0ja004827; Sat, 28 Jan 2017 09:58:00 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201701280958.v0S9w0ja004827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sat, 28 Jan 2017 09:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312917 - in head: share/man/man4 share/man/man4/man4.i386 sys/dev/pci sys/modules/ata/atacbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 09:58:02 -0000 Author: nyan Date: Sat Jan 28 09:58:00 2017 New Revision: 312917 URL: https://svnweb.freebsd.org/changeset/base/312917 Log: Remove more pc98 support. Deleted: head/sys/modules/ata/atacbus/ Modified: head/share/man/man4/ed.4 head/share/man/man4/le.4 head/share/man/man4/man4.i386/ep.4 head/sys/dev/pci/isa_pci.c Modified: head/share/man/man4/ed.4 ============================================================================== --- head/share/man/man4/ed.4 Sat Jan 28 07:26:42 2017 (r312916) +++ head/share/man/man4/ed.4 Sat Jan 28 09:58:00 2017 (r312917) @@ -257,7 +257,7 @@ Winbond W89C940 Winbond W89C940F .El .Pp -C-Bus, ISA, PCI and PC Card devices are supported. +ISA, PCI and PC Card devices are supported. .Pp The .Nm Modified: head/share/man/man4/le.4 ============================================================================== --- head/share/man/man4/le.4 Sat Jan 28 07:26:42 2017 (r312916) +++ head/share/man/man4/le.4 Sat Jan 28 09:58:00 2017 (r312917) @@ -57,13 +57,6 @@ module at boot time, place the following if_le_load="YES" .Ed .Pp -For C-Bus non-PnP adapters, the port address and the IRQ number have to be -specified in -.Pa /boot/device.hints : -.Cd hint.le.0.at="isa" -.Cd hint.le.0.port="0x03d0" -.Cd hint.le.0.irq="6" -.Pp For ISA non-PnP adapters, the port address as well as the IRQ and the DRQ numbers have to be specified in .Pa /boot/device.hints : Modified: head/share/man/man4/man4.i386/ep.4 ============================================================================== --- head/share/man/man4/man4.i386/ep.4 Sat Jan 28 07:26:42 2017 (r312916) +++ head/share/man/man4/man4.i386/ep.4 Sat Jan 28 09:58:00 2017 (r312917) @@ -99,8 +99,6 @@ driver supports Ethernet adapters based .It 3Com 3C562/3C563 PCMCIA .It -3Com 3C569B-J-TPO, 3C569B-J-COMBO CBUS -.It 3Com 3C574, 3C574TX, 3C574-TX, 3CCFE574BT, 3CXFE574BT, 3C3FE574BT PCMCIA .It 3Com 3C579-TP, 3C579-BNC EISA Modified: head/sys/dev/pci/isa_pci.c ============================================================================== --- head/sys/dev/pci/isa_pci.c Sat Jan 28 07:26:42 2017 (r312916) +++ head/sys/dev/pci/isa_pci.c Sat Jan 28 09:58:00 2017 (r312917) @@ -136,9 +136,6 @@ isab_pci_probe(device_t dev) case 0x00001078: /* Cyrix Cx5510 */ case 0x01001078: /* Cyrix Cx5530 */ case 0xc7001045: /* OPTi 82C700 (FireStar) */ - case 0x00011033: /* NEC 0001 (C-bus) */ - case 0x002c1033: /* NEC 002C (C-bus) */ - case 0x003b1033: /* NEC 003B (C-bus) */ case 0x886a1060: /* UMC UM8886 ISA */ case 0x02001166: /* ServerWorks IB6566 PCI */ if (bootverbose) From owner-svn-src-all@freebsd.org Sat Jan 28 11:38: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 C5760CC5693; Sat, 28 Jan 2017 11:38:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95024F51; Sat, 28 Jan 2017 11:38:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SBcph4046068; Sat, 28 Jan 2017 11:38:51 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SBcp8s046067; Sat, 28 Jan 2017 11:38:51 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201701281138.v0SBcp8s046067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sat, 28 Jan 2017 11:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312918 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 11:38:52 -0000 Author: rwatson Date: Sat Jan 28 11:38:51 2017 New Revision: 312918 URL: https://svnweb.freebsd.org/changeset/base/312918 Log: As with GENERIC on other architectures, include COMPAT_FREEBSD10 and COMPAT_FREEBSD11 in the generic BERI kernel configuration template. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/mips/conf/BERI_TEMPLATE Modified: head/sys/mips/conf/BERI_TEMPLATE ============================================================================== --- head/sys/mips/conf/BERI_TEMPLATE Sat Jan 28 09:58:00 2017 (r312917) +++ head/sys/mips/conf/BERI_TEMPLATE Sat Jan 28 11:38:51 2017 (r312918) @@ -33,6 +33,9 @@ options KTRACE options CAPABILITY_MODE options CAPABILITIES +options COMPAT_FREEBSD10 +options COMPAT_FREEBSD11 + options SCHED_ULE options FFS #Berkeley Fast Filesystem From owner-svn-src-all@freebsd.org Sat Jan 28 12:26: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 B8B3BCC312E; Sat, 28 Jan 2017 12:26:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8841CDF6; Sat, 28 Jan 2017 12:26:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SCQMwK066158; Sat, 28 Jan 2017 12:26:22 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SCQMOG066157; Sat, 28 Jan 2017 12:26:22 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201701281226.v0SCQMOG066157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sat, 28 Jan 2017 12:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312919 - head/tests/sys/aio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 12:26:23 -0000 Author: rwatson Date: Sat Jan 28 12:26:22 2017 New Revision: 312919 URL: https://svnweb.freebsd.org/changeset/base/312919 Log: Fix build of aio_test on MIPS, where the compiler warns about the local variable 'err' shadowing the global function err(3). Which it does. Sponsored by: DARPA, AFRL Modified: head/tests/sys/aio/aio_test.c Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Sat Jan 28 11:38:51 2017 (r312918) +++ head/tests/sys/aio/aio_test.c Sat Jan 28 12:26:22 2017 (r312919) @@ -188,31 +188,31 @@ aio_context_init(struct aio_context *ac, static ssize_t poll(struct aiocb *aio) { - int err; + int error; - while ((err = aio_error(aio)) == EINPROGRESS && !aio_timedout) + while ((error = aio_error(aio)) == EINPROGRESS && !aio_timedout) usleep(25000); - switch (err) { + switch (error) { case EINPROGRESS: errno = EINTR; return (-1); case 0: return (aio_return(aio)); default: - return (err); + return (error); } } static ssize_t suspend(struct aiocb *aio) { const struct aiocb *const iocbs[] = {aio}; - int err; + int error; - err = aio_suspend(iocbs, 1, NULL); - if (err == 0) + error = aio_suspend(iocbs, 1, NULL); + if (error == 0) return (aio_return(aio)); else - return (err); + return (error); } static ssize_t From owner-svn-src-all@freebsd.org Sat Jan 28 12:43: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 0A028CC35A0; Sat, 28 Jan 2017 12:43:21 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCDC41564; Sat, 28 Jan 2017 12:43:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SChJYj074080; Sat, 28 Jan 2017 12:43:19 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SChJGs074078; Sat, 28 Jan 2017 12:43:19 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201701281243.v0SChJGs074078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sat, 28 Jan 2017 12:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312920 - head/sys/dev/altera/jtag_uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 12:43:21 -0000 Author: rwatson Date: Sat Jan 28 12:43:19 2017 New Revision: 312920 URL: https://svnweb.freebsd.org/changeset/base/312920 Log: Merge robustness improvements for the ALTERA JTAG UART driver from CheriBSD, which attempt to work around an inherent race in the UART's control-register design in detecting whether JTAG is currently, present, which will otherwise lead to moderately frequent output drops when running in polled rather than interrupt-driven operation. Now, these drops are quite infrequent. commit 9f33fddac9215e32781a4f016ba17eab804fb6d4 Author: Robert N. M. Watson Date: Thu Jul 16 17:34:12 2015 +0000 Add a new sysctl, hw.altera_jtag_uart.ac_poll_delay, which allows the (default 10ms) delay associated with a full JTAG UART buffer combined with a lack of a JTAG-present flag to be tuned. Setting this higher may cause some JTAG configurations to be more reliable when printing out low-level console output at a speed greater than the JTAG UART is willing to carry data. Or it may not. commit 73992ef7607738b2973736e409ccd644b30eadba Author: Robert N. M. Watson Date: Sun Jan 1 15:13:07 2017 +0000 Minor improvements to the Altera JTAG UART device driver: - Minor rework to the logic to detect JTAG presence in order to be a bit more resilient to inevitable races: increase the retry period from two seconds to four seconds for trying to find JTAG, and more agressively clear the miss counter if JTAG has been reconnected. Once JTAG has vanished, stop prodding the miss counter. - Do a bit of reworking of the output code to frob the control register less by checking whether write interrupts are enabled/disabled before changing their state. This should reduce the opportunity for races with JTAG discovery (which are inherent to the Altera hardware-software interface, but can at least be minimised). - Add statistics relating to interrupt enable/disable/JTAG discovery/etc. With these changes, polled-mode JTAG UART ttys appear substantially more robust. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c head/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c Modified: head/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c ============================================================================== --- head/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c Sat Jan 28 12:26:22 2017 (r312919) +++ head/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c Sat Jan 28 12:43:19 2017 (r312920) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,6 +50,9 @@ __FBSDID("$FreeBSD$"); devclass_t altera_jtag_uart_devclass; +static SYSCTL_NODE(_hw, OID_AUTO, altera_jtag_uart, CTLFLAG_RW, 0, + "Altera JTAG UART configuration knobs"); + /* * One-byte buffer as we can't check whether the UART is readable without * actually reading from it, synchronised by a spinlock; this lock also @@ -82,6 +86,11 @@ static cn_ungrab_t aju_cnungrab; * no AC bit set. */ #define ALTERA_JTAG_UART_AC_POLL_DELAY 10000 +static u_int altera_jtag_uart_ac_poll_delay = + ALTERA_JTAG_UART_AC_POLL_DELAY; +SYSCTL_UINT(_hw_altera_jtag_uart, OID_AUTO, ac_poll_delay, + CTLFLAG_RW, &altera_jtag_uart_ac_poll_delay, 0, + "Maximum delay waiting for JTAG present flag when buffer is full"); /* * I/O routines lifted from Deimos. This is not only MIPS-specific, but also @@ -220,10 +229,10 @@ aju_cons_write(char ch) * layer clearing of the bit doesn't trigger a TTY-layer * disconnection. * - * XXXRW: The polling delay may require tuning. - * * XXXRW: Notice the inherent race with hardware: in clearing the - * bit, we may race with hardware setting the same bit. + * bit, we may race with hardware setting the same bit. This can + * cause real-world reliability problems due to lost output on the + * console. */ v = aju_cons_control_read(); if (v & ALTERA_JTAG_UART_CONTROL_AC) { @@ -235,7 +244,7 @@ aju_cons_write(char ch) while ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) == 0) { if (!aju_cons_jtag_present) return; - DELAY(ALTERA_JTAG_UART_AC_POLL_DELAY); + DELAY(altera_jtag_uart_ac_poll_delay); v = aju_cons_control_read(); if (v & ALTERA_JTAG_UART_CONTROL_AC) { aju_cons_jtag_present = 1; Modified: head/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c ============================================================================== --- head/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c Sat Jan 28 12:26:22 2017 (r312919) +++ head/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c Sat Jan 28 12:43:19 2017 (r312920) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2012 Robert N. M. Watson + * Copyright (c) 2011-2012, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -40,10 +40,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include @@ -65,9 +67,9 @@ static struct ttydevsw aju_ttydevsw = { /* * When polling for the AC bit, the number of times we have to not see it - * before assuming JTAG has disappeared on us. By default, two seconds. + * before assuming JTAG has disappeared on us. By default, four seconds. */ -#define AJU_JTAG_MAXMISS 10 +#define AJU_JTAG_MAXMISS 20 /* * Polling intervals for input/output and JTAG connection events. @@ -76,6 +78,53 @@ static struct ttydevsw aju_ttydevsw = { #define AJU_AC_POLLINTERVAL (hz/5) /* + * Statistics on JTAG removal events when sending, for debugging purposes + * only. + */ +static u_int aju_jtag_vanished; +SYSCTL_UINT(_debug, OID_AUTO, aju_jtag_vanished, CTLFLAG_RW, + &aju_jtag_vanished, 0, "Number of times JTAG has vanished"); + +static u_int aju_jtag_appeared; +SYSCTL_UINT(_debug, OID_AUTO, aju_jtag_appeared, CTLFLAG_RW, + &aju_jtag_appeared, 0, "Number of times JTAG has appeared"); + +SYSCTL_INT(_debug, OID_AUTO, aju_cons_jtag_present, CTLFLAG_RW, + &aju_cons_jtag_present, 0, "JTAG console present flag"); + +SYSCTL_UINT(_debug, OID_AUTO, aju_cons_jtag_missed, CTLFLAG_RW, + &aju_cons_jtag_missed, 0, "JTAG console missed counter"); + +/* + * Interrupt-related statistics. + */ +static u_int aju_intr_readable_enabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_readable_enabled, CTLFLAG_RW, + &aju_intr_readable_enabled, 0, "Number of times read interrupt enabled"); + +static u_int aju_intr_writable_disabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_writable_disabled, CTLFLAG_RW, + &aju_intr_writable_disabled, 0, + "Number of times write interrupt disabled"); + +static u_int aju_intr_writable_enabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_writable_enabled, CTLFLAG_RW, + &aju_intr_writable_enabled, 0, + "Number of times write interrupt enabled"); + +static u_int aju_intr_disabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_disabled, CTLFLAG_RW, + &aju_intr_disabled, 0, "Number of times write interrupt disabled"); + +static u_int aju_intr_read_count; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_read_count, CTLFLAG_RW, + &aju_intr_read_count, 0, "Number of times read interrupt fired"); + +static u_int aju_intr_write_count; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_write_count, CTLFLAG_RW, + &aju_intr_write_count, 0, "Number of times write interrupt fired"); + +/* * Low-level read and write register routines; the Altera UART is little * endian, so we byte swap 32-bit reads and writes. */ @@ -160,6 +209,7 @@ aju_intr_readable_enable(struct altera_j AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_readable_enabled, 1); v = aju_control_read(sc); v |= ALTERA_JTAG_UART_CONTROL_RE; aju_control_write(sc, v); @@ -172,6 +222,7 @@ aju_intr_writable_enable(struct altera_j AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_writable_enabled, 1); v = aju_control_read(sc); v |= ALTERA_JTAG_UART_CONTROL_WE; aju_control_write(sc, v); @@ -184,6 +235,7 @@ aju_intr_writable_disable(struct altera_ AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_writable_disabled, 1); v = aju_control_read(sc); v &= ~ALTERA_JTAG_UART_CONTROL_WE; aju_control_write(sc, v); @@ -196,6 +248,7 @@ aju_intr_disable(struct altera_jtag_uart AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_disabled, 1); v = aju_control_read(sc); v &= ~(ALTERA_JTAG_UART_CONTROL_RE | ALTERA_JTAG_UART_CONTROL_WE); aju_control_write(sc, v); @@ -249,30 +302,7 @@ aju_handle_output(struct altera_jtag_uar AJU_UNLOCK(sc); while (ttydisc_getc_poll(tp) != 0) { AJU_LOCK(sc); - v = aju_control_read(sc); - if ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) != 0) { - AJU_UNLOCK(sc); - if (ttydisc_getc(tp, &ch, sizeof(ch)) != sizeof(ch)) - panic("%s: ttydisc_getc", __func__); - AJU_LOCK(sc); - - /* - * XXXRW: There is a slight race here in which we test - * for writability, drop the lock, get the character - * from the tty layer, re-acquire the lock, and then - * write. It's possible for other code -- - * specifically, the low-level console -- to have - * written in the mean time, which might mean that - * there is no longer space. The BERI memory bus will - * cause this write to block, wedging the processor - * until space is available -- which could be a while - * if JTAG is not attached! - * - * The 'easy' fix is to drop the character if WSPACE - * has become unset. Not sure what the 'hard' fix is. - */ - aju_data_write(sc, ch); - } else { + if (*sc->ajus_jtag_presentp == 0) { /* * If JTAG is not present, then we will drop this * character instead of perhaps scheduling an @@ -281,21 +311,50 @@ aju_handle_output(struct altera_jtag_uar * later even though we aren't interested in sending * anymore. Loop to drain TTY-layer buffer. */ - if (*sc->ajus_jtag_presentp == 0) { - if (ttydisc_getc(tp, &ch, sizeof(ch)) != - sizeof(ch)) - panic("%s: ttydisc_getc 2", __func__); - AJU_UNLOCK(sc); - continue; - } - if (sc->ajus_irq_res != NULL) + AJU_UNLOCK(sc); + if (ttydisc_getc(tp, &ch, sizeof(ch)) != + sizeof(ch)) + panic("%s: ttydisc_getc", __func__); + continue; + } + v = aju_control_read(sc); + if ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) == 0) { + if (sc->ajus_irq_res != NULL && + (v & ALTERA_JTAG_UART_CONTROL_WE) == 0) aju_intr_writable_enable(sc); return; } AJU_UNLOCK(sc); + if (ttydisc_getc(tp, &ch, sizeof(ch)) != sizeof(ch)) + panic("%s: ttydisc_getc 2", __func__); + AJU_LOCK(sc); + + /* + * XXXRW: There is a slight race here in which we test for + * writability, drop the lock, get the character from the tty + * layer, re-acquire the lock, and then write. It's possible + * for other code -- specifically, the low-level console -- to + * have* written in the mean time, which might mean that there + * is no longer space. The BERI memory bus will cause this + * write to block, wedging the processor until space is + * available -- which could be a while if JTAG is not + * attached! + * + * The 'easy' fix is to drop the character if WSPACE has + * become unset. Not sure what the 'hard' fix is. + */ + aju_data_write(sc, ch); + AJU_UNLOCK(sc); } AJU_LOCK(sc); - aju_intr_writable_disable(sc); + + /* + * If interrupts are configured, and there's no data to write, but we + * had previously enabled write interrupts, disable them now. + */ + v = aju_control_read(sc); + if (sc->ajus_irq_res != NULL && (v & ALTERA_JTAG_UART_CONTROL_WE) != 0) + aju_intr_writable_disable(sc); } static void @@ -355,16 +414,25 @@ aju_ac_callout(void *arg) v &= ~ALTERA_JTAG_UART_CONTROL_AC; aju_control_write(sc, v); if (*sc->ajus_jtag_presentp == 0) { - *sc->ajus_jtag_missedp = 0; *sc->ajus_jtag_presentp = 1; + atomic_add_int(&aju_jtag_appeared, 1); aju_handle_output(sc, tp); } + + /* Any hit eliminates all recent misses. */ + *sc->ajus_jtag_missedp = 0; } else if (*sc->ajus_jtag_presentp != 0) { - (*sc->ajus_jtag_missedp)++; - if (*sc->ajus_jtag_missedp >= AJU_JTAG_MAXMISS) { + /* + * If we've exceeded our tolerance for misses, mark JTAG as + * disconnected and drain output. Otherwise, bump the miss + * counter. + */ + if (*sc->ajus_jtag_missedp > AJU_JTAG_MAXMISS) { *sc->ajus_jtag_presentp = 0; + atomic_add_int(&aju_jtag_vanished, 1); aju_handle_output(sc, tp); - } + } else + (*sc->ajus_jtag_missedp)++; } callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL, aju_ac_callout, sc); @@ -382,10 +450,14 @@ aju_intr(void *arg) tty_lock(tp); AJU_LOCK(sc); v = aju_control_read(sc); - if (v & ALTERA_JTAG_UART_CONTROL_RI) + if (v & ALTERA_JTAG_UART_CONTROL_RI) { + atomic_add_int(&aju_intr_read_count, 1); aju_handle_input(sc, tp); - if (v & ALTERA_JTAG_UART_CONTROL_WI) + } + if (v & ALTERA_JTAG_UART_CONTROL_WI) { + atomic_add_int(&aju_intr_write_count, 1); aju_handle_output(sc, tp); + } AJU_UNLOCK(sc); tty_unlock(tp); } From owner-svn-src-all@freebsd.org Sat Jan 28 13:09: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 5DEF7CC3C6B; Sat, 28 Jan 2017 13:09:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27BAF1EF0; Sat, 28 Jan 2017 13:09:19 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SD9I8T082180; Sat, 28 Jan 2017 13:09:18 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SD9Ipk082179; Sat, 28 Jan 2017 13:09:18 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201701281309.v0SD9Ipk082179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 28 Jan 2017 13:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312921 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 13:09:19 -0000 Author: hrs Date: Sat Jan 28 13:09:18 2017 New Revision: 312921 URL: https://svnweb.freebsd.org/changeset/base/312921 Log: Fix a bug which caused not to create AF_LOCAL sockets when family is specified. Spotted by: Alex Deiter Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Jan 28 12:43:19 2017 (r312920) +++ head/usr.sbin/syslogd/syslogd.c Sat Jan 28 13:09:18 2017 (r312921) @@ -2908,7 +2908,8 @@ socksetup(struct peer *pe) /* Only AF_LOCAL in secure mode. */ continue; } - if (family != AF_UNSPEC && res->ai_family != family) + if (family != AF_UNSPEC && + res->ai_family != AF_LOCAL && res->ai_family != family) continue; s = socket(res->ai_family, res->ai_socktype, From owner-svn-src-all@freebsd.org Sat Jan 28 13:25: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 16FC6CC4382; Sat, 28 Jan 2017 13:25:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA10DBB9; Sat, 28 Jan 2017 13:25:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SDP7IE090177; Sat, 28 Jan 2017 13:25:07 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SDP6Yf090172; Sat, 28 Jan 2017 13:25:06 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201701281325.v0SDP6Yf090172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sat, 28 Jan 2017 13:25:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312922 - head/sys/dev/altera/avgen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 13:25:08 -0000 Author: rwatson Date: Sat Jan 28 13:25:06 2017 New Revision: 312922 URL: https://svnweb.freebsd.org/changeset/base/312922 Log: Merge enhancements to the ALTERA Avalon bus generic device attachment driver to support exposing a GEOM device, which can be used to mount Avalon-attached ROMs, reserved areas of DRAM, etc, as a filesystem: commit 9deb1e60eaaaf7a3687e48c58af5efd756f32ec6 Author: Robert N. M. Watson Date: Sat Mar 5 20:33:12 2016 +0000 Use format strings with make_dev(9) in avgen(4). commit 0bf2176c23e7425bfa042c08a24f8a25fe6d8885 Author: Robert N. M. Watson Date: Tue Mar 1 10:23:23 2016 +0000 Implement a new "geomio" configuration argument to altera_avgen(4), the generic I/O device we attach to various BERI peripherals. The new option requests that, instead of exposing the underlying device via a special device node in /dev, it instead be exposed via geom(4), allowing it to be used with filesystems. The current implementation does not allow a device to be exposed both for file/mmap and geom, so one of the two models must be selected when configuring it via FDT or device.hints. A typical use of the new option will be: sri-cambridge,geomio = "rw"; MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/dev/altera/avgen/altera_avgen.c head/sys/dev/altera/avgen/altera_avgen.h head/sys/dev/altera/avgen/altera_avgen_fdt.c head/sys/dev/altera/avgen/altera_avgen_nexus.c Modified: head/sys/dev/altera/avgen/altera_avgen.c ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen.c Sat Jan 28 13:09:18 2017 (r312921) +++ head/sys/dev/altera/avgen/altera_avgen.c Sat Jan 28 13:25:06 2017 (r312922) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -45,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -65,14 +68,19 @@ static d_mmap_t altera_avgen_mmap; static d_read_t altera_avgen_read; static d_write_t altera_avgen_write; +#define ALTERA_AVGEN_DEVNAME "altera_avgen" +#define ALTERA_AVGEN_DEVNAME_FMT (ALTERA_AVGEN_DEVNAME "%d") + static struct cdevsw avg_cdevsw = { .d_version = D_VERSION, .d_mmap = altera_avgen_mmap, .d_read = altera_avgen_read, .d_write = altera_avgen_write, - .d_name = "altera_avgen", + .d_name = ALTERA_AVGEN_DEVNAME, }; +#define ALTERA_AVGEN_SECTORSIZE 512 /* Not configurable at this time. */ + static int altera_avgen_read(struct cdev *dev, struct uio *uio, int flag) { @@ -227,11 +235,103 @@ altera_avgen_mmap(struct cdev *dev, vm_o return (0); } +/* + * NB: We serialise block reads and writes in case the OS is generating + * concurrent I/O against the same block, in which case we want one I/O (or + * another) to win. This is not sufficient to provide atomicity for the + * sector in the presence of a fail stop -- however, we're just writing this + * to non-persistent DRAM .. right? + */ +static void +altera_avgen_disk_strategy(struct bio *bp) +{ + struct altera_avgen_softc *sc; + void *data; + long bcount; + daddr_t pblkno; + + sc = bp->bio_disk->d_drv1; + data = bp->bio_data; + bcount = bp->bio_bcount; + pblkno = bp->bio_pblkno; + + /* + * Serialize block reads / writes. + */ + mtx_lock(&sc->avg_disk_mtx); + switch (bp->bio_cmd) { + case BIO_READ: + if (!(sc->avg_flags & ALTERA_AVALON_FLAG_GEOM_READ)) { + biofinish(bp, NULL, EIO); + break; + } + switch (sc->avg_width) { + case 1: + bus_read_region_1(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint8_t *)data, bcount); + break; + + case 2: + bus_read_region_2(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint16_t *)data, bcount / 2); + break; + + case 4: + bus_read_region_4(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint32_t *)data, bcount / 4); + break; + + default: + panic("%s: unexpected width %u", __func__, + sc->avg_width); + } + break; + + case BIO_WRITE: + if (!(sc->avg_flags & ALTERA_AVALON_FLAG_GEOM_WRITE)) { + biofinish(bp, NULL, EROFS); + break; + } + switch (sc->avg_width) { + case 1: + bus_write_region_1(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint8_t *)data, bcount); + break; + + case 2: + bus_write_region_2(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint16_t *)data, bcount / 2); + break; + + case 4: + bus_write_region_4(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint32_t *)data, bcount / 4); + break; + + default: + panic("%s: unexpected width %u", __func__, + sc->avg_width); + } + break; + + default: + panic("%s: unsupported I/O operation %d", __func__, + bp->bio_cmd); + } + mtx_unlock(&sc->avg_disk_mtx); + biofinish(bp, NULL, 0); +} static int altera_avgen_process_options(struct altera_avgen_softc *sc, - const char *str_fileio, const char *str_mmapio, const char *str_devname, - int devunit) + const char *str_fileio, const char *str_geomio, const char *str_mmapio, + const char *str_devname, int devunit) { const char *cp; device_t dev = sc->avg_dev; @@ -239,12 +339,30 @@ altera_avgen_process_options(struct alte /* * Check for valid combinations of options. */ - if (str_fileio == NULL && str_mmapio == NULL) { + if (str_fileio == NULL && str_geomio == NULL && str_mmapio == NULL) { + device_printf(dev, + "at least one of %s, %s, or %s must be specified\n", + ALTERA_AVALON_STR_FILEIO, ALTERA_AVALON_STR_GEOMIO, + ALTERA_AVALON_STR_MMAPIO); + return (ENXIO); + } + + /* + * Validity check: a device can either be a GEOM device (in which case + * we use GEOM to register the device node), or a special device -- + * but not both as that causes a collision in /dev. + */ + if (str_geomio != NULL && (str_fileio != NULL || str_mmapio != NULL)) { device_printf(dev, - "at least one of %s or %s must be specified\n", - ALTERA_AVALON_STR_FILEIO, ALTERA_AVALON_STR_MMAPIO); + "at most one of %s and (%s or %s) may be specified\n", + ALTERA_AVALON_STR_GEOMIO, ALTERA_AVALON_STR_FILEIO, + ALTERA_AVALON_STR_MMAPIO); return (ENXIO); } + + /* + * Ensure that a unit is specified if a name is also specified. + */ if (str_devname == NULL && devunit != -1) { device_printf(dev, "%s requires %s be specified\n", ALTERA_AVALON_STR_DEVUNIT, ALTERA_AVALON_STR_DEVNAME); @@ -288,6 +406,25 @@ altera_avgen_process_options(struct alte } } } + if (str_geomio != NULL) { + for (cp = str_geomio; *cp != '\0'; cp++){ + switch (*cp) { + case ALTERA_AVALON_CHAR_READ: + sc->avg_flags |= ALTERA_AVALON_FLAG_GEOM_READ; + break; + + case ALTERA_AVALON_CHAR_WRITE: + sc->avg_flags |= ALTERA_AVALON_FLAG_GEOM_WRITE; + break; + + default: + device_printf(dev, + "invalid %s character %c\n", + ALTERA_AVALON_STR_GEOMIO, *cp); + return (ENXIO); + } + } + } if (str_mmapio != NULL) { for (cp = str_mmapio; *cp != '\0'; cp++) { switch (*cp) { @@ -317,13 +454,14 @@ altera_avgen_process_options(struct alte int altera_avgen_attach(struct altera_avgen_softc *sc, const char *str_fileio, - const char *str_mmapio, const char *str_devname, int devunit) + const char *str_geomio, const char *str_mmapio, const char *str_devname, + int devunit) { device_t dev = sc->avg_dev; int error; - error = altera_avgen_process_options(sc, str_fileio, str_mmapio, - str_devname, devunit); + error = altera_avgen_process_options(sc, str_fileio, str_geomio, + str_mmapio, str_devname, devunit); if (error) return (error); @@ -339,23 +477,59 @@ altera_avgen_attach(struct altera_avgen_ } } - /* Device node allocation. */ - if (str_devname == NULL) { - str_devname = "altera_avgen%d"; + /* + * If a GEOM permission is requested, then create the device via GEOM. + * Otherwise, create a special device. We checked during options + * processing that both weren't requested a once. + */ + if (str_devname != NULL) { + sc->avg_name = strdup(str_devname, M_TEMP); devunit = sc->avg_unit; + } else + sc->avg_name = strdup(ALTERA_AVGEN_DEVNAME, M_TEMP); + if (sc->avg_flags & (ALTERA_AVALON_FLAG_GEOM_READ | + ALTERA_AVALON_FLAG_GEOM_WRITE)) { + mtx_init(&sc->avg_disk_mtx, "altera_avgen_disk", NULL, + MTX_DEF); + sc->avg_disk = disk_alloc(); + sc->avg_disk->d_drv1 = sc; + sc->avg_disk->d_strategy = altera_avgen_disk_strategy; + if (devunit == -1) + devunit = 0; + sc->avg_disk->d_name = sc->avg_name; + sc->avg_disk->d_unit = devunit; + + /* + * NB: As avg_res is a multiple of PAGE_SIZE, it is also a + * multiple of ALTERA_AVGEN_SECTORSIZE. + */ + sc->avg_disk->d_sectorsize = ALTERA_AVGEN_SECTORSIZE; + sc->avg_disk->d_mediasize = rman_get_size(sc->avg_res); + sc->avg_disk->d_maxsize = ALTERA_AVGEN_SECTORSIZE; + disk_create(sc->avg_disk, DISK_VERSION); + } else { + /* Device node allocation. */ + if (str_devname == NULL) { + str_devname = ALTERA_AVGEN_DEVNAME_FMT; + devunit = sc->avg_unit; + } + if (devunit != -1) + sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, + UID_ROOT, GID_WHEEL, S_IRUSR | S_IWUSR, "%s%d", + str_devname, devunit); + else + sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, + UID_ROOT, GID_WHEEL, S_IRUSR | S_IWUSR, + "%s", str_devname); + if (sc->avg_cdev == NULL) { + device_printf(sc->avg_dev, "%s: make_dev failed\n", + __func__); + return (ENXIO); + } + + /* XXXRW: Slight race between make_dev(9) and here. */ + sc->avg_cdev->si_drv1 = sc; } - if (devunit != -1) - sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, UID_ROOT, - GID_WHEEL, S_IRUSR | S_IWUSR, str_devname, devunit); - else - sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, UID_ROOT, - GID_WHEEL, S_IRUSR | S_IWUSR, str_devname); - if (sc->avg_cdev == NULL) { - device_printf(sc->avg_dev, "%s: make_dev failed\n", __func__); - return (ENXIO); - } - /* XXXRW: Slight race between make_dev(9) and here. */ - sc->avg_cdev->si_drv1 = sc; return (0); } @@ -363,5 +537,15 @@ void altera_avgen_detach(struct altera_avgen_softc *sc) { - destroy_dev(sc->avg_cdev); + KASSERT((sc->avg_disk != NULL) || (sc->avg_cdev != NULL), + ("%s: neither GEOM nor special device", __func__)); + + if (sc->avg_disk != NULL) { + disk_gone(sc->avg_disk); + disk_destroy(sc->avg_disk); + free(sc->avg_name, M_TEMP); + mtx_destroy(&sc->avg_disk_mtx); + } else { + destroy_dev(sc->avg_cdev); + } } Modified: head/sys/dev/altera/avgen/altera_avgen.h ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen.h Sat Jan 28 13:09:18 2017 (r312921) +++ head/sys/dev/altera/avgen/altera_avgen.h Sat Jan 28 13:25:06 2017 (r312922) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Robert N. M. Watson + * Copyright (c) 2012, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -39,6 +39,7 @@ struct altera_avgen_softc { */ device_t avg_dev; int avg_unit; + char *avg_name; /* * The device node and memory-mapped I/O region. @@ -52,6 +53,13 @@ struct altera_avgen_softc { */ u_int avg_flags; u_int avg_width; + u_int avg_sectorsize; + + /* + * disk(9) state, if required for this device. + */ + struct disk *avg_disk; + struct mtx avg_disk_mtx; }; /* @@ -63,6 +71,8 @@ struct altera_avgen_softc { #define ALTERA_AVALON_FLAG_MMAP_READ 0x04 #define ALTERA_AVALON_FLAG_MMAP_WRITE 0x08 #define ALTERA_AVALON_FLAG_MMAP_EXEC 0x10 +#define ALTERA_AVALON_FLAG_GEOM_READ 0x20 +#define ALTERA_AVALON_FLAG_GEOM_WRITE 0x40 #define ALTERA_AVALON_CHAR_READ 'r' #define ALTERA_AVALON_CHAR_WRITE 'w' @@ -70,6 +80,7 @@ struct altera_avgen_softc { #define ALTERA_AVALON_STR_WIDTH "width" #define ALTERA_AVALON_STR_FILEIO "fileio" +#define ALTERA_AVALON_STR_GEOMIO "geomio" #define ALTERA_AVALON_STR_MMAPIO "mmapio" #define ALTERA_AVALON_STR_DEVNAME "devname" #define ALTERA_AVALON_STR_DEVUNIT "devunit" @@ -78,8 +89,8 @@ struct altera_avgen_softc { * Driver setup routines from the bus attachment/teardown. */ int altera_avgen_attach(struct altera_avgen_softc *sc, - const char *str_fileio, const char *str_mmapio, - const char *str_devname, int devunit); + const char *str_fileio, const char *str_geomio, + const char *str_mmapio, const char *str_devname, int devunit); void altera_avgen_detach(struct altera_avgen_softc *sc); extern devclass_t altera_avgen_devclass; Modified: head/sys/dev/altera/avgen/altera_avgen_fdt.c ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen_fdt.c Sat Jan 28 13:09:18 2017 (r312921) +++ head/sys/dev/altera/avgen/altera_avgen_fdt.c Sat Jan 28 13:25:06 2017 (r312922) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -75,7 +75,7 @@ static int altera_avgen_fdt_attach(device_t dev) { struct altera_avgen_softc *sc; - char *str_fileio, *str_mmapio; + char *str_fileio, *str_geomio, *str_mmapio; char *str_devname; phandle_t node; pcell_t cell; @@ -90,6 +90,7 @@ altera_avgen_fdt_attach(device_t dev) * expose the device via /dev. */ str_fileio = NULL; + str_geomio = NULL; str_mmapio = NULL; str_devname = NULL; devunit = -1; @@ -99,6 +100,8 @@ altera_avgen_fdt_attach(device_t dev) sc->avg_width = cell; (void)OF_getprop_alloc(node, "sri-cambridge,fileio", sizeof(char), (void **)&str_fileio); + (void)OF_getprop_alloc(node, "sri-cambridge,geomio", sizeof(char), + (void **)&str_geomio); (void)OF_getprop_alloc(node, "sri-cambridge,mmapio", sizeof(char), (void **)&str_mmapio); (void)OF_getprop_alloc(node, "sri-cambridge,devname", sizeof(char), @@ -114,13 +117,15 @@ altera_avgen_fdt_attach(device_t dev) device_printf(dev, "couldn't map memory\n"); return (ENXIO); } - error = altera_avgen_attach(sc, str_fileio, str_mmapio, str_devname, - devunit); + error = altera_avgen_attach(sc, str_fileio, str_geomio, str_mmapio, + str_devname, devunit); if (error != 0) bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res); if (str_fileio != NULL) OF_prop_free(str_fileio); + if (str_geomio != NULL) + OF_prop_free(str_geomio); if (str_mmapio != NULL) OF_prop_free(str_mmapio); if (str_devname != NULL) Modified: head/sys/dev/altera/avgen/altera_avgen_nexus.c ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen_nexus.c Sat Jan 28 13:09:18 2017 (r312921) +++ head/sys/dev/altera/avgen/altera_avgen_nexus.c Sat Jan 28 13:25:06 2017 (r312922) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -64,7 +64,7 @@ static int altera_avgen_nexus_attach(device_t dev) { struct altera_avgen_softc *sc; - const char *str_fileio, *str_mmapio; + const char *str_fileio, *str_geomio, *str_mmapio; const char *str_devname; int devunit, error; @@ -77,6 +77,7 @@ altera_avgen_nexus_attach(device_t dev) * on the device, and whether it is cached. */ str_fileio = NULL; + str_geomio = NULL; str_mmapio = NULL; str_devname = NULL; devunit = -1; @@ -90,6 +91,8 @@ altera_avgen_nexus_attach(device_t dev) (void)resource_string_value(device_get_name(dev), device_get_unit(dev), ALTERA_AVALON_STR_FILEIO, &str_fileio); (void)resource_string_value(device_get_name(dev), + device_get_unit(dev), ALTERA_AVALON_STR_GEOMIO, &str_geomio); + (void)resource_string_value(device_get_name(dev), device_get_unit(dev), ALTERA_AVALON_STR_MMAPIO, &str_mmapio); (void)resource_string_value(device_get_name(dev), device_get_unit(dev), ALTERA_AVALON_STR_DEVNAME, &str_devname); @@ -104,8 +107,8 @@ altera_avgen_nexus_attach(device_t dev) device_printf(dev, "couldn't map memory\n"); return (ENXIO); } - error = altera_avgen_attach(sc, str_fileio, str_mmapio, str_devname, - devunit); + error = altera_avgen_attach(sc, str_fileio, str_geomio, str_mmapio, + str_devname, devunit); if (error != 0) bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res); From owner-svn-src-all@freebsd.org Sat Jan 28 13:25: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 AB913CC43DB; Sat, 28 Jan 2017 13:25:36 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BD92D17; Sat, 28 Jan 2017 13:25:36 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-228-247.lns20.per1.internode.on.net [121.45.228.247]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v0SDPOqJ094549 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 28 Jan 2017 05:25:27 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r312871 - stable/11/share/zoneinfo To: "Rodney W. Grimes" References: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Julian Elischer Message-ID: <722a5ab1-f997-fa44-4f67-91430673622d@freebsd.org> Date: Sat, 28 Jan 2017 21:25:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <201701271525.v0RFPmVq025332@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 13:25:36 -0000 Hi Rod, On 27/1/17 11:25 pm, Rodney W. Grimes wrote: >> Author: julian >> Date: Fri Jan 27 09:11:44 2017 >> New Revision: 312871 >> URL: https://svnweb.freebsd.org/changeset/base/312871 >> >> Log: >> MFH: r308671 >> >> When you select make OLDTIMEZONES=1 then you need a few added directories >> to be made or the command fails >> >> Sponsored by: panzura >> >> MFH: r310426 >> >> If you are going to be run individually to make a new timezone set >> then ensure the destination directories exist. >> Especially if you define OLDTIMEZONES because the mtree pass >> doesn't do it for you. > Perhaps it is time to start pre-processing mtree files so this > would no longer be the case? A much bigger question than I can handle at this time.. :-) > >> Sponsored by: Panzura >> >> Modified: >> stable/11/share/zoneinfo/Makefile >> Directory Properties: >> stable/11/ (props changed) >> >> Modified: stable/11/share/zoneinfo/Makefile >> ============================================================================== >> --- stable/11/share/zoneinfo/Makefile Fri Jan 27 09:07:11 2017 (r312870) >> +++ stable/11/share/zoneinfo/Makefile Fri Jan 27 09:11:44 2017 (r312871) >> @@ -67,6 +67,10 @@ TZBUILDSUBDIRS= \ >> Pacific \ >> SystemV >> >> +.if defined(OLDTIMEZONES) >> +TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil >> +.endif >> + >> .if !defined(_SKIP_BUILD) >> all: zoneinfo >> .endif >> @@ -81,6 +85,8 @@ zoneinfo: yearistype ${TDATA} >> >> beforeinstall: install-zoneinfo >> install-zoneinfo: >> + mkdir -p ${DESTDIR}/usr/share/zoneinfo >> + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} > This has the failure mode that your current uid and umask, etc are > used in creating the directories. Please add appropriate chown/chmod > commands to reflect what mtree would of done had it done this. This is mostly because it failed when run as an individual operation to update zoninfo files. which would probably be done as root, or someone who wants the files owned by them. You can't write here unless you are root, so I'm not sure what the right thing to do would be. and chown doesn't work if you are not root, so what would you suggest? (what is needed for the offline permissions tool)? should we assume ${DESTDIR}/usr/share exists already? the following might be a very slight improvement, but ... mkdir -p -m 755 ${DESTDIR}/usr/share mkdir -p -m 755 ${DESTDIR}/usr/share/zoneinfo cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p -m 755 ${TZBUILDSUBDIRS} -cd ${DESTDIR}/usr/share/zoneinfo; chown -R ${BINOWN}:${BINGRP} . < would fail if you are not root. >> cd ${TZBUILDDIR} && \ >> find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ >> -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ >> _______________________________________________ >> svn-src-stable-11@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 >> To unsubscribe, send any mail to "svn-src-stable-11-unsubscribe@freebsd.org" >> From owner-svn-src-all@freebsd.org Sat Jan 28 15:26: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 E8997CC41FE; Sat, 28 Jan 2017 15:26:20 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 88EDD33E; Sat, 28 Jan 2017 15:26:19 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id XUtHcKFbOC3JIXUtIcZYIq; Sat, 28 Jan 2017 08:26:13 -0700 X-Authority-Analysis: v=2.2 cv=XbT59Mx5 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=6I5d2MoRAAAA:8 a=72mLzN8eAAAA:8 a=YxBL1-UpAAAA:8 a=-oEIcx5AVUFLjKJhEQwA:9 a=Mcm_EvF5RGMneZTp:21 a=o1xm4dKvSUkbT5Ct:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=-7La2cLJWLV_9KNFy1_x:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 7EAE71C15; Sat, 28 Jan 2017 07:26:11 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0SFQAmv018310; Sat, 28 Jan 2017 07:26:10 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701281526.v0SFQAmv018310@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Sean Bruno cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net In-Reply-To: Message from Cy Schubert of "Fri, 27 Jan 2017 23:19:49 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 28 Jan 2017 07:26:10 -0800 X-CMAE-Envelope: MS4wfMXrww5KFShvo6RKY89DPQiY3HeEucMGf70TcC7Pj0MmBbhvpVrij5/2fXAS4/QDx9U4eQf+JsB95xl241H1ivjI9Ad6HHbnl7EmAh87r5AGbON3+koW xIZBa7j3k+0DyCE+TeXvTTcjQgCbHriuAGUjXrhqeE/3BXeDuy00VUfmgxgN1T87moY9DZNboA+qLwkEF04/tes/qhQemwnKk1/EIdixGT4UGjAkOctctPey r6T+qKLb6AapyuPLYXhSkGBZsiuvrvKpAxVbnCYngiHSB6Ns68W5JtG16evvVSMB X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 15:26:21 -0000 Cy Schubert writes: > In message <201701272308.v0RN86Fx040955@repo.freebsd.org>, Sean Bruno > writes: > > Author: sbruno > > Date: Fri Jan 27 23:08:06 2017 > > New Revision: 312905 > > URL: https://svnweb.freebsd.org/changeset/base/312905 > > > > Log: > > IFLIB updates: > > We found routing performance dropped significantly when configuring > > FreeBSD as a router, we are applying the following changes in order to > > resolve those issues and hopefully perform better. > > - don't prefetch the flags array, we usually don't need it > > - prefetch the next cache line of each of the software descriptor arrays > a > > s > > well as the first cache line of each of the next four packets' mbufs a > nd > > clusters > > - reduce max copy size to 63 bytes > > - convert rx soft descriptors from array of structures to a structure of > a > > rrays > > - update copyrights > > > > Submitted by: Matt Macy > > > > Modified: > > head/sys/net/iflib.c > > head/sys/net/iflib.h > > > > Modified: head/sys/net/iflib.c > > =========================================================================== > == > > = > > --- head/sys/net/iflib.c Fri Jan 27 23:03:28 2017 (r312904) > > +++ head/sys/net/iflib.c Fri Jan 27 23:08:06 2017 (r312905) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2014-2016, Matthew Macy > > + * Copyright (c) 2014-2017, Matthew Macy > > * All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > @@ -264,18 +264,12 @@ iflib_get_sctx(if_ctx_t ctx) > > #define RX_SW_DESC_INUSE (1 << 3) > > #define TX_SW_DESC_MAPPED (1 << 4) > > > > -typedef struct iflib_sw_rx_desc { > > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > > - struct mbuf *ifsd_m; /* rx: uninitialized mbuf */ > > - caddr_t ifsd_cl; /* direct cluster pointer for rx */ > > - uint16_t ifsd_flags; > > -} *iflib_rxsd_t; > > - > > -typedef struct iflib_sw_tx_desc_val { > > - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ > > - struct mbuf *ifsd_m; /* pkthdr mbuf */ > > - uint8_t ifsd_flags; > > -} *iflib_txsd_val_t; > > +typedef struct iflib_sw_rx_desc_array { > > + bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > > + struct mbuf **ifsd_m; /* pkthdr mbufs */ > > + caddr_t *ifsd_cl; /* direct cluster pointer for rx */ > > + uint8_t *ifsd_flags; > > +} iflib_rxsd_array_t; > > > > typedef struct iflib_sw_tx_desc_array { > > bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ > > @@ -287,7 +281,7 @@ typedef struct iflib_sw_tx_desc_array { > > /* magic number that should be high enough for any hardware */ > > #define IFLIB_MAX_TX_SEGS 128 > > #define IFLIB_MAX_RX_SEGS 32 > > -#define IFLIB_RX_COPY_THRESH 128 > > +#define IFLIB_RX_COPY_THRESH 63 > > #define IFLIB_MAX_RX_REFRESH 32 > > #define IFLIB_QUEUE_IDLE 0 > > #define IFLIB_QUEUE_HUNG 1 > > @@ -383,7 +377,7 @@ struct iflib_fl { > > uint16_t ifl_buf_size; > > uint16_t ifl_cltype; > > uma_zone_t ifl_zone; > > - iflib_rxsd_t ifl_sds; > > + iflib_rxsd_array_t ifl_sds; > > iflib_rxq_t ifl_rxq; > > uint8_t ifl_id; > > bus_dma_tag_t ifl_desc_tag; > > @@ -909,7 +903,7 @@ iflib_netmap_rxsync(struct netmap_kring > > ring->slot[nm_i].len = ri.iri_len - crc > > len; > > ring->slot[nm_i].flags = slot_flags; > > bus_dmamap_sync(fl->ifl_ifdi->idi_tag, > > - fl->ifl_sds[nic > > _i].ifsd_map, BUS_DMASYNC_POSTREAD); > > + fl->ifl_sds.ifs > > d_map[nic_i], BUS_DMASYNC_POSTREAD); > > nm_i = nm_next(nm_i, lim); > > nic_i = nm_next(nic_i, lim); > > } > > @@ -949,14 +943,14 @@ iflib_netmap_rxsync(struct netmap_kring > > vaddr = addr; > > if (slot->flags & NS_BUF_CHANGED) { > > /* buffer has changed, reload map */ > > - netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > > ->ifl_sds[nic_i].ifsd_map, addr); > > + netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl > > ->ifl_sds.ifsd_map[nic_i], addr); > > slot->flags &= ~NS_BUF_CHANGED; > > } > > /* > > * XXX we should be batching this operation - TODO > > */ > > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, fl->if > > l_id, nic_i, &paddr, &vaddr, 1, fl->ifl_buf_size); > > - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_ > > i].ifsd_map, > > + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd > > _map[nic_i], > > BUS_DMASYNC_PREREAD); > > nm_i = nm_next(nm_i, lim); > > nic_i = nm_next(nic_i, lim); > > @@ -1030,22 +1024,22 @@ iflib_netmap_rxq_init(if_ctx_t ctx, ifli > > { > > struct netmap_adapter *na = NA(ctx->ifc_ifp); > > struct netmap_slot *slot; > > - iflib_rxsd_t sd; > > + bus_dmamap_t *map; > > int nrxd; > > > > slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); > > if (slot == 0) > > return; > > - sd = rxq->ifr_fl[0].ifl_sds; > > + map = rxq->ifr_fl[0].ifl_sds.ifsd_map; > > nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; > > - for (int i = 0; i < nrxd; i++, sd++) { > > + for (int i = 0; i < nrxd; i++, map++) { > > int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); > > uint64_t paddr; > > void *addr; > > caddr_t vaddr; > > > > vaddr = addr = PNMB(na, slot + sj, &paddr); > > - netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, s > > d->ifsd_map, addr); > > + netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, * > > map, addr); > > /* Update descriptor and the cached value */ > > ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, 0 /* f > > l_id */, i, &paddr, &vaddr, 1, rxq->ifr_fl[0].ifl_buf_size); > > } > > @@ -1476,7 +1470,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; > > device_t dev = ctx->ifc_dev; > > iflib_fl_t fl; > > - iflib_rxsd_t rxsd; > > int err; > > > > MPASS(scctx->isc_nrxd[0] > 0); > > @@ -1484,13 +1477,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > > > fl = rxq->ifr_fl; > > for (int i = 0; i < rxq->ifr_nfl; i++, fl++) { > > - fl->ifl_sds = malloc(sizeof(struct iflib_sw_rx_desc) * > > - scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, > > - M_WAITOK | M_ZERO); > > - if (fl->ifl_sds == NULL) { > > - device_printf(dev, "Unable to allocate rx sw desc memor > > y\n"); > > - return (ENOMEM); > > - } > > fl->ifl_size = scctx->isc_nrxd[rxq->ifr_fl_offset]; /* this isn > > 't necessarily the same */ > > err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ > > 1, 0, /* alignment, b > > ounds */ > > @@ -1509,17 +1495,49 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) > > __func__, err); > > goto fail; > > } > > + if (!(fl->ifl_sds.ifsd_flags = > > + (uint8_t *) malloc(sizeof(uint8_t) * > > + scctx->isc_nrxd[rxq->ifr_fl_offset], M > > _IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + if (!(fl->ifl_sds.ifsd_m = > > + (struct mbuf **) malloc(sizeof(struct mbuf *) * > > + scctx->isc_nrxd[rxq->ifr_fl_offse > > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + if (!(fl->ifl_sds.ifsd_cl = > > + (caddr_t *) malloc(sizeof(caddr_t) * > > + scctx->isc_nrxd[rxq->ifr_fl_offse > > t], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer memory > > \n"); > > + err = ENOMEM; > > + goto fail; > > + } > > > > - rxsd = fl->ifl_sds; > > - for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++, r > > xsd++) { > > - err = bus_dmamap_create(fl->ifl_desc_tag, 0, &rxsd->ifs > > d_map); > > - if (err) { > > - device_printf(dev, "%s: bus_dmamap_create faile > > d: %d\n", > > - __func__, err); > > + /* Create the descriptor buffer dma maps */ > > +#if defined(ACPI_DMAR) || (!(defined(__i386__) && !defined(__amd64__))) > > + if ((ctx->ifc_flags & IFC_DMAR) == 0) > > + continue; > > + > > + if (!(fl->ifl_sds.ifsd_map = > > + (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc > > _nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { > > + device_printf(dev, "Unable to allocate tx_buffer map me > > mory\n"); > > + err = ENOMEM; > > + goto fail; > > + } > > + > > + for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++) { > > + err = bus_dmamap_create(fl->ifl_desc_tag, 0, &fl->ifl_s > > ds.ifsd_map[i]); > > + if (err != 0) { > > + device_printf(dev, "Unable to create TX DMA map > > \n"); > > goto fail; > > } > > } > > } > > +#endif > > return (0); > > > > fail: > > @@ -1568,13 +1586,21 @@ static void > > _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) > > { > > struct mbuf *m; > > - int pidx = fl->ifl_pidx; > > - iflib_rxsd_t rxsd = &fl->ifl_sds[pidx]; > > - caddr_t cl; > > + int idx, pidx = fl->ifl_pidx; > > + caddr_t cl, *sd_cl; > > + struct mbuf **sd_m; > > + uint8_t *sd_flags; > > + bus_dmamap_t *sd_map; > > int n, i = 0; > > uint64_t bus_addr; > > int err; > > > > + sd_m = fl->ifl_sds.ifsd_m; > > + sd_map = fl->ifl_sds.ifsd_map; > > + sd_cl = fl->ifl_sds.ifsd_cl; > > + sd_flags = fl->ifl_sds.ifsd_flags; > > + idx = pidx; > > + > > n = count; > > MPASS(n > 0); > > MPASS(fl->ifl_credits + n <= fl->ifl_size); > > @@ -1597,8 +1623,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > * > > * If the cluster is still set then we know a minimum sized pac > > ket was received > > */ > > - if ((cl = rxsd->ifsd_cl) == NULL) { > > - if ((cl = rxsd->ifsd_cl = m_cljget(NULL, M_NOWAIT, fl-> > > ifl_buf_size)) == NULL) > > + if ((cl = sd_cl[idx]) == NULL) { > > + if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl > > _buf_size)) == NULL) > > break; > > #if MEMORY_LOGGING > > fl->ifl_cl_enqueued++; > > @@ -1613,16 +1639,16 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > > > DBG_COUNTER_INC(rx_allocs); > > #ifdef notyet > > - if ((rxsd->ifsd_flags & RX_SW_DESC_MAP_CREATED) == 0) { > > + if ((sd_flags[pidx] & RX_SW_DESC_MAP_CREATED) == 0) { > > int err; > > > > - if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > > &rxsd->ifsd_map))) { > > + if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, > > &sd_map[idx]))) { > > log(LOG_WARNING, "bus_dmamap_create failed %d\n > > ", err); > > uma_zfree(fl->ifl_zone, cl); > > n = 0; > > goto done; > > } > > - rxsd->ifsd_flags |= RX_SW_DESC_MAP_CREATED; > > + sd_flags[idx] |= RX_SW_DESC_MAP_CREATED; > > } > > #endif > > #if defined(__i386__) || defined(__amd64__) > > @@ -1636,7 +1662,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > > > cb_arg.error = 0; > > q = fl->ifl_rxq; > > - err = bus_dmamap_load(fl->ifl_desc_tag, rxsd->ifsd_map, > > + err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], > > cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); > > > > if (err != 0 || cb_arg.error) { > > @@ -1651,28 +1677,28 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_ > > } > > bus_addr = cb_arg.seg.ds_addr; > > } > > - rxsd->ifsd_flags |= RX_SW_DESC_INUSE; > > + sd_flags[idx] |= RX_SW_DESC_INUSE; > > > > - MPASS(rxsd->ifsd_m == NULL); > > - rxsd->ifsd_cl = cl; > > - rxsd->ifsd_m = m; > > + MPASS(sd_m[idx] == NULL); > > + sd_cl[idx] = cl; > > + sd_m[idx] = m; > > fl->ifl_bus_addrs[i] = bus_addr; > > fl->ifl_vm_addrs[i] = cl; > > - rxsd++; > > fl->ifl_credits++; > > i++; > > MPASS(fl->ifl_credits <= fl->ifl_size); > > - if (++fl->ifl_pidx == fl->ifl_size) { > > - fl->ifl_pidx = 0; > > + if (++idx == fl->ifl_size) { > > fl->ifl_gen = 1; > > - rxsd = fl->ifl_sds; > > + idx = 0; > > } > > if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { > > ctx->isc_rxd_refill(ctx->ifc_softc, fl->ifl_rxq->ifr_id > > , fl->ifl_id, pidx, > > fl->ifl_bus_ad > > drs, fl->ifl_vm_addrs, i, fl->ifl_buf_size); > > i = 0; > > - pidx = fl->ifl_pidx; > > + pidx = idx; > > } > > + fl->ifl_pidx = idx; > > + > > } > > done: > > DBG_COUNTER_INC(rxd_flush); > > @@ -1706,28 +1732,33 @@ iflib_fl_bufs_free(iflib_fl_t fl) > > uint32_t i; > > > > for (i = 0; i < fl->ifl_size; i++) { > > - iflib_rxsd_t d = &fl->ifl_sds[i]; > > - > > - if (d->ifsd_flags & RX_SW_DESC_INUSE) { > > - bus_dmamap_unload(fl->ifl_desc_tag, d->ifsd_map); > > - bus_dmamap_destroy(fl->ifl_desc_tag, d->ifsd_map); > > - if (d->ifsd_m != NULL) { > > - m_init(d->ifsd_m, M_NOWAIT, MT_DATA, 0); > > - uma_zfree(zone_mbuf, d->ifsd_m); > > + struct mbuf **sd_m = &fl->ifl_sds.ifsd_m[i]; > > + uint8_t *sd_flags = &fl->ifl_sds.ifsd_flags[i]; > > + caddr_t *sd_cl = &fl->ifl_sds.ifsd_cl[i]; > > + > > + if (*sd_flags & RX_SW_DESC_INUSE) { > > + if (fl->ifl_sds.ifsd_map != NULL) { > > + bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; > > + bus_dmamap_unload(fl->ifl_desc_tag, sd_map); > > + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); > > + } > > + if (*sd_m != NULL) { > > + m_init(*sd_m, M_NOWAIT, MT_DATA, 0); > > + uma_zfree(zone_mbuf, *sd_m); > > } > > - if (d->ifsd_cl != NULL) > > - uma_zfree(fl->ifl_zone, d->ifsd_cl); > > - d->ifsd_flags = 0; > > + if (*sd_cl != NULL) > > + uma_zfree(fl->ifl_zone, *sd_cl); > > + *sd_flags = 0; > > } else { > > - MPASS(d->ifsd_cl == NULL); > > - MPASS(d->ifsd_m == NULL); > > + MPASS(*sd_cl == NULL); > > + MPASS(*sd_m == NULL); > > } > > #if MEMORY_LOGGING > > fl->ifl_m_dequeued++; > > fl->ifl_cl_dequeued++; > > #endif > > - d->ifsd_cl = NULL; > > - d->ifsd_m = NULL; > > + *sd_cl = NULL; > > + *sd_m = NULL; > > } > > /* > > * Reset free list values > > @@ -1807,10 +1838,14 @@ iflib_rx_sds_free(iflib_rxq_t rxq) > > bus_dma_tag_destroy(fl->ifl_desc_tag); > > fl->ifl_desc_tag = NULL; > > } > > + free(fl->ifl_sds.ifsd_m, M_IFLIB); > > + free(fl->ifl_sds.ifsd_cl, M_IFLIB); > > + /* XXX destroy maps first */ > > + free(fl->ifl_sds.ifsd_map, M_IFLIB); > > + fl->ifl_sds.ifsd_m = NULL; > > + fl->ifl_sds.ifsd_cl = NULL; > > + fl->ifl_sds.ifsd_map = NULL; > > } > > - if (rxq->ifr_fl->ifl_sds != NULL) > > - free(rxq->ifr_fl->ifl_sds, M_IFLIB); > > - > > free(rxq->ifr_fl, M_IFLIB); > > rxq->ifr_fl = NULL; > > rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; > > @@ -1995,13 +2030,33 @@ iflib_stop(if_ctx_t ctx) > > } > > } > > > > -static iflib_rxsd_t > > -rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload > ) > > +static inline void > > +prefetch_pkts(iflib_fl_t fl, int cidx) > > +{ > > + int nextptr; > > + int nrxd = fl->ifl_size; > > + > > + nextptr = (cidx + CACHE_PTR_INCREMENT) & (nrxd-1); > > + prefetch(&fl->ifl_sds.ifsd_m[nextptr]); > > + prefetch(&fl->ifl_sds.ifsd_cl[nextptr]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 1) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 2) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 3) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_m[(cidx + 4) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 1) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 2) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 3) & (nrxd-1)]); > > + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]); > > +} > > + > > +static void > > +rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload > , > > iflib_fl_t *pfl, int *pcidx) > > { > > int flid, cidx; > > - iflib_rxsd_t sd; > > + bus_dmamap_t map; > > iflib_fl_t fl; > > iflib_dma_info_t di; > > + int next; > > > > flid = irf->irf_flid; > > cidx = irf->irf_idx; > > @@ -2012,16 +2067,22 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > > if (cltype) > > fl->ifl_cl_dequeued++; > > #endif > > - sd = &fl->ifl_sds[cidx]; > > - di = fl->ifl_ifdi; > > - bus_dmamap_sync(di->idi_tag, di->idi_map, > > - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > > + prefetch_pkts(fl, cidx); > > + if (fl->ifl_sds.ifsd_map != NULL) { > > + next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); > > + prefetch(&fl->ifl_sds.ifsd_map[next]); > > + map = fl->ifl_sds.ifsd_map[cidx]; > > + di = fl->ifl_ifdi; > > + next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); > > + prefetch(&fl->ifl_sds.ifsd_flags[next]); > > + bus_dmamap_sync(di->idi_tag, di->idi_map, > > + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); > > > > /* not valid assert if bxe really does SGE from non-contiguous elements > > */ > > - MPASS(fl->ifl_cidx == cidx); > > - if (unload) > > - bus_dmamap_unload(fl->ifl_desc_tag, sd->ifsd_map); > > - > > + MPASS(fl->ifl_cidx == cidx); > > + if (unload) > > + bus_dmamap_unload(fl->ifl_desc_tag, map); > > + } > > if (__predict_false(++fl->ifl_cidx == fl->ifl_size)) { > > fl->ifl_cidx = 0; > > fl->ifl_gen = 0; > > @@ -2029,35 +2090,38 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_f > > /* YES ick */ > > if (cltype) > > *cltype = fl->ifl_cltype; > > - return (sd); > > + *pfl = fl; > > + *pcidx = cidx; > > } > > > > static struct mbuf * > > assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) > > { > > int i, padlen , flags, cltype; > > - struct mbuf *m, *mh, *mt; > > - iflib_rxsd_t sd; > > - caddr_t cl; > > + struct mbuf *m, *mh, *mt, *sd_m; > > + iflib_fl_t fl; > > + int cidx; > > + caddr_t cl, sd_cl; > > > > i = 0; > > mh = NULL; > > do { > > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE); > > + rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE, &fl, &cid > > x); > > + sd_m = fl->ifl_sds.ifsd_m[cidx]; > > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > > > > - MPASS(sd->ifsd_cl != NULL); > > - MPASS(sd->ifsd_m != NULL); > > + MPASS(sd_cl != NULL); > > + MPASS(sd_m != NULL); > > > > /* Don't include zero-length frags */ > > if (ri->iri_frags[i].irf_len == 0) { > > /* XXX we can save the cluster here, but not the mbuf * > > / > > - m_init(sd->ifsd_m, M_NOWAIT, MT_DATA, 0); > > - m_free(sd->ifsd_m); > > - sd->ifsd_m = NULL; > > + m_init(sd_m, M_NOWAIT, MT_DATA, 0); > > + m_free(sd_m); > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > continue; > > } > > - > > - m = sd->ifsd_m; > > + m = sd_m; > > if (mh == NULL) { > > flags = M_PKTHDR|M_EXT; > > mh = mt = m; > > @@ -2069,9 +2133,9 @@ assemble_segments(iflib_rxq_t rxq, if_rx > > /* assuming padding is only on the first fragment */ > > padlen = 0; > > } > > - sd->ifsd_m = NULL; > > - cl = sd->ifsd_cl; > > - sd->ifsd_cl = NULL; > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > + cl = fl->ifl_sds.ifsd_cl[cidx]; > > + fl->ifl_sds.ifsd_cl[cidx] = NULL; > > > > /* Can these two be made one ? */ > > m_init(m, M_NOWAIT, MT_DATA, flags); > > @@ -2094,16 +2158,19 @@ static struct mbuf * > > iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) > > { > > struct mbuf *m; > > - iflib_rxsd_t sd; > > + iflib_fl_t fl; > > + caddr_t sd_cl; > > + int cidx; > > > > /* should I merge this back in now that the two paths are basically dup > > licated? */ > > if (ri->iri_nfrags == 1 && > > ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { > > - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE); > > - m = sd->ifsd_m; > > - sd->ifsd_m = NULL; > > + rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE, &fl, &cidx) > > ; > > + m = fl->ifl_sds.ifsd_m[cidx]; > > + fl->ifl_sds.ifsd_m[cidx] = NULL; > > + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; > > m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR); > > - memcpy(m->m_data, sd->ifsd_cl, ri->iri_len); > > + memcpy(m->m_data, sd_cl, ri->iri_len); > > m->m_len = ri->iri_frags[0].irf_len; > > } else { > > m = assemble_segments(rxq, ri); > > > > Modified: head/sys/net/iflib.h > > =========================================================================== > == > > = > > --- head/sys/net/iflib.h Fri Jan 27 23:03:28 2017 (r312904) > > +++ head/sys/net/iflib.h Fri Jan 27 23:08:06 2017 (r312905) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2014-2015, Matthew Macy (mmacy@nextbsd.org) > > + * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org) > > Really? Just a copyright notice? > > The reason I ask is because of this: > > ===> ae (all) > --- iflib.o --- > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1561:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1587:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1714:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1730:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1777:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1830:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1861:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1902:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1962:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1975:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:1986:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2035:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2054:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2099:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2159:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2191:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2315:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2333:1: error: > function definition is not allowed here > { > ^ > /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error: > function definition is not allowed here > { > ^ > fatal error: too many errors emitted, stopping now [-ferror-limit=] My initial email about this was correct. It does fail when building i386 only. (It builds for amd64.) -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 28 15:32: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 B00C6CC4566; Sat, 28 Jan 2017 15:32:07 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91620AC8; Sat, 28 Jan 2017 15:32:07 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-248-244.albq.qwest.net [67.0.248.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 20FE41928BA; Sat, 28 Jan 2017 15:32:00 +0000 (UTC) Subject: Re: svn commit: r312905 - head/sys/net To: Cy Schubert References: <201701281526.v0SFQAmv018310@slippy.cwsent.com> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Sean Bruno Message-ID: <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> Date: Sat, 28 Jan 2017 08:31:57 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <201701281526.v0SFQAmv018310@slippy.cwsent.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dkfsunaMxftWlJwiAwenDrGag5jVrG0u1" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 15:32:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dkfsunaMxftWlJwiAwenDrGag5jVrG0u1 Content-Type: multipart/mixed; boundary="7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl"; protected-headers="v1" From: Sean Bruno To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> Subject: Re: svn commit: r312905 - head/sys/net References: <201701281526.v0SFQAmv018310@slippy.cwsent.com> In-Reply-To: <201701281526.v0SFQAmv018310@slippy.cwsent.com> --7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable >> /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error:=20 >> function definition is not allowed here >> { >> ^ >> fatal error: too many errors emitted, stopping now [-ferror-limit=3D] >=20 > My initial email about this was correct. It does fail when building i38= 6 only. (It builds for amd64.) >=20 >=20 Hmmm ... ok. Does Hiren's suggestion fix your build error? Index: sys/net/iflib.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/net/iflib.c (revision 312909) +++ sys/net/iflib.c (working copy) @@ -1536,8 +1536,8 @@ goto fail; } } +#endif } -#endif return (0); fail: --7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl-- --dkfsunaMxftWlJwiAwenDrGag5jVrG0u1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEuq1GMucSHejSCZfdEgHvyh5yfmQFAliMuW1fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJB QUQ0NjMyRTcxMjFERThEMjA5OTdERDEyMDFFRkNBMUU3MjdFNjQACgkQEgHvyh5y fmSPnAgArD3grcYkprDvPBsqycznC2e6DJNUWjVYvtTwGwSdUqEdQ28+Hf+uDijC bbxv6+8216I7DIAxqnOsnobTcMOxYAkilUCB+G4kf5rg5JZFRSq6Dgvst5xkn3fu 0RFeMT/25ERmeWrnDdGD3O8gjgpRTW8c5DGdWfZiP9Cf7B1nwLVqYLO2Irzay/ua bAP4rL4iyRBCt6TbTUxQ9rnxe4ksY8Z4p/nhbYWc0LoOGJ5CgUOFI+ZGsrChWdy1 p4IqSk78NOURc5U9Vn/AOevvUNNW4heGZG7ksns/zH2ufNhJpZdWenwkYzU1ovuy v776Q+RU9mDxJcxJhlif9yeOmjcahg== =brOd -----END PGP SIGNATURE----- --dkfsunaMxftWlJwiAwenDrGag5jVrG0u1-- From owner-svn-src-all@freebsd.org Sat Jan 28 15:43: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 321BFCC487B; Sat, 28 Jan 2017 15:43:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6F52111C; Sat, 28 Jan 2017 15:43:20 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SFhKUC047003; Sat, 28 Jan 2017 15:43:20 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SFhJL9046997; Sat, 28 Jan 2017 15:43:19 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281543.v0SFhJL9046997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 15:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312923 - in head/sys: dev/drm2 modules/drm2/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 15:43:21 -0000 Author: bapt Date: Sat Jan 28 15:43:19 2017 New Revision: 312923 URL: https://svnweb.freebsd.org/changeset/base/312923 Log: Make the drm2 module depend on linuxkpi Use linux memory allocation to reduce diff with upstream Modified: head/sys/dev/drm2/drm_agpsupport.c head/sys/dev/drm2/drm_drv.c head/sys/dev/drm2/drm_os_freebsd.c head/sys/dev/drm2/drm_os_freebsd.h head/sys/dev/drm2/drm_stub.c head/sys/modules/drm2/drm2/Makefile Modified: head/sys/dev/drm2/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 15:43:19 2017 (r312923) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #if __OS_HAS_AGP @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return -ENOMEM; } @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct { struct drm_agp_head *head = NULL; - if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) return NULL; - memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - free(head, DRM_MEM_AGPLISTS); + kfree(head); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/dev/drm2/drm_drv.c Sat Jan 28 15:43:19 2017 (r312923) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * de if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); } INIT_LIST_HEAD(&dev->agp->memory); Modified: head/sys/dev/drm2/drm_os_freebsd.c ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 15:43:19 2017 (r312923) @@ -24,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queue MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -496,4 +495,5 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 15:43:19 2017 (r312923) @@ -552,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); -MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); Modified: head/sys/dev/drm2/drm_stub.c ============================================================================== --- head/sys/dev/drm2/drm_stub.c Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/dev/drm2/drm_stub.c Sat Jan 28 15:43:19 2017 (r312923) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_d DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; } Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Jan 28 13:25:06 2017 (r312922) +++ head/sys/modules/drm2/drm2/Makefile Sat Jan 28 15:43:19 2017 (r312923) @@ -48,6 +48,8 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c +CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include + .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif From owner-svn-src-all@freebsd.org Sat Jan 28 15:44: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 BFDF1CC48F2; Sat, 28 Jan 2017 15:44:15 +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 8F916128E; Sat, 28 Jan 2017 15:44:15 +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 v0SFiEMf047097; Sat, 28 Jan 2017 15:44:14 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SFiExE047096; Sat, 28 Jan 2017 15:44:14 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201701281544.v0SFiExE047096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sat, 28 Jan 2017 15:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312924 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 15:44:15 -0000 Author: sbruno Date: Sat Jan 28 15:44:14 2017 New Revision: 312924 URL: https://svnweb.freebsd.org/changeset/base/312924 Log: Fix i386 compile failure by moving needed closing parenthesis out of conditional block. Submitted by: hiren Reported by: cy Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Sat Jan 28 15:43:19 2017 (r312923) +++ head/sys/net/iflib.c Sat Jan 28 15:44:14 2017 (r312924) @@ -1536,8 +1536,8 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) goto fail; } } - } #endif + } return (0); fail: From owner-svn-src-all@freebsd.org Sat Jan 28 16:22: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 4769FCC5241; Sat, 28 Jan 2017 16:22:36 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B2AA677C; Sat, 28 Jan 2017 16:22:35 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([92.225.10.15]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LbR3e-1c5N4f2L5m-00kx5I; Sat, 28 Jan 2017 17:22:23 +0100 Date: Sat, 28 Jan 2017 17:22:15 +0100 From: "O. Hartmann" To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312923 - in head/sys: dev/drm2 modules/drm2/drm2 Message-ID: <20170128172215.4fad63e8@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201701281543.v0SFhJL9046997@repo.freebsd.org> References: <201701281543.v0SFhJL9046997@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_//Saql4e=KQ2OYa0RjOoYCEg"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:aU//dv2rV5dFDZ1euEBYHPADXesGCDxB7MOViZVP5ImvrqfhP03 sghPSYdnQACApc+KuuJk49Y4nMnUL6EW/QAbjRMABRqzkWrVOQy6F3h30CR5H4bOosaFkw+ yXtV/BMDRRiEv2IotQDh22laCmzIHGfWBS38do2s48t4igrbcjvXHzASZjtyNqb6rOj8pEC 8xc4xvNo6/B0KJwAhUKLA== X-UI-Out-Filterresults: notjunk:1;V01:K0:hbxB54w9bKw=:sY4UiJ49D/mf+IHNzIr8Ps tyMXeEy+V7fAnnUOxlvb1bXSz7soimdolYwLcSaiarsIiGdpXY06Pjaxhz3ms7ZaoGjPRPmCh ki0D7mxn7eTIfNxy+Um4Hwb1FUDPsVsk60NXlI2uP2/Y/0c3ctZCbLBLslX8A/ietsK2k85Y2 H3I0a4r4pq9wzHGDUyh1Tq9wpbz53g8ZQmQ18Fr0//I8/ka1pbTbZ6RIvx6u/wB+N8xP6Cz/C vfYDvW8N10vi/1vOYFtWMKIbDxUjqc1ML8RKXA64rxO1vkT230sa+GCBfikn9XMZP/np49y1D k53ijoueSz12diThLIL0gucD+TBZKW9gm3mFompoKbq1gjwcHDFOgYSpGkhnD9fG2MAWJQRuG NsIOFIMhL7FfJ670YVC38Cyy6A+Iu3XZY5wa5RJDFBCFTHxcmayA13AWX3eG7REj3/UowDqiV GOBCs2zB+aubFTVHOXOcuyXAQnxKE+MlN0UitB0hnSm9Tmogt79M7TwwayjXSlpa3cy4EeMxa fbitOD8aUcSf+a8ocwKAXG+eW8nqS2ld++J2Nmt/vDBMiLer8xZUjxGYh/x7mU3zMConzSI9D uVxR3+BcWf3siUGZej8BP6vtGIdJpRRzAh/2ATX+UUa37NXxj8b2W3urFoD939uRL9XKn6nTl CmsXF68X4besHsxm31Fw4D8lJzmY7NVNBdtSd44NTmDEdxA/+w2tAs3q0r2nN27MLqjqPp9TC D8Ja2KvhTqHkhTXCRwwm2NJ3ud7We46LnrG6DltojE6FuTfV0yUMqHxxHCEAq6+UOxOcHiK3R QBnBMvyfFGbP6k9urC5BoAw6qLJKFd5KlZf7f5xCsCpWHIEEt0mTdwnKqY00+bTUm2kmK2utF rdumQIPUerczXfWIc8MFswYnOL7qmegq99/RavJJIX2kOi8impMwqXFL8UCkyyD2YNJnj/FsR AXnQb1DQQBPb1izOOn2KCUCX7gyYQu7r3TymIcbFLN76twTqOPFlmkdiiKnbZGjTxA2yh2Ky/ Hw== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:22:36 -0000 --Sig_//Saql4e=KQ2OYa0RjOoYCEg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Sat, 28 Jan 2017 15:43:19 +0000 (UTC) Baptiste Daroussin schrieb: > Author: bapt > Date: Sat Jan 28 15:43:19 2017 > New Revision: 312923 > URL: https://svnweb.freebsd.org/changeset/base/312923 >=20 > Log: > Make the drm2 module depend on linuxkpi > =20 > Use linux memory allocation to reduce diff with upstream >=20 > Modified: > head/sys/dev/drm2/drm_agpsupport.c > head/sys/dev/drm2/drm_drv.c > head/sys/dev/drm2/drm_os_freebsd.c > head/sys/dev/drm2/drm_os_freebsd.h > head/sys/dev/drm2/drm_stub.c > head/sys/modules/drm2/drm2/Makefile >=20 > Modified: head/sys/dev/drm2/drm_agpsupport.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 15:43:19 2017 (r312923) > @@ -35,6 +35,7 @@ > __FBSDID("$FreeBSD$"); > =20 > #include > +#include > =20 > #if __OS_HAS_AGP > =20 > @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev > =20 > if (!dev->agp || !dev->agp->acquired) > return -EINVAL; > - if (!(entry =3D malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) > + if (!(entry =3D kzalloc(sizeof(*entry), GFP_KERNEL))) > return -ENOMEM; > =20 > - memset(entry, 0, sizeof(*entry)); > - > pages =3D (request->size + PAGE_SIZE - 1) / PAGE_SIZE; > type =3D (u32) request->type; > if (!(memory =3D agp_alloc_memory(dev->agp->bridge, type, pages << PAGE= _SHIFT))) > { > - free(entry, DRM_MEM_AGPLISTS); > + kfree(entry); > return -ENOMEM; > } > =20 > @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, > list_del(&entry->head); > =20 > drm_free_agp(entry->memory, entry->pages); > - free(entry, DRM_MEM_AGPLISTS); > + kfree(entry); > return 0; > } > EXPORT_SYMBOL(drm_agp_free); > @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct > { > struct drm_agp_head *head =3D NULL; > =20 > - if (!(head =3D malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) > + if (!(head =3D kzalloc(sizeof(*head), GFP_KERNEL))) > return NULL; > - memset((void *)head, 0, sizeof(*head)); > head->bridge =3D agp_find_device(); > if (!head->bridge) { > - free(head, DRM_MEM_AGPLISTS); > + kfree(head); > return NULL; > } else { > agp_get_info(head->bridge, &head->agp_info); >=20 > Modified: head/sys/dev/drm2/drm_drv.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/drm2/drm_drv.c Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/dev/drm2/drm_drv.c Sat Jan 28 15:43:19 2017 (r312923) > @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); > =20 > #include > =20 > +#include > #include > #include > #include > @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * de > if (entry->bound) > drm_unbind_agp(entry->memory); > drm_free_agp(entry->memory, entry->pages); > - free(entry, DRM_MEM_AGPLISTS); > + kfree(entry); > } > INIT_LIST_HEAD(&dev->agp->memory); > =20 >=20 > Modified: head/sys/dev/drm2/drm_os_freebsd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 15:43:19 2017 (r312923) > @@ -24,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queue > MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); > MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structu= res"); > MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Struc= tures"); > -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Struc= tures"); > MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", > "DRM CTXBITMAP Data Structures"); > MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structur= es"); > @@ -496,4 +495,5 @@ MODULE_VERSION(drmn, 1); > MODULE_DEPEND(drmn, agp, 1, 1, 1); > MODULE_DEPEND(drmn, pci, 1, 1, 1); > MODULE_DEPEND(drmn, mem, 1, 1, 1); > +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); > MODULE_DEPEND(drmn, iicbus, 1, 1, 1); >=20 > Modified: head/sys/dev/drm2/drm_os_freebsd.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 15:43:19 2017 (r312923) > @@ -552,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); > MALLOC_DECLARE(DRM_MEM_CMDS); > MALLOC_DECLARE(DRM_MEM_MAPPINGS); > MALLOC_DECLARE(DRM_MEM_BUFLISTS); > -MALLOC_DECLARE(DRM_MEM_AGPLISTS); > MALLOC_DECLARE(DRM_MEM_CTXBITMAP); > MALLOC_DECLARE(DRM_MEM_SGLISTS); > MALLOC_DECLARE(DRM_MEM_MM); >=20 > Modified: head/sys/dev/drm2/drm_stub.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/drm2/drm_stub.c Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/dev/drm2/drm_stub.c Sat Jan 28 15:43:19 2017 (r312923) > @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); > =20 > #include > #include > +#include > =20 > #ifdef DRM_DEBUG_DEFAULT_ON > unsigned int drm_debug =3D (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | > @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_d > DRM_MTRR_WC); > DRM_DEBUG("mtrr_del=3D%d\n", retval); > } > - free(dev->agp, DRM_MEM_AGPLISTS); > + kfree(dev->agp); > dev->agp =3D NULL; > =20 > drm_ht_remove(&dev->map_hash); > @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) > drm_sysctl_cleanup(dev); > =20 > if (drm_core_has_AGP(dev) && dev->agp) { > - free(dev->agp, DRM_MEM_AGPLISTS); > + kfree(dev->agp); > dev->agp =3D NULL; > } > =20 >=20 > Modified: head/sys/modules/drm2/drm2/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/sys/modules/drm2/drm2/Makefile Sat Jan 28 13:25:06 2017 (r312922) > +++ head/sys/modules/drm2/drm2/Makefile Sat Jan 28 15:43:19 2017 (r312923) > @@ -48,6 +48,8 @@ SRCS =3D \ > ati_pcigart.c > #ttm_page_alloc_dma.c > =20 > +CFLAGS+=3D -I${.CURDIR}/../../../compat/linuxkpi/common/include > + > .if ${MACHINE_CPUARCH} =3D=3D "amd64" || ${MACHINE_ARCH} =3D=3D "powerpc= 64" > SRCS +=3D drm_ioc32.c > .endif > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" This "patch" broke buildkernel: make[4]: stopped in /usr/src/sys/modules/drm2 .ERROR_TARGET=3D'all_subdir_drm2/radeonkms' --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_//Saql4e=KQ2OYa0RjOoYCEg Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWIzFNwAKCRDS528fyFhY lI2FAgCJPiO5e/NRiWnnyB1z9QZmMQXohHurT5jBpeRcTTgyNt2aqRXPFVKMp9cI PNh0aKl4XvZ6dQ2fRtKr5fzN97zgAf9k94w89KIuw04jJeI4USpQD3lUPhMu/onb iT2ggX0j/FuwCzL+DO8/MQhddrOTFgsVzpFsRBt7ToUADJ3rTfwA =Esvm -----END PGP SIGNATURE----- --Sig_//Saql4e=KQ2OYa0RjOoYCEg-- From owner-svn-src-all@freebsd.org Sat Jan 28 16:24: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 A33F1CC532D; Sat, 28 Jan 2017 16:24:07 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DC4C919; Sat, 28 Jan 2017 16:24:07 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SGO63b063485; Sat, 28 Jan 2017 16:24:06 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SGO6xr063480; Sat, 28 Jan 2017 16:24:06 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201701281624.v0SGO6xr063480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 28 Jan 2017 16:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312925 - in head/sys: arm/include arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:24:07 -0000 Author: cognet Date: Sat Jan 28 16:24:06 2017 New Revision: 312925 URL: https://svnweb.freebsd.org/changeset/base/312925 Log: Implement atomic_fcmpset_* for arm and arm64. Modified: head/sys/arm/include/atomic-v4.h head/sys/arm/include/atomic-v6.h head/sys/arm/include/atomic.h head/sys/arm64/include/atomic.h Modified: head/sys/arm/include/atomic-v4.h ============================================================================== --- head/sys/arm/include/atomic-v4.h Sat Jan 28 15:44:14 2017 (r312924) +++ head/sys/arm/include/atomic-v4.h Sat Jan 28 16:24:06 2017 (r312925) @@ -112,6 +112,43 @@ atomic_clear_64(volatile uint64_t *addre __with_interrupts_disabled(*address &= ~clearmask); } +static __inline int +atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) +{ + u_int32_t ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + +static __inline int +atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_int64_t newval) +{ + u_int64_t ret; + + __with_interrupts_disabled( + { + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + static __inline u_int32_t atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { @@ -370,6 +407,12 @@ atomic_swap_32(volatile u_int32_t *p, u_ return (__swp(v, p)); } +#define atomic_fcmpset_rel_32 atomic_fcmpset_32 +#define atomic_fcmpset_acq_32 atomic_fcmpset_32 +#define atomic_fcmpset_rel_64 atomic_fcmpset_64 +#define atomic_fcmpset_acq_64 atomic_fcmpset_64 +#define atomic_fcmpset_acq_long atomic_fcmpset_long +#define atomic_fcmpset_rel_long atomic_fcmpset_long #define atomic_cmpset_rel_32 atomic_cmpset_32 #define atomic_cmpset_acq_32 atomic_cmpset_32 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -421,6 +464,14 @@ atomic_cmpset_long(volatile u_long *dst, } static __inline u_long +atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe) +{ + + return (atomic_fcmpset_32((volatile uint32_t *)dst, + (uint32_t *)old, newe)); +} + +static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Sat Jan 28 15:44:14 2017 (r312924) +++ head/sys/arm/include/atomic-v6.h Sat Jan 28 16:24:06 2017 (r312925) @@ -190,6 +190,116 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(clear, 64) ATOMIC_ACQ_REL_LONG(clear) +static __inline int +atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + uint32_t tmp; + uint32_t _cmpval = *cmpval; + int ret; + + __asm __volatile( + "1: mov %0, #1 \n" + " ldrex %1, [%2] \n" + " cmp %1, %3 \n" + " it ne \n" + " bne 2f \n" + " strex %0, %4, [%2] \n" + "2:" + : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) + : : "cc", "memory"); + *cmpval = tmp; + return (!ret); +} + +static __inline uint64_t +atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + uint64_t tmp; + uint64_t _cmpval = *cmpval; + int ret; + + __asm __volatile( + "1: mov %[ret], #1 \n" + " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" + " teq %Q[tmp], %Q[_cmpval] \n" + " itee eq \n" + " teqeq %R[tmp], %R[_cmpval] \n" + " bne 2f \n" + " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" + "2: \n" + : [ret] "=&r" (ret), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [_cmpval] "r" (_cmpval), + [newval] "r" (newval) + : "cc", "memory"); + *cmpval = tmp; + return (!ret); +} + +static __inline u_long +atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + + return (atomic_fcmpset_32((volatile uint32_t *)p, + (uint32_t *)cmpval, newval)); +} + +static __inline uint64_t +atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + uint64_t ret; + + ret = atomic_fcmpset_64(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline u_long +atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + u_long ret; + + ret = atomic_fcmpset_long(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline uint32_t +atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + + uint32_t ret; + + ret = atomic_fcmpset_32(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline uint32_t +atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + + dmb(); + return (atomic_fcmpset_32(p, cmpval, newval)); +} + +static __inline uint64_t +atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + + dmb(); + return (atomic_fcmpset_64(p, cmpval, newval)); +} + +static __inline u_long +atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + + dmb(); + return (atomic_fcmpset_long(p, cmpval, newval)); +} + static __inline uint32_t atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) { Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Sat Jan 28 15:44:14 2017 (r312924) +++ head/sys/arm/include/atomic.h Sat Jan 28 16:24:06 2017 (r312925) @@ -84,6 +84,9 @@ atomic_store_long(volatile u_long *dst, #define atomic_set_ptr atomic_set_32 #define atomic_set_acq_ptr atomic_set_acq_32 #define atomic_set_rel_ptr atomic_set_rel_32 +#define atomic_fcmpset_ptr atomic_fcmpset_32 +#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_32 +#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_32 #define atomic_cmpset_ptr atomic_cmpset_32 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_32 #define atomic_cmpset_rel_ptr atomic_cmpset_rel_32 @@ -105,6 +108,9 @@ atomic_store_long(volatile u_long *dst, #define atomic_set_int atomic_set_32 #define atomic_set_acq_int atomic_set_acq_32 #define atomic_set_rel_int atomic_set_rel_32 +#define atomic_fcmpset_int atomic_fcmpset_32 +#define atomic_fcmpset_acq_int atomic_fcmpset_acq_32 +#define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_cmpset_int atomic_cmpset_32 #define atomic_cmpset_acq_int atomic_cmpset_acq_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Sat Jan 28 15:44:14 2017 (r312924) +++ head/sys/arm64/include/atomic.h Sat Jan 28 16:24:06 2017 (r312925) @@ -98,6 +98,61 @@ ATOMIC(clear, bic) ATOMIC(set, orr) ATOMIC(subtract, sub) +#define ATOMIC_FCMPSET(bar, a, l) \ +static __inline int \ +atomic_fcmpset_##bar##32(volatile uint32_t *p, uint32_t *cmpval, \ + uint32_t newval) \ +{ \ + uint32_t tmp; \ + uint32_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xr %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xr %w1, %w4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##bar##64(volatile uint64_t *p, uint64_t *cmpval, \ + uint64_t newval) \ +{ \ + uint64_t tmp; \ + uint64_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xr %0, [%2] \n" \ + " cmp %0, %3 \n" \ + " b.ne 2f \n" \ + " st"#l"xr %w1, %4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} + +ATOMIC_FCMPSET( , , ) +ATOMIC_FCMPSET(acq_, a, ) +ATOMIC_FCMPSET(rel_, ,l) + +#undef ATOMIC_FCMPSET + #define ATOMIC_CMPSET(bar, a, l) \ static __inline int \ atomic_cmpset_##bar##32(volatile uint32_t *p, uint32_t cmpval, \ @@ -311,6 +366,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_add_int atomic_add_32 +#define atomic_fcmpset_int atomic_fcmpset_32 #define atomic_clear_int atomic_clear_32 #define atomic_cmpset_int atomic_cmpset_32 #define atomic_fetchadd_int atomic_fetchadd_32 @@ -320,6 +376,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_int atomic_subtract_32 #define atomic_add_acq_int atomic_add_acq_32 +#define atomic_fcmpset_acq_int atomic_fcmpset_acq_32 #define atomic_clear_acq_int atomic_clear_acq_32 #define atomic_cmpset_acq_int atomic_cmpset_acq_32 #define atomic_load_acq_int atomic_load_acq_32 @@ -327,6 +384,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_acq_int atomic_subtract_acq_32 #define atomic_add_rel_int atomic_add_rel_32 +#define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_clear_rel_int atomic_add_rel_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 #define atomic_set_rel_int atomic_set_rel_32 @@ -334,6 +392,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_store_rel_int atomic_store_rel_32 #define atomic_add_long atomic_add_64 +#define atomic_fcmpset_long atomic_fcmpset_64 #define atomic_clear_long atomic_clear_64 #define atomic_cmpset_long atomic_cmpset_64 #define atomic_fetchadd_long atomic_fetchadd_64 @@ -343,6 +402,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_long atomic_subtract_64 #define atomic_add_ptr atomic_add_64 +#define atomic_fcmpset_ptr atomic_fcmpset_64 #define atomic_clear_ptr atomic_clear_64 #define atomic_cmpset_ptr atomic_cmpset_64 #define atomic_fetchadd_ptr atomic_fetchadd_64 @@ -352,6 +412,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_ptr atomic_subtract_64 #define atomic_add_acq_long atomic_add_acq_64 +#define atomic_fcmpset_acq_long atomic_fcmpset_acq_64 #define atomic_clear_acq_long atomic_add_acq_64 #define atomic_cmpset_acq_long atomic_cmpset_acq_64 #define atomic_load_acq_long atomic_load_acq_64 @@ -359,6 +420,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_acq_long atomic_subtract_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 +#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 #define atomic_clear_acq_ptr atomic_add_acq_64 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 #define atomic_load_acq_ptr atomic_load_acq_64 @@ -366,6 +428,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_subtract_acq_ptr atomic_subtract_acq_64 #define atomic_add_rel_long atomic_add_rel_64 +#define atomic_fcmpset_rel_long atomic_fcmpset_rel_64 #define atomic_clear_rel_long atomic_clear_rel_64 #define atomic_cmpset_rel_long atomic_cmpset_rel_64 #define atomic_set_rel_long atomic_set_rel_64 @@ -373,6 +436,7 @@ atomic_store_rel_64(volatile uint64_t *p #define atomic_store_rel_long atomic_store_rel_64 #define atomic_add_rel_ptr atomic_add_rel_64 +#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_64 #define atomic_clear_rel_ptr atomic_clear_rel_64 #define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 #define atomic_set_rel_ptr atomic_set_rel_64 From owner-svn-src-all@freebsd.org Sat Jan 28 16:26: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 37A26CC53B3; Sat, 28 Jan 2017 16:26:26 +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 10FF9A7E; Sat, 28 Jan 2017 16:26:25 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id 3so9793051pgj.1; Sat, 28 Jan 2017 08:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IO5vGkDSBqRb/yDPswlqBj6khbfxGevuyCyBj696tqc=; b=EmoHH95JUKo1p+Dr8PYzKxW9UE2jShx5aouWCXAT2gK56m/It+/zfRUcQxgUoKDWRo R/68k6elrFpWsJIhl3os9aIX4/7AZmjun8QwyH8aTjo0G4EuRtC2vfEYuCH1VfdZ0c+t YppBeZxNTpQHEgEmf5db7g4cgJRjbu2pbAn9wOQfwiN0PmQS/ZLbUSQnb6hqg6mvtzjg xbxfyOqIn1Exak7qwriC2YFjqQx/Jm927hvjx6Ps6Lwcs1uvMQjGfWNuRDQYUk470rWL HwBCxl5sut5J3hroBucQaLBJjPFzmtpglWtzwHdSFU0yDZHCL9wQBy8P+G05D2Dz4reN 0DjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IO5vGkDSBqRb/yDPswlqBj6khbfxGevuyCyBj696tqc=; b=ZRS5/OAsYSzlEV0cXgTWXzziIIs5TkbB8lvDK5WEImXjo5/um3jC3MQ7yEuZpNG1KJ YuVrx28JRA9ASTgsGtQt8PD4qJOF09mPgyG0qqNPkjGQrSp1KWeUU6Lxa612zZuiL3LD Tp0DsYWraa6hxDjkU+rPxnh4/ynVzYsQ8mnWeo0iHBQUCqmCIaELP1wajxVY/+qYd9Ke VaG8Y9fi3GocVpkw/Q+NrtY5Rtr5RytpRSmhqnDMgHVgh/sqtp8Ar+xxGE1P3W2QwOKp 8799ochqSDUOfshHds/JjSAy6DCDDLKfBHd3cTlnOAxsD+LqomSM4tacHLVTHrrNTa+W HOpw== X-Gm-Message-State: AIkVDXJHEyZWgtHpculWetemCcCNDTFuXtOsSBlnl2f79FOLoPMomUqnqPGLJFPic7kMJw== X-Received: by 10.99.101.199 with SMTP id z190mr14925271pgb.219.1485620785172; Sat, 28 Jan 2017 08:26:25 -0800 (PST) Received: from [192.168.20.13] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id w76sm20041433pfd.74.2017.01.28.08.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Jan 2017 08:26:24 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r312917 - in head: share/man/man4 share/man/man4/man4.i386 sys/dev/pci sys/modules/ata/atacbus From: Ngie Cooper X-Mailer: iPhone Mail (14D27) In-Reply-To: <201701280958.v0S9w0ja004827@repo.freebsd.org> Date: Sat, 28 Jan 2017 08:26:24 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201701280958.v0S9w0ja004827@repo.freebsd.org> To: Takahashi Yoshihiro X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:26:26 -0000 > On Jan 28, 2017, at 01:58, Takahashi Yoshihiro wrote: > > Author: nyan > Date: Sat Jan 28 09:58:00 2017 > New Revision: 312917 > URL: https://svnweb.freebsd.org/changeset/base/312917 > > Log: > Remove more pc98 support. Hello Yoshiro-San, Have appropriate man pages and files been added to ObsoleteFiles.inc? Thank you! -Ngie From owner-svn-src-all@freebsd.org Sat Jan 28 16:30: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 14005CC5497; Sat, 28 Jan 2017 16:30:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D08C0CF6; Sat, 28 Jan 2017 16:30:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SGUHXG063933; Sat, 28 Jan 2017 16:30:17 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SGUEfW063907; Sat, 28 Jan 2017 16:30:14 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281630.v0SGUEfW063907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312926 - in head: bin/ed contrib/dma share/mk sys/amd64/amd64 sys/amd64/cloudabi64 sys/cam/ctl sys/cddl/dev/fbt/x86 sys/compat/cloudabi sys/compat/cloudabi64 sys/compat/linuxkpi/common... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:30:18 -0000 Author: bapt Date: Sat Jan 28 16:30:14 2017 New Revision: 312926 URL: https://svnweb.freebsd.org/changeset/base/312926 Log: Revert r312923 a better approach will be taken later Modified: head/bin/ed/Makefile head/contrib/dma/mail.c head/share/mk/bsd.doc.mk head/sys/amd64/amd64/db_trace.c head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/cam/ctl/ctl_ioctl.h head/sys/cddl/dev/fbt/x86/fbt_isa.c head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/cloudabi64/cloudabi64_poll.c head/sys/compat/linuxkpi/common/include/linux/slab.h head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/include/acpixf.h head/sys/ddb/ddb.h head/sys/dev/drm2/drm_agpsupport.c head/sys/dev/drm2/drm_bufs.c head/sys/dev/drm2/drm_dma.c head/sys/dev/drm2/drm_drv.c head/sys/dev/drm2/drm_os_freebsd.c head/sys/dev/drm2/drm_os_freebsd.h head/sys/dev/drm2/drm_stub.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/kern/kern_descrip.c head/sys/kern/kern_shutdown.c head/sys/modules/drm2/drm2/Makefile head/tools/build/Makefile head/tools/tools/locale/etc/unicode.conf head/usr.bin/getconf/confstr.gperf head/usr.bin/getconf/getconf.c head/usr.bin/getconf/limits.gperf head/usr.bin/getconf/pathconf.gperf head/usr.bin/getconf/progenv.gperf head/usr.bin/getconf/sysconf.gperf head/usr.sbin/nscd/nscd.c head/usr.sbin/nscd/nscdcli.c Modified: head/bin/ed/Makefile ============================================================================== --- head/bin/ed/Makefile Sat Jan 28 16:24:06 2017 (r312925) +++ head/bin/ed/Makefile Sat Jan 28 16:30:14 2017 (r312926) @@ -9,7 +9,7 @@ LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 .if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" -CFLAGS+=-DDES +CFLAGS+=-DDES -I/usr/include/private/openssl LIBADD= crypto .endif Modified: head/contrib/dma/mail.c ============================================================================== --- head/contrib/dma/mail.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/contrib/dma/mail.c Sat Jan 28 16:30:14 2017 (r312926) @@ -38,6 +38,7 @@ #include #include #include +#include #include "dma.h" @@ -341,18 +342,41 @@ newaddr: goto again; } +static int +writeline(struct queue *queue, const char *line, ssize_t linelen) +{ + ssize_t len; + + while (linelen > 0) { + len = linelen; + if (linelen > 1000) { + len = 990; + } + if (fwrite(line, len, 1, queue->mailf) != 1) + return (-1); + if (linelen <= 1000) + break; + if (fwrite("\n", 1, 1, queue->mailf) != 1) + return (-1); + line += 990; + linelen = strlen(line); + } + return (0); +} + int readmail(struct queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; - char line[1000]; /* by RFC2822 */ - size_t linelen; + char *line = NULL; + ssize_t linelen; + size_t linecap = 0; + char newline[1000]; size_t error; int had_headers = 0; int had_from = 0; int had_messagid = 0; int had_date = 0; - int had_last_line = 0; int nocopy = 0; parse_state.state = NONE; @@ -372,24 +396,15 @@ readmail(struct queue *queue, int nodot, return (-1); while (!feof(stdin)) { - if (fgets(line, sizeof(line) - 1, stdin) == NULL) + newline[0] = '\0'; + if ((linelen = getline(&line, &linecap, stdin)) <= 0) break; - if (had_last_line) - errlogx(EX_DATAERR, "bad mail input format:" - " from %s (uid %d) (envelope-from %s)", - username, useruid, queue->sender); - linelen = strlen(line); - if (linelen == 0 || line[linelen - 1] != '\n') { - /* - * This line did not end with a newline character. - * If we fix it, it better be the last line of - * the file. - */ - line[linelen] = '\n'; - line[linelen + 1] = 0; - had_last_line = 1; - } if (!had_headers) { + if (linelen > 1000) + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + /* * Unless this is a continuation, switch of * the Bcc: nocopy flag. @@ -425,36 +440,44 @@ readmail(struct queue *queue, int nodot, } } - if (strcmp(line, "\n") == 0 && !had_headers) { + if (line[0] == '\n' && !had_headers) { had_headers = 1; while (!had_date || !had_messagid || !had_from) { if (!had_date) { had_date = 1; - snprintf(line, sizeof(line), "Date: %s\n", rfc822date()); + snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); } else if (!had_messagid) { /* XXX msgid, assign earlier and log? */ had_messagid = 1; - snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, (uintmax_t)random(), hostname()); } else if (!had_from) { had_from = 1; - snprintf(line, sizeof(line), "From: <%s>\n", queue->sender); + snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); } - if (fwrite(line, strlen(line), 1, queue->mailf) != 1) - return (-1); + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; } - strcpy(line, "\n"); + strlcpy(newline, "\n", sizeof(newline)); } if (!nodot && linelen == 2 && line[0] == '.') break; if (!nocopy) { - if (fwrite(line, strlen(line), 1, queue->mailf) != 1) - return (-1); + if (newline[0] != '\0') { + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } else { + if (writeline(queue, line, linelen) != 0) + goto fail; + } } } return (0); +fail: + free(line); + return (-1); } Modified: head/share/mk/bsd.doc.mk ============================================================================== --- head/share/mk/bsd.doc.mk Sat Jan 28 16:24:06 2017 (r312925) +++ head/share/mk/bsd.doc.mk Sat Jan 28 16:30:14 2017 (r312926) @@ -54,10 +54,10 @@ INDXBIB?= indxbib PIC?= pic REFER?= refer .for _dev in ${PRINTERDEVICE:Mascii} -ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} +ROFF.ascii?= nroff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} .endfor .for _dev in ${PRINTERDEVICE:Nascii} -ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} +ROFF.${_dev}?= nroff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} .endfor SOELIM?= soelim TBL?= tbl Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/amd64/amd64/db_trace.c Sat Jan 28 16:30:14 2017 (r312926) @@ -270,6 +270,7 @@ db_nextframe(struct amd64_frame **fp, db *fp = (struct amd64_frame *) rbp; } + static int db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame, db_addr_t pc, register_t sp, int count) @@ -384,6 +385,20 @@ db_trace_self(void) db_backtrace(curthread, NULL, frame, callpc, 0, -1); } +void +db_trace_self_depth(int depth) +{ + struct amd64_frame *frame; + db_addr_t callpc; + register_t rbp; + + __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); + frame = (struct amd64_frame *)rbp; + callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE); + frame = frame->f_frame; + db_backtrace(curthread, NULL, frame, callpc, 0, depth); +} + int db_trace_thread(struct thread *thr, int count) { Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sat Jan 28 16:30:14 2017 (r312926) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/cam/ctl/ctl_ioctl.h Sat Jan 28 16:30:14 2017 (r312926) @@ -150,7 +150,7 @@ struct ctl_lun_io_stats { uint64_t lun_number; uint32_t blocksize; ctl_lun_stats_flags flags; - struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; + struct ctl_lun_io_port_stats *ports; }; struct ctl_stats { Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Sat Jan 28 16:30:14 2017 (r312926) @@ -34,6 +34,8 @@ #include +#include + #include "fbt.h" #define FBT_PUSHL_EBP 0x55 Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/compat/cloudabi/cloudabi_fd.c Sat Jan 28 16:30:14 2017 (r312926) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/compat/cloudabi64/cloudabi64_poll.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_poll.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/compat/cloudabi64/cloudabi64_poll.c Sat Jan 28 16:30:14 2017 (r312926) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sat Jan 28 16:30:14 2017 (r312926) @@ -72,6 +72,14 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN 0x0001 +static inline void * +kmalloc_array(size_t n, size_t size, gfp_t flags) +{ + if (size != 0 && n > SIZE_MAX / size) + return (NULL); + return kmalloc(n * size, flags); +} +} static inline int linux_kmem_ctor(void *mem, int size, void *arg, int flags) Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sat Jan 28 16:30:14 2017 (r312926) @@ -1022,23 +1022,25 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData) /******************************************************************************* * - * FUNCTION: AcpiGetData + * FUNCTION: AcpiGetDataFull * * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData + * Handle - Handler used in call to attach_data * Data - Where the data is returned + * Callback - function to execute before returning * * RETURN: Status * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * DESCRIPTION: Retrieve data that was previously attached to a namespace node + * and execute a callback before returning. * ******************************************************************************/ - ACPI_STATUS -AcpiGetData ( +AcpiGetDataFull ( ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, - void **Data) + void **Data, + void (*Callback)(void *)) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; @@ -1069,10 +1071,34 @@ AcpiGetData ( } Status = AcpiNsGetAttachedData (Node, Handler, Data); - + if (ACPI_SUCCESS(Status) && Callback) { + Callback(*Data); + } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } +ACPI_EXPORT_SYMBOL (AcpiGetDataFull) +/******************************************************************************* + * + * FUNCTION: AcpiGetData + * + * PARAMETERS: ObjHandle - Namespace node + * Handler - Handler used in call to AttachData + * Data - Where the data is returned + * + * RETURN: Status + * + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * + ******************************************************************************/ +ACPI_STATUS +AcpiGetData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void **Data) +{ + return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL)); +} ACPI_EXPORT_SYMBOL (AcpiGetData) Modified: head/sys/contrib/dev/acpica/include/acpixf.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acpixf.h Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/contrib/dev/acpica/include/acpixf.h Sat Jan 28 16:30:14 2017 (r312926) @@ -672,6 +672,14 @@ AcpiGetData ( ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS +AcpiGetDataFull ( + ACPI_HANDLE Object, + ACPI_OBJECT_HANDLER Handler, + void **Data, + void (*Callback)(void *))) + +ACPI_EXTERNAL_RETURN_STATUS ( +ACPI_STATUS AcpiDebugTrace ( const char *Name, UINT32 DebugLevel, Modified: head/sys/ddb/ddb.h ============================================================================== --- head/sys/ddb/ddb.h Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/ddb/ddb.h Sat Jan 28 16:30:14 2017 (r312926) @@ -219,6 +219,7 @@ bool db_stop_at_pc(int type, int code, bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); +void db_trace_self_depth(int); int db_trace_thread(struct thread *, int); bool db_value_of_name(const char *name, db_expr_t *valuep); bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep); Modified: head/sys/dev/drm2/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:30:14 2017 (r312926) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include -#include #if __OS_HAS_AGP @@ -209,13 +208,15 @@ int drm_agp_alloc(struct drm_device *dev if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) + if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); + pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return -ENOMEM; } @@ -375,7 +376,7 @@ int drm_agp_free(struct drm_device *dev, list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -403,11 +404,12 @@ struct drm_agp_head *drm_agp_init(struct { struct drm_agp_head *head = NULL; - if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) + if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) return NULL; + memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - kfree(head); + free(head, DRM_MEM_AGPLISTS); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); Modified: head/sys/dev/drm2/drm_bufs.c ============================================================================== --- head/sys/dev/drm2/drm_bufs.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_bufs.c Sat Jan 28 16:30:14 2017 (r312926) @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -216,7 +219,7 @@ static int drm_addmap_core(struct drm_de int ret; int align; - map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT); + map = kmalloc(sizeof(*map), GFP_KERNEL); if (!map) return -ENOMEM; @@ -230,7 +233,7 @@ static int drm_addmap_core(struct drm_de * when processes fork. */ if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", @@ -249,7 +252,7 @@ static int drm_addmap_core(struct drm_de * constant. */ if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } map->mtrr = -1; @@ -281,7 +284,7 @@ static int drm_addmap_core(struct drm_de list->map->size = map->size; } - free(map, DRM_MEM_MAPS); + kfree(map); *maplist = list; return 0; } @@ -298,7 +301,7 @@ static int drm_addmap_core(struct drm_de if (map->type == _DRM_REGISTERS) { drm_core_ioremap(map, dev); if (!map->handle) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } } @@ -314,23 +317,23 @@ static int drm_addmap_core(struct drm_de list->map->size = map->size; } - free(map, DRM_MEM_MAPS); + kfree(map); *maplist = list; return 0; } - map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); + map->handle = vmalloc_user(map->size); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } map->offset = (unsigned long)map->handle; if (map->flags & _DRM_CONTAINS_LOCK) { /* Prevent a 2nd X Server from creating a 2nd lock */ if (dev->primary->master->lock.hw_lock != NULL) { - free(map->handle, DRM_MEM_MAPS); - free(map, DRM_MEM_MAPS); + kfree(map->handle); + kfree(map); return -EBUSY; } dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -341,7 +344,7 @@ static int drm_addmap_core(struct drm_de int valid = 0; if (!drm_core_has_AGP(dev)) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } #ifdef __linux__ @@ -376,7 +379,7 @@ static int drm_addmap_core(struct drm_de } } if (!list_empty(&dev->agp->memory) && !valid) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EPERM; } DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n", @@ -389,7 +392,7 @@ static int drm_addmap_core(struct drm_de break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } map->handle = (void *)(dev->sg->vaddr + offset); @@ -405,7 +408,7 @@ static int drm_addmap_core(struct drm_de align = PAGE_SIZE; dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR); if (!dmah) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } map->handle = dmah->vaddr; @@ -413,15 +416,15 @@ static int drm_addmap_core(struct drm_de map->dmah = dmah; break; default: - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } - list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); + list = kzalloc(sizeof(*list), GFP_KERNEL); if (!list) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } list->map = map; @@ -438,8 +441,8 @@ static int drm_addmap_core(struct drm_de if (ret) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - free(map, DRM_MEM_MAPS); - free(list, DRM_MEM_MAPS); + kfree(map); + kfree(list); DRM_UNLOCK(dev); return ret; } @@ -523,7 +526,7 @@ int drm_rmmap_locked(struct drm_device * list_del(&r_list->head); drm_ht_remove_key(&dev->map_hash, r_list->user_token >> PAGE_SHIFT); - free(r_list, DRM_MEM_MAPS); + kfree(r_list); found = 1; break; } @@ -545,7 +548,7 @@ int drm_rmmap_locked(struct drm_device * } break; case _DRM_SHM: - free(map->handle, DRM_MEM_MAPS); + kfree(map->handle); if (master) { if (dev->sigdata.lock == master->lock.hw_lock) dev->sigdata.lock = NULL; @@ -564,7 +567,7 @@ int drm_rmmap_locked(struct drm_device * DRM_ERROR("tried to rmmap GEM object\n"); break; } - free(map, DRM_MEM_MAPS); + kfree(map); return 0; } @@ -655,16 +658,16 @@ static void drm_cleanup_buf_error(struct drm_pci_free(dev, entry->seglist[i]); } } - free(entry->seglist, DRM_MEM_SEGS); + kfree(entry->seglist); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - free(entry->buflist[i].dev_private, DRM_MEM_BUFS); + kfree(entry->buflist[i].dev_private); } - free(entry->buflist, DRM_MEM_BUFS); + kfree(entry->buflist); entry->buf_count = 0; } @@ -761,8 +764,7 @@ int drm_addbufs_agp(struct drm_device * return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -790,8 +792,7 @@ int drm_addbufs_agp(struct drm_device * buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -810,9 +811,8 @@ int drm_addbufs_agp(struct drm_device * DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -912,18 +912,16 @@ int drm_addbufs_pci(struct drm_device * return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, - M_NOWAIT | M_ZERO); + entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); if (!entry->seglist) { - free(entry->buflist, DRM_MEM_BUFS); + kfree(entry->buflist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -932,11 +930,12 @@ int drm_addbufs_pci(struct drm_device * /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = malloc((dma->page_count + (count << page_order)) * - sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); + temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), + sizeof(*dma->pagelist), + GFP_KERNEL); if (!temp_pagelist) { - free(entry->buflist, DRM_MEM_BUFS); - free(entry->seglist, DRM_MEM_SEGS); + kfree(entry->buflist); + kfree(entry->seglist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -960,7 +959,7 @@ int drm_addbufs_pci(struct drm_device * entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -990,14 +989,14 @@ int drm_addbufs_pci(struct drm_device * buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, - DRM_MEM_BUFS, M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, + GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1009,13 +1008,13 @@ int drm_addbufs_pci(struct drm_device * byte_count += PAGE_SIZE << page_order; } - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * + sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1030,7 +1029,7 @@ int drm_addbufs_pci(struct drm_device * * with the new one. */ if (dma->page_count) { - free(dma->pagelist, DRM_MEM_PAGES); + kfree(dma->pagelist); } dma->pagelist = temp_pagelist; @@ -1124,8 +1123,7 @@ static int drm_addbufs_sg(struct drm_dev return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1154,8 +1152,7 @@ static int drm_addbufs_sg(struct drm_dev buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1174,9 +1171,9 @@ static int drm_addbufs_sg(struct drm_dev DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * + sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -1280,8 +1277,7 @@ static int drm_addbufs_fb(struct drm_dev return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1309,8 +1305,7 @@ static int drm_addbufs_fb(struct drm_dev buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1329,9 +1324,8 @@ static int drm_addbufs_fb(struct drm_dev DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); Modified: head/sys/dev/drm2/drm_dma.c ============================================================================== --- head/sys/dev/drm2/drm_dma.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_dma.c Sat Jan 28 16:30:14 2017 (r312926) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include +#include /** * Initialize the DMA data. @@ -89,18 +90,17 @@ void drm_dma_takedown(struct drm_device drm_pci_free(dev, dma->bufs[i].seglist[j]); } } - free(dma->bufs[i].seglist, DRM_MEM_SEGS); + kfree(dma->bufs[i].seglist); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { - free(dma->bufs[i].buflist[j].dev_private, - DRM_MEM_BUFS); + kfree(dma->bufs[i].buflist[j].dev_private); } - free(dma->bufs[i].buflist, DRM_MEM_BUFS); + kfree(dma->bufs[i].buflist); } } - free(dma->buflist, DRM_MEM_BUFS); + kfree(dma->buflist); free(dma->pagelist, DRM_MEM_PAGES); free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:30:14 2017 (r312926) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -212,7 +211,7 @@ int drm_lastclose(struct drm_device * de if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); } INIT_LIST_HEAD(&dev->agp->memory); Modified: head/sys/dev/drm2/drm_os_freebsd.c ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:30:14 2017 (r312926) @@ -16,7 +16,6 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic" MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures"); MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); -MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); @@ -24,6 +23,7 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queue MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,5 +495,4 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); -MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:30:14 2017 (r312926) @@ -544,7 +544,6 @@ MALLOC_DECLARE(DRM_MEM_MAGIC); MALLOC_DECLARE(DRM_MEM_MINOR); MALLOC_DECLARE(DRM_MEM_IOCTLS); MALLOC_DECLARE(DRM_MEM_MAPS); -MALLOC_DECLARE(DRM_MEM_BUFS); MALLOC_DECLARE(DRM_MEM_SEGS); MALLOC_DECLARE(DRM_MEM_PAGES); MALLOC_DECLARE(DRM_MEM_FILES); @@ -552,6 +551,7 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); +MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); Modified: head/sys/dev/drm2/drm_stub.c ============================================================================== --- head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:30:14 2017 (r312926) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -316,7 +315,7 @@ void drm_cancel_fill_in_dev(struct drm_d DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -468,7 +467,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 16:30:14 2017 (r312926) @@ -3081,7 +3081,7 @@ tryagain: new_deleg->ls_stateid.other[2] = delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos || !readonly) && + (nfsrv_writedelegifpos && !readonly) && (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) { new_deleg->ls_flags = (NFSLCK_DELEGWRITE | NFSLCK_READACCESS | NFSLCK_WRITEACCESS); @@ -3153,7 +3153,7 @@ tryagain: delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos || !readonly) && + (nfsrv_writedelegifpos && !readonly) && ((nd->nd_flag & ND_NFSV41) == 0 || (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0)) { Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/kern/kern_descrip.c Sat Jan 28 16:30:14 2017 (r312926) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -4074,6 +4075,13 @@ invfo_sendfile(struct file *fp, int sock return (EINVAL); } +bool +fd_modified(struct filedesc *fdp, int fd, uint32_t seq) +{ + + return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq)); +} + /*-------------------------------------------------------------------*/ /* Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/kern/kern_shutdown.c Sat Jan 28 16:30:14 2017 (r312926) @@ -722,6 +722,14 @@ vpanic(const char *fmt, va_list ap) spinlock_enter(); +#if 0 +/***** DEBUGGING DRM *****/ + + doadump(0); + EVENTHANDLER_INVOKE(shutdown_final, RB_NOSYNC); + +/************************/ +#endif #ifdef SMP /* * stop_cpus_hard(other_cpus) should prevent multiple CPUs from Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:24:06 2017 (r312925) +++ head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:30:14 2017 (r312926) @@ -48,8 +48,6 @@ SRCS = \ ati_pcigart.c *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 28 16:31: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 533E7CC5547; Sat, 28 Jan 2017 16:31:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BCF71033; Sat, 28 Jan 2017 16:31:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SGVQRo066796; Sat, 28 Jan 2017 16:31:26 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SGVNuv066770; Sat, 28 Jan 2017 16:31:23 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281631.v0SGVNuv066770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312927 - in head: bin/ed contrib/dma share/mk sys/amd64/amd64 sys/amd64/cloudabi64 sys/cam/ctl sys/cddl/dev/fbt/x86 sys/compat/cloudabi sys/compat/cloudabi64 sys/compat/linuxkpi/common... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:31:27 -0000 Author: bapt Date: Sat Jan 28 16:31:23 2017 New Revision: 312927 URL: https://svnweb.freebsd.org/changeset/base/312927 Log: Revert crap accidentally committed Modified: head/bin/ed/Makefile head/contrib/dma/mail.c head/share/mk/bsd.doc.mk head/sys/amd64/amd64/db_trace.c head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/cam/ctl/ctl_ioctl.h head/sys/cddl/dev/fbt/x86/fbt_isa.c head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/cloudabi64/cloudabi64_poll.c head/sys/compat/linuxkpi/common/include/linux/slab.h head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/include/acpixf.h head/sys/ddb/ddb.h head/sys/dev/drm2/drm_agpsupport.c head/sys/dev/drm2/drm_bufs.c head/sys/dev/drm2/drm_dma.c head/sys/dev/drm2/drm_drv.c head/sys/dev/drm2/drm_os_freebsd.c head/sys/dev/drm2/drm_os_freebsd.h head/sys/dev/drm2/drm_stub.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/kern/kern_descrip.c head/sys/kern/kern_shutdown.c head/sys/modules/drm2/drm2/Makefile head/tools/build/Makefile head/tools/tools/locale/etc/unicode.conf head/usr.bin/getconf/confstr.gperf head/usr.bin/getconf/getconf.c head/usr.bin/getconf/limits.gperf head/usr.bin/getconf/pathconf.gperf head/usr.bin/getconf/progenv.gperf head/usr.bin/getconf/sysconf.gperf head/usr.sbin/nscd/nscd.c head/usr.sbin/nscd/nscdcli.c Modified: head/bin/ed/Makefile ============================================================================== --- head/bin/ed/Makefile Sat Jan 28 16:30:14 2017 (r312926) +++ head/bin/ed/Makefile Sat Jan 28 16:31:23 2017 (r312927) @@ -9,7 +9,7 @@ LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 .if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" -CFLAGS+=-DDES -I/usr/include/private/openssl +CFLAGS+=-DDES LIBADD= crypto .endif Modified: head/contrib/dma/mail.c ============================================================================== --- head/contrib/dma/mail.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/contrib/dma/mail.c Sat Jan 28 16:31:23 2017 (r312927) @@ -38,7 +38,6 @@ #include #include #include -#include #include "dma.h" @@ -342,41 +341,18 @@ newaddr: goto again; } -static int -writeline(struct queue *queue, const char *line, ssize_t linelen) -{ - ssize_t len; - - while (linelen > 0) { - len = linelen; - if (linelen > 1000) { - len = 990; - } - if (fwrite(line, len, 1, queue->mailf) != 1) - return (-1); - if (linelen <= 1000) - break; - if (fwrite("\n", 1, 1, queue->mailf) != 1) - return (-1); - line += 990; - linelen = strlen(line); - } - return (0); -} - int readmail(struct queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; - char *line = NULL; - ssize_t linelen; - size_t linecap = 0; - char newline[1000]; + char line[1000]; /* by RFC2822 */ + size_t linelen; size_t error; int had_headers = 0; int had_from = 0; int had_messagid = 0; int had_date = 0; + int had_last_line = 0; int nocopy = 0; parse_state.state = NONE; @@ -396,15 +372,24 @@ readmail(struct queue *queue, int nodot, return (-1); while (!feof(stdin)) { - newline[0] = '\0'; - if ((linelen = getline(&line, &linecap, stdin)) <= 0) + if (fgets(line, sizeof(line) - 1, stdin) == NULL) break; + if (had_last_line) + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + linelen = strlen(line); + if (linelen == 0 || line[linelen - 1] != '\n') { + /* + * This line did not end with a newline character. + * If we fix it, it better be the last line of + * the file. + */ + line[linelen] = '\n'; + line[linelen + 1] = 0; + had_last_line = 1; + } if (!had_headers) { - if (linelen > 1000) - errlogx(EX_DATAERR, "bad mail input format:" - " from %s (uid %d) (envelope-from %s)", - username, useruid, queue->sender); - /* * Unless this is a continuation, switch of * the Bcc: nocopy flag. @@ -440,44 +425,36 @@ readmail(struct queue *queue, int nodot, } } - if (line[0] == '\n' && !had_headers) { + if (strcmp(line, "\n") == 0 && !had_headers) { had_headers = 1; while (!had_date || !had_messagid || !had_from) { if (!had_date) { had_date = 1; - snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); + snprintf(line, sizeof(line), "Date: %s\n", rfc822date()); } else if (!had_messagid) { /* XXX msgid, assign earlier and log? */ had_messagid = 1; - snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, (uintmax_t)random(), hostname()); } else if (!had_from) { had_from = 1; - snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); + snprintf(line, sizeof(line), "From: <%s>\n", queue->sender); } - if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) - goto fail; + if (fwrite(line, strlen(line), 1, queue->mailf) != 1) + return (-1); } - strlcpy(newline, "\n", sizeof(newline)); + strcpy(line, "\n"); } if (!nodot && linelen == 2 && line[0] == '.') break; if (!nocopy) { - if (newline[0] != '\0') { - if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) - goto fail; - } else { - if (writeline(queue, line, linelen) != 0) - goto fail; - } + if (fwrite(line, strlen(line), 1, queue->mailf) != 1) + return (-1); } } return (0); -fail: - free(line); - return (-1); } Modified: head/share/mk/bsd.doc.mk ============================================================================== --- head/share/mk/bsd.doc.mk Sat Jan 28 16:30:14 2017 (r312926) +++ head/share/mk/bsd.doc.mk Sat Jan 28 16:31:23 2017 (r312927) @@ -54,10 +54,10 @@ INDXBIB?= indxbib PIC?= pic REFER?= refer .for _dev in ${PRINTERDEVICE:Mascii} -ROFF.ascii?= nroff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} +ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} .endfor .for _dev in ${PRINTERDEVICE:Nascii} -ROFF.${_dev}?= nroff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} +ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} .endfor SOELIM?= soelim TBL?= tbl Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/amd64/amd64/db_trace.c Sat Jan 28 16:31:23 2017 (r312927) @@ -270,7 +270,6 @@ db_nextframe(struct amd64_frame **fp, db *fp = (struct amd64_frame *) rbp; } - static int db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame, db_addr_t pc, register_t sp, int count) @@ -385,20 +384,6 @@ db_trace_self(void) db_backtrace(curthread, NULL, frame, callpc, 0, -1); } -void -db_trace_self_depth(int depth) -{ - struct amd64_frame *frame; - db_addr_t callpc; - register_t rbp; - - __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); - frame = (struct amd64_frame *)rbp; - callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE); - frame = frame->f_frame; - db_backtrace(curthread, NULL, frame, callpc, 0, depth); -} - int db_trace_thread(struct thread *thr, int count) { Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sat Jan 28 16:31:23 2017 (r312927) @@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -39,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/cam/ctl/ctl_ioctl.h Sat Jan 28 16:31:23 2017 (r312927) @@ -150,7 +150,7 @@ struct ctl_lun_io_stats { uint64_t lun_number; uint32_t blocksize; ctl_lun_stats_flags flags; - struct ctl_lun_io_port_stats *ports; + struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; struct ctl_stats { Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Sat Jan 28 16:31:23 2017 (r312927) @@ -34,8 +34,6 @@ #include -#include - #include "fbt.h" #define FBT_PUSHL_EBP 0x55 Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/compat/cloudabi/cloudabi_fd.c Sat Jan 28 16:31:23 2017 (r312927) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/compat/cloudabi64/cloudabi64_poll.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_poll.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/compat/cloudabi64/cloudabi64_poll.c Sat Jan 28 16:31:23 2017 (r312927) @@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/slab.h Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/compat/linuxkpi/common/include/linux/slab.h Sat Jan 28 16:31:23 2017 (r312927) @@ -72,14 +72,6 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN 0x0001 -static inline void * -kmalloc_array(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) - return (NULL); - return kmalloc(n * size, flags); -} -} static inline int linux_kmem_ctor(void *mem, int size, void *arg, int flags) Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sat Jan 28 16:31:23 2017 (r312927) @@ -1022,25 +1022,23 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData) /******************************************************************************* * - * FUNCTION: AcpiGetDataFull + * FUNCTION: AcpiGetData * * PARAMETERS: ObjHandle - Namespace node - * Handle - Handler used in call to attach_data + * Handler - Handler used in call to AttachData * Data - Where the data is returned - * Callback - function to execute before returning * * RETURN: Status * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node - * and execute a callback before returning. + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. * ******************************************************************************/ + ACPI_STATUS -AcpiGetDataFull ( +AcpiGetData ( ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, - void **Data, - void (*Callback)(void *)) + void **Data) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; @@ -1071,34 +1069,10 @@ AcpiGetDataFull ( } Status = AcpiNsGetAttachedData (Node, Handler, Data); - if (ACPI_SUCCESS(Status) && Callback) { - Callback(*Data); - } + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } -ACPI_EXPORT_SYMBOL (AcpiGetDataFull) -/******************************************************************************* - * - * FUNCTION: AcpiGetData - * - * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData - * Data - Where the data is returned - * - * RETURN: Status - * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. - * - ******************************************************************************/ -ACPI_STATUS -AcpiGetData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void **Data) -{ - return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL)); -} ACPI_EXPORT_SYMBOL (AcpiGetData) Modified: head/sys/contrib/dev/acpica/include/acpixf.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acpixf.h Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/contrib/dev/acpica/include/acpixf.h Sat Jan 28 16:31:23 2017 (r312927) @@ -672,14 +672,6 @@ AcpiGetData ( ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS -AcpiGetDataFull ( - ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler, - void **Data, - void (*Callback)(void *))) - -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS AcpiDebugTrace ( const char *Name, UINT32 DebugLevel, Modified: head/sys/ddb/ddb.h ============================================================================== --- head/sys/ddb/ddb.h Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/ddb/ddb.h Sat Jan 28 16:31:23 2017 (r312927) @@ -219,7 +219,6 @@ bool db_stop_at_pc(int type, int code, bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); -void db_trace_self_depth(int); int db_trace_thread(struct thread *, int); bool db_value_of_name(const char *name, db_expr_t *valuep); bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep); Modified: head/sys/dev/drm2/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:31:23 2017 (r312927) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #if __OS_HAS_AGP @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return -ENOMEM; } @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct { struct drm_agp_head *head = NULL; - if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) return NULL; - memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - free(head, DRM_MEM_AGPLISTS); + kfree(head); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); Modified: head/sys/dev/drm2/drm_bufs.c ============================================================================== --- head/sys/dev/drm2/drm_bufs.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_bufs.c Sat Jan 28 16:31:23 2017 (r312927) @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include @@ -219,7 +216,7 @@ static int drm_addmap_core(struct drm_de int ret; int align; - map = kmalloc(sizeof(*map), GFP_KERNEL); + map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT); if (!map) return -ENOMEM; @@ -233,7 +230,7 @@ static int drm_addmap_core(struct drm_de * when processes fork. */ if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", @@ -252,7 +249,7 @@ static int drm_addmap_core(struct drm_de * constant. */ if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->mtrr = -1; @@ -284,7 +281,7 @@ static int drm_addmap_core(struct drm_de list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } @@ -301,7 +298,7 @@ static int drm_addmap_core(struct drm_de if (map->type == _DRM_REGISTERS) { drm_core_ioremap(map, dev); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } } @@ -317,23 +314,23 @@ static int drm_addmap_core(struct drm_de list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } - map->handle = vmalloc_user(map->size); + map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->offset = (unsigned long)map->handle; if (map->flags & _DRM_CONTAINS_LOCK) { /* Prevent a 2nd X Server from creating a 2nd lock */ if (dev->primary->master->lock.hw_lock != NULL) { - kfree(map->handle); - kfree(map); + free(map->handle, DRM_MEM_MAPS); + free(map, DRM_MEM_MAPS); return -EBUSY; } dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -344,7 +341,7 @@ static int drm_addmap_core(struct drm_de int valid = 0; if (!drm_core_has_AGP(dev)) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } #ifdef __linux__ @@ -379,7 +376,7 @@ static int drm_addmap_core(struct drm_de } } if (!list_empty(&dev->agp->memory) && !valid) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EPERM; } DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n", @@ -392,7 +389,7 @@ static int drm_addmap_core(struct drm_de break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->handle = (void *)(dev->sg->vaddr + offset); @@ -408,7 +405,7 @@ static int drm_addmap_core(struct drm_de align = PAGE_SIZE; dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR); if (!dmah) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->handle = dmah->vaddr; @@ -416,15 +413,15 @@ static int drm_addmap_core(struct drm_de map->dmah = dmah; break; default: - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); if (!list) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } list->map = map; @@ -441,8 +438,8 @@ static int drm_addmap_core(struct drm_de if (ret) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); - kfree(list); + free(map, DRM_MEM_MAPS); + free(list, DRM_MEM_MAPS); DRM_UNLOCK(dev); return ret; } @@ -526,7 +523,7 @@ int drm_rmmap_locked(struct drm_device * list_del(&r_list->head); drm_ht_remove_key(&dev->map_hash, r_list->user_token >> PAGE_SHIFT); - kfree(r_list); + free(r_list, DRM_MEM_MAPS); found = 1; break; } @@ -548,7 +545,7 @@ int drm_rmmap_locked(struct drm_device * } break; case _DRM_SHM: - kfree(map->handle); + free(map->handle, DRM_MEM_MAPS); if (master) { if (dev->sigdata.lock == master->lock.hw_lock) dev->sigdata.lock = NULL; @@ -567,7 +564,7 @@ int drm_rmmap_locked(struct drm_device * DRM_ERROR("tried to rmmap GEM object\n"); break; } - kfree(map); + free(map, DRM_MEM_MAPS); return 0; } @@ -658,16 +655,16 @@ static void drm_cleanup_buf_error(struct drm_pci_free(dev, entry->seglist[i]); } } - kfree(entry->seglist); + free(entry->seglist, DRM_MEM_SEGS); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - kfree(entry->buflist[i].dev_private); + free(entry->buflist[i].dev_private, DRM_MEM_BUFS); } - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); entry->buf_count = 0; } @@ -764,7 +761,8 @@ int drm_addbufs_agp(struct drm_device * return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -792,7 +790,8 @@ int drm_addbufs_agp(struct drm_device * buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -811,8 +810,9 @@ int drm_addbufs_agp(struct drm_device * DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -912,16 +912,18 @@ int drm_addbufs_pci(struct drm_device * return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); + entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, + M_NOWAIT | M_ZERO); if (!entry->seglist) { - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -930,12 +932,11 @@ int drm_addbufs_pci(struct drm_device * /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), - sizeof(*dma->pagelist), - GFP_KERNEL); + temp_pagelist = malloc((dma->page_count + (count << page_order)) * + sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); if (!temp_pagelist) { - kfree(entry->buflist); - kfree(entry->seglist); + free(entry->buflist, DRM_MEM_BUFS); + free(entry->seglist, DRM_MEM_SEGS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -959,7 +960,7 @@ int drm_addbufs_pci(struct drm_device * entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -989,14 +990,14 @@ int drm_addbufs_pci(struct drm_device * buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, - GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, + DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1008,13 +1009,13 @@ int drm_addbufs_pci(struct drm_device * byte_count += PAGE_SIZE << page_order; } - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1029,7 +1030,7 @@ int drm_addbufs_pci(struct drm_device * * with the new one. */ if (dma->page_count) { - kfree(dma->pagelist); + free(dma->pagelist, DRM_MEM_PAGES); } dma->pagelist = temp_pagelist; @@ -1123,7 +1124,8 @@ static int drm_addbufs_sg(struct drm_dev return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1152,7 +1154,8 @@ static int drm_addbufs_sg(struct drm_dev buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1171,9 +1174,9 @@ static int drm_addbufs_sg(struct drm_dev DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -1277,7 +1280,8 @@ static int drm_addbufs_fb(struct drm_dev return -EINVAL; } - entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1305,7 +1309,8 @@ static int drm_addbufs_fb(struct drm_dev buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1324,8 +1329,9 @@ static int drm_addbufs_fb(struct drm_dev DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); Modified: head/sys/dev/drm2/drm_dma.c ============================================================================== --- head/sys/dev/drm2/drm_dma.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_dma.c Sat Jan 28 16:31:23 2017 (r312927) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include -#include /** * Initialize the DMA data. @@ -90,17 +89,18 @@ void drm_dma_takedown(struct drm_device drm_pci_free(dev, dma->bufs[i].seglist[j]); } } - kfree(dma->bufs[i].seglist); + free(dma->bufs[i].seglist, DRM_MEM_SEGS); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { - kfree(dma->bufs[i].buflist[j].dev_private); + free(dma->bufs[i].buflist[j].dev_private, + DRM_MEM_BUFS); } - kfree(dma->bufs[i].buflist); + free(dma->bufs[i].buflist, DRM_MEM_BUFS); } } - kfree(dma->buflist); + free(dma->buflist, DRM_MEM_BUFS); free(dma->pagelist, DRM_MEM_PAGES); free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:31:23 2017 (r312927) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * de if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); } INIT_LIST_HEAD(&dev->agp->memory); Modified: head/sys/dev/drm2/drm_os_freebsd.c ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:31:23 2017 (r312927) @@ -16,6 +16,7 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic" MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures"); MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); +MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); @@ -23,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queue MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,4 +495,5 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:31:23 2017 (r312927) @@ -544,6 +544,7 @@ MALLOC_DECLARE(DRM_MEM_MAGIC); MALLOC_DECLARE(DRM_MEM_MINOR); MALLOC_DECLARE(DRM_MEM_IOCTLS); MALLOC_DECLARE(DRM_MEM_MAPS); +MALLOC_DECLARE(DRM_MEM_BUFS); MALLOC_DECLARE(DRM_MEM_SEGS); MALLOC_DECLARE(DRM_MEM_PAGES); MALLOC_DECLARE(DRM_MEM_FILES); @@ -551,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); -MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); Modified: head/sys/dev/drm2/drm_stub.c ============================================================================== --- head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:31:23 2017 (r312927) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_d DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; } Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 16:31:23 2017 (r312927) @@ -3081,7 +3081,7 @@ tryagain: new_deleg->ls_stateid.other[2] = delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos && !readonly) && + (nfsrv_writedelegifpos || !readonly) && (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) { new_deleg->ls_flags = (NFSLCK_DELEGWRITE | NFSLCK_READACCESS | NFSLCK_WRITEACCESS); @@ -3153,7 +3153,7 @@ tryagain: delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos && !readonly) && + (nfsrv_writedelegifpos || !readonly) && ((nd->nd_flag & ND_NFSV41) == 0 || (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0)) { Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/kern/kern_descrip.c Sat Jan 28 16:31:23 2017 (r312927) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -4075,13 +4074,6 @@ invfo_sendfile(struct file *fp, int sock return (EINVAL); } -bool -fd_modified(struct filedesc *fdp, int fd, uint32_t seq) -{ - - return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq)); -} - /*-------------------------------------------------------------------*/ /* Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/kern/kern_shutdown.c Sat Jan 28 16:31:23 2017 (r312927) @@ -722,14 +722,6 @@ vpanic(const char *fmt, va_list ap) spinlock_enter(); -#if 0 -/***** DEBUGGING DRM *****/ - - doadump(0); - EVENTHANDLER_INVOKE(shutdown_final, RB_NOSYNC); - -/************************/ -#endif #ifdef SMP /* * stop_cpus_hard(other_cpus) should prevent multiple CPUs from Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:30:14 2017 (r312926) +++ head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:31:23 2017 (r312927) @@ -48,6 +48,8 @@ SRCS = \ ati_pcigart.c *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 28 16:32: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 0F48CCC5708; Sat, 28 Jan 2017 16:32:31 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BD6C71279; Sat, 28 Jan 2017 16:32:30 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id XVvPcvA88VQuxXVvQcc7Z2; Sat, 28 Jan 2017 09:32:29 -0700 X-Authority-Analysis: v=2.2 cv=BNTDlBYG c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=VxmjJ2MpAAAA:8 a=YxBL1-UpAAAA:8 a=nljkXKcvcIquU9aQhwcA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=pxhY87DP9d2VeQe4joPk:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 372621CB8; Sat, 28 Jan 2017 08:32:27 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0SGWQIr092332; Sat, 28 Jan 2017 08:32:26 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701281632.v0SGWQIr092332@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Sean Bruno cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net In-Reply-To: Message from Sean Bruno of "Sat, 28 Jan 2017 08:31:57 -0700." <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 28 Jan 2017 08:32:26 -0800 X-CMAE-Envelope: MS4wfMnY93mvocCYQ3OcgjcSoma4yvPhNAT5kVDouK8JG1Nj3O0CvHPxsnla6t1RedgzaEB1p7w//kAPGaiT6jaflnuzJUI18oXbaScy2JpGr5g+u01+WHfF lnap7RcsC76hxU59jeWeK5c+ezzw/GmsBxZ+4I5K/F3CbUXYxd2fyxUQ8swUwzkTgNxMiX7sW7QxYlATHBKc9921T46jtizSZruK1DsbKnk+KLdlbZT1K055 SuvVnLmp89RgSlyQV5d66jFHFQ61L4kwT1+FZPd8DKXe3UZle/Luv5K0vAVB793c X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:32:31 -0000 In message <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org>, Sean Bruno write s: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) > --dkfsunaMxftWlJwiAwenDrGag5jVrG0u1 > Content-Type: multipart/mixed; boundary="7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl"; > protected-headers="v1" > From: Sean Bruno > To: Cy Schubert > Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-head@freebsd.org > Message-ID: <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> > Subject: Re: svn commit: r312905 - head/sys/net > References: <201701281526.v0SFQAmv018310@slippy.cwsent.com> > In-Reply-To: <201701281526.v0SFQAmv018310@slippy.cwsent.com> > > --7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl > Content-Type: text/plain; charset=windows-1252 > Content-Transfer-Encoding: quoted-printable > > >> /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error:=20 > >> function definition is not allowed here > >> { > >> ^ > >> fatal error: too many errors emitted, stopping now [-ferror-limit=3D] > >=20 > > My initial email about this was correct. It does fail when building i38= > 6 only. (It builds for amd64.) > >=20 > >=20 > > Hmmm ... ok. Does Hiren's suggestion fix your build error? > > Index: sys/net/iflib.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/net/iflib.c (revision 312909) > +++ sys/net/iflib.c (working copy) > @@ -1536,8 +1536,8 @@ > goto fail; > } > } > +#endif > } > -#endif > return (0); > > fail: I just read his email and was applying the patch. Trying again... -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 28 16:40: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 6879FCC5AA0; Sat, 28 Jan 2017 16:40:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22A7516EA; Sat, 28 Jan 2017 16:40:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SGeq8F070185; Sat, 28 Jan 2017 16:40:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SGepe9070179; Sat, 28 Jan 2017 16:40:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281640.v0SGepe9070179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312928 - in head/sys: dev/drm2 modules/drm2/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:40:53 -0000 Author: bapt Date: Sat Jan 28 16:40:51 2017 New Revision: 312928 URL: https://svnweb.freebsd.org/changeset/base/312928 Log: Really revert 312923 this time Modified: head/sys/dev/drm2/drm_agpsupport.c head/sys/dev/drm2/drm_drv.c head/sys/dev/drm2/drm_os_freebsd.c head/sys/dev/drm2/drm_os_freebsd.h head/sys/dev/drm2/drm_stub.c head/sys/modules/drm2/drm2/Makefile Modified: head/sys/dev/drm2/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/dev/drm2/drm_agpsupport.c Sat Jan 28 16:40:51 2017 (r312928) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include -#include #if __OS_HAS_AGP @@ -209,13 +208,15 @@ int drm_agp_alloc(struct drm_device *dev if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) + if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); + pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return -ENOMEM; } @@ -375,7 +376,7 @@ int drm_agp_free(struct drm_device *dev, list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -403,11 +404,12 @@ struct drm_agp_head *drm_agp_init(struct { struct drm_agp_head *head = NULL; - if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) + if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) return NULL; + memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - kfree(head); + free(head, DRM_MEM_AGPLISTS); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/dev/drm2/drm_drv.c Sat Jan 28 16:40:51 2017 (r312928) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -212,7 +211,7 @@ int drm_lastclose(struct drm_device * de if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); } INIT_LIST_HEAD(&dev->agp->memory); Modified: head/sys/dev/drm2/drm_os_freebsd.c ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/dev/drm2/drm_os_freebsd.c Sat Jan 28 16:40:51 2017 (r312928) @@ -24,6 +24,7 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queue MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,5 +496,4 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); -MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/dev/drm2/drm_os_freebsd.h Sat Jan 28 16:40:51 2017 (r312928) @@ -552,6 +552,7 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); +MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); Modified: head/sys/dev/drm2/drm_stub.c ============================================================================== --- head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/dev/drm2/drm_stub.c Sat Jan 28 16:40:51 2017 (r312928) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -316,7 +315,7 @@ void drm_cancel_fill_in_dev(struct drm_d DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -468,7 +467,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:31:23 2017 (r312927) +++ head/sys/modules/drm2/drm2/Makefile Sat Jan 28 16:40:51 2017 (r312928) @@ -48,8 +48,6 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c -CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include - .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif From owner-svn-src-all@freebsd.org Sat Jan 28 16:53: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 7596FCC5F64; Sat, 28 Jan 2017 16:53:43 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 253191EB7; Sat, 28 Jan 2017 16:53:42 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id XWFvcKlK9C3JIXWFwcaMaP; Sat, 28 Jan 2017 09:53:41 -0700 X-Authority-Analysis: v=2.2 cv=XbT59Mx5 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=IgFoBzBjUZAA:10 a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=VxmjJ2MpAAAA:8 a=YxBL1-UpAAAA:8 a=nljkXKcvcIquU9aQhwcA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=pxhY87DP9d2VeQe4joPk:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 135911CD8; Sat, 28 Jan 2017 08:53:39 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v0SGrb4Z019261; Sat, 28 Jan 2017 08:53:37 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201701281653.v0SGrb4Z019261@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Sean Bruno cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r312905 - head/sys/net In-Reply-To: Message from Sean Bruno of "Sat, 28 Jan 2017 08:31:57 -0700." <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 28 Jan 2017 08:53:37 -0800 X-CMAE-Envelope: MS4wfD3P7Rg/65NboVKsI/0Gz+W2g6voOmsAKjiVkhns3eTKvzE77lXn3pGQvhyOuxQkPsI+UFhuYHbPneHRAiPk8+ykg1uExLMDX4RP5pLD/juAZJz51rom DmSaLU6kw8MV2I2T3LI4IvFxiHYoFQYzycjPcUldmQWhzXmp64J8jxwc30ZnSO/IOyznFkaWkcKV8SoDfGq0IRMOpx0vsWj8vIGtZVlc2YMTBMGim5hMmmWE QViRdj61mwHzkDP44O/0csiBL7tO5lL4ZQu7JpEKYDQ7OISmUp0xRdrY3YiRCs53 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 16:53:43 -0000 In message <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org>, Sean Bruno write s: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) > --dkfsunaMxftWlJwiAwenDrGag5jVrG0u1 > Content-Type: multipart/mixed; boundary="7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl"; > protected-headers="v1" > From: Sean Bruno > To: Cy Schubert > Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-head@freebsd.org > Message-ID: <6db0fa21-aaf0-6e0d-5b90-5b0c58fd396b@freebsd.org> > Subject: Re: svn commit: r312905 - head/sys/net > References: <201701281526.v0SFQAmv018310@slippy.cwsent.com> > In-Reply-To: <201701281526.v0SFQAmv018310@slippy.cwsent.com> > > --7VU3bI00OrFqhCUsm1WfMDVJhUghilMdl > Content-Type: text/plain; charset=windows-1252 > Content-Transfer-Encoding: quoted-printable > > >> /export/home/cy/freebsd/svn/ip6-cksum/sys/net/iflib.c:2363:1: error:=20 > >> function definition is not allowed here > >> { > >> ^ > >> fatal error: too many errors emitted, stopping now [-ferror-limit=3D] > >=20 > > My initial email about this was correct. It does fail when building i38= > 6 only. (It builds for amd64.) > >=20 > >=20 > > Hmmm ... ok. Does Hiren's suggestion fix your build error? > > Index: sys/net/iflib.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/net/iflib.c (revision 312909) > +++ sys/net/iflib.c (working copy) > @@ -1536,8 +1536,8 @@ > goto fail; > } > } > +#endif > } > -#endif > return (0); > > fail: Yes, that fixes it. I'm sorry for expressing it so badly at first. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 28 17:08: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 40B6DCC4522; Sat, 28 Jan 2017 17:08:13 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 223DFA3D; Sat, 28 Jan 2017 17:08:12 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-248-244.albq.qwest.net [67.0.248.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 6A6441928BA; Sat, 28 Jan 2017 17:08:11 +0000 (UTC) Subject: Re: svn commit: r312905 - head/sys/net To: Cy Schubert References: <201701281653.v0SGrb4Z019261@slippy.cwsent.com> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Sean Bruno Message-ID: Date: Sat, 28 Jan 2017 10:08:08 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <201701281653.v0SGrb4Z019261@slippy.cwsent.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bLgRVOABthjgtaicuuh4TIemwFmNpgjsw" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:08:13 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bLgRVOABthjgtaicuuh4TIemwFmNpgjsw Content-Type: multipart/mixed; boundary="iGSncqI9QRkQK87BiJtpfDuGbL3ven40j"; protected-headers="v1" From: Sean Bruno To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r312905 - head/sys/net References: <201701281653.v0SGrb4Z019261@slippy.cwsent.com> In-Reply-To: <201701281653.v0SGrb4Z019261@slippy.cwsent.com> --iGSncqI9QRkQK87BiJtpfDuGbL3ven40j Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable >> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D= =3D3D=3D3D=3D3D >> --- sys/net/iflib.c (revision 312909) >> +++ sys/net/iflib.c (working copy) >> @@ -1536,8 +1536,8 @@ >> goto fail; >> } >> } >> +#endif >> } >> -#endif >> return (0); >> >> fail: >=20 > Yes, that fixes it. >=20 > I'm sorry for expressing it so badly at first. >=20 >=20 No worries, sorry for the breakage. sean --iGSncqI9QRkQK87BiJtpfDuGbL3ven40j-- --bLgRVOABthjgtaicuuh4TIemwFmNpgjsw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEuq1GMucSHejSCZfdEgHvyh5yfmQFAliMz/hfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJB QUQ0NjMyRTcxMjFERThEMjA5OTdERDEyMDFFRkNBMUU3MjdFNjQACgkQEgHvyh5y fmTj9Af/Zp6hQUepMmFmnnjnEZtOD36Cu41zWNrB447L1ZjVSgTMwLrt7VAxX2PZ UfCk3TSgXZNP5GzCgKyfJMh8guXnDecC0CpOjM1OPJWhgCxOccByvTU4UwBt6qSU HcUxBaLueH4AiI931e5NZ38656BDI3jr3rzB/Yuzh8tIw6qHhbqjckyKb6xrBkLw GVeN0Rg2ZuFuSkEGv871BwC7zMSkaXhOaQusHfkuxl5BSIFYpme0GfTVCnsgEst8 N0Op6iqx6NHg5AgxeU8x95LE2EKKe6iD7hMvCb8jOYg1TLSUXYtClw5vmSqIHazT eLR9lMNcGzTEmX60ozPHRKErZtVZpw== =BSHZ -----END PGP SIGNATURE----- --bLgRVOABthjgtaicuuh4TIemwFmNpgjsw-- From owner-svn-src-all@freebsd.org Sat Jan 28 17:08: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 73136CC4582; Sat, 28 Jan 2017 17:08:42 +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 34015BA4; Sat, 28 Jan 2017 17:08:42 +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 v0SH8fDY081099; Sat, 28 Jan 2017 17:08:41 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SH8esE081091; Sat, 28 Jan 2017 17:08:40 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201701281708.v0SH8esE081091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 28 Jan 2017 17:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312929 - in head: sys/net sys/netinet6 usr.sbin/rtsold X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:08:42 -0000 Author: avos Date: Sat Jan 28 17:08:40 2017 New Revision: 312929 URL: https://svnweb.freebsd.org/changeset/base/312929 Log: Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) This interface type ("a parent interface of wlanX") is not used since r287197 Reviewed by: adrian, glebius Differential Revision: https://reviews.freebsd.org/D9308 Modified: head/sys/net/if.c head/sys/net/if_types.h head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/usr.sbin/rtsold/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/net/if.c Sat Jan 28 17:08:40 2017 (r312929) @@ -3530,7 +3530,6 @@ if_setlladdr(struct ifnet *ifp, const u_ case IFT_BRIDGE: case IFT_ARCNET: case IFT_IEEE8023ADLAG: - case IFT_IEEE80211: bcopy(lladdr, LLADDR(sdl), len); ifa_free(ifa); break; Modified: head/sys/net/if_types.h ============================================================================== --- head/sys/net/if_types.h Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/net/if_types.h Sat Jan 28 17:08:40 2017 (r312929) @@ -113,7 +113,7 @@ typedef enum { IFT_QLLC = 0x44, /* SNA QLLC */ IFT_FASTETHERFX = 0x45, /* Fast Ethernet (100BaseFX) */ IFT_CHANNEL = 0x46, /* channel */ - IFT_IEEE80211 = 0x47, /* radio spread spectrum */ + IFT_IEEE80211 = 0x47, /* radio spread spectrum (unused) */ IFT_IBM370PARCHAN = 0x48, /* IBM System 360/370 OEMI Channel */ IFT_ESCON = 0x49, /* IBM Enterprise Systems Connection */ IFT_DLSW = 0x4a, /* Data Link Switching */ Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/netinet6/in6.c Sat Jan 28 17:08:40 2017 (r312929) @@ -1962,7 +1962,6 @@ in6_if2idlen(struct ifnet *ifp) case IFT_ETHER: /* RFC2464 */ case IFT_PROPVIRTUAL: /* XXX: no RFC. treat it as ether */ case IFT_L2VLAN: /* ditto */ - case IFT_IEEE80211: /* ditto */ case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */ case IFT_INFINIBAND: return (64); Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/netinet6/in6_ifattach.c Sat Jan 28 17:08:40 2017 (r312929) @@ -276,7 +276,6 @@ found: case IFT_ISO88025: case IFT_ATM: case IFT_IEEE1394: - case IFT_IEEE80211: /* IEEE802/EUI64 cases - what others? */ /* IEEE1394 uses 16byte length address starting with EUI64 */ if (addrlen > 8) Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/netinet6/nd6.c Sat Jan 28 17:08:40 2017 (r312929) @@ -2259,7 +2259,6 @@ nd6_resolve(struct ifnet *ifp, int is_gw case IFT_ETHER: case IFT_FDDI: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_BRIDGE: case IFT_ISO88025: ETHER_MAP_IPV6_MULTICAST(&dst6->sin6_addr, @@ -2527,7 +2526,6 @@ nd6_need_cache(struct ifnet *ifp) case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_INFINIBAND: case IFT_BRIDGE: case IFT_PROPVIRTUAL: Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/sys/netinet6/nd6_nbr.c Sat Jan 28 17:08:40 2017 (r312929) @@ -1086,7 +1086,6 @@ nd6_ifptomac(struct ifnet *ifp) case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_INFINIBAND: case IFT_BRIDGE: case IFT_ISO88025: @@ -1457,7 +1456,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, s case IFT_FDDI: case IFT_ATM: case IFT_IEEE1394: - case IFT_IEEE80211: case IFT_INFINIBAND: in6 = ia->ia_addr.sin6_addr; if (in6_get_hw_ifid(ifp, &in6) == 0 && Modified: head/usr.sbin/rtsold/if.c ============================================================================== --- head/usr.sbin/rtsold/if.c Sat Jan 28 16:40:51 2017 (r312928) +++ head/usr.sbin/rtsold/if.c Sat Jan 28 17:08:40 2017 (r312929) @@ -247,7 +247,6 @@ lladdropt_length(struct sockaddr_dl *sdl { switch (sdl->sdl_type) { case IFT_ETHER: - case IFT_IEEE80211: return (ROUNDUP8(ETHER_ADDR_LEN + 2)); default: return (0); @@ -263,7 +262,6 @@ lladdropt_fill(struct sockaddr_dl *sdl, switch (sdl->sdl_type) { case IFT_ETHER: - case IFT_IEEE80211: ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3; addr = (char *)(ndopt + 1); memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); From owner-svn-src-all@freebsd.org Sat Jan 28 17:37: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 0F494CC4D30; Sat, 28 Jan 2017 17:37:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B75DE1AB0; Sat, 28 Jan 2017 17:37:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHbpM2094121; Sat, 28 Jan 2017 17:37:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHbpKP094120; Sat, 28 Jan 2017 17:37:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281737.v0SHbpKP094120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 17:37: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: r312930 - stable/11/lib/libstand X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:37:53 -0000 Author: bapt Date: Sat Jan 28 17:37:51 2017 New Revision: 312930 URL: https://svnweb.freebsd.org/changeset/base/312930 Log: MFC r311659: remove network mask calculation for Classful network Nowadays it's not necessary to compute network mask from the IP address and compare to given by DHCP. Submitted by: kczekirda Reviewed by: glebius, bapt Sponsored by: Oktawave MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D8740 Modified: stable/11/lib/libstand/bootp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/bootp.c ============================================================================== --- stable/11/lib/libstand/bootp.c Sat Jan 28 17:08:40 2017 (r312929) +++ stable/11/lib/libstand/bootp.c Sat Jan 28 17:37:51 2017 (r312930) @@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$"); struct in_addr servip; -static n_long nmask, smask; - static time_t bot; static char vm_rfc1048[4] = VM_RFC1048; @@ -223,30 +221,19 @@ bootp(sock, flag) bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile)); bootfile[sizeof(bootfile) - 1] = '\0'; - if (IN_CLASSA(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSB_NET); - else - nmask = htonl(IN_CLASSC_NET); -#ifdef BOOTP_DEBUG - if (debug) - printf("'native netmask' is %s\n", intoa(nmask)); -#endif - - /* Check subnet mask against net mask; toss if bogus */ - if ((nmask & smask) != nmask) { + if (!netmask) { + if (IN_CLASSA(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSB_NET); + else + netmask = htonl(IN_CLASSC_NET); #ifdef BOOTP_DEBUG if (debug) - printf("subnet mask (%s) bad\n", intoa(smask)); + printf("'native netmask' is %s\n", intoa(netmask)); #endif - smask = 0; } - /* Get subnet (or natural net) mask */ - netmask = nmask; - if (smask) - netmask = smask; #ifdef BOOTP_DEBUG if (debug) printf("mask: %s\n", intoa(netmask)); @@ -385,7 +372,7 @@ vend_rfc1048(cp, len) break; if (tag == TAG_SUBNET_MASK) { - bcopy(cp, &smask, sizeof(smask)); + bcopy(cp, &netmask, sizeof(netmask)); } if (tag == TAG_GATEWAY) { bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr)); @@ -445,7 +432,7 @@ vend_cmu(cp) vp = (struct cmu_vend *)cp; if (vp->v_smask.s_addr != 0) { - smask = vp->v_smask.s_addr; + netmask = vp->v_smask.s_addr; } if (vp->v_dgate.s_addr != 0) { gateip = vp->v_dgate; From owner-svn-src-all@freebsd.org Sat Jan 28 17:40: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 DF64DCC4E25; Sat, 28 Jan 2017 17:40:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2F981C57; Sat, 28 Jan 2017 17:40:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHebjj094373; Sat, 28 Jan 2017 17:40:37 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHebel094370; Sat, 28 Jan 2017 17:40:37 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201701281740.v0SHebel094370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 28 Jan 2017 17:40: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: r312931 - in stable/11/usr.sbin/pw: . tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:40:39 -0000 Author: bapt Date: Sat Jan 28 17:40:37 2017 New Revision: 312931 URL: https://svnweb.freebsd.org/changeset/base/312931 Log: MFC r312644, r312650 r312644: Readd a feature lost in pw(8) refactoring pw usermod foo -m It used to be able to (re)create the home directory if it didn't exists PR: 216224 Reported by: ae MFC after: 3 days r312650: Really restore the old behaviour for pw usermod -m It again reinstall missing skel files without overwriting changed one Add a regression test about it Reported by: ae MFC after: 3 days Modified: stable/11/usr.sbin/pw/psdate.c stable/11/usr.sbin/pw/pw_user.c stable/11/usr.sbin/pw/tests/pw_usermod.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/psdate.c ============================================================================== --- stable/11/usr.sbin/pw/psdate.c Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/psdate.c Sat Jan 28 17:40:37 2017 (r312931) @@ -41,12 +41,8 @@ static const char rcsid[] = static int numerics(char const * str) { - int rc = isdigit((unsigned char)*str); - if (rc) - while (isdigit((unsigned char)*str) || *str == 'x') - ++str; - return rc && !*str; + return (str[strspn(str, "0123456789x")] == '\0'); } static int Modified: stable/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/pw_user.c Sat Jan 28 17:40:37 2017 (r312931) @@ -1493,7 +1493,7 @@ pw_user_mod(int argc, char **argv, char intmax_t id = -1; int ch, fd = -1; size_t i, j; - bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome; + bool quiet, createhome, pretty, dryrun, nis, edited; bool precrypted; mode_t homemode = 0; time_t expire_days, password_days, now; @@ -1503,7 +1503,7 @@ pw_user_mod(int argc, char **argv, char passwd = NULL; class = nispasswd = NULL; quiet = createhome = pretty = dryrun = nis = precrypted = false; - edited = docreatehome = false; + edited = false; if (arg1 != NULL) { if (arg1[strspn(arg1, "0123456789")] == '\0') @@ -1704,8 +1704,6 @@ pw_user_mod(int argc, char **argv, char if (!createhome) warnx("WARNING: home `%s' does not exist", pwd->pw_dir); - else - docreatehome = true; } else if (!S_ISDIR(st.st_mode)) { warnx("WARNING: home `%s' is not a directory", pwd->pw_dir); @@ -1797,7 +1795,7 @@ pw_user_mod(int argc, char **argv, char * that this also `works' for editing users if -m is used, but * existing files will *not* be overwritten. */ - if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir && + if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { if (!skel) skel = cnf->dotdir; Modified: stable/11/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_usermod.sh Sat Jan 28 17:37:51 2017 (r312930) +++ stable/11/usr.sbin/pw/tests/pw_usermod.sh Sat Jan 28 17:40:37 2017 (r312931) @@ -253,6 +253,26 @@ user_mod_w_yes_body() { $(atf_get_srcdir)/crypt $passhash "foo" } +atf_test_case user_mod_m +user_mod_m_body() { + populate_root_etc_skel + + mkdir -p ${HOME}/home + mkdir -p ${HOME}/skel + echo "entry" > ${HOME}/skel/.file + atf_check -s exit:0 ${RPW} useradd foo + ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been created" + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -d ${HOME}/home/foo || atf_fail "Directory should have been created" + test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added" + echo "entry" > ${HOME}/skel/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added" + echo > ${HOME}/home/foo/.file2 + atf_check -s exit:0 ${RPW} usermod foo -m -k /skel + atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2 +} + atf_init_test_cases() { atf_add_test_case user_mod @@ -275,4 +295,5 @@ atf_init_test_cases() { atf_add_test_case user_mod_w_none atf_add_test_case user_mod_w_random atf_add_test_case user_mod_w_yes + atf_add_test_case user_mod_m } From owner-svn-src-all@freebsd.org Sat Jan 28 17:46: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 EA05FCC5142; Sat, 28 Jan 2017 17:46:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF4E819A; Sat, 28 Jan 2017 17:46:05 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHk4w2098252; Sat, 28 Jan 2017 17:46:04 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHk4k2098251; Sat, 28 Jan 2017 17:46:04 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201701281746.v0SHk4k2098251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 28 Jan 2017 17:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312932 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:46:06 -0000 Author: cognet Date: Sat Jan 28 17:46:04 2017 New Revision: 312932 URL: https://svnweb.freebsd.org/changeset/base/312932 Log: Use strexeq instead of needlessly branch. Suggested by: ian Modified: head/sys/arm/include/atomic-v6.h Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Sat Jan 28 17:40:37 2017 (r312931) +++ head/sys/arm/include/atomic-v6.h Sat Jan 28 17:46:04 2017 (r312932) @@ -201,9 +201,8 @@ atomic_fcmpset_32(volatile uint32_t *p, "1: mov %0, #1 \n" " ldrex %1, [%2] \n" " cmp %1, %3 \n" - " it ne \n" - " bne 2f \n" - " strex %0, %4, [%2] \n" + " it eq \n" + " strexeq %0, %4, [%2] \n" "2:" : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) : : "cc", "memory"); From owner-svn-src-all@freebsd.org Sat Jan 28 17: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 D6B96CC51F5; Sat, 28 Jan 2017 17:48:34 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6560341; Sat, 28 Jan 2017 17:48:34 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SHmXtY098428; Sat, 28 Jan 2017 17:48:33 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SHmXvJ098427; Sat, 28 Jan 2017 17:48:33 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201701281748.v0SHmXvJ098427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Sat, 28 Jan 2017 17:48:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312933 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 17:48:34 -0000 Author: cognet Date: Sat Jan 28 17:48:33 2017 New Revision: 312933 URL: https://svnweb.freebsd.org/changeset/base/312933 Log: Remove useless labels. Modified: head/sys/arm/include/atomic-v6.h Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Sat Jan 28 17:46:04 2017 (r312932) +++ head/sys/arm/include/atomic-v6.h Sat Jan 28 17:48:33 2017 (r312933) @@ -198,12 +198,11 @@ atomic_fcmpset_32(volatile uint32_t *p, int ret; __asm __volatile( - "1: mov %0, #1 \n" + " mov %0, #1 \n" " ldrex %1, [%2] \n" " cmp %1, %3 \n" " it eq \n" " strexeq %0, %4, [%2] \n" - "2:" : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) : : "cc", "memory"); *cmpval = tmp; From owner-svn-src-all@freebsd.org Sat Jan 28 20:54: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 CD3CECC63E4; Sat, 28 Jan 2017 20:54:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D6A0130; Sat, 28 Jan 2017 20:54:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0SKsiVK081240; Sat, 28 Jan 2017 20:54:44 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SKsicq081233; Sat, 28 Jan 2017 20:54:44 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201701282054.v0SKsicq081233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 28 Jan 2017 20:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312934 - in head: include lib/libthr/thread sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 20:54:45 -0000 Author: pfg Date: Sat Jan 28 20:54:43 2017 New Revision: 312934 URL: https://svnweb.freebsd.org/changeset/base/312934 Log: Make use of clang nullability attributes. Replace uses of the GCC __nonnull__ attribute with the clang nullability qualifiers. The replacement should be transparent for clang developers as the new qualifiers will produce the same warnings and will be useful for static checkers but will not cause aggressive optimizations. GCC will not produce such warnings and developers will have to use upgraded GCC ports built with the system headers from r312538. Hinted by: Apple's Libc-1158.20.4, Bionic libc MFC after: 11.1 Release Differential Revision: https://reviews.freebsd.org/D9004 Modified: head/include/err.h head/include/pthread.h head/include/signal.h head/include/stdio.h head/include/stdlib.h head/lib/libthr/thread/thr_private.h head/sys/sys/systm.h Modified: head/include/err.h ============================================================================== --- head/include/err.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/include/err.h Sat Jan 28 20:54:43 2017 (r312934) @@ -43,6 +43,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + __BEGIN_DECLS void err(int, const char *, ...) __dead2 __printf0like(2, 3); void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0); @@ -58,7 +60,8 @@ void vwarnc(int, const char *, __va_list void warnx(const char *, ...) __printflike(1, 2); void vwarnx(const char *, __va_list) __printflike(1, 0); void err_set_file(void *); -void err_set_exit(void (*)(int)); +void err_set_exit(void (* _Nullable)(int)); __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_ERR_H_ */ Modified: head/include/pthread.h ============================================================================== --- head/include/pthread.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/include/pthread.h Sat Jan 28 20:54:43 2017 (r312934) @@ -46,6 +46,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + /* * Run-time invariant values: */ @@ -147,28 +149,35 @@ struct _pthread_cleanup_info { */ __BEGIN_DECLS int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); -int pthread_attr_destroy(pthread_attr_t *); -int pthread_attr_getstack(const pthread_attr_t * __restrict, - void ** __restrict, size_t * __restrict); -int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); -int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); +int pthread_attr_destroy(pthread_attr_t * _Nonnull); +int pthread_attr_getstack( + const pthread_attr_t * _Nonnull __restrict, + void ** _Nonnull __restrict, + size_t * _Nonnull __restrict); +int pthread_attr_getstacksize(const pthread_attr_t * _Nonnull, + size_t * _Nonnull); +int pthread_attr_getguardsize(const pthread_attr_t * _Nonnull, + size_t * _Nonnull); int pthread_attr_getstackaddr(const pthread_attr_t *, void **); -int pthread_attr_getdetachstate(const pthread_attr_t *, int *); -int pthread_attr_init(pthread_attr_t *); -int pthread_attr_setstacksize(pthread_attr_t *, size_t); -int pthread_attr_setguardsize(pthread_attr_t *, size_t); -int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +int pthread_attr_getdetachstate(const pthread_attr_t * _Nonnull, + int * _Nonnull); +int pthread_attr_init(pthread_attr_t * _Nonnull); +int pthread_attr_setstacksize(pthread_attr_t * _Nonnull, size_t); +int pthread_attr_setguardsize(pthread_attr_t * _Nonnull, size_t); +int pthread_attr_setstack(pthread_attr_t * _Nonnull, void *, + size_t); int pthread_attr_setstackaddr(pthread_attr_t *, void *); -int pthread_attr_setdetachstate(pthread_attr_t *, int); -int pthread_barrier_destroy(pthread_barrier_t *); -int pthread_barrier_init(pthread_barrier_t *, +int pthread_attr_setdetachstate(pthread_attr_t * _Nonnull, int); +int pthread_barrier_destroy(pthread_barrier_t * _Nonnull); +int pthread_barrier_init(pthread_barrier_t * _Nonnull, const pthread_barrierattr_t *, unsigned); -int pthread_barrier_wait(pthread_barrier_t *); -int pthread_barrierattr_destroy(pthread_barrierattr_t *); -int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, - int *); -int pthread_barrierattr_init(pthread_barrierattr_t *); -int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); +int pthread_barrier_wait(pthread_barrier_t * _Nonnull); +int pthread_barrierattr_destroy(pthread_barrierattr_t * _Nonnull); +int pthread_barrierattr_getpshared( + const pthread_barrierattr_t * _Nonnull, int * _Nonnull); +int pthread_barrierattr_init(pthread_barrierattr_t * _Nonnull); +int pthread_barrierattr_setpshared(pthread_barrierattr_t * _Nonnull, + int); #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ { \ @@ -183,100 +192,109 @@ int pthread_barrierattr_setpshared(pthr __pthread_cleanup_pop_imp(execute); \ } -int pthread_condattr_destroy(pthread_condattr_t *); -int pthread_condattr_getclock(const pthread_condattr_t *, - clockid_t *); -int pthread_condattr_getpshared(const pthread_condattr_t *, int *); -int pthread_condattr_init(pthread_condattr_t *); -int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); -int pthread_condattr_setpshared(pthread_condattr_t *, int); -int pthread_cond_broadcast(pthread_cond_t *); -int pthread_cond_destroy(pthread_cond_t *); -int pthread_cond_init(pthread_cond_t *, +int pthread_condattr_destroy(pthread_condattr_t * _Nonnull); +int pthread_condattr_getclock(const pthread_condattr_t * _Nonnull, + clockid_t * _Nonnull); +int pthread_condattr_getpshared(const pthread_condattr_t * _Nonnull, + int * _Nonnull); +int pthread_condattr_init(pthread_condattr_t * _Nonnull); +int pthread_condattr_setclock(pthread_condattr_t * _Nonnull, + clockid_t); +int pthread_condattr_setpshared(pthread_condattr_t * _Nonnull, int); +int pthread_cond_broadcast(pthread_cond_t * _Nonnull); +int pthread_cond_destroy(pthread_cond_t * _Nonnull); +int pthread_cond_init(pthread_cond_t * _Nonnull, const pthread_condattr_t *); -int pthread_cond_signal(pthread_cond_t *); -int pthread_cond_timedwait(pthread_cond_t *, - pthread_mutex_t *__mutex, const struct timespec *) +int pthread_cond_signal(pthread_cond_t * _Nonnull); +int pthread_cond_timedwait(pthread_cond_t * _Nonnull, + pthread_mutex_t * _Nonnull __mutex, + const struct timespec * _Nonnull) __requires_exclusive(*__mutex); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *__mutex) +int pthread_cond_wait(pthread_cond_t * _Nonnull, + pthread_mutex_t * _Nonnull __mutex) __requires_exclusive(*__mutex); -int pthread_create(pthread_t *, const pthread_attr_t *, - void *(*) (void *), void *); +int pthread_create(pthread_t * _Nonnull, const pthread_attr_t *, + void *(* _Nonnull) (void *), void *); int pthread_detach(pthread_t); int pthread_equal(pthread_t, pthread_t); void pthread_exit(void *) __dead2; void *pthread_getspecific(pthread_key_t); -int pthread_getcpuclockid(pthread_t, clockid_t *); +int pthread_getcpuclockid(pthread_t, clockid_t * _Nonnull); int pthread_join(pthread_t, void **); -int pthread_key_create(pthread_key_t *, - void (*) (void *)); +int pthread_key_create(pthread_key_t * _Nonnull, + void (*) (void *)); int pthread_key_delete(pthread_key_t); -int pthread_mutexattr_init(pthread_mutexattr_t *); -int pthread_mutexattr_destroy(pthread_mutexattr_t *); -int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, - int *); -int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *); -int pthread_mutexattr_settype(pthread_mutexattr_t *, int); -int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); -int pthread_mutex_consistent(pthread_mutex_t *__mutex) - __nonnull(1) __requires_exclusive(*__mutex); -int pthread_mutex_destroy(pthread_mutex_t *__mutex) +int pthread_mutexattr_init(pthread_mutexattr_t * _Nonnull); +int pthread_mutexattr_destroy(pthread_mutexattr_t * _Nonnull); +int pthread_mutexattr_getpshared( + const pthread_mutexattr_t * _Nonnull, int * _Nonnull); +int pthread_mutexattr_gettype(pthread_mutexattr_t * _Nonnull, + int * _Nonnull); +int pthread_mutexattr_settype(pthread_mutexattr_t * _Nonnull, int); +int pthread_mutexattr_setpshared(pthread_mutexattr_t * _Nonnull, + int); +int pthread_mutex_consistent(pthread_mutex_t * _Nonnull __mutex) + __requires_exclusive(*__mutex); +int pthread_mutex_destroy(pthread_mutex_t * _Nonnull __mutex) __requires_unlocked(*__mutex); -int pthread_mutex_init(pthread_mutex_t *__mutex, - const pthread_mutexattr_t *) +int pthread_mutex_init(pthread_mutex_t * _Nonnull __mutex, + const pthread_mutexattr_t *) __requires_unlocked(*__mutex); -int pthread_mutex_lock(pthread_mutex_t *__mutex) - __locks_exclusive(*__mutex); -int pthread_mutex_trylock(pthread_mutex_t *__mutex) - __trylocks_exclusive(0, *__mutex); -int pthread_mutex_timedlock(pthread_mutex_t *__mutex, - const struct timespec *) - __trylocks_exclusive(0, *__mutex); -int pthread_mutex_unlock(pthread_mutex_t *__mutex) +int pthread_mutex_lock(pthread_mutex_t * _Nonnull __mutex) + __locks_exclusive(*__mutex); +int pthread_mutex_trylock(pthread_mutex_t * _Nonnull __mutex) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_timedlock(pthread_mutex_t * _Nonnull __mutex, + const struct timespec * _Nonnull) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_unlock(pthread_mutex_t * _Nonnull __mutex) __unlocks(*__mutex); -int pthread_once(pthread_once_t *, void (*) (void)); -int pthread_rwlock_destroy(pthread_rwlock_t *__rwlock) +int pthread_once(pthread_once_t * _Nonnull, + void (* _Nonnull) (void)); +int pthread_rwlock_destroy(pthread_rwlock_t * _Nonnull __rwlock) __requires_unlocked(*__rwlock); -int pthread_rwlock_init(pthread_rwlock_t *__rwlock, - const pthread_rwlockattr_t *) +int pthread_rwlock_init(pthread_rwlock_t * _Nonnull __rwlock, + const pthread_rwlockattr_t *) __requires_unlocked(*__rwlock); -int pthread_rwlock_rdlock(pthread_rwlock_t *__rwlock) - __locks_shared(*__rwlock); -int pthread_rwlock_timedrdlock(pthread_rwlock_t *__rwlock, - const struct timespec *) - __trylocks_shared(0, *__rwlock); -int pthread_rwlock_timedwrlock(pthread_rwlock_t *__rwlock, - const struct timespec *) - __trylocks_exclusive(0, *__rwlock); -int pthread_rwlock_tryrdlock(pthread_rwlock_t *__rwlock) - __trylocks_shared(0, *__rwlock); -int pthread_rwlock_trywrlock(pthread_rwlock_t *__rwlock) - __trylocks_exclusive(0, *__rwlock); -int pthread_rwlock_unlock(pthread_rwlock_t *__rwlock) +int pthread_rwlock_rdlock(pthread_rwlock_t * _Nonnull __rwlock) + __locks_shared(*__rwlock); +int pthread_rwlock_timedrdlock(pthread_rwlock_t * _Nonnull __rwlock, + const struct timespec * _Nonnull) + __trylocks_shared(0, *__rwlock); +int pthread_rwlock_timedwrlock(pthread_rwlock_t * _Nonnull __rwlock, + const struct timespec * _Nonnull) + __trylocks_exclusive(0, *__rwlock); +int pthread_rwlock_tryrdlock(pthread_rwlock_t * _Nonnull __rwlock) + __trylocks_shared(0, *__rwlock); +int pthread_rwlock_trywrlock(pthread_rwlock_t * _Nonnull __rwlock) + __trylocks_exclusive(0, *__rwlock); +int pthread_rwlock_unlock(pthread_rwlock_t * _Nonnull __rwlock) __unlocks(*__rwlock); -int pthread_rwlock_wrlock(pthread_rwlock_t *__rwlock) - __locks_exclusive(*__rwlock); -int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); -int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *, - int *); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, - int *); -int pthread_rwlockattr_init(pthread_rwlockattr_t *); -int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int); -int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +int pthread_rwlock_wrlock(pthread_rwlock_t * _Nonnull __rwlock) + __locks_exclusive(*__rwlock); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t * _Nonnull); +int pthread_rwlockattr_getkind_np( + const pthread_rwlockattr_t * _Nonnull, int *); +int pthread_rwlockattr_getpshared( + const pthread_rwlockattr_t * _Nonnull, int * _Nonnull); +int pthread_rwlockattr_init(pthread_rwlockattr_t * _Nonnull); +int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t * _Nonnull, + int); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t * _Nonnull, + int); pthread_t pthread_self(void); int pthread_setspecific(pthread_key_t, const void *); -int pthread_spin_init(pthread_spinlock_t *__spin, int) +int pthread_spin_init(pthread_spinlock_t * _Nonnull __spin, int) __requires_unlocked(*__spin); -int pthread_spin_destroy(pthread_spinlock_t *__spin) +int pthread_spin_destroy(pthread_spinlock_t * _Nonnull __spin) __requires_unlocked(*__spin); -int pthread_spin_lock(pthread_spinlock_t *__spin) - __locks_exclusive(*__spin); -int pthread_spin_trylock(pthread_spinlock_t *__spin) - __trylocks_exclusive(0, *__spin); -int pthread_spin_unlock(pthread_spinlock_t *__spin) - __unlocks(*__spin); +int pthread_spin_lock(pthread_spinlock_t * _Nonnull __spin) + __locks_exclusive(*__spin); +int pthread_spin_trylock(pthread_spinlock_t * _Nonnull __spin) + __trylocks_exclusive(0, *__spin); +int pthread_spin_unlock(pthread_spinlock_t * _Nonnull __spin) + __unlocks(*__spin); int pthread_cancel(pthread_t); int pthread_setcancelstate(int, int *); int pthread_setcanceltype(int, int *); @@ -288,35 +306,36 @@ int pthread_setprio(pthread_t, int); void pthread_yield(void); #endif -int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, - int *); -int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, - int); +int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); int pthread_mutex_getprioceiling(pthread_mutex_t *, int *); int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); -int pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, - int *__restrict) __nonnull_all; -int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) - __nonnull(1); +int pthread_mutexattr_getrobust( + pthread_mutexattr_t * _Nonnull __restrict, + int * _Nonnull __restrict); +int pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, + int); int pthread_attr_getinheritsched(const pthread_attr_t *, int *); -int pthread_attr_getschedparam(const pthread_attr_t *, - struct sched_param *); -int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); -int pthread_attr_getscope(const pthread_attr_t *, int *); +int pthread_attr_getschedparam(const pthread_attr_t * _Nonnull, + struct sched_param * _Nonnull); +int pthread_attr_getschedpolicy(const pthread_attr_t * _Nonnull, + int * _Nonnull); +int pthread_attr_getscope(const pthread_attr_t * _Nonnull, + int * _Nonnull); int pthread_attr_setinheritsched(pthread_attr_t *, int); -int pthread_attr_setschedparam(pthread_attr_t *, - const struct sched_param *); -int pthread_attr_setschedpolicy(pthread_attr_t *, int); -int pthread_attr_setscope(pthread_attr_t *, int); -int pthread_getschedparam(pthread_t pthread, int *, - struct sched_param *); +int pthread_attr_setschedparam(pthread_attr_t * _Nonnull, + const struct sched_param * _Nonnull); +int pthread_attr_setschedpolicy(pthread_attr_t * _Nonnull, int); +int pthread_attr_setscope(pthread_attr_t * _Nonnull, int); +int pthread_getschedparam(pthread_t pthread, int * _Nonnull, + struct sched_param * _Nonnull); int pthread_setschedparam(pthread_t, int, - const struct sched_param *); + const struct sched_param * _Nonnull); #if __XSI_VISIBLE int pthread_getconcurrency(void); int pthread_setconcurrency(int); @@ -326,5 +345,6 @@ void __pthread_cleanup_push_imp(void (* struct _pthread_cleanup_info *); void __pthread_cleanup_pop_imp(int); __END_DECLS +__NULLABILITY_PRAGMA_POP -#endif +#endif /* _PTHREAD_H_ */ Modified: head/include/signal.h ============================================================================== --- head/include/signal.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/include/signal.h Sat Jan 28 20:54:43 2017 (r312934) @@ -41,6 +41,8 @@ #include #endif +__NULLABILITY_PRAGMA_PUSH + #if __BSD_VISIBLE /* * XXX should enlarge these, if only to give empty names instead of bounds @@ -82,10 +84,11 @@ int sigdelset(sigset_t *, int); int sigemptyset(sigset_t *); int sigfillset(sigset_t *); int sigismember(const sigset_t *, int); -int sigpending(sigset_t *); +int sigpending(sigset_t * _Nonnull); int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); -int sigsuspend(const sigset_t *); -int sigwait(const sigset_t * __restrict, int * __restrict); +int sigsuspend(const sigset_t * _Nonnull); +int sigwait(const sigset_t * _Nonnull __restrict, + int * _Nonnull __restrict); #endif #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600 @@ -104,7 +107,7 @@ int sighold(int); int sigignore(int); int sigpause(int); int sigrelse(int); -void (*sigset(int, void (*)(int)))(int); +void (* _Nullable sigset(int, void (* _Nullable)(int)))(int); int xsi_sigpause(int); #endif @@ -124,5 +127,6 @@ int sigstack(const struct sigstack *, st int sigvec(int, struct sigvec *, struct sigvec *); #endif __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_SIGNAL_H_ */ Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/include/stdio.h Sat Jan 28 20:54:43 2017 (r312934) @@ -40,6 +40,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + typedef __off_t fpos_t; #ifndef _SIZE_T_DECLARED @@ -123,10 +125,10 @@ struct __sFILE { /* operations */ void *_cookie; /* (*) cookie passed to io functions */ - int (*_close)(void *); - int (*_read)(void *, char *, int); - fpos_t (*_seek)(void *, fpos_t, int); - int (*_write)(void *, const char *, int); + int (* _Nullable _close)(void *); + int (* _Nullable _read)(void *, char *, int); + fpos_t (* _Nullable _seek)(void *, fpos_t, int); + int (* _Nullable _write)(void *, const char *, int); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -390,10 +392,10 @@ extern const char * const sys_errlist[]; * Stdio function-access interface. */ FILE *funopen(const void *, - int (*)(void *, char *, int), - int (*)(void *, const char *, int), - fpos_t (*)(void *, fpos_t, int), - int (*)(void *)); + int (* _Nullable)(void *, char *, int), + int (* _Nullable)(void *, const char *, int), + fpos_t (* _Nullable)(void *, fpos_t, int), + int (* _Nullable)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) @@ -506,4 +508,6 @@ extern int __isthreaded; #endif /* __cplusplus */ __END_DECLS +__NULLABILITY_PRAGMA_POP + #endif /* !_STDIO_H_ */ Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/include/stdlib.h Sat Jan 28 20:54:43 2017 (r312934) @@ -37,6 +37,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; @@ -81,12 +83,12 @@ extern int ___mb_cur_max(void); _Noreturn void abort(void); int abs(int) __pure2; -int atexit(void (*)(void)); +int atexit(void (* _Nonnull)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, - size_t, int (*)(const void *, const void *)); + size_t, int (*)(const void * _Nonnull, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); div_t div(int, int) __pure2; @@ -100,7 +102,7 @@ int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); void qsort(void *, size_t, size_t, - int (*)(const void *, const void *)); + int (* _Nonnull)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __result_use_check __alloc_size(2); void srand(unsigned); @@ -256,9 +258,9 @@ void arc4random_stir(void); __uint32_t arc4random_uniform(__uint32_t); #ifdef __BLOCKS__ -int atexit_b(void (^)(void)); +int atexit_b(void (^ _Nonnull)(void)); void *bsearch_b(const void *, const void *, size_t, - size_t, int (^)(const void *, const void *)); + size_t, int (^ _Nonnull)(const void *, const void *)); #endif char *getbsize(int *, long *); /* getcap(3) functions */ @@ -282,11 +284,13 @@ int getloadavg(double [], int); const char * getprogname(void); -int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); +int heapsort(void *, size_t, size_t, + int (* _Nonnull)(const void *, const void *)); #ifdef __BLOCKS__ -int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); +int heapsort_b(void *, size_t, size_t, + int (^ _Nonnull)(const void *, const void *)); void qsort_b(void *, size_t, size_t, - int (^)(const void *, const void *)); + int (^ _Nonnull)(const void *, const void *)); #endif int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); @@ -320,5 +324,6 @@ __uint64_t extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_STDLIB_H_ */ Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/lib/libthr/thread/thr_private.h Sat Jan 28 20:54:43 2017 (r312934) @@ -53,6 +53,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + #define SYM_FB10(sym) __CONCAT(sym, _fb10) #define SYM_FBP10(sym) __CONCAT(sym, _fbp10) #define WEAK_REF(sym, alias) __weak_reference(sym, alias) @@ -835,11 +837,10 @@ void _pthread_cleanup_pop(int); void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; void _pthread_cancel_enter(int maycancel); void _pthread_cancel_leave(int maycancel); -int _pthread_mutex_consistent(pthread_mutex_t *) __nonnull(1); -int _pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, - int *__restrict) __nonnull_all; -int _pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) - __nonnull(1); +int _pthread_mutex_consistent(pthread_mutex_t * _Nonnull); +int _pthread_mutexattr_getrobust(pthread_mutexattr_t * _Nonnull __restrict, + int * _Nonnull __restrict); +int _pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, int); /* #include */ #ifdef _SYS_FCNTL_H_ @@ -984,5 +985,6 @@ void __thr_pshared_atfork_pre(void) __hi void __thr_pshared_atfork_post(void) __hidden; __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_THR_PRIVATE_H */ Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sat Jan 28 17:48:33 2017 (r312933) +++ head/sys/sys/systm.h Sat Jan 28 20:54:43 2017 (r312934) @@ -45,6 +45,8 @@ #include #include /* for people using printf mainly */ +__NULLABILITY_PRAGMA_PUSH + extern int cold; /* nonzero if we are doing a cold boot */ extern int suspend_blocked; /* block suspend due to pending shutdown */ extern int rebooting; /* kern_reboot() has been called. */ @@ -233,12 +235,12 @@ int vsnprintf(char *, size_t, const char int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); -long strtol(const char *, char **, int) __nonnull(1); -u_long strtoul(const char *, char **, int) __nonnull(1); -quad_t strtoq(const char *, char **, int) __nonnull(1); -u_quad_t strtouq(const char *, char **, int) __nonnull(1); +int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3); +int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0); +long strtol(const char *, char **, int); +u_long strtoul(const char *, char **, int); +quad_t strtoq(const char *, char **, int); +u_quad_t strtouq(const char *, char **, int); void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4); void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0); void hexdump(const void *ptr, int length, const char *hdr, int flags); @@ -249,27 +251,27 @@ void hexdump(const void *ptr, int length #define HD_OMIT_CHARS (1 << 18) #define ovbcopy(f, t, l) bcopy((f), (t), (l)) -void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2); -void bzero(void *buf, size_t len) __nonnull(1); -void explicit_bzero(void *, size_t) __nonnull(1); - -void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2); -void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2); - -int copystr(const void * __restrict kfaddr, void * __restrict kdaddr, - size_t len, size_t * __restrict lencopied) - __nonnull(1) __nonnull(2); -int copyinstr(const void * __restrict udaddr, void * __restrict kaddr, - size_t len, size_t * __restrict lencopied) - __nonnull(1) __nonnull(2); -int copyin(const void * __restrict udaddr, void * __restrict kaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyout(const void * __restrict kaddr, void * __restrict udaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, - size_t len) __nonnull(1) __nonnull(2); +void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); +void bzero(void * _Nonnull buf, size_t len); +void explicit_bzero(void * _Nonnull, size_t); + +void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); +void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); + +int copystr(const void * _Nonnull __restrict kfaddr, + void * _Nonnull __restrict kdaddr, size_t len, + size_t * __restrict lencopied); +int copyinstr(const void * __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len, + size_t * __restrict lencopied); +int copyin(const void * _Nonnull __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len); +int copyin_nofault(const void * _Nonnull __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len); +int copyout(const void * _Nonnull __restrict kaddr, + void * _Nonnull __restrict udaddr, size_t len); +int copyout_nofault(const void * _Nonnull __restrict kaddr, + void * _Nonnull __restrict udaddr, size_t len); int fubyte(volatile const void *base); long fuword(volatile const void *base); @@ -380,16 +382,16 @@ static __inline void splx(intrmask_t ip * Common `proc' functions are declared here so that proc.h can be included * less often. */ -int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg, - sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); +int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri, + const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ (flags)) -int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg, - sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); +int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx, + const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep_spin(chan, mtx, wmesg, timo) \ msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ 0, C_HARDCLOCK) @@ -402,8 +404,8 @@ int pause_sbt(const char *wmesg, sbintim 0, C_HARDCLOCK) #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) -void wakeup(void *chan) __nonnull(1); -void wakeup_one(void *chan) __nonnull(1); +void wakeup(void * chan); +void wakeup_one(void * chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning @@ -451,4 +453,6 @@ extern void (*softdep_ast_cleanup)(void) void counted_warning(unsigned *counter, const char *msg); +__NULLABILITY_PRAGMA_POP + #endif /* !_SYS_SYSTM_H_ */ From owner-svn-src-all@freebsd.org Sat Jan 28 23:41: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 9CFB9CC53FC; Sat, 28 Jan 2017 23:41: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 6CE48D89; Sat, 28 Jan 2017 23:41: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 v0SNfcW9049113; Sat, 28 Jan 2017 23:41:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SNfcx2049112; Sat, 28 Jan 2017 23:41:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701282341.v0SNfcx2049112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 28 Jan 2017 23:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312935 - head/sys/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 23:41:39 -0000 Author: ngie Date: Sat Jan 28 23:41:38 2017 New Revision: 312935 URL: https://svnweb.freebsd.org/changeset/base/312935 Log: Remove duplicate bhnd SUBDIR entry MFC after: 1 week PR: 216413 Reported by: mail@fbsd.e4m.org Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Jan 28 20:54:43 2017 (r312934) +++ head/sys/modules/Makefile Sat Jan 28 23:41:38 2017 (r312935) @@ -51,7 +51,6 @@ SUBDIR= \ ${_auxio} \ ${_bce} \ bfe \ - bhnd \ bge \ bhnd \ ${_bxe} \ From owner-svn-src-all@freebsd.org Sat Jan 28 23:47: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 8EFEBCC5688; Sat, 28 Jan 2017 23:47: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 5BD3B1022; Sat, 28 Jan 2017 23:47: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 v0SNlHJ6051501; Sat, 28 Jan 2017 23:47:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SNlHF1051500; Sat, 28 Jan 2017 23:47:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701282347.v0SNlHF1051500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 28 Jan 2017 23:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312936 - head/sys/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 23:47:18 -0000 Author: ngie Date: Sat Jan 28 23:47:17 2017 New Revision: 312936 URL: https://svnweb.freebsd.org/changeset/base/312936 Log: Garbage collect pc98-only variables still referenced in sys/modules/Makefile These should have been removed with r312910 Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Jan 28 23:41:38 2017 (r312935) +++ head/sys/modules/Makefile Sat Jan 28 23:47:17 2017 (r312936) @@ -64,8 +64,6 @@ SUBDIR= \ bwn_pci \ ${_bytgpio} \ cam \ - ${_canbepm} \ - ${_canbus} \ ${_cardbus} \ ${_carp} \ cas \ @@ -91,7 +89,6 @@ SUBDIR= \ ${_crypto} \ ${_cryptodev} \ ${_cs} \ - ${_ct} \ ${_ctau} \ ctl \ ${_cxgb} \ @@ -295,7 +292,6 @@ SUBDIR= \ ${_pflog} \ ${_pfsync} \ plip \ - ${_pmc} \ ${_pms} \ ppbus \ ppc \ @@ -344,7 +340,6 @@ SUBDIR= \ sk \ smbfs \ sn \ - ${_snc} \ snp \ sound \ ${_speaker} \ From owner-svn-src-all@freebsd.org Sat Jan 28 23:51: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 3B52ECC57F0; Sat, 28 Jan 2017 23:51: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 0B30612BB; Sat, 28 Jan 2017 23:51: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 v0SNp4hY053807; Sat, 28 Jan 2017 23:51:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SNp4KY053806; Sat, 28 Jan 2017 23:51:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701282351.v0SNp4KY053806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 28 Jan 2017 23:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312937 - head/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 23:51:05 -0000 Author: ngie Date: Sat Jan 28 23:51:03 2017 New Revision: 312937 URL: https://svnweb.freebsd.org/changeset/base/312937 Log: Fix typo in lib/Makefile The SUBDIR_DEPEND variable should be for librpcsec_gss, not liblibrpc_gss MFC after: 1 week PR: 216409 Reported by: mail@fbsd.e4m.org Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sat Jan 28 23:47:17 2017 (r312936) +++ head/lib/Makefile Sat Jan 28 23:51:03 2017 (r312937) @@ -106,7 +106,7 @@ SUBDIR_DEPEND_libdevstat= libkvm SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil SUBDIR_DEPEND_libedit= ncurses SUBDIR_DEPEND_libgeom= libexpat libsbuf -SUBDIR_DEPEND_liblibrpcsec_gss= libgssapi +SUBDIR_DEPEND_librpcsec_gss= libgssapi SUBDIR_DEPEND_libmagic= libz SUBDIR_DEPEND_libmemstat= libkvm SUBDIR_DEPEND_libopie= libmd From owner-svn-src-all@freebsd.org Sat Jan 28 23:58: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 B7210CC5C24; Sat, 28 Jan 2017 23:58: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 6D57F1794; Sat, 28 Jan 2017 23:58: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 v0SNwH9W055558; Sat, 28 Jan 2017 23:58:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0SNwHo6055555; Sat, 28 Jan 2017 23:58:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201701282358.v0SNwHo6055555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 28 Jan 2017 23:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312938 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Jan 2017 23:58:18 -0000 Author: ngie Date: Sat Jan 28 23:58:17 2017 New Revision: 312938 URL: https://svnweb.freebsd.org/changeset/base/312938 Log: Update TARGET/TARGET_ARCH examples to use arm64/aarch64 instead of i386/pc98 pc98 support was removed in r312910 Modified: head/share/man/man7/build.7 head/share/man/man7/release.7 Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Sat Jan 28 23:51:03 2017 (r312937) +++ head/share/man/man7/build.7 Sat Jan 28 23:58:17 2017 (r312938) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 20, 2016 +.Dd January 28, 2017 .Dt BUILD 7 .Os .Sh NAME @@ -517,10 +517,10 @@ This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. -For example, cross-building for PC98 machines requires -.Va TARGET_ARCH Ns = Ns Li i386 +For example, cross-building for ARM64 machines requires +.Va TARGET_ARCH Ns = Ns Li aarch64 and -.Va TARGET Ns = Ns Li pc98 . +.Va TARGET Ns = Ns Li arm64 . If not set, .Va TARGET defaults to the current hardware platform. Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Sat Jan 28 23:51:03 2017 (r312937) +++ head/share/man/man7/release.7 Sat Jan 28 23:58:17 2017 (r312938) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2015 +.Dd January 28, 2017 .Dt RELEASE 7 .Os .Sh NAME @@ -620,10 +620,10 @@ This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. -For example, cross-building for PC98 machines requires -.Ev TARGET_ARCH Ns = Ns Li i386 +For example, cross-building for ARM64 machines requires +.Ev TARGET_ARCH Ns = Ns Li aarch64 and -.Ev TARGET Ns = Ns Li pc98 . +.Ev TARGET Ns = Ns Li arm64 . If not set, .Ev TARGET defaults to the current hardware platform.