From owner-svn-src-all@freebsd.org Sun Sep 27 01:06:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E7ACA0A2EA; Sun, 27 Sep 2015 01:06:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4588D2D9; Sun, 27 Sep 2015 01:06:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R16kDC087500; Sun, 27 Sep 2015 01:06:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R16kIY087499; Sun, 27 Sep 2015 01:06:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509270106.t8R16kIY087499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Sep 2015 01:06: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: r288282 - stable/10/sys/fs/fifofs 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:06:46 -0000 Author: kib Date: Sun Sep 27 01:06:45 2015 New Revision: 288282 URL: https://svnweb.freebsd.org/changeset/base/288282 Log: MFC r288044: Ensure that when a blockable open of fifo returns success, a valid file descriptor opened for complimentary access exists as well. Modified: stable/10/sys/fs/fifofs/fifo_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/10/sys/fs/fifofs/fifo_vnops.c Sat Sep 26 22:57:10 2015 (r288281) +++ stable/10/sys/fs/fifofs/fifo_vnops.c Sun Sep 27 01:06:45 2015 (r288282) @@ -64,6 +64,8 @@ struct fifoinfo { struct pipe *fi_pipe; long fi_readers; long fi_writers; + u_int fi_rgen; + u_int fi_wgen; }; static vop_print_t fifo_print; @@ -137,6 +139,7 @@ fifo_open(ap) struct thread *td; struct fifoinfo *fip; struct pipe *fpipe; + u_int gen; int error, stops_deferred; vp = ap->a_vp; @@ -164,6 +167,7 @@ fifo_open(ap) PIPE_LOCK(fpipe); if (ap->a_mode & FREAD) { fip->fi_readers++; + fip->fi_rgen++; if (fip->fi_readers == 1) { fpipe->pipe_state &= ~PIPE_EOF; if (fip->fi_writers > 0) @@ -179,6 +183,7 @@ fifo_open(ap) return (ENXIO); } fip->fi_writers++; + fip->fi_wgen++; if (fip->fi_writers == 1) { fpipe->pipe_state &= ~PIPE_EOF; if (fip->fi_readers > 0) @@ -187,6 +192,7 @@ fifo_open(ap) } if ((ap->a_mode & O_NONBLOCK) == 0) { if ((ap->a_mode & FREAD) && fip->fi_writers == 0) { + gen = fip->fi_wgen; VOP_UNLOCK(vp, 0); stops_deferred = sigallowstop(); error = msleep(&fip->fi_readers, PIPE_MTX(fpipe), @@ -194,7 +200,7 @@ fifo_open(ap) if (stops_deferred) sigdeferstop(); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (error) { + if (error != 0 && gen == fip->fi_wgen) { fip->fi_readers--; if (fip->fi_readers == 0) { PIPE_LOCK(fpipe); @@ -214,6 +220,7 @@ fifo_open(ap) */ } if ((ap->a_mode & FWRITE) && fip->fi_readers == 0) { + gen = fip->fi_rgen; VOP_UNLOCK(vp, 0); stops_deferred = sigallowstop(); error = msleep(&fip->fi_writers, PIPE_MTX(fpipe), @@ -221,7 +228,7 @@ fifo_open(ap) if (stops_deferred) sigdeferstop(); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (error) { + if (error != 0 && gen == fip->fi_rgen) { fip->fi_writers--; if (fip->fi_writers == 0) { PIPE_LOCK(fpipe); From owner-svn-src-all@freebsd.org Sun Sep 27 01:15:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24DD2A0A8E7; Sun, 27 Sep 2015 01:15:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 161729C6; Sun, 27 Sep 2015 01:15:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1FH3I091603; Sun, 27 Sep 2015 01:15:17 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1FHu7091602; Sun, 27 Sep 2015 01:15:17 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270115.t8R1FHu7091602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 01:15: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: r288283 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:15:18 -0000 Author: alc Date: Sun Sep 27 01:15:17 2015 New Revision: 288283 URL: https://svnweb.freebsd.org/changeset/base/288283 Log: MFC r287944 Eliminate (many) unnecessary calls to pmap_remove_all(). Modified: stable/10/sys/vm/vm_page.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Sun Sep 27 01:06:45 2015 (r288282) +++ stable/10/sys/vm/vm_page.c Sun Sep 27 01:15:17 2015 (r288283) @@ -3009,7 +3009,8 @@ vm_page_set_invalid(vm_page_t m, int bas bits = VM_PAGE_BITS_ALL; else bits = vm_page_bits(base, size); - if (m->valid == VM_PAGE_BITS_ALL && bits != 0) + if (object->ref_count != 0 && m->valid == VM_PAGE_BITS_ALL && + bits != 0) pmap_remove_all(m); KASSERT((bits == 0 && m->valid == VM_PAGE_BITS_ALL) || !pmap_page_is_mapped(m), From owner-svn-src-all@freebsd.org Sun Sep 27 01:19:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C8DFA0AAC4; Sun, 27 Sep 2015 01:19:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D645B6A; Sun, 27 Sep 2015 01:19:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1JhTG091855; Sun, 27 Sep 2015 01:19:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1Jhwv091854; Sun, 27 Sep 2015 01:19:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509270119.t8R1Jhwv091854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Sep 2015 01:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288284 - stable/10/sys/dev/uart 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:19:43 -0000 Author: mav Date: Sun Sep 27 01:19:42 2015 New Revision: 288284 URL: https://svnweb.freebsd.org/changeset/base/288284 Log: MFC r287747: Add ID for Intel Panther Point KT Controller Found on ASUS P8Q77-M motherboard. Submitted by: Dmitry Luhtionov Modified: stable/10/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/10/sys/dev/uart/uart_bus_pci.c Sun Sep 27 01:15:17 2015 (r288283) +++ stable/10/sys/dev/uart/uart_bus_pci.c Sun Sep 27 01:19:42 2015 (r288284) @@ -120,6 +120,7 @@ static const struct pci_id pci_ns8250_id 8 * DEFAULT_RCLK }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, { 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", 0x10 }, +{ 0x8086, 0x1e3d, 0xffff, 0, "Intel Panther Point KT Controller", 0x10 }, { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, From owner-svn-src-all@freebsd.org Sun Sep 27 01:20:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A526A0AB7E; Sun, 27 Sep 2015 01:20:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B55ED40; Sun, 27 Sep 2015 01:20:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1Ktq7095071; Sun, 27 Sep 2015 01:20:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1Kt63095070; Sun, 27 Sep 2015 01:20:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509270120.t8R1Kt63095070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Sep 2015 01:20:55 +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: r288285 - stable/9/sys/dev/uart 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:20:56 -0000 Author: mav Date: Sun Sep 27 01:20:55 2015 New Revision: 288285 URL: https://svnweb.freebsd.org/changeset/base/288285 Log: MFC r287747: Add ID for Intel Panther Point KT Controller Found on ASUS P8Q77-M motherboard. Submitted by: Dmitry Luhtionov Modified: stable/9/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_pci.c Sun Sep 27 01:19:42 2015 (r288284) +++ stable/9/sys/dev/uart/uart_bus_pci.c Sun Sep 27 01:20:55 2015 (r288285) @@ -120,6 +120,7 @@ static const struct pci_id pci_ns8250_id 8 * DEFAULT_RCLK }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, { 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", 0x10 }, +{ 0x8086, 0x1e3d, 0xffff, 0, "Intel Panther Point KT Controller", 0x10 }, { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, From owner-svn-src-all@freebsd.org Sun Sep 27 01:26:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8043A9CF025; Sun, 27 Sep 2015 01:26:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71814155; Sun, 27 Sep 2015 01:26:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1QgvK095879; Sun, 27 Sep 2015 01:26:42 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1QgK8095878; Sun, 27 Sep 2015 01:26:42 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270126.t8R1QgK8095878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 01:26:42 +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: r288286 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:26:42 -0000 Author: alc Date: Sun Sep 27 01:26:41 2015 New Revision: 288286 URL: https://svnweb.freebsd.org/changeset/base/288286 Log: MFC r284654 Avoid pmap_is_modified() on pages that can't be mapped. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sun Sep 27 01:20:55 2015 (r288285) +++ stable/10/sys/vm/vm_pageout.c Sun Sep 27 01:26:41 2015 (r288286) @@ -1115,9 +1115,11 @@ vm_pageout_scan(struct vm_domain *vmd, i * then the page may still be modified until the last of those * mappings are removed. */ - vm_page_test_dirty(m); - if (m->dirty == 0 && object->ref_count != 0) - pmap_remove_all(m); + if (object->ref_count != 0) { + vm_page_test_dirty(m); + if (m->dirty == 0) + pmap_remove_all(m); + } if (m->valid == 0) { /* From owner-svn-src-all@freebsd.org Sun Sep 27 01:33:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6BAD9CF5F8; Sun, 27 Sep 2015 01:33:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5832809; Sun, 27 Sep 2015 01:33:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1XlLe099862; Sun, 27 Sep 2015 01:33:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1Xix6099851; Sun, 27 Sep 2015 01:33:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509270133.t8R1Xix6099851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Sep 2015 01:33:44 +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: r288287 - in stable/10/sys: amd64/amd64 arm/arm i386/i386 ia64/ia64 kern mips/mips powerpc/powerpc sparc64/sparc64 sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:33:47 -0000 Author: kib Date: Sun Sep 27 01:33:43 2015 New Revision: 288287 URL: https://svnweb.freebsd.org/changeset/base/288287 Log: MFC r288000: Add support for weak symbols to the kernel linkers. Modified: stable/10/sys/amd64/amd64/elf_machdep.c stable/10/sys/arm/arm/elf_machdep.c stable/10/sys/i386/i386/elf_machdep.c stable/10/sys/ia64/ia64/elf_machdep.c stable/10/sys/kern/link_elf.c stable/10/sys/kern/link_elf_obj.c stable/10/sys/mips/mips/elf_machdep.c stable/10/sys/powerpc/powerpc/elf32_machdep.c stable/10/sys/powerpc/powerpc/elf64_machdep.c stable/10/sys/sparc64/sparc64/elf_machdep.c stable/10/sys/sys/linker.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/amd64/amd64/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -167,6 +167,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -202,29 +203,29 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_X86_64_64: /* S + A */ - addr = lookup(lf, symidx, 1); + error = lookup(lf, symidx, 1, &addr); val = addr + addend; - if (addr == 0) + if (error != 0) return -1; if (*where != val) *where = val; break; case R_X86_64_PC32: /* S + A - P */ - addr = lookup(lf, symidx, 1); + error = lookup(lf, symidx, 1, &addr); where32 = (Elf32_Addr *)where; val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where); - if (addr == 0) + if (error != 0) return -1; if (*where32 != val32) *where32 = val32; break; case R_X86_64_32S: /* S + A sign extend */ - addr = lookup(lf, symidx, 1); + error = lookup(lf, symidx, 1, &addr); val32 = (Elf32_Addr)(addr + addend); where32 = (Elf32_Addr *)where; - if (addr == 0) + if (error != 0) return -1; if (*where32 != val32) *where32 = val32; @@ -241,8 +242,8 @@ elf_reloc_internal(linker_file_t lf, Elf case R_X86_64_GLOB_DAT: /* S */ case R_X86_64_JMP_SLOT: /* XXX need addend + offset */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; if (*where != addr) *where = addr; Modified: stable/10/sys/arm/arm/elf_machdep.c ============================================================================== --- stable/10/sys/arm/arm/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/arm/arm/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -132,6 +132,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Word rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -167,8 +168,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_ARM_ABS32: - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; *where += addr; break; @@ -183,8 +184,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_ARM_JUMP_SLOT: - addr = lookup(lf, symidx, 1); - if (addr) { + error = lookup(lf, symidx, 1, &addr); + if (error == 0) { *where = addr; return (0); } Modified: stable/10/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/10/sys/i386/i386/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/i386/i386/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -177,6 +177,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Word rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -212,8 +213,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_386_32: /* S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; addr += addend; if (*where != addr) @@ -221,8 +222,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_386_PC32: /* S + A - P */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; addr += addend - (Elf_Addr)where; if (*where != addr) @@ -239,8 +240,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_386_GLOB_DAT: /* S */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; if (*where != addr) *where = addr; Modified: stable/10/sys/ia64/ia64/elf_machdep.c ============================================================================== --- stable/10/sys/ia64/ia64/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/ia64/ia64/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -127,17 +127,18 @@ elf64_dump_thread(struct thread *td, voi } -static Elf_Addr -lookup_fdesc(linker_file_t lf, Elf_Size symidx, elf_lookup_fn lookup) +static int +lookup_fdesc(linker_file_t lf, Elf_Size symidx, elf_lookup_fn lookup, + Elf_Addr *addr1) { linker_file_t top; Elf_Addr addr; const char *symname; - int i; + int i, error; static int eot = 0; - addr = lookup(lf, symidx, 0); - if (addr == 0) { + error = lookup(lf, symidx, 0, &addr); + if (error != 0) { top = lf; symname = elf_get_symname(top, symidx); for (i = 0; i < top->ndeps; i++) { @@ -148,30 +149,33 @@ lookup_fdesc(linker_file_t lf, Elf_Size break; } if (addr == 0) - return (0); + return (EINVAL); } if (eot) - return (0); + return (EINVAL); /* * Lookup and/or construct OPD */ for (i = 0; i < 8192; i += 2) { - if (fptr_storage[i] == addr) - return (Elf_Addr)(fptr_storage + i); + if (fptr_storage[i] == addr) { + *addr1 = (Elf_Addr)(fptr_storage + i); + return (0); + } if (fptr_storage[i] == 0) { fptr_storage[i] = addr; fptr_storage[i+1] = link_elf_get_gp(lf); - return (Elf_Addr)(fptr_storage + i); + *addr1 = (Elf_Addr)(fptr_storage + i); + return (0); } } printf("%s: fptr table full\n", __func__); eot = 1; - return (0); + return (EINVAL); } /* Process one elf relocation with addend. */ @@ -184,6 +188,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -223,8 +228,8 @@ elf_reloc_internal(linker_file_t lf, Elf case R_IA_64_NONE: break; case R_IA_64_DIR64LSB: /* word64 LSB S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); *where = addr + addend; break; @@ -233,16 +238,16 @@ elf_reloc_internal(linker_file_t lf, Elf printf("%s: addend ignored for OPD relocation\n", __func__); } - addr = lookup_fdesc(lf, symidx, lookup); - if (addr == 0) + error = lookup_fdesc(lf, symidx, lookup, &addr); + if (error != 0) return (-1); *where = addr; break; case R_IA_64_REL64LSB: /* word64 LSB BD + A */ break; case R_IA_64_IPLTLSB: - addr = lookup_fdesc(lf, symidx, lookup); - if (addr == 0) + error = lookup_fdesc(lf, symidx, lookup, &addr); + if (error != 0) return (-1); where[0] = *((Elf_Addr*)addr) + addend; where[1] = *((Elf_Addr*)addr + 1); Modified: stable/10/sys/kern/link_elf.c ============================================================================== --- stable/10/sys/kern/link_elf.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/kern/link_elf.c Sun Sep 27 01:33:43 2015 (r288287) @@ -158,7 +158,7 @@ static int link_elf_each_function_nameva static void link_elf_reloc_local(linker_file_t); static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); static long link_elf_strtab_get(linker_file_t, caddr_t *); -static Elf_Addr elf_lookup(linker_file_t, Elf_Size, int); +static int elf_lookup(linker_file_t, Elf_Size, int, Elf_Addr *); static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), @@ -1498,8 +1498,8 @@ elf_get_symname(linker_file_t lf, Elf_Si * This is not only more efficient, it's also more correct. It's not always * the case that the symbol can be found through the hash table. */ -static Elf_Addr -elf_lookup(linker_file_t lf, Elf_Size symidx, int deps) +static int +elf_lookup(linker_file_t lf, Elf_Size symidx, int deps, Elf_Addr *res) { elf_file_t ef = (elf_file_t)lf; const Elf_Sym *sym; @@ -1507,8 +1507,10 @@ elf_lookup(linker_file_t lf, Elf_Size sy Elf_Addr addr, start, base; /* Don't even try to lookup the symbol if the index is bogus. */ - if (symidx >= ef->nchains) - return (0); + if (symidx >= ef->nchains) { + *res = 0; + return (EINVAL); + } sym = ef->symtab + symidx; @@ -1518,9 +1520,12 @@ elf_lookup(linker_file_t lf, Elf_Size sy */ if (ELF_ST_BIND(sym->st_info) == STB_LOCAL) { /* Force lookup failure when we have an insanity. */ - if (sym->st_shndx == SHN_UNDEF || sym->st_value == 0) - return (0); - return ((Elf_Addr)ef->address + sym->st_value); + if (sym->st_shndx == SHN_UNDEF || sym->st_value == 0) { + *res = 0; + return (EINVAL); + } + *res = ((Elf_Addr)ef->address + sym->st_value); + return (0); } /* @@ -1533,8 +1538,10 @@ elf_lookup(linker_file_t lf, Elf_Size sy symbol = ef->strtab + sym->st_name; /* Force a lookup failure if the symbol name is bogus. */ - if (*symbol == 0) - return (0); + if (*symbol == 0) { + *res = 0; + return (EINVAL); + } addr = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); @@ -1544,7 +1551,8 @@ elf_lookup(linker_file_t lf, Elf_Size sy else if (elf_set_find(&set_vnet_list, addr, &start, &base)) addr = addr - start + base; #endif - return addr; + *res = addr; + return (0); } static void Modified: stable/10/sys/kern/link_elf_obj.c ============================================================================== --- stable/10/sys/kern/link_elf_obj.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/kern/link_elf_obj.c Sun Sep 27 01:33:43 2015 (r288287) @@ -144,7 +144,8 @@ static void link_elf_reloc_local(linker_ static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); static long link_elf_strtab_get(linker_file_t, caddr_t *); -static Elf_Addr elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps); +static int elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps, + Elf_Addr *); static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), @@ -1224,38 +1225,46 @@ elf_obj_cleanup_globals_cache(elf_file_t * This is not only more efficient, it's also more correct. It's not always * the case that the symbol can be found through the hash table. */ -static Elf_Addr -elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps) +static int +elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps, Elf_Addr *res) { elf_file_t ef = (elf_file_t)lf; Elf_Sym *sym; const char *symbol; - Elf_Addr ret; + Elf_Addr res1; /* Don't even try to lookup the symbol if the index is bogus. */ - if (symidx >= ef->ddbsymcnt) - return (0); + if (symidx >= ef->ddbsymcnt) { + *res = 0; + return (EINVAL); + } sym = ef->ddbsymtab + symidx; /* Quick answer if there is a definition included. */ - if (sym->st_shndx != SHN_UNDEF) - return (sym->st_value); + if (sym->st_shndx != SHN_UNDEF) { + *res = sym->st_value; + return (0); + } /* If we get here, then it is undefined and needs a lookup. */ switch (ELF_ST_BIND(sym->st_info)) { case STB_LOCAL: /* Local, but undefined? huh? */ - return (0); + *res = 0; + return (EINVAL); case STB_GLOBAL: + case STB_WEAK: /* Relative to Data or Function name */ symbol = ef->ddbstrtab + sym->st_name; /* Force a lookup failure if the symbol name is bogus. */ - if (*symbol == 0) - return (0); - ret = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); + if (*symbol == 0) { + *res = 0; + return (EINVAL); + } + res1 = (Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps); /* * Cache global lookups during module relocation. The failure @@ -1267,18 +1276,20 @@ elf_obj_lookup(linker_file_t lf, Elf_Siz * restored to SHN_UNDEF in elf_obj_cleanup_globals_cache(), * above. */ - if (ret != 0) { + if (res1 != 0) { sym->st_shndx = SHN_FBSD_CACHED; - sym->st_value = ret; + sym->st_value = res1; + *res = res1; + return (0); + } else if (ELF_ST_BIND(sym->st_info) == STB_WEAK) { + sym->st_value = 0; + *res = 0; + return (0); } - return (ret); - - case STB_WEAK: - printf("link_elf_obj: Weak symbols not supported\n"); - return (0); + return (EINVAL); default: - return (0); + return (EINVAL); } } Modified: stable/10/sys/mips/mips/elf_machdep.c ============================================================================== --- stable/10/sys/mips/mips/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/mips/mips/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -174,6 +174,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Word rtype = (Elf_Word)0, symidx; const Elf_Rel *rel = NULL; const Elf_Rela *rela = NULL; + int error; /* * Stash R_MIPS_HI16 info so we can use it when processing R_MIPS_LO16 @@ -213,8 +214,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_MIPS_32: /* S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; if (*where != addr) @@ -222,8 +223,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_MIPS_26: /* ((A << 2) | (P & 0xf0000000) + S) >> 2 */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addend &= 0x03ffffff; @@ -241,8 +242,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_MIPS_64: /* S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; if (*(Elf64_Addr*)where != addr) @@ -251,8 +252,8 @@ elf_reloc_internal(linker_file_t lf, Elf case R_MIPS_HI16: /* ((AHL + S) - ((short)(AHL + S)) >> 16 */ if (rela != NULL) { - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; *where &= 0xffff0000; @@ -266,8 +267,8 @@ elf_reloc_internal(linker_file_t lf, Elf case R_MIPS_LO16: /* AHL + S */ if (rela != NULL) { - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; *where &= 0xffff0000; @@ -275,8 +276,8 @@ elf_reloc_internal(linker_file_t lf, Elf } else { ahl += (int16_t)addend; - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addend &= 0xffff0000; @@ -292,8 +293,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_MIPS_HIGHER: /* %higher(A+S) */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; *where &= 0xffff0000; @@ -301,8 +302,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_MIPS_HIGHEST: /* %highest(A+S) */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); addr += addend; *where &= 0xffff0000; Modified: stable/10/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf32_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/powerpc/powerpc/elf32_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -164,6 +164,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Addr addend; Elf_Word rtype, symidx; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -187,16 +188,16 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_PPC_ADDR32: /* word32 S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; + error = lookup(lf, symidx, 1, &addr); + if (error != 0) + return -1; addr += addend; *where = addr; break; case R_PPC_ADDR16_LO: /* #lo(S) */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; /* * addend values are sometimes relative to sections @@ -211,8 +212,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_PPC_ADDR16_HA: /* #ha(S) */ - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return -1; /* * addend values are sometimes relative to sections Modified: stable/10/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf64_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/powerpc/powerpc/elf64_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -135,6 +135,7 @@ elf_reloc_internal(linker_file_t lf, Elf Elf_Addr addend; Elf_Word rtype, symidx; const Elf_Rela *rela; + int error; switch (type) { case ELF_RELOC_REL: @@ -157,9 +158,9 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_PPC64_ADDR64: /* doubleword64 S + A */ - addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; + error = lookup(lf, symidx, 1, &addr); + if (error != 0) + return -1; addr += addend; *where = addr; break; @@ -169,7 +170,7 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_PPC_JMP_SLOT: /* function descriptor copy */ - addr = lookup(lf, symidx, 1); + lookup(lf, symidx, 1, &addr); memcpy(where, (Elf_Addr *)addr, 3*sizeof(Elf_Addr)); __asm __volatile("dcbst 0,%0; sync" :: "r"(where) : "memory"); break; Modified: stable/10/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/elf_machdep.c Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/sparc64/sparc64/elf_machdep.c Sun Sep 27 01:33:43 2015 (r288287) @@ -343,6 +343,7 @@ elf_reloc(linker_file_t lf, Elf_Addr rel Elf_Addr value; Elf_Addr mask; Elf_Addr addr; + int error; if (type != ELF_RELOC_RELA) return (-1); @@ -371,8 +372,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel value = rela->r_addend; if (RELOC_RESOLVE_SYMBOL(rtype)) { - addr = lookup(lf, symidx, 1); - if (addr == 0) + error = lookup(lf, symidx, 1, &addr); + if (error != 0) return (-1); value += addr; if (RELOC_BARE_SYMBOL(rtype)) Modified: stable/10/sys/sys/linker.h ============================================================================== --- stable/10/sys/sys/linker.h Sun Sep 27 01:26:41 2015 (r288286) +++ stable/10/sys/sys/linker.h Sun Sep 27 01:33:43 2015 (r288287) @@ -259,7 +259,7 @@ extern int kld_debug; #endif -typedef Elf_Addr elf_lookup_fn(linker_file_t, Elf_Size, int); +typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *); /* Support functions */ int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu); From owner-svn-src-all@freebsd.org Sun Sep 27 01:35:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FE619CF7E1; Sun, 27 Sep 2015 01:35:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90F3396C; Sun, 27 Sep 2015 01:35:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1ZXfp000102; Sun, 27 Sep 2015 01:35:33 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1ZXEd000101; Sun, 27 Sep 2015 01:35:33 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270135.t8R1ZXEd000101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 01:35:33 +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: r288288 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:35:33 -0000 Author: alc Date: Sun Sep 27 01:35:32 2015 New Revision: 288288 URL: https://svnweb.freebsd.org/changeset/base/288288 Log: MFC r287121 Testing whether a page is dirty does not require the page lock. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sun Sep 27 01:33:43 2015 (r288287) +++ stable/10/sys/vm/vm_pageout.c Sun Sep 27 01:35:32 2015 (r288288) @@ -408,10 +408,13 @@ more: ib = 0; break; } - vm_page_lock(p); vm_page_test_dirty(p); - if (p->dirty == 0 || - p->queue != PQ_INACTIVE || + if (p->dirty == 0) { + ib = 0; + break; + } + vm_page_lock(p); + if (p->queue != PQ_INACTIVE || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); ib = 0; @@ -435,10 +438,11 @@ more: if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p)) break; - vm_page_lock(p); vm_page_test_dirty(p); - if (p->dirty == 0 || - p->queue != PQ_INACTIVE || + if (p->dirty == 0) + break; + vm_page_lock(p); + if (p->queue != PQ_INACTIVE || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); break; From owner-svn-src-all@freebsd.org Sun Sep 27 01:37:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D9F89CF993; Sun, 27 Sep 2015 01:37:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 325B9B01; Sun, 27 Sep 2015 01:37:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R1bVvh000245; Sun, 27 Sep 2015 01:37:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R1bUYD000243; Sun, 27 Sep 2015 01:37:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509270137.t8R1bUYD000243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Sep 2015 01:37: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: r288289 - stable/10/sys/powerpc/powerpc 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 01:37:31 -0000 Author: kib Date: Sun Sep 27 01:37:30 2015 New Revision: 288289 URL: https://svnweb.freebsd.org/changeset/base/288289 Log: MFC r288001: Use tabs for indend. Modified: stable/10/sys/powerpc/powerpc/elf32_machdep.c stable/10/sys/powerpc/powerpc/elf64_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf32_machdep.c Sun Sep 27 01:35:32 2015 (r288288) +++ stable/10/sys/powerpc/powerpc/elf32_machdep.c Sun Sep 27 01:37:30 2015 (r288289) @@ -184,8 +184,8 @@ elf_reloc_internal(linker_file_t lf, Elf switch (rtype) { - case R_PPC_NONE: - break; + case R_PPC_NONE: + break; case R_PPC_ADDR32: /* word32 S + A */ error = lookup(lf, symidx, 1, &addr); @@ -193,9 +193,9 @@ elf_reloc_internal(linker_file_t lf, Elf return -1; addr += addend; *where = addr; - break; + break; - case R_PPC_ADDR16_LO: /* #lo(S) */ + case R_PPC_ADDR16_LO: /* #lo(S) */ error = lookup(lf, symidx, 1, &addr); if (error != 0) return -1; @@ -224,17 +224,17 @@ elf_reloc_internal(linker_file_t lf, Elf addr = relocbase + addend; else addr += addend; - *hwhere = ((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) + *hwhere = ((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) & 0xffff; break; case R_PPC_RELATIVE: /* word32 B + A */ - *where = elf_relocaddr(lf, relocbase + addend); - break; + *where = elf_relocaddr(lf, relocbase + addend); + break; default: - printf("kldload: unexpected relocation type %d\n", - (int) rtype); + printf("kldload: unexpected relocation type %d\n", + (int) rtype); return -1; } return(0); Modified: stable/10/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/elf64_machdep.c Sun Sep 27 01:35:32 2015 (r288288) +++ stable/10/sys/powerpc/powerpc/elf64_machdep.c Sun Sep 27 01:37:30 2015 (r288289) @@ -154,20 +154,20 @@ elf_reloc_internal(linker_file_t lf, Elf switch (rtype) { - case R_PPC_NONE: - break; + case R_PPC_NONE: + break; case R_PPC64_ADDR64: /* doubleword64 S + A */ error = lookup(lf, symidx, 1, &addr); if (error != 0) return -1; addr += addend; - *where = addr; - break; + *where = addr; + break; case R_PPC_RELATIVE: /* doubleword64 B + A */ - *where = elf_relocaddr(lf, relocbase + addend); - break; + *where = elf_relocaddr(lf, relocbase + addend); + break; case R_PPC_JMP_SLOT: /* function descriptor copy */ lookup(lf, symidx, 1, &addr); @@ -176,8 +176,8 @@ elf_reloc_internal(linker_file_t lf, Elf break; default: - printf("kldload: unexpected relocation type %d\n", - (int) rtype); + printf("kldload: unexpected relocation type %d\n", + (int) rtype); return -1; } return(0); From owner-svn-src-all@freebsd.org Sun Sep 27 03:46:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DFB3A0A191; Sun, 27 Sep 2015 03:46:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E291A61F; Sun, 27 Sep 2015 03:46:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R3kuYM054236; Sun, 27 Sep 2015 03:46:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R3ku6k054234; Sun, 27 Sep 2015 03:46:56 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509270346.t8R3ku6k054234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 27 Sep 2015 03:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288290 - head/sys/dev/otus 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 03:46:57 -0000 Author: adrian Date: Sun Sep 27 03:46:55 2015 New Revision: 288290 URL: https://svnweb.freebsd.org/changeset/base/288290 Log: Track the command response code buffer size and verify it in the receive path. Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Sun Sep 27 01:37:30 2015 (r288289) +++ head/sys/dev/otus/if_otus.c Sun Sep 27 03:46:55 2015 (r288290) @@ -156,7 +156,7 @@ void otus_do_async(struct otus_softc *, int otus_newstate(struct ieee80211vap *, enum ieee80211_state, int); int otus_cmd(struct otus_softc *, uint8_t, const void *, int, - void *); + void *, int); void otus_write(struct otus_softc *, uint32_t, uint32_t); int otus_write_barrier(struct otus_softc *); struct ieee80211_node *otus_node_alloc(struct ieee80211com *); @@ -702,7 +702,7 @@ otus_attachhook(struct otus_softc *sc) /* Send an ECHO command to check that everything is settled. */ in = 0xbadc0ffe; - if (otus_cmd(sc, AR_CMD_ECHO, &in, sizeof in, &out) != 0) { + if (otus_cmd(sc, AR_CMD_ECHO, &in, sizeof in, &out, sizeof(out)) != 0) { OTUS_UNLOCK(sc); device_printf(sc->sc_dev, "%s: echo command failed\n", __func__); @@ -1282,7 +1282,7 @@ otus_newstate(struct ieee80211vap *vap, int otus_cmd(struct otus_softc *sc, uint8_t code, const void *idata, int ilen, - void *odata) + void *odata, int odatalen) { struct otus_tx_cmd *cmd; struct ar_cmd_hdr *hdr; @@ -1321,6 +1321,7 @@ otus_cmd(struct otus_softc *sc, uint8_t __func__, code, ilen, hdr->token); cmd->odata = odata; + cmd->odatalen = odatalen; cmd->buflen = xferlen; /* Queue the command to the endpoint */ @@ -1373,7 +1374,7 @@ otus_write_barrier(struct otus_softc *sc sc->write_idx); error = otus_cmd(sc, AR_CMD_WREG, sc->write_buf, - sizeof (sc->write_buf[0]) * sc->write_idx, NULL); + sizeof (sc->write_buf[0]) * sc->write_idx, NULL, 0); sc->write_idx = 0; return error; } @@ -1428,7 +1429,7 @@ otus_read_eeprom(struct otus_softc *sc) for (i = 0; i < sizeof (sc->eeprom) / 32; i++) { for (j = 0; j < 8; j++, reg += 4) regs[j] = htole32(reg); - error = otus_cmd(sc, AR_CMD_RREG, regs, sizeof regs, eep); + error = otus_cmd(sc, AR_CMD_RREG, regs, sizeof regs, eep, 32); if (error != 0) break; eep += 32; @@ -1477,8 +1478,18 @@ otus_cmd_handle_response(struct otus_sof (int) cmd->token); if (hdr->token == cmd->token) { /* Copy answer into caller's supplied buffer. */ - if (cmd->odata != NULL) - memcpy(cmd->odata, &hdr[1], hdr->len); + if (cmd->odata != NULL) { + if (hdr->len != cmd->odatalen) { + device_printf(sc->sc_dev, + "%s: code 0x%02x, len=%d, olen=%d\n", + __func__, + (int) hdr->code, + (int) hdr->len, + (int) cmd->odatalen); + } + memcpy(cmd->odata, &hdr[1], + MIN(cmd->odatalen, hdr->len)); + } wakeup(cmd); } @@ -1513,8 +1524,9 @@ otus_cmd_rxeof(struct otus_softc *sc, ui hdr->code); /* - * XXX TODO: has to reach into the cmd queue "waiting for + * This has to reach into the cmd queue "waiting for * an RX response" list, grab the head entry and check + * if we need to wake anyone up. */ if ((hdr->code & 0xc0) != 0xc0) { otus_cmd_handle_response(sc, hdr); @@ -2686,7 +2698,7 @@ otus_set_chan(struct otus_softc *sc, str goto finish; /* XXX Is that FREQ_START ? */ - error = otus_cmd(sc, AR_CMD_FREQ_STRAT, NULL, 0, NULL); + error = otus_cmd(sc, AR_CMD_FREQ_STRAT, NULL, 0, NULL, 0); if (error != 0) goto finish; @@ -2758,7 +2770,7 @@ otus_set_chan(struct otus_softc *sc, str cmd.check_loop_count = assoc ? htole32(2000) : htole32(1000); OTUS_DPRINTF(sc, OTUS_DEBUG_RESET, "%s\n", (code == AR_CMD_RF_INIT) ? "RF_INIT" : "FREQUENCY"); - error = otus_cmd(sc, code, &cmd, sizeof cmd, &rsp); + error = otus_cmd(sc, code, &cmd, sizeof cmd, &rsp, sizeof(rsp)); if (error != 0) goto finish; if ((rsp.status & htole32(AR_CAL_ERR_AGC | AR_CAL_ERR_NF_VAL)) != 0) { @@ -2848,14 +2860,14 @@ otus_set_key_cb(struct otus_softc *sc, v } key.cipher = htole16(cipher); memcpy(key.key, k->k_key, MIN(k->k_len, 16)); - error = otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL); + error = otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL, 0); if (error != 0 || k->k_cipher != IEEE80211_CIPHER_TKIP) return; /* TKIP: set Tx/Rx MIC Key. */ key.kix = htole16(1); memcpy(key.key, k->k_key + 16, 16); - (void)otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL); + (void)otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL, 0); } void @@ -2886,7 +2898,7 @@ otus_delete_key_cb(struct otus_softc *sc uid = htole32(k->k_id); else uid = htole32(OTUS_UID(cmd->associd)); - (void)otus_cmd(sc, AR_CMD_DKEY, &uid, sizeof uid, NULL); + (void)otus_cmd(sc, AR_CMD_DKEY, &uid, sizeof uid, NULL, 0); } #endif Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Sun Sep 27 01:37:30 2015 (r288289) +++ head/sys/dev/otus/if_otusreg.h Sun Sep 27 03:46:55 2015 (r288290) @@ -875,6 +875,7 @@ struct otus_tx_cmd { uint8_t *buf; uint16_t buflen; void * *odata; + uint16_t odatalen; uint16_t token; STAILQ_ENTRY(otus_tx_cmd) next_cmd; }; From owner-svn-src-all@freebsd.org Sun Sep 27 04:03:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAD6FA0AA2B; Sun, 27 Sep 2015 04:03:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBFCBE16; Sun, 27 Sep 2015 04:03:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R43Bb5062242; Sun, 27 Sep 2015 04:03:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R43B5Z062241; Sun, 27 Sep 2015 04:03:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509270403.t8R43B5Z062241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 27 Sep 2015 04:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288291 - head/etc 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:03:12 -0000 Author: adrian Date: Sun Sep 27 04:03:11 2015 New Revision: 288291 URL: https://svnweb.freebsd.org/changeset/base/288291 Log: Enforce consistent limits of daemons run from rc.subr: * Allow the user to configure the login class to use in rc.conf by using {daemon}_login_class, which; * Use the daemon class by default; * .. and then use 'limits' to set the login class so it works both via init at startup (which runs this in 'daemon' class) and via whichever root environment (eg command line, other daemons, etc.) Reviewed by: dteske Differential Revision: https://reviews.freebsd.org/D3630 Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sun Sep 27 03:46:55 2015 (r288290) +++ head/etc/rc.subr Sun Sep 27 04:03:11 2015 (r288291) @@ -768,6 +768,8 @@ check_startmsgs() # # ${name}_prepend n Command added before ${command}. # +# ${name}_login_class n Login class to use, else "daemon". +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -942,7 +944,7 @@ run_rc_command() _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ - _prepend=\$${name}_prepend + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1050,6 +1052,9 @@ $command $rc_flags $command_args" fi fi + # Prepend default limits + _doit="limits -C $_login_class $_doit" + # run the full command # if ! _run_rc_doit "$_doit"; then From owner-svn-src-all@freebsd.org Sun Sep 27 04:17:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 716319B8A43; Sun, 27 Sep 2015 04:17:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61FD28B6; Sun, 27 Sep 2015 04:17:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4H9mt066679; Sun, 27 Sep 2015 04:17:09 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4H9jX066678; Sun, 27 Sep 2015 04:17:09 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270417.t8R4H9jX066678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 04:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288292 - stable/10/lib/libc/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:17:09 -0000 Author: alc Date: Sun Sep 27 04:17:08 2015 New Revision: 288292 URL: https://svnweb.freebsd.org/changeset/base/288292 Log: MFC r285428 Correct the description of MADV_DONTNEED. Modified: stable/10/lib/libc/sys/madvise.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/madvise.2 ============================================================================== --- stable/10/lib/libc/sys/madvise.2 Sun Sep 27 04:03:11 2015 (r288291) +++ stable/10/lib/libc/sys/madvise.2 Sun Sep 27 04:17:08 2015 (r288292) @@ -28,7 +28,7 @@ .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 30, 2014 +.Dd July 12, 2015 .Dt MADVISE 2 .Os .Sh NAME @@ -79,9 +79,9 @@ pages in from backing store, but quickly into the calling process. .It Dv MADV_DONTNEED Allows the VM system to decrease the in-memory priority -of pages in the specified range. -Additionally future references to -this address range will incur a page fault. +of pages in the specified address range. +Consequently, future references to this address range are more likely +to incur a page fault. .It Dv MADV_FREE Gives the VM system the freedom to free pages, and tells the system that information in the specified page range From owner-svn-src-all@freebsd.org Sun Sep 27 04:25:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30646A0A01A; Sun, 27 Sep 2015 04:25:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14466C95; Sun, 27 Sep 2015 04:25:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4P7cr070734; Sun, 27 Sep 2015 04:25:07 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4P7tY070733; Sun, 27 Sep 2015 04:25:07 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270425.t8R4P7tY070733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 04:25: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: r288293 - stable/10/share/man/man9 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:25:08 -0000 Author: alc Date: Sun Sep 27 04:25:07 2015 New Revision: 288293 URL: https://svnweb.freebsd.org/changeset/base/288293 Log: MFC r286513, r286784 Revise the text about the atomicity of the defined operations across multiple processors. In particular, clearly state that the operations are always atomic when they are applied to the default memory type that is used by the kernel (and applications). Stop describing an acquire operation as a read barrier and a release operation as a write barrier. That description has never been correct, and it has caused confusion. Also, explicitly say that a thread doesn't see its own accesses being reordered. The reordering of a thread's accesses is only (potentially) visible to another thread. Modified: stable/10/share/man/man9/atomic.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/atomic.9 ============================================================================== --- stable/10/share/man/man9/atomic.9 Sun Sep 27 04:17:08 2015 (r288292) +++ stable/10/share/man/man9/atomic.9 Sun Sep 27 04:25:07 2015 (r288293) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2015 +.Dd August 14, 2015 .Dt ATOMIC 9 .Os .Sh NAME @@ -67,8 +67,8 @@ .Ft int .Fn atomic_testandset_ "volatile *p" "u_int v" .Sh DESCRIPTION -Each of the atomic operations is guaranteed to be atomic in the presence of -interrupts. +Each of the atomic operations is guaranteed to be atomic across multiple +threads and in the presence of interrupts. They can be used to implement reference counts or as building blocks for more advanced synchronization primitives such as mutexes. .Ss Types @@ -108,71 +108,94 @@ unsigned 16-bit integer .El .Pp These must not be used in MI code because the instructions to implement them -efficiently may not be available. -.Ss Memory Barriers -Memory barriers are used to guarantee the order of data accesses in -two ways. -First, they specify hints to the compiler to not re-order or optimize the -operations. -Second, on architectures that do not guarantee ordered data accesses, -special instructions or special variants of instructions are used to indicate -to the processor that data accesses need to occur in a certain order. -As a result, most of the atomic operations have three variants in order to -include optional memory barriers. -The first form just performs the operation without any explicit barriers. -The second form uses a read memory barrier, and the third variant uses a write -memory barrier. -.Pp -The second variant of each operation includes an +efficiently might not be available. +.Ss Acquire and Release Operations +By default, a thread's accesses to different memory locations might not be +performed in +.Em program order , +that is, the order in which the accesses appear in the source code. +To optimize the program's execution, both the compiler and processor might +reorder the thread's accesses. +However, both ensure that their reordering of the accesses is not visible to +the thread. +Otherwise, the traditional memory model that is expected by single-threaded +programs would be violated. +Nonetheless, other threads in a multithreaded program, such as the +.Fx +kernel, might observe the reordering. +Moreover, in some cases, such as the implementation of synchronization between +threads, arbitrary reordering might result in the incorrect execution of the +program. +To constrain the reordering that both the compiler and processor might perform +on a thread's accesses, the thread should use atomic operations with .Em acquire -memory barrier. -This barrier ensures that the effects of this operation are completed before the -effects of any later data accesses. -As a result, the operation is said to have acquire semantics as it acquires a -pseudo-lock requiring further operations to wait until it has completed. -To denote this, the suffix +and +.Em release +semantics. +.Pp +Most of the atomic operations on memory have three variants. +The first variant performs the operation without imposing any ordering +constraints on memory accesses to other locations. +The second variant has acquire semantics, and the third variant has release +semantics. +In effect, operations with acquire and release semantics establish one-way +barriers to reordering. +.Pp +When an atomic operation has acquire semantics, the effects of the operation +must have completed before any subsequent load or store (by program order) is +performed. +Conversely, acquire semantics do not require that prior loads or stores have +completed before the atomic operation is performed. +To denote acquire semantics, the suffix .Dq Li _acq is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. -For example, to subtract two integers ensuring that any later writes will -happen after the subtraction is performed, use +For example, to subtract two integers ensuring that subsequent loads and +stores happen after the subtraction is performed, use .Fn atomic_subtract_acq_int . .Pp -The third variant of each operation includes a -.Em release -memory barrier. -This ensures that all effects of all previous data accesses are completed -before this operation takes place. -As a result, the operation is said to have release semantics as it releases -any pending data accesses to be completed before its operation is performed. -To denote this, the suffix +When an atomic operation has release semantics, the effects of all prior +loads or stores (by program order) must have completed before the operation +is performed. +Conversely, release semantics do not require that the effects of the +atomic operation must have completed before any subsequent load or store is +performed. +To denote release semantics, the suffix .Dq Li _rel is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. -For example, to add two long integers ensuring that all previous -writes will happen first, use +For example, to add two long integers ensuring that all prior loads and +stores happen before the addition, use .Fn atomic_add_rel_long . .Pp -A practical example of using memory barriers is to ensure that data accesses -that are protected by a lock are all performed while the lock is held. -To achieve this, one would use a read barrier when acquiring the lock to -guarantee that the lock is held before any protected operations are performed. -Finally, one would use a write barrier when releasing the lock to ensure that -all of the protected operations are completed before the lock is released. +The one-way barriers provided by acquire and release operations allow the +implementations of common synchronization primitives to express their +ordering requirements without also imposing unnecessary ordering. +For example, for a critical section guarded by a mutex, an acquire operation +when the mutex is locked and a release operation when the mutex is unlocked +will prevent any loads or stores from moving outside of the critical +section. +However, they will not prevent the compiler or processor from moving loads +or stores into the critical section, which does not violate the semantics of +a mutex. .Ss Multiple Processors -The current set of atomic operations do not necessarily guarantee atomicity -across multiple processors. -To guarantee atomicity across processors, not only does the individual -operation need to be atomic on the processor performing the operation, but -the result of the operation needs to be pushed out to stable storage and the -caches of all other processors on the system need to invalidate any cache -lines that include the affected memory region. -On the +In multiprocessor systems, the atomicity of the atomic operations on memory +depends on support for cache coherence in the underlying architecture. +In general, cache coherence on the default memory type, +.Dv VM_MEMATTR_DEFAULT , +is guaranteed by all architectures that are supported by +.Fx . +For example, cache coherence is guaranteed on write-back memory by the +.Tn amd64 +and .Tn i386 -architecture, the cache coherency model requires that the hardware perform -this task, thus the atomic operations are atomic across multiple processors. +architectures. +However, on some architectures, cache coherence might not be enabled on all +memory types. +To determine if cache coherence is enabled for a non-default memory type, +consult the architecture's documentation. On the .Tn ia64 architecture, coherency is only guaranteed for pages that are configured to From owner-svn-src-all@freebsd.org Sun Sep 27 04:36:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F09C2A0A5C4; Sun, 27 Sep 2015 04:36:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1056235; Sun, 27 Sep 2015 04:36:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4aAM5074957; Sun, 27 Sep 2015 04:36:10 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4aAG5074955; Sun, 27 Sep 2015 04:36:10 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270436.t8R4aAG5074955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 04:36:10 +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: r288294 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:36:11 -0000 Author: alc Date: Sun Sep 27 04:36:09 2015 New Revision: 288294 URL: https://svnweb.freebsd.org/changeset/base/288294 Log: MFC r285282 The intention of r254304 was to scan the active queue continuously. However, I've observed the active queue scan stopping when there are frequent free page shortages and the inactive queue is steadily refilled by other mechanisms, such as the sequential access heuristic in vm_fault() or madvise(2). To remedy this problem, record the time of the last active queue scan, and always scan a number of pages proportional to the time since the last scan, regardless of whether that last scan was a timeout-triggered ("pass == 0") or free-page-shortage-triggered ("pass > 0") scan. Also, on a timeout-triggered scan, allow a full scan of the active queue when the system is short of inactive pages. Modified: stable/10/sys/vm/vm_page.h stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.h ============================================================================== --- stable/10/sys/vm/vm_page.h Sun Sep 27 04:25:07 2015 (r288293) +++ stable/10/sys/vm/vm_page.h Sun Sep 27 04:36:09 2015 (r288294) @@ -227,6 +227,7 @@ struct vm_domain { long vmd_segs; /* bitmask of the segments */ boolean_t vmd_oom; int vmd_pass; /* local pagedaemon pass */ + int vmd_last_active_scan; struct vm_page vmd_marker; /* marker for pagedaemon private use */ }; Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sun Sep 27 04:25:07 2015 (r288293) +++ stable/10/sys/vm/vm_pageout.c Sun Sep 27 04:36:09 2015 (r288294) @@ -926,9 +926,10 @@ vm_pageout_scan(struct vm_domain *vmd, i vm_page_t m, next; struct vm_pagequeue *pq; vm_object_t object; + long min_scan; int act_delta, addl_page_shortage, deficit, maxscan, page_shortage; int vnodes_skipped = 0; - int maxlaunder; + int maxlaunder, scan_tick, scanned; int lockmode; boolean_t queues_locked; @@ -1359,34 +1360,37 @@ relock_queues: * If we're just idle polling attempt to visit every * active page within 'update_period' seconds. */ - if (pass == 0 && vm_pageout_update_period != 0) { - maxscan /= vm_pageout_update_period; - page_shortage = maxscan; - } + scan_tick = ticks; + if (vm_pageout_update_period != 0) { + min_scan = pq->pq_cnt; + min_scan *= scan_tick - vmd->vmd_last_active_scan; + min_scan /= hz * vm_pageout_update_period; + } else + min_scan = 0; + if (min_scan > 0 || (page_shortage > 0 && maxscan > 0)) + vmd->vmd_last_active_scan = scan_tick; /* - * Scan the active queue for things we can deactivate. We nominally - * track the per-page activity counter and use it to locate - * deactivation candidates. - */ - m = TAILQ_FIRST(&pq->pq_pl); - while (m != NULL && maxscan-- > 0 && page_shortage > 0) { + * Scan the active queue for pages that can be deactivated. Update + * the per-page activity counter and use it to identify deactivation + * candidates. + */ + for (m = TAILQ_FIRST(&pq->pq_pl), scanned = 0; m != NULL && (scanned < + min_scan || (page_shortage > 0 && scanned < maxscan)); m = next, + scanned++) { KASSERT(m->queue == PQ_ACTIVE, ("vm_pageout_scan: page %p isn't active", m)); next = TAILQ_NEXT(m, plinks.q); - if ((m->flags & PG_MARKER) != 0) { - m = next; + if ((m->flags & PG_MARKER) != 0) continue; - } KASSERT((m->flags & PG_FICTITIOUS) == 0, ("Fictitious page %p cannot be in active queue", m)); KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("Unmanaged page %p cannot be in active queue", m)); if (!vm_pageout_page_lock(m, &next)) { vm_page_unlock(m); - m = next; continue; } @@ -1439,7 +1443,6 @@ relock_queues: } else vm_page_requeue_locked(m); vm_page_unlock(m); - m = next; } vm_pagequeue_unlock(pq); #if !defined(NO_SWAPPING) @@ -1627,6 +1630,7 @@ vm_pageout_worker(void *arg) */ KASSERT(domain->vmd_segs != 0, ("domain without segments")); + domain->vmd_last_active_scan = ticks; vm_pageout_init_marker(&domain->vmd_marker, PQ_INACTIVE); /* From owner-svn-src-all@freebsd.org Sun Sep 27 04:40:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 986A3A0A7C7; Sun, 27 Sep 2015 04:40:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 867837A9; Sun, 27 Sep 2015 04:40:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4etQm075234; Sun, 27 Sep 2015 04:40:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4esUp075231; Sun, 27 Sep 2015 04:40:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270440.t8R4esUp075231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 04:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288295 - in 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:40:55 -0000 Author: ngie Date: Sun Sep 27 04:40:54 2015 New Revision: 288295 URL: https://svnweb.freebsd.org/changeset/base/288295 Log: Posthumously remove all references to MFREE(9) The macro was removed in r90227 MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/mbuf.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Sep 27 04:36:09 2015 (r288294) +++ head/ObsoleteFiles.inc Sun Sep 27 04:40:54 2015 (r288295) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150926: posthumously (r90227) remove MFREE(9) from mbuf(9) +OLD_FILES+=usr/share/man/man9/MFREE.9.gz # 20150818: *allocm() are gone in jemalloc 4.0.0 OLD_FILES+=usr/share/man/man3/allocm.3.gz OLD_FILES+=usr/share/man/man3/dallocm.3.gz Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Sep 27 04:36:09 2015 (r288294) +++ head/share/man/man9/Makefile Sun Sep 27 04:40:54 2015 (r288295) @@ -1013,7 +1013,6 @@ MLINKS+=\ mbuf.9 MEXT_IS_REF.9 \ mbuf.9 MEXT_REM_REF.9 \ mbuf.9 m_fixhdr.9 \ - mbuf.9 MFREE.9 \ mbuf.9 m_free.9 \ mbuf.9 m_freem.9 \ mbuf.9 MGET.9 \ Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Sun Sep 27 04:36:09 2015 (r288294) +++ head/share/man/man9/mbuf.9 Sun Sep 27 04:40:54 2015 (r288295) @@ -53,7 +53,6 @@ .Fa "int type" .Fc .Fn MEXTFREE "struct mbuf *mbuf" -.Fn MFREE "struct mbuf *mbuf" "struct mbuf *successor" .\" .Ss Mbuf utility macros .Fn mtod "struct mbuf *mbuf" "type" From owner-svn-src-all@freebsd.org Sun Sep 27 04:47:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDA3EA0ABAE; Sun, 27 Sep 2015 04:47:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3C42A52; Sun, 27 Sep 2015 04:47:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4l9nm079133; Sun, 27 Sep 2015 04:47:09 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4l9lg079132; Sun, 27 Sep 2015 04:47:09 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270447.t8R4l9lg079132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 04:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288296 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:47:09 -0000 Author: alc Date: Sun Sep 27 04:47:08 2015 New Revision: 288296 URL: https://svnweb.freebsd.org/changeset/base/288296 Log: MFC r288025 Correct a non-fatal error in vm_pageout_worker(). vm_pageout_worker() should not assume that vm_pages_needed will remain set while it sleeps. Other threads can clear vm_pages_needed by performing a sufficient number of vm_page_free() calls, e.g., process termination. The effect of this error was that vm_pageout_worker() would free and/or launder pages when, in fact, there was no shortage of free pages. Rewrite a nearby comment to describe all of the possible cases and not just the most common case. The problem being that the comment made the most common case seem like the only case. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Sun Sep 27 04:40:54 2015 (r288295) +++ stable/10/sys/vm/vm_pageout.c Sun Sep 27 04:47:08 2015 (r288296) @@ -1651,9 +1651,15 @@ vm_pageout_worker(void *arg) } if (vm_pages_needed) { /* - * Still not done, take a second pass without waiting - * (unlimited dirty cleaning), otherwise sleep a bit - * and try again. + * We're still not done. Either vm_pages_needed was + * set by another thread during the previous scan + * (typically, this happens during a level 0 scan) or + * vm_pages_needed was already set and the scan failed + * to free enough pages. If we haven't yet performed + * a level >= 2 scan (unlimited dirty cleaning), then + * upgrade the level and scan again now. Otherwise, + * sleep a bit and try again later. While sleeping, + * vm_pages_needed can be cleared. */ if (domain->vmd_pass > 1) msleep(&vm_pages_needed, @@ -1664,15 +1670,14 @@ vm_pageout_worker(void *arg) * Good enough, sleep until required to refresh * stats. */ - domain->vmd_pass = 0; msleep(&vm_pages_needed, &vm_page_queue_free_mtx, PVM, "psleep", hz); - } if (vm_pages_needed) { cnt.v_pdwakeups++; domain->vmd_pass++; - } + } else + domain->vmd_pass = 0; mtx_unlock(&vm_page_queue_free_mtx); vm_pageout_scan(domain, domain->vmd_pass); } From owner-svn-src-all@freebsd.org Sun Sep 27 04:54:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 861189CF0E3; Sun, 27 Sep 2015 04:54:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68310E87; Sun, 27 Sep 2015 04:54:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4sV7C083063; Sun, 27 Sep 2015 04:54:31 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4sUYo083058; Sun, 27 Sep 2015 04:54:30 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201509270454.t8R4sUYo083058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 27 Sep 2015 04:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288297 - in head: sys/netinet sys/netinet6 usr.sbin/arp usr.sbin/ndp 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:54:31 -0000 Author: melifaro Date: Sun Sep 27 04:54:29 2015 New Revision: 288297 URL: https://svnweb.freebsd.org/changeset/base/288297 Log: rtsock requests for deleting interface address lles started to return EPERM instead of old "ignore-and-return 0" in r287789. This broke arp -da / ndp -cn behavior (they exit on rtsock command failure). Fix this by translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and making arp/ndp ignore these entries in batched delete. MFC after: 2 weeks Modified: head/sys/netinet/in.c head/sys/netinet6/in6.c head/usr.sbin/arp/arp.c head/usr.sbin/ndp/ndp.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/sys/netinet/in.c Sun Sep 27 04:54:29 2015 (r288297) @@ -1333,6 +1333,8 @@ in_lltable_dump_entry(struct lltable *ll arpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA); if (lle->la_flags & LLE_STATIC) arpc.rtm.rtm_flags |= RTF_STATIC; + if (lle->la_flags & LLE_IFADDR) + arpc.rtm.rtm_flags |= RTF_PINNED; arpc.rtm.rtm_index = ifp->if_index; error = SYSCTL_OUT(wr, &arpc, sizeof(arpc)); Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/sys/netinet6/in6.c Sun Sep 27 04:54:29 2015 (r288297) @@ -2354,6 +2354,8 @@ in6_lltable_dump_entry(struct lltable *l ndpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA); if (lle->la_flags & LLE_STATIC) ndpc.rtm.rtm_flags |= RTF_STATIC; + if (lle->la_flags & LLE_IFADDR) + ndpc.rtm.rtm_flags |= RTF_PINNED; ndpc.rtm.rtm_index = ifp->if_index; error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc)); Modified: head/usr.sbin/arp/arp.c ============================================================================== --- head/usr.sbin/arp/arp.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/usr.sbin/arp/arp.c Sun Sep 27 04:54:29 2015 (r288297) @@ -673,10 +673,13 @@ print_entry(struct sockaddr_dl *sdl, */ static void nuke_entry(struct sockaddr_dl *sdl __unused, - struct sockaddr_in *addr, struct rt_msghdr *rtm __unused) + struct sockaddr_in *addr, struct rt_msghdr *rtm) { char ip[20]; + if (rtm->rtm_flags & RTF_PINNED) + return; + snprintf(ip, sizeof(ip), "%s", inet_ntoa(addr->sin_addr)); delete(ip); } Modified: head/usr.sbin/ndp/ndp.c ============================================================================== --- head/usr.sbin/ndp/ndp.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/usr.sbin/ndp/ndp.c Sun Sep 27 04:54:29 2015 (r288297) @@ -649,6 +649,8 @@ again:; if (rtm->rtm_flags & RTF_CLONED) delete(host_buf); #else + if (rtm->rtm_flags & RTF_PINNED) + continue; delete(host_buf); #endif continue; From owner-svn-src-all@freebsd.org Sun Sep 27 04:55:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DB0C9CF1F5; Sun, 27 Sep 2015 04:55:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65ADB8D; Sun, 27 Sep 2015 04:55:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4tjKm083187; Sun, 27 Sep 2015 04:55:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4ti42083184; Sun, 27 Sep 2015 04:55:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270455.t8R4ti42083184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 04:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288298 - in 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 04:55:45 -0000 Author: ngie Date: Sun Sep 27 04:55:43 2015 New Revision: 288298 URL: https://svnweb.freebsd.org/changeset/base/288298 Log: Remove MLINKS to more non-existent mbuf(9) macros X-MFC with: r288295 MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/mbuf.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Sep 27 04:54:29 2015 (r288297) +++ head/ObsoleteFiles.inc Sun Sep 27 04:55:43 2015 (r288298) @@ -38,7 +38,11 @@ # xargs -n1 | sort | uniq -d; # done -# 20150926: posthumously (r90227) remove MFREE(9) from mbuf(9) +# 20150926: remove links to removed/unimplemented mbuf(9) macros +OLD_FILES+=usr/share/man/man9/MEXT_ADD_REF.9.gz +OLD_FILES+=usr/share/man/man9/MEXTFREE.9.gz +OLD_FILES+=usr/share/man/man9/MEXT_IS_REF.9.gz +OLD_FILES+=usr/share/man/man9/MEXT_REM_REF.9.gz OLD_FILES+=usr/share/man/man9/MFREE.9.gz # 20150818: *allocm() are gone in jemalloc 4.0.0 OLD_FILES+=usr/share/man/man3/allocm.3.gz Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Sep 27 04:54:29 2015 (r288297) +++ head/share/man/man9/Makefile Sun Sep 27 04:55:43 2015 (r288298) @@ -1008,10 +1008,6 @@ MLINKS+=\ mbuf.9 m_dup.9 \ mbuf.9 m_dup_pkthdr.9 \ mbuf.9 MEXTADD.9 \ - mbuf.9 MEXT_ADD_REF.9 \ - mbuf.9 MEXTFREE.9 \ - mbuf.9 MEXT_IS_REF.9 \ - mbuf.9 MEXT_REM_REF.9 \ mbuf.9 m_fixhdr.9 \ mbuf.9 m_free.9 \ mbuf.9 m_freem.9 \ Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Sun Sep 27 04:54:29 2015 (r288297) +++ head/share/man/man9/mbuf.9 Sun Sep 27 04:55:43 2015 (r288298) @@ -52,7 +52,6 @@ .Fa "short flags" .Fa "int type" .Fc -.Fn MEXTFREE "struct mbuf *mbuf" .\" .Ss Mbuf utility macros .Fn mtod "struct mbuf *mbuf" "type" From owner-svn-src-all@freebsd.org Sun Sep 27 05:16:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6CDCA0A06B; Sun, 27 Sep 2015 05:16:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AE03AA2; Sun, 27 Sep 2015 05:16:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5G7Ym091317; Sun, 27 Sep 2015 05:16:07 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5G7s2091316; Sun, 27 Sep 2015 05:16:07 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201509270516.t8R5G7s2091316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 27 Sep 2015 05:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288299 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 05:16:07 -0000 Author: jeff Date: Sun Sep 27 05:16:06 2015 New Revision: 288299 URL: https://svnweb.freebsd.org/changeset/base/288299 Log: - Collapse vfs_vmio_truncate & vfs_vmio_release into a single function. - Allow vfs_vmio_invalidate() to free the pages, leaving us with a single loop and bufobj lock when B_NOCACHE/B_INVAL is used. - Eliminate the special B_ASYNC handling on free that has not been relevant for some time. - Remove the extraneous page busy from vfs_vmio_truncate(). Reviewed by: kib Tested by: pho Sponsored by: EMC / Isilon storage division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Sep 27 04:55:43 2015 (r288298) +++ head/sys/kern/vfs_bio.c Sun Sep 27 05:16:06 2015 (r288299) @@ -111,7 +111,6 @@ static void vfs_page_set_validclean(stru static void vfs_clean_pages_dirty_buf(struct buf *bp); static void vfs_setdirty_locked_object(struct buf *bp); static void vfs_vmio_invalidate(struct buf *bp); -static void vfs_vmio_release(struct buf *bp); static void vfs_vmio_truncate(struct buf *bp, int npages); static void vfs_vmio_extend(struct buf *bp, int npages, int size); static int vfs_bio_clcheck(struct vnode *vp, int size, @@ -1830,20 +1829,19 @@ brelse(struct buf *bp) bdirtysub(); bp->b_flags &= ~(B_DELWRI | B_CACHE); if ((bp->b_flags & B_VMIO) == 0) { - if (bp->b_bufsize) - allocbuf(bp, 0); + allocbuf(bp, 0); if (bp->b_vp) brelvp(bp); } } /* - * We must clear B_RELBUF if B_DELWRI is set. If vfs_vmio_release() + * We must clear B_RELBUF if B_DELWRI is set. If vfs_vmio_truncate() * is called with B_DELWRI set, the underlying pages may wind up * getting freed causing a previous write (bdwrite()) to get 'lost' * because pages associated with a B_DELWRI bp are marked clean. * - * We still allow the B_INVAL case to call vfs_vmio_release(), even + * We still allow the B_INVAL case to call vfs_vmio_truncate(), even * if B_DELWRI is set. */ if (bp->b_flags & B_DELWRI) @@ -1870,14 +1868,13 @@ brelse(struct buf *bp) (bp->b_ioflags & BIO_ERROR && bp->b_iocmd == BIO_READ)) && !(bp->b_vp->v_mount != NULL && (bp->b_vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 && - !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI))) + !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI))) { vfs_vmio_invalidate(bp); + allocbuf(bp, 0); + } if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0) { - if (bp->b_flags & B_VMIO) - vfs_vmio_release(bp); - if (bp->b_bufsize != 0) - allocbuf(bp, 0); + allocbuf(bp, 0); if (bp->b_vp != NULL) brelvp(bp); } @@ -2059,8 +2056,41 @@ vfs_vmio_iodone(struct buf *bp) } /* + * Unwire a page held by a buf and place it on the appropriate vm queue. + */ +static void +vfs_vmio_unwire(struct buf *bp, vm_page_t m) +{ + bool freed; + + vm_page_lock(m); + if (vm_page_unwire(m, PQ_NONE)) { + /* + * Determine if the page should be freed before adding + * it to the inactive queue. + */ + if (m->valid == 0) { + freed = !vm_page_busied(m); + if (freed) + vm_page_free(m); + } else if ((bp->b_flags & B_DIRECT) != 0) + freed = vm_page_try_to_free(m); + else + freed = false; + if (!freed) { + /* + * In order to maintain LRU page ordering, put + * the page at the tail of the inactive queue. + */ + vm_page_deactivate(m); + } + } + vm_page_unlock(m); +} + +/* * Perform page invalidation when a buffer is released. The fully invalid - * pages will be reclaimed later in vfs_vmio_release(). + * pages will be reclaimed later in vfs_vmio_truncate(). */ static void vfs_vmio_invalidate(struct buf *bp) @@ -2069,6 +2099,11 @@ vfs_vmio_invalidate(struct buf *bp) vm_page_t m; int i, resid, poffset, presid; + if (buf_mapped(bp)) { + BUF_CHECK_MAPPED(bp); + pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); + } else + BUF_CHECK_UNMAPPED(bp); /* * Get the base offset and length of the buffer. Note that * in the VMIO case if the buffer block size is not @@ -2089,6 +2124,7 @@ vfs_vmio_invalidate(struct buf *bp) m = bp->b_pages[i]; if (m == bogus_page) panic("vfs_vmio_invalidate: Unexpected bogus page."); + bp->b_pages[i] = NULL; presid = resid > (PAGE_SIZE - poffset) ? (PAGE_SIZE - poffset) : resid; @@ -2101,63 +2137,12 @@ vfs_vmio_invalidate(struct buf *bp) } if (pmap_page_wired_mappings(m) == 0) vm_page_set_invalid(m, poffset, presid); + vfs_vmio_unwire(bp, m); resid -= presid; poffset = 0; } VM_OBJECT_WUNLOCK(obj); -} - -/* Give pages used by the bp back to the VM system (where possible) */ -static void -vfs_vmio_release(struct buf *bp) -{ - vm_object_t obj; - vm_page_t m; - int i; - bool freed; - - if (buf_mapped(bp)) { - BUF_CHECK_MAPPED(bp); - pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); - } else - BUF_CHECK_UNMAPPED(bp); - obj = bp->b_bufobj->bo_object; - if (obj != NULL) - VM_OBJECT_WLOCK(obj); - for (i = 0; i < bp->b_npages; i++) { - m = bp->b_pages[i]; - bp->b_pages[i] = NULL; - vm_page_lock(m); - if (vm_page_unwire(m, PQ_NONE)) { - /* - * Determine if the page should be freed before adding - * it to the inactive queue. - */ - if ((bp->b_flags & B_ASYNC) == 0 && m->valid == 0) { - freed = !vm_page_busied(m); - if (freed) - vm_page_free(m); - } else if ((bp->b_flags & B_DIRECT) != 0) - freed = vm_page_try_to_free(m); - else - freed = false; - if (!freed) { - /* - * In order to maintain LRU page ordering, put - * the page at the tail of the inactive queue. - */ - vm_page_deactivate(m); - } - } - vm_page_unlock(m); - } - if (obj != NULL) - VM_OBJECT_WUNLOCK(obj); - - if (bp->b_bufsize) - bufspaceadjust(bp, 0); bp->b_npages = 0; - bp->b_flags &= ~B_VMIO; } /* @@ -2166,6 +2151,7 @@ vfs_vmio_release(struct buf *bp) static void vfs_vmio_truncate(struct buf *bp, int desiredpages) { + vm_object_t obj; vm_page_t m; int i; @@ -2178,22 +2164,17 @@ vfs_vmio_truncate(struct buf *bp, int de (desiredpages << PAGE_SHIFT), bp->b_npages - desiredpages); } else BUF_CHECK_UNMAPPED(bp); - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + obj = bp->b_bufobj->bo_object; + if (obj != NULL) + VM_OBJECT_WLOCK(obj); for (i = desiredpages; i < bp->b_npages; i++) { - /* - * The page is not freed here -- it is the responsibility of - * vnode_pager_setsize. - */ m = bp->b_pages[i]; KASSERT(m != bogus_page, ("allocbuf: bogus page found")); - while (vm_page_sleep_if_busy(m, "biodep")) - continue; bp->b_pages[i] = NULL; - vm_page_lock(m); - vm_page_unwire(m, PQ_INACTIVE); - vm_page_unlock(m); + vfs_vmio_unwire(bp, m); } - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); + if (obj != NULL) + VM_OBJECT_WUNLOCK(obj); bp->b_npages = desiredpages; } @@ -2478,11 +2459,12 @@ getnewbuf_reuse_bp(struct buf *bp, int q KASSERT((bp->b_flags & B_DELWRI) == 0, ("delwri buffer %p found in queue %d", bp, qindex)); + /* + * When recycling a clean buffer we have to truncate it and + * release the vnode. + */ if (qindex == QUEUE_CLEAN) { - if (bp->b_flags & B_VMIO) { - bp->b_flags &= ~B_ASYNC; - vfs_vmio_release(bp); - } + allocbuf(bp, 0); if (bp->b_vp != NULL) brelvp(bp); } @@ -2491,7 +2473,6 @@ getnewbuf_reuse_bp(struct buf *bp, int q * Get the rest of the buffer freed up. b_kva* is still valid * after this operation. */ - if (bp->b_rcred != NOCRED) { crfree(bp->b_rcred); bp->b_rcred = NOCRED; @@ -2508,9 +2489,8 @@ getnewbuf_reuse_bp(struct buf *bp, int q bp, bp->b_vp, qindex)); KASSERT((bp->b_xflags & (BX_VNCLEAN|BX_VNDIRTY)) == 0, ("bp: %p still on a buffer list. xflags %X", bp, bp->b_xflags)); - - if (bp->b_bufsize) - allocbuf(bp, 0); + KASSERT(bp->b_npages == 0, + ("bp: %p still has %d vm pages\n", bp, bp->b_npages)); bp->b_flags = 0; bp->b_ioflags = 0; @@ -3426,8 +3406,7 @@ loop: * cleared. If the size has not changed, B_CACHE remains * unchanged from its previous state. */ - if (bp->b_bcount != size) - allocbuf(bp, size); + allocbuf(bp, size); KASSERT(bp->b_offset != NOOFFSET, ("getblk: no buffer offset")); @@ -3678,6 +3657,9 @@ allocbuf(struct buf *bp, int size) BUF_ASSERT_HELD(bp); + if (bp->b_bcount == size) + return (1); + if (bp->b_kvasize != 0 && bp->b_kvasize < size) panic("allocbuf: buffer too small"); @@ -3716,7 +3698,7 @@ allocbuf(struct buf *bp, int size) bufspaceadjust(bp, newbsize); } bp->b_bcount = size; /* requested buffer size. */ - return 1; + return (1); } extern int inflight_transient_maps; From owner-svn-src-all@freebsd.org Sun Sep 27 05:26:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E923A0A876; Sun, 27 Sep 2015 05:26:23 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EEC0FF0; Sun, 27 Sep 2015 05:26:23 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5QNcC095378; Sun, 27 Sep 2015 05:26:23 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5QNAu095377; Sun, 27 Sep 2015 05:26:23 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270526.t8R5QNAu095377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 05:26:23 +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: r288300 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 05:26:23 -0000 Author: alc Date: Sun Sep 27 05:26:22 2015 New Revision: 288300 URL: https://svnweb.freebsd.org/changeset/base/288300 Log: MFC r283795 Document vm_page_alloc_contig()'s support for the VM_ALLOC_NODUMP option. Modified: stable/10/sys/vm/vm_page.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Sun Sep 27 05:16:06 2015 (r288299) +++ stable/10/sys/vm/vm_page.c Sun Sep 27 05:26:22 2015 (r288300) @@ -1710,6 +1710,7 @@ vm_page_alloc_contig_vdrop(struct spglis * * optional allocation flags: * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_NODUMP do not include the page in a kernel core dump * VM_ALLOC_NOOBJ page is not associated with an object and * should not be exclusive busy * VM_ALLOC_SBUSY shared busy the allocated page From owner-svn-src-all@freebsd.org Sun Sep 27 05:29:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5570FA0AA9F; Sun, 27 Sep 2015 05:29:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 398391F8; Sun, 27 Sep 2015 05:29:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5TbSf095551; Sun, 27 Sep 2015 05:29:37 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5TYRf095540; Sun, 27 Sep 2015 05:29:34 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201509270529.t8R5TYRf095540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 27 Sep 2015 05:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288301 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 05:29:37 -0000 Author: melifaro Date: Sun Sep 27 05:29:34 2015 New Revision: 288301 URL: https://svnweb.freebsd.org/changeset/base/288301 Log: Eliminate nd6_nud_hint() and its TCP bindings. Initially function was introduced in r53541 (KAME initial commit) to "provide hints from upper layer protocols that indicate a connection is making "forward progress"" (quote from RFC 2461 7.3.1 Reachability Confirmation). However, it was converted to do nothing (e.g. just return) in r122922 (tcp_hostcache implementation) back in 2003. Some defines were moved to tcp_var.h in r169541. Then, it was broken (for non-corner cases) by r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, right now this code is broken and has no "real" base users. Differential Revision: https://reviews.freebsd.org/D3699 Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_nbr.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/net/if_llatbl.c Sun Sep 27 05:29:34 2015 (r288301) @@ -721,7 +721,6 @@ llatbl_lle_show(struct llentry_sa *la) db_printf(" la_flags=0x%04x\n", lle->la_flags); db_printf(" la_asked=%u\n", lle->la_asked); db_printf(" la_preempt=%u\n", lle->la_preempt); - db_printf(" ln_byhint=%u\n", lle->ln_byhint); db_printf(" ln_state=%d\n", lle->ln_state); db_printf(" ln_router=%u\n", lle->ln_router); db_printf(" ln_ntick=%ju\n", (uintmax_t)lle->ln_ntick); Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/net/if_llatbl.h Sun Sep 27 05:29:34 2015 (r288301) @@ -75,7 +75,6 @@ struct llentry { uint16_t la_flags; uint16_t la_asked; uint16_t la_preempt; - uint16_t ln_byhint; int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ uint16_t ln_router; time_t ln_ntick; Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_input.c Sun Sep 27 05:29:34 2015 (r288301) @@ -469,18 +469,6 @@ tcp_signature_verify_input(struct mbuf * } #endif -/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ -#ifdef INET6 -#define ND6_HINT(tp) \ -do { \ - if ((tp) && (tp)->t_inpcb && \ - ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \ - nd6_nud_hint(NULL, NULL, 0); \ -} while (0) -#else -#define ND6_HINT(tp) -#endif - /* * Indicate whether this ack should be delayed. We can delay the ack if * following conditions are met: @@ -1763,7 +1751,6 @@ tcp_do_segment(struct mbuf *m, struct tc tp->snd_wl2 = th->th_ack; tp->t_dupacks = 0; m_freem(m); - ND6_HINT(tp); /* Some progress has been made. */ /* * If all outstanding data are acked, stop @@ -1822,7 +1809,6 @@ tcp_do_segment(struct mbuf *m, struct tc tp->rcv_up = tp->rcv_nxt; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); - ND6_HINT(tp); /* Some progress has been made */ #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_INPUT, ostate, tp, @@ -2924,7 +2910,6 @@ dodata: /* XXX */ thflags = th->th_flags & TH_FIN; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); - ND6_HINT(tp); SOCKBUF_LOCK(&so->so_rcv); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) m_freem(m); Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_reass.c Sun Sep 27 05:29:34 2015 (r288301) @@ -327,7 +327,6 @@ present: tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); - ND6_HINT(tp); sorwakeup_locked(so); return (flags); } Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_var.h Sun Sep 27 05:29:34 2015 (r288301) @@ -83,18 +83,6 @@ struct tcptemp { #define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ -/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ -#ifdef INET6 -#define ND6_HINT(tp) \ -do { \ - if ((tp) && (tp)->t_inpcb && \ - ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \ - nd6_nud_hint(NULL, NULL, 0); \ -} while (0) -#else -#define ND6_HINT(tp) -#endif - /* * Tcp control block, one per tcp; fields: * Organized for 16 byte cacheline efficiency. Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6.c Sun Sep 27 05:29:34 2015 (r288301) @@ -1314,47 +1314,6 @@ nd6_free_redirect(const struct llentry * } /* - * Upper-layer reachability hint for Neighbor Unreachability Detection. - * - * XXX cost-effective methods? - */ -void -nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force) -{ - struct llentry *ln; - struct ifnet *ifp; - - if ((dst6 == NULL) || (rt == NULL)) - return; - - ifp = rt->rt_ifp; - IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(dst6, LLE_EXCLUSIVE, NULL); - IF_AFDATA_RUNLOCK(ifp); - if (ln == NULL) - return; - - if (ln->ln_state < ND6_LLINFO_REACHABLE) - goto done; - - /* - * if we get upper-layer reachability confirmation many times, - * it is possible we have false information. - */ - if (!force) { - ln->ln_byhint++; - if (ln->ln_byhint > V_nd6_maxnudhint) { - goto done; - } - } - - nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); -done: - LLE_WUNLOCK(ln); -} - - -/* * Rejuvenate this function for routing operations related * processing. */ Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6.h Sun Sep 27 05:29:34 2015 (r288301) @@ -412,7 +412,6 @@ void nd6_llinfo_settimer(struct llentry void nd6_llinfo_settimer_locked(struct llentry *, long); void nd6_timer(void *); void nd6_purge(struct ifnet *); -void nd6_nud_hint(struct rtentry *, struct in6_addr *, int); int nd6_resolve(struct ifnet *, int, struct mbuf *, const struct sockaddr *, u_char *, uint32_t *); int nd6_ioctl(u_long, caddr_t, struct ifnet *); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6_nbr.c Sun Sep 27 05:29:34 2015 (r288301) @@ -768,10 +768,9 @@ nd6_na_input(struct mbuf *m, int off, in bcopy(lladdr, &ln->ll_addr, ifp->if_addrlen); ln->la_flags |= LLE_VALID; EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); - if (is_solicited) { + if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); - ln->ln_byhint = 0; - } else + else nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); if ((ln->ln_router = is_router) != 0) { /* @@ -844,10 +843,9 @@ nd6_na_input(struct mbuf *m, int off, in * If not solicited and the link-layer address was * changed, make it STALE. */ - if (is_solicited) { - ln->ln_byhint = 0; + if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); - } else { + else { if (lladdr != NULL && llchange) nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); } From owner-svn-src-all@freebsd.org Sun Sep 27 05:45:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E7FA9D0366; Sun, 27 Sep 2015 05:45:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EEEEBA2; Sun, 27 Sep 2015 05:45:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5jH8k003633; Sun, 27 Sep 2015 05:45:17 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5jHpv003632; Sun, 27 Sep 2015 05:45:17 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201509270545.t8R5jHpv003632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 27 Sep 2015 05:45: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: r288302 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 05:45:17 -0000 Author: alc Date: Sun Sep 27 05:45:16 2015 New Revision: 288302 URL: https://svnweb.freebsd.org/changeset/base/288302 Log: MFC r266588 There is no reason to perform the pmap_remove() on the kernel pmap while the kmem object lock is held. Do the pmap_remove() before acquiring the kmem object lock. Modified: stable/10/sys/vm/vm_kern.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_kern.c ============================================================================== --- stable/10/sys/vm/vm_kern.c Sun Sep 27 05:29:34 2015 (r288301) +++ stable/10/sys/vm/vm_kern.c Sun Sep 27 05:45:16 2015 (r288302) @@ -396,9 +396,9 @@ kmem_unback(vm_object_t object, vm_offse KASSERT(object == kmem_object || object == kernel_object, ("kmem_unback: only supports kernel objects.")); + pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; VM_OBJECT_WLOCK(object); - pmap_remove(kernel_pmap, addr, addr + size); for (i = 0; i < size; i += PAGE_SIZE) { m = vm_page_lookup(object, OFF_TO_IDX(offset + i)); vm_page_unwire(m, 0); From owner-svn-src-all@freebsd.org Sun Sep 27 07:04:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57EC0A0AA8D; Sun, 27 Sep 2015 07:04:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDDFF0; Sun, 27 Sep 2015 07:04:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R74I3b036335; Sun, 27 Sep 2015 07:04:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R74Hcg036332; Sun, 27 Sep 2015 07:04:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509270704.t8R74Hcg036332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 27 Sep 2015 07:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288303 - head/contrib/netcat 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 07:04:18 -0000 Author: delphij Date: Sun Sep 27 07:04:16 2015 New Revision: 288303 URL: https://svnweb.freebsd.org/changeset/base/288303 Log: MFV r288243: nc from OpenBSD 5.8. Modified: head/contrib/netcat/nc.1 head/contrib/netcat/netcat.c head/contrib/netcat/socks.c Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/nc.1 ============================================================================== --- head/contrib/netcat/nc.1 Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/nc.1 Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.67 2014/02/26 20:56:11 claudio Exp $ +.\" $OpenBSD: nc.1,v 1.68 2015/03/26 10:35:04 tobias Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 11, 2014 +.Dd September 26, 2015 .Dt NC 1 .Os .Sh NAME @@ -133,7 +133,7 @@ connection to another program (e.g.\& .Xr ssh 1 using the .Xr ssh_config 5 -.Cm ProxyUseFdPass +.Cm ProxyUseFdpass option). .It Fl h Prints out Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/netcat.c Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.127 2015/02/14 22:40:22 jca Exp $ */ +/* $OpenBSD: netcat.c,v 1.130 2015/07/26 19:12:28 chl Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -52,15 +52,16 @@ #include #include #include +#include +#include #include #include +#include #include #include #include #include #include -#include -#include #include "atomicio.h" #ifndef SUN_LEN @@ -163,6 +164,8 @@ main(int argc, char *argv[]) uport = NULL; sv = NULL; + signal(SIGPIPE, SIG_IGN); + while ((ch = getopt_long(argc, argv, "46DdEe:FhI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z", longopts, NULL)) != -1) { @@ -1042,7 +1045,6 @@ fdpass(int nfd) bzero(&mh, sizeof(mh)); bzero(&cmsgbuf, sizeof(cmsgbuf)); bzero(&iov, sizeof(iov)); - bzero(&pfd, sizeof(pfd)); mh.msg_control = (caddr_t)&cmsgbuf.buf; mh.msg_controllen = sizeof(cmsgbuf.buf); @@ -1059,17 +1061,17 @@ fdpass(int nfd) bzero(&pfd, sizeof(pfd)); pfd.fd = STDOUT_FILENO; + pfd.events = POLLOUT; for (;;) { r = sendmsg(STDOUT_FILENO, &mh, 0); if (r == -1) { if (errno == EAGAIN || errno == EINTR) { - pfd.events = POLLOUT; if (poll(&pfd, 1, -1) == -1) err(1, "poll"); continue; } err(1, "sendmsg"); - } else if (r == -1) + } else if (r != 1) errx(1, "sendmsg: unexpected return value %zd", r); else break; Modified: head/contrib/netcat/socks.c ============================================================================== --- head/contrib/netcat/socks.c Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/socks.c Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -/* $OpenBSD: socks.c,v 1.20 2012/03/08 09:56:28 espie Exp $ */ +/* $OpenBSD: socks.c,v 1.21 2015/03/26 21:19:51 tobias Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. @@ -308,8 +308,8 @@ socks_connect(const char *host, const ch } /* Terminate headers */ - if ((r = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2) - err(1, "write failed (2/%d)", r); + if ((cnt = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2) + err(1, "write failed (%zu/2)", cnt); /* Read status reply */ proxy_read_line(proxyfd, buf, sizeof(buf)); From owner-svn-src-all@freebsd.org Sun Sep 27 07:40:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453749D0EEA; Sun, 27 Sep 2015 07:40:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36115F13; Sun, 27 Sep 2015 07:40:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R7eKuc049122; Sun, 27 Sep 2015 07:40:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R7eKqR049121; Sun, 27 Sep 2015 07:40:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270740.t8R7eKqR049121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 07:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288304 - head/sys/modules/netgraph 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 07:40:20 -0000 Author: ngie Date: Sun Sep 27 07:40:19 2015 New Revision: 288304 URL: https://svnweb.freebsd.org/changeset/base/288304 Log: Enable parallel subdirectory building with sys/modules/netgraph MFC after: 2 weeks Modified: head/sys/modules/netgraph/Makefile Modified: head/sys/modules/netgraph/Makefile ============================================================================== --- head/sys/modules/netgraph/Makefile Sun Sep 27 07:04:16 2015 (r288303) +++ head/sys/modules/netgraph/Makefile Sun Sep 27 07:40:19 2015 (r288304) @@ -62,4 +62,6 @@ _bluetooth= bluetooth _mppc= mppc .endif +SUBDIR_PARALLEL= + .include From owner-svn-src-all@freebsd.org Sun Sep 27 07:51:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AA99A0A7F8; Sun, 27 Sep 2015 07:51:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEB8583B; Sun, 27 Sep 2015 07:51:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R7pNWI055675; Sun, 27 Sep 2015 07:51:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R7pJ0B055658; Sun, 27 Sep 2015 07:51:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270751.t8R7pJ0B055658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 07:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288305 - head/sbin/ifconfig 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 07:51:24 -0000 Author: ngie Date: Sun Sep 27 07:51:18 2015 New Revision: 288305 URL: https://svnweb.freebsd.org/changeset/base/288305 Log: Replace N #defines with nitems to simplify ifconfig code slightly MFC after: 1 week Modified: head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/carp.c head/sbin/ifconfig/ifbridge.c head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/iffib.c head/sbin/ifconfig/ifgre.c head/sbin/ifconfig/ifgroup.c head/sbin/ifconfig/ifieee80211.c head/sbin/ifconfig/iflagg.c head/sbin/ifconfig/ifmac.c head/sbin/ifconfig/ifmedia.c head/sbin/ifconfig/ifpfsync.c head/sbin/ifconfig/ifvlan.c head/sbin/ifconfig/ifvxlan.c Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/af_inet6.c Sun Sep 27 07:51:18 2015 (r288305) @@ -521,7 +521,6 @@ static struct option in6_Lopt = { static __constructor void inet6_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; #ifndef RESCUE @@ -529,9 +528,8 @@ inet6_ctor(void) return; #endif - for (i = 0; i < N(inet6_cmds); i++) + for (i = 0; i < nitems(inet6_cmds); i++) cmd_register(&inet6_cmds[i]); af_register(&af_inet6); opt_register(&in6_Lopt); -#undef N } Modified: head/sbin/ifconfig/carp.c ============================================================================== --- head/sbin/ifconfig/carp.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/carp.c Sun Sep 27 07:51:18 2015 (r288305) @@ -217,11 +217,9 @@ static struct afswtch af_carp = { static __constructor void carp_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(carp_cmds); i++) + for (i = 0; i < nitems(carp_cmds); i++) cmd_register(&carp_cmds[i]); af_register(&af_carp); -#undef N } Modified: head/sbin/ifconfig/ifbridge.c ============================================================================== --- head/sbin/ifconfig/ifbridge.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifbridge.c Sun Sep 27 07:51:18 2015 (r288305) @@ -749,11 +749,9 @@ static struct afswtch af_bridge = { static __constructor void bridge_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(bridge_cmds); i++) + for (i = 0; i < nitems(bridge_cmds); i++) cmd_register(&bridge_cmds[i]); af_register(&af_bridge); -#undef N } Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifclone.c Sun Sep 27 07:51:18 2015 (r288305) @@ -32,9 +32,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include +#include #include +#include #include #include @@ -184,11 +184,9 @@ static struct option clone_Copt = { .opt static __constructor void clone_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(clone_cmds); i++) + for (i = 0; i < nitems(clone_cmds); i++) cmd_register(&clone_cmds[i]); opt_register(&clone_Copt); -#undef N } Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifconfig.c Sun Sep 27 07:51:18 2015 (r288305) @@ -43,11 +43,11 @@ static const char rcsid[] = #include #include -#include -#include #include #include #include +#include +#include #include #include @@ -604,7 +604,6 @@ cmd_register(struct cmd *p) static const struct cmd * cmd_lookup(const char *name, int iscreate) { -#define N(a) (sizeof(a)/sizeof(a[0])) const struct cmd *p; for (p = cmds; p != NULL; p = p->c_next) @@ -618,7 +617,6 @@ cmd_lookup(const char *name, int iscreat } } return NULL; -#undef N } struct callback { @@ -1387,10 +1385,8 @@ static struct cmd basic_cmds[] = { static __constructor void ifconfig_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(basic_cmds); i++) + for (i = 0; i < nitems(basic_cmds); i++) cmd_register(&basic_cmds[i]); -#undef N } Modified: head/sbin/ifconfig/iffib.c ============================================================================== --- head/sbin/ifconfig/iffib.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/iffib.c Sun Sep 27 07:51:18 2015 (r288305) @@ -113,11 +113,9 @@ static struct afswtch af_fib = { static __constructor void fib_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(fib_cmds); i++) + for (i = 0; i < nitems(fib_cmds); i++) cmd_register(&fib_cmds[i]); af_register(&af_fib); -#undef N } Modified: head/sbin/ifconfig/ifgre.c ============================================================================== --- head/sbin/ifconfig/ifgre.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifgre.c Sun Sep 27 07:51:18 2015 (r288305) @@ -113,11 +113,9 @@ static struct afswtch af_gre = { static __constructor void gre_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(gre_cmds); i++) + for (i = 0; i < nitems(gre_cmds); i++) cmd_register(&gre_cmds[i]); af_register(&af_gre); -#undef N } Modified: head/sbin/ifconfig/ifgroup.c ============================================================================== --- head/sbin/ifconfig/ifgroup.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifgroup.c Sun Sep 27 07:51:18 2015 (r288305) @@ -28,7 +28,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include +#include #include #include #include @@ -174,12 +174,10 @@ static struct option group_gopt = { "g:" static __constructor void group_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(group_cmds); i++) + for (i = 0; i < nitems(group_cmds); i++) cmd_register(&group_cmds[i]); af_register(&af_group); opt_register(&group_gopt); -#undef N } Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifieee80211.c Sun Sep 27 07:51:18 2015 (r288305) @@ -2856,7 +2856,6 @@ printrsnie(const char *tag, const u_int8 static void printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) { -#define N(a) (sizeof(a) / sizeof(a[0])) u_int8_t len = ie[1]; printf("%s", tag); @@ -2897,7 +2896,7 @@ printwpsie(const char *tag, const u_int8 break; case IEEE80211_WPS_DEV_PASS_ID: n = LE_READ_2(ie); - if (n < N(dev_pass_id)) + if (n < nitems(dev_pass_id)) printf(" dpi:%s", dev_pass_id[n]); break; case IEEE80211_WPS_UUID_E: @@ -2911,7 +2910,6 @@ printwpsie(const char *tag, const u_int8 } printf(">"); } -#undef N } static void @@ -3418,7 +3416,6 @@ list_stations(int s) static const char * mesh_linkstate_string(uint8_t state) { -#define N(a) (sizeof(a) / sizeof(a[0])) static const char *state_names[] = { [0] = "IDLE", [1] = "OPEN-TX", @@ -3428,13 +3425,12 @@ mesh_linkstate_string(uint8_t state) [5] = "HOLDING", }; - if (state >= N(state_names)) { + if (state >= nitems(state_names)) { static char buf[10]; snprintf(buf, sizeof(buf), "#%u", state); return buf; } else return state_names[state]; -#undef N } static const char * @@ -5320,12 +5316,10 @@ static struct afswtch af_ieee80211 = { static __constructor void ieee80211_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(ieee80211_cmds); i++) + for (i = 0; i < nitems(ieee80211_cmds); i++) cmd_register(&ieee80211_cmds[i]); af_register(&af_ieee80211); clone_setdefcallback("wlan", wlan_create); -#undef N } Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/iflagg.c Sun Sep 27 07:51:18 2015 (r288305) @@ -308,11 +308,9 @@ static struct afswtch af_lagg = { static __constructor void lagg_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(lagg_cmds); i++) + for (i = 0; i < nitems(lagg_cmds); i++) cmd_register(&lagg_cmds[i]); af_register(&af_lagg); -#undef N } Modified: head/sbin/ifconfig/ifmac.c ============================================================================== --- head/sbin/ifconfig/ifmac.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifmac.c Sun Sep 27 07:51:18 2015 (r288305) @@ -111,11 +111,9 @@ static struct afswtch af_mac = { static __constructor void mac_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(mac_cmds); i++) + for (i = 0; i < nitems(mac_cmds); i++) cmd_register(&mac_cmds[i]); af_register(&af_mac); -#undef N } Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifmedia.c Sun Sep 27 07:51:18 2015 (r288305) @@ -845,11 +845,9 @@ static struct afswtch af_media = { static __constructor void ifmedia_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(media_cmds); i++) + for (i = 0; i < nitems(media_cmds); i++) cmd_register(&media_cmds[i]); af_register(&af_media); -#undef N } Modified: head/sbin/ifconfig/ifpfsync.c ============================================================================== --- head/sbin/ifconfig/ifpfsync.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifpfsync.c Sun Sep 27 07:51:18 2015 (r288305) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include +#include #include #include @@ -227,11 +227,9 @@ static struct afswtch af_pfsync = { static __constructor void pfsync_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(pfsync_cmds); i++) + for (i = 0; i < nitems(pfsync_cmds); i++) cmd_register(&pfsync_cmds[i]); af_register(&af_pfsync); -#undef N } Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifvlan.c Sun Sep 27 07:51:18 2015 (r288305) @@ -194,13 +194,11 @@ static struct afswtch af_vlan = { static __constructor void vlan_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(vlan_cmds); i++) + for (i = 0; i < nitems(vlan_cmds); i++) cmd_register(&vlan_cmds[i]); af_register(&af_vlan); callback_register(vlan_cb, NULL); clone_setdefcallback("vlan", vlan_create); -#undef N } Modified: head/sbin/ifconfig/ifvxlan.c ============================================================================== --- head/sbin/ifconfig/ifvxlan.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifvxlan.c Sun Sep 27 07:51:18 2015 (r288305) @@ -635,13 +635,11 @@ static struct afswtch af_vxlan = { static __constructor void vxlan_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(vxlan_cmds); i++) + for (i = 0; i < nitems(vxlan_cmds); i++) cmd_register(&vxlan_cmds[i]); af_register(&af_vxlan); callback_register(vxlan_cb, NULL); clone_setdefcallback("vxlan", vxlan_create); -#undef N } From owner-svn-src-all@freebsd.org Sun Sep 27 09:15:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFEA8A0A659; Sun, 27 Sep 2015 09:15:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFEF033D; Sun, 27 Sep 2015 09:15:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R9FuxO089165; Sun, 27 Sep 2015 09:15:56 GMT (envelope-from mr@FreeBSD.org) Received: (from mr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R9FsEi089158; Sun, 27 Sep 2015 09:15:54 GMT (envelope-from mr@FreeBSD.org) Message-Id: <201509270915.t8R9FsEi089158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mr set sender to mr@FreeBSD.org using -f From: Michael Reifenberger Date: Sun, 27 Sep 2015 09:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288306 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 09:15:57 -0000 Author: mr Date: Sun Sep 27 09:15:54 2015 New Revision: 288306 URL: https://svnweb.freebsd.org/changeset/base/288306 Log: Add support to systat to display zfs arc cache status/info PR: 195460 Submitted by: ota Added: head/usr.bin/systat/zarc.c (contents, props changed) Modified: head/usr.bin/systat/Makefile head/usr.bin/systat/cmdtab.c head/usr.bin/systat/extern.h head/usr.bin/systat/main.c head/usr.bin/systat/systat.1 head/usr.bin/systat/systat.h Modified: head/usr.bin/systat/Makefile ============================================================================== --- head/usr.bin/systat/Makefile Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/Makefile Sun Sep 27 09:15:54 2015 (r288306) @@ -6,7 +6,7 @@ PROG= systat SRCS= cmds.c cmdtab.c devs.c fetch.c iostat.c keyboard.c main.c \ netcmds.c netstat.c pigs.c swap.c icmp.c \ - mode.c ip.c tcp.c \ + mode.c ip.c tcp.c zarc.c \ vmstat.c convtbl.c ifcmds.c ifstat.c .if ${MK_INET6_SUPPORT} != "no" Modified: head/usr.bin/systat/cmdtab.c ============================================================================== --- head/usr.bin/systat/cmdtab.c Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/cmdtab.c Sun Sep 27 09:15:54 2015 (r288306) @@ -75,6 +75,9 @@ struct cmdtab cmdtab[] = { { "ifstat", showifstat, fetchifstat, labelifstat, initifstat, openifstat, closeifstat, cmdifstat, 0, CF_LOADAV }, + { "zarc", showzarc, fetchzarc, labelzarc, + initzarc, openzarc, closezarc, 0, + resetzarc, CF_ZFSARC }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 } }; struct cmdtab *curcmd = &cmdtab[0]; Modified: head/usr.bin/systat/extern.h ============================================================================== --- head/usr.bin/systat/extern.h Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/extern.h Sun Sep 27 09:15:54 2015 (r288306) @@ -163,3 +163,14 @@ void showtcp(void); void status(void); void suspend(int); char *sysctl_dynread(const char *, size_t *); + +#define SYSTAT_CMD(name) \ + void close ## name(WINDOW *); \ + void fetch ## name(void); \ + int init ## name(void); \ + void label ## name(void); \ + WINDOW *open ## name(void); \ + void reset ## name(void); \ + void show ## name(void) + +SYSTAT_CMD( zarc ); Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/main.c Sun Sep 27 09:15:54 2015 (r288306) @@ -243,6 +243,11 @@ labels(void) "/0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10"); mvaddstr(1, 5, "Load Average"); } + if (curcmd->c_flags & CF_ZFSARC) { + mvaddstr(0, 20, + " Total MFU MRU Anon Hdr L2Hdr Other"); + mvaddstr(1, 5, "ZFS ARC "); + } (*curcmd->c_label)(); #ifdef notdef mvprintw(21, 25, "CPU usage on %s", hostname); @@ -276,8 +281,33 @@ display(void) if (j > 50) wprintw(wload, " %4.1f", avenrun[0]); } + if (curcmd->c_flags & CF_ZFSARC) { + uint64_t arc[7] = {}; + size_t size = sizeof(arc[0]); + if (sysctlbyname("kstat.zfs.misc.arcstats.size", + &arc[0], &size, NULL, 0) == 0 ) { + GETSYSCTL("vfs.zfs.mfu_size", arc[1]); + GETSYSCTL("vfs.zfs.mru_size", arc[2]); + GETSYSCTL("vfs.zfs.anon_size", arc[3]); + GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc[4]); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]); + GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]); + wmove(wload, 0, 0); wclrtoeol(wload); + for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) { + if (arc[i] > 10llu * 1024 * 1024 * 1024 ) { + wprintw(wload, "%7lluG", arc[i] >> 30); + } + else if (arc[i] > 10 * 1024 * 1024 ) { + wprintw(wload, "%7lluM", arc[i] >> 20); + } + else { + wprintw(wload, "%7lluK", arc[i] >> 10); + } + } + } + } (*curcmd->c_refresh)(); - if (curcmd->c_flags & CF_LOADAV) + if (curcmd->c_flags & (CF_LOADAV |CF_ZFSARC)) wrefresh(wload); wrefresh(wnd); move(CMDLINE, col); Modified: head/usr.bin/systat/systat.1 ============================================================================== --- head/usr.bin/systat/systat.1 Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/systat.1 Sun Sep 27 09:15:54 2015 (r288306) @@ -98,8 +98,9 @@ to be one of: .Ic pigs , .Ic swap , .Ic tcp , +.Ic vmstat , or -.Ic vmstat . +.Ic zarc , These displays can also be requested interactively (without the .Dq Fl ) and are described in @@ -441,6 +442,8 @@ Display statistics averaged over the ref .It Cm zero Reset running statistics to zero. .El +.It Ic zarc +display arc cache usage and hit/miss statistics. .It Ic netstat Display, in the lower window, network connections. By default, Modified: head/usr.bin/systat/systat.h ============================================================================== --- head/usr.bin/systat/systat.h Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/systat.h Sun Sep 27 09:15:54 2015 (r288306) @@ -54,6 +54,7 @@ extern int use_kvm; #define CF_INIT 0x1 /* been initialized */ #define CF_LOADAV 0x2 /* display w/ load average */ +#define CF_ZFSARC 0x4 /* display w/ ZFS cache usage */ #define TCP 0x1 #define UDP 0x2 Added: head/usr.bin/systat/zarc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/systat/zarc.c Sun Sep 27 09:15:54 2015 (r288306) @@ -0,0 +1,221 @@ +/*- + * Copyright (c) 2014 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "systat.h" +#include "extern.h" + +struct zfield{ + uint64_t arcstats; + uint64_t arcstats_demand_data; + uint64_t arcstats_demand_metadata; + uint64_t arcstats_prefetch_data; + uint64_t arcstats_prefetch_metadata; + uint64_t zfetchstats; + uint64_t arcstats_l2; + uint64_t vdev_cache_stats; +}; + +static struct zarcstats { + struct zfield hits; + struct zfield misses; +} curstat, initstat, oldstat; + +static void +getinfo(struct zarcstats *ls); + +WINDOW * +openzarc(void) +{ + return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); +} + +void +closezarc(WINDOW *w) +{ + if (w == NULL) + return; + wclear(w); + wrefresh(w); + delwin(w); +} + +void +labelzarc(void) +{ + wmove(wnd, 0, 0); wclrtoeol(wnd); + mvwprintw(wnd, 0, 31+1, "%4.4s %7.7s %7.7s %12.12s %12.12s", + "rate", "hits", "misses", "total hits", "total misses"); +#define L(row, str) mvwprintw(wnd, row, 5, str); \ + mvwprintw(wnd, row, 31, ":"); \ + mvwprintw(wnd, row, 31+4, "%%") + L(1, "arcstats"); + L(2, "arcstats.demand_data"); + L(3, "arcstats.demand_metadata"); + L(4, "arcstats.prefetch_data"); + L(5, "arcstats.prefetch_metadata"); + L(6, "zfetchstats"); + L(7, "arcstats.l2"); + L(8, "vdev_cache_stats"); +#undef L +} + +static int calc(uint64_t hits, uint64_t misses) +{ + if( hits ) + return 100 * hits / ( hits + misses ); + else + return 0; +} + +static void +domode(struct zarcstats *delta, struct zarcstats *rate) +{ +#define DO(stat) \ + delta->hits.stat = (curstat.hits.stat - oldstat.hits.stat); \ + delta->misses.stat = (curstat.misses.stat - oldstat.misses.stat); \ + rate->hits.stat = calc(delta->hits.stat, delta->misses.stat) + DO(arcstats); + DO(arcstats_demand_data); + DO(arcstats_demand_metadata); + DO(arcstats_prefetch_data); + DO(arcstats_prefetch_metadata); + DO(zfetchstats); + DO(arcstats_l2); + DO(vdev_cache_stats); + DO(arcstats); + DO(arcstats_demand_data); + DO(arcstats_demand_metadata); + DO(arcstats_prefetch_data); + DO(arcstats_prefetch_metadata); + DO(zfetchstats); + DO(arcstats_l2); + DO(vdev_cache_stats); +#undef DO +} + +void +showzarc(void) +{ + struct zarcstats delta, rate; + + memset(&delta, 0, sizeof delta); + memset(&rate, 0, sizeof rate); + + domode(&delta, &rate); + +#define DO(stat, row, col, fmt) \ + mvwprintw(wnd, row, col, fmt, stat) +#define R(row, stat) DO(rate.hits.stat, row, 31+1, "%3lu") +#define H(row, stat) DO(delta.hits.stat, row, 31+1+5, "%7lu"); \ + DO(curstat.hits.stat, row, 31+1+5+8+8, "%12lu") +#define M(row, stat) DO(delta.misses.stat, row, 31+1+5+8, "%7lu"); \ + DO(curstat.misses.stat, row, 31+1+5+8+8+13, "%12lu") +#define E(row, stat) R(row, stat); H(row, stat); M(row, stat); + E(1, arcstats); + E(2, arcstats_demand_data); + E(3, arcstats_demand_metadata); + E(4, arcstats_prefetch_data); + E(5, arcstats_prefetch_metadata); + E(6, zfetchstats); + E(7, arcstats_l2); + E(8, vdev_cache_stats); +#undef DO +#undef E +#undef M +#undef H +#undef R +} + +int +initzarc(void) +{ + getinfo(&initstat); + curstat = oldstat = initstat; + return 1; +} + +void +resetzarc(void) +{ + initzarc(); +} + +static void +getinfo(struct zarcstats *ls) +{ + size_t size = sizeof( ls->hits.arcstats ); + if ( sysctlbyname("kstat.zfs.misc.arcstats.hits", + &ls->hits.arcstats, &size, NULL, 0 ) != 0 ) + return; + GETSYSCTL("kstat.zfs.misc.arcstats.misses", + ls->misses.arcstats); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_hits", + ls->hits.arcstats_demand_data); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_misses", + ls->misses.arcstats_demand_data); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_hits", + ls->hits.arcstats_demand_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_misses", + ls->misses.arcstats_demand_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_hits", + ls->hits.arcstats_prefetch_data); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_misses", + ls->misses.arcstats_prefetch_data); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_hits", + ls->hits.arcstats_prefetch_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_misses", + ls->misses.arcstats_prefetch_metadata); + GETSYSCTL("kstat.zfs.misc.zfetchstats.hits", + ls->hits.zfetchstats); + GETSYSCTL("kstat.zfs.misc.zfetchstats.misses", + ls->misses.zfetchstats); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hits", + ls->hits.arcstats_l2); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_misses", + ls->misses.arcstats_l2); + GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.hits", + ls->hits.vdev_cache_stats); + GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.misses", + ls->misses.vdev_cache_stats); +} + +void +fetchzarc(void) +{ + oldstat = curstat; + getinfo(&curstat); +} From owner-svn-src-all@freebsd.org Sun Sep 27 12:17:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 912DEA0ACA4; Sun, 27 Sep 2015 12:17:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8206B259; Sun, 27 Sep 2015 12:17:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCH4jO063260; Sun, 27 Sep 2015 12:17:04 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCH4Zi063259; Sun, 27 Sep 2015 12:17:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201509271217.t8RCH4Zi063259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 27 Sep 2015 12:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288307 - head/sys/dev/nxge 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 12:17:04 -0000 Author: bz Date: Sun Sep 27 12:17:03 2015 New Revision: 288307 URL: https://svnweb.freebsd.org/changeset/base/288307 Log: Compare the correct variable to see if memory allocation succeeded. I don't even want to know where the symbol "version" comes from. Spotted by: reading kernel compile time log MFC after: 2 weeks Modified: head/sys/dev/nxge/if_nxge.c Modified: head/sys/dev/nxge/if_nxge.c ============================================================================== --- head/sys/dev/nxge/if_nxge.c Sun Sep 27 09:15:54 2015 (r288306) +++ head/sys/dev/nxge/if_nxge.c Sun Sep 27 12:17:03 2015 (r288307) @@ -1457,7 +1457,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, stru case XGE_READ_VERSION: info = xge_os_malloc(NULL, XGE_BUFFER_SIZE); - if(version != NULL) { + if(info != NULL) { strcpy(info, XGE_DRIVER_VERSION); if(copyout(info, ifreqp->ifr_data, XGE_BUFFER_SIZE) == 0) retValue = 0; From owner-svn-src-all@freebsd.org Sun Sep 27 12:19:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA69FA0AE17; Sun, 27 Sep 2015 12:19:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B28F62F; Sun, 27 Sep 2015 12:19:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCJbIJ063405; Sun, 27 Sep 2015 12:19:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCJb1m063403; Sun, 27 Sep 2015 12:19:37 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201509271219.t8RCJb1m063403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 27 Sep 2015 12:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288308 - head/sys/dev/nxge/xgehal 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 12:19:37 -0000 Author: bz Date: Sun Sep 27 12:19:36 2015 New Revision: 288308 URL: https://svnweb.freebsd.org/changeset/base/288308 Log: Fix what looks like a consistent copy&paste error. Don't make an integer to a boolean and then compare to a value which needs an integer comparison. Spotted by: reading kernel compile time log MFC after: 2 weeks Modified: head/sys/dev/nxge/xgehal/xgehal-fifo.c head/sys/dev/nxge/xgehal/xgehal-ring.c Modified: head/sys/dev/nxge/xgehal/xgehal-fifo.c ============================================================================== --- head/sys/dev/nxge/xgehal/xgehal-fifo.c Sun Sep 27 12:17:03 2015 (r288307) +++ head/sys/dev/nxge/xgehal/xgehal-fifo.c Sun Sep 27 12:19:36 2015 (r288308) @@ -464,7 +464,7 @@ __hal_fifo_hw_initialize(xge_hal_device_ if (!hldev->config.fifo.queue[i].configured || !hldev->config.fifo.queue[i].intr_vector || - !hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) + hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) continue; /* find channel */ Modified: head/sys/dev/nxge/xgehal/xgehal-ring.c ============================================================================== --- head/sys/dev/nxge/xgehal/xgehal-ring.c Sun Sep 27 12:17:03 2015 (r288307) +++ head/sys/dev/nxge/xgehal/xgehal-ring.c Sun Sep 27 12:19:36 2015 (r288308) @@ -609,7 +609,7 @@ __hal_ring_hw_initialize(xge_hal_device_ if (!hldev->config.ring.queue[i].configured || !hldev->config.ring.queue[i].intr_vector || - !hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) + hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) continue; /* find channel */ From owner-svn-src-all@freebsd.org Sun Sep 27 12:26:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32F96A0A92C; Sun, 27 Sep 2015 12:26:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E266EC65; Sun, 27 Sep 2015 12:26:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5197F25D387C; Sun, 27 Sep 2015 12:26:53 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 60783C770BD; Sun, 27 Sep 2015 12:26:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id MjVqNRmBDXo3; Sun, 27 Sep 2015 12:26:50 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1CFE1C770B3; Sun, 27 Sep 2015 12:26:49 +0000 (UTC) Date: Sun, 27 Sep 2015 12:26:48 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Alexander V. Chernikov" , George Neville-Neil cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288301 - in head/sys: net netinet netinet6 In-Reply-To: <201509270529.t8R5TYRf095540@repo.freebsd.org> Message-ID: References: <201509270529.t8R5TYRf095540@repo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 12:26:56 -0000 On Sun, 27 Sep 2015, Alexander V. Chernikov wrote: > Author: melifaro > Date: Sun Sep 27 05:29:34 2015 > New Revision: 288301 > URL: https://svnweb.freebsd.org/changeset/base/288301 > > Log: > Eliminate nd6_nud_hint() and its TCP bindings. > > Initially function was introduced in r53541 (KAME initial commit) to > "provide hints from upper layer protocols that indicate a connection > is making "forward progress"" (quote from RFC 2461 7.3.1 Reachability > Confirmation). > However, it was converted to do nothing (e.g. just return) in r122922 > (tcp_hostcache implementation) back in 2003. Some defines were moved > to tcp_var.h in r169541. Then, it was broken (for non-corner cases) > by r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, > right now this code is broken and has no "real" base users. > > Differential Revision: https://reviews.freebsd.org/D3699 PR: 165692 It would be nice to have the feature back though it would be very expensive locking wise if it'd remain a per-packet operation. -- Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@freebsd.org Sun Sep 27 12:52:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 817D99CFAFF; Sun, 27 Sep 2015 12:52:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 659339B5; Sun, 27 Sep 2015 12:52:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCqJkk079338; Sun, 27 Sep 2015 12:52:19 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCqJqO079337; Sun, 27 Sep 2015 12:52:19 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509271252.t8RCqJqO079337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 27 Sep 2015 12:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288309 - head/lib/libc/gen 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 12:52:19 -0000 Author: jilles Date: Sun Sep 27 12:52:18 2015 New Revision: 288309 URL: https://svnweb.freebsd.org/changeset/base/288309 Log: fnmatch(): Remove exponential behaviour as in sh r229201. The old code was exponential in the number of asterisks in the pattern. However, once a match has been found upto the next asterisk, the previous asterisks are no longer relevant. Modified: head/lib/libc/gen/fnmatch.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Sun Sep 27 12:19:36 2015 (r288308) +++ head/lib/libc/gen/fnmatch.c Sun Sep 27 12:52:18 2015 (r288309) @@ -87,11 +87,14 @@ static int fnmatch1(const char *pattern, const char *string, const char *stringstart, int flags, mbstate_t patmbs, mbstate_t strmbs) { + const char *bt_pattern, *bt_string; + mbstate_t bt_patmbs, bt_strmbs; char *newp; char c; wchar_t pc, sc; size_t pclen, sclen; + bt_pattern = bt_string = NULL; for (;;) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); if (pclen == (size_t)-1 || pclen == (size_t)-2) @@ -107,16 +110,18 @@ fnmatch1(const char *pattern, const char case EOS: if ((flags & FNM_LEADING_DIR) && sc == '/') return (0); - return (sc == EOS ? 0 : FNM_NOMATCH); + if (sc == EOS) + return (0); + goto backtrack; case '?': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; string += sclen; break; case '*': @@ -128,7 +133,7 @@ fnmatch1(const char *pattern, const char if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; /* Optimize for pattern with * at end or before /. */ if (c == EOS) @@ -144,33 +149,24 @@ fnmatch1(const char *pattern, const char break; } - /* General case, use recursion. */ - while (sc != EOS) { - if (!fnmatch1(pattern, string, stringstart, - flags, patmbs, strmbs)) - return (0); - sclen = mbrtowc(&sc, string, MB_LEN_MAX, - &strmbs); - if (sclen == (size_t)-1 || - sclen == (size_t)-2) { - sc = (unsigned char)*string; - sclen = 1; - memset(&strmbs, 0, sizeof(strmbs)); - } - if (sc == '/' && flags & FNM_PATHNAME) - break; - string += sclen; - } - return (FNM_NOMATCH); + /* + * First try the shortest match for the '*' that + * could work. We can forget any earlier '*' since + * there is no way having it match more characters + * can help us, given that we are already here. + */ + bt_pattern = pattern, bt_patmbs = patmbs; + bt_string = string, bt_strmbs = strmbs; + break; case '[': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; switch (rangematch(pattern, sc, flags, &newp, &patmbs)) { @@ -180,7 +176,7 @@ fnmatch1(const char *pattern, const char pattern = newp; break; case RANGE_NOMATCH: - return (FNM_NOMATCH); + goto backtrack; } string += sclen; break; @@ -195,14 +191,39 @@ fnmatch1(const char *pattern, const char /* FALLTHROUGH */ default: norm: + string += sclen; if (pc == sc) ; else if ((flags & FNM_CASEFOLD) && (towlower(pc) == towlower(sc))) ; - else - return (FNM_NOMATCH); - string += sclen; + else { + backtrack: + /* + * If we have a mismatch (other than hitting + * the end of the string), go back to the last + * '*' seen and have it match one additional + * character. + */ + if (bt_pattern == NULL) + return (FNM_NOMATCH); + sclen = mbrtowc(&sc, bt_string, MB_LEN_MAX, + &bt_strmbs); + if (sclen == (size_t)-1 || + sclen == (size_t)-2) { + sc = (unsigned char)*bt_string; + sclen = 1; + memset(&bt_strmbs, 0, + sizeof(bt_strmbs)); + } + if (sc == EOS) + return (FNM_NOMATCH); + if (sc == '/' && flags & FNM_PATHNAME) + return (FNM_NOMATCH); + bt_string += sclen; + pattern = bt_pattern, patmbs = bt_patmbs; + string = bt_string, strmbs = bt_strmbs; + } break; } } From owner-svn-src-all@freebsd.org Sun Sep 27 13:47:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E927EA0AE99; Sun, 27 Sep 2015 13:47:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D84FFFD; Sun, 27 Sep 2015 13:47:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RDlULD099835; Sun, 27 Sep 2015 13:47:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RDlT2S099825; Sun, 27 Sep 2015 13:47:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509271347.t8RDlT2S099825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Sep 2015 13:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288310 - in head: share/man/man4 sys/cam/ctl sys/cam/scsi usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 13:47:31 -0000 Author: mav Date: Sun Sep 27 13:47:28 2015 New Revision: 288310 URL: https://svnweb.freebsd.org/changeset/base/288310 Log: Add to CTL initial support for CDROMs and removable devices. Relnotes: yes Modified: head/share/man/man4/ctl.4 head/sys/cam/ctl/README.ctl.txt head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_cd.h head/usr.sbin/ctladm/ctladm.8 head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/share/man/man4/ctl.4 ============================================================================== --- head/share/man/man4/ctl.4 Sun Sep 27 12:52:18 2015 (r288309) +++ head/share/man/man4/ctl.4 Sun Sep 27 13:47:28 2015 (r288310) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 12, 2015 +.Dd September 27, 2015 .Dt CTL 4 .Os .Sh NAME @@ -53,7 +53,7 @@ It supports features such as: .Pp .Bl -bullet -compact .It -Disk and processor device emulation +Disk, processor and cdrom device emulation .It Tagged queueing .It Modified: head/sys/cam/ctl/README.ctl.txt ============================================================================== --- head/sys/cam/ctl/README.ctl.txt Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/README.ctl.txt Sun Sep 27 13:47:28 2015 (r288310) @@ -19,9 +19,9 @@ Userland Commands Introduction: ============ -CTL is a disk and processor device emulation subsystem originally written -for Copan Systems under Linux starting in 2003. It has been shipping in -Copan (now SGI) products since 2005. +CTL is a disk, processor and cdrom device emulation subsystem originally +written for Copan Systems under Linux starting in 2003. It has been +shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is @@ -31,7 +31,7 @@ that Spectra would work to get CTL into Features: ======== - - Disk and processor device emulation. + - Disk, processor and cdrom device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl.c Sun Sep 27 13:47:28 2015 (r288310) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -3819,8 +3820,14 @@ ctl_init_page_index(struct ctl_lun *lun) for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { page_index = &lun->mode_pages.index[i]; - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; switch (page_index->page_code & SMPH_PC_MASK) { @@ -4205,8 +4212,14 @@ ctl_init_log_page_index(struct ctl_lun * for (i = 0, j = 0, k = 0; i < CTL_NUM_LOG_PAGES; i++) { page_index = &lun->log_pages.index[i]; - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; if (page_index->page_code == SLS_LOGICAL_BLOCK_PROVISIONING && @@ -4282,7 +4295,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_lun *nlun, *lun; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor; + const char *eui, *naa, *scsiname, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4294,8 +4307,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft */ switch (be_lun->lun_type) { case T_DIRECT: - break; case T_PROCESSOR: + case T_CDROM: break; case T_SEQUENTIAL: case T_CHANGER: @@ -4448,6 +4461,13 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; + value = ctl_get_opt(&be_lun->options, "removable"); + if (value != NULL) { + if (strcmp(value, "on") == 0) + lun->flags |= CTL_LUN_REMOVABLE; + } else if (be_lun->lun_type == T_CDROM) + lun->flags |= CTL_LUN_REMOVABLE; + lun->ctl_softc = ctl_softc; #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); @@ -5124,14 +5144,14 @@ ctl_start_stop(struct ctl_scsiio *ctsio) } } - /* - * If there is no backend on this device, we can't start or stop - * it. In theory we shouldn't get any start/stop commands in the - * first place at this level if the LUN doesn't have a backend. - * That should get stopped by the command decode code. - */ - if (lun->backend == NULL) { - ctl_set_invalid_opcode(ctsio); + if ((cdb->how & SSS_LOEJ) && + (lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 4, + /*bit_valid*/ 1, + /*bit*/ 1); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -5161,6 +5181,26 @@ ctl_start_stop(struct ctl_scsiio *ctsio) return (retval); } +int +ctl_prevent_allow(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + int retval; + + CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + retval = lun->backend->config_write((union ctl_io *)ctsio); + return (retval); +} + /* * We support the SYNCHRONIZE CACHE command (10 and 16 byte versions), but * we don't really do anything with the LBA and length fields if the user @@ -5222,15 +5262,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) goto bailout; } - /* - * If this LUN has no backend, we can't flush the cache anyway. - */ - if (lun->backend == NULL) { - ctl_set_invalid_opcode(ctsio); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - lbalen = (struct ctl_lba_len_flags *)&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->lba = starting_lba; lbalen->len = block_count; @@ -5933,13 +5964,18 @@ do_next_page: * XXX KDM should we do something with the block descriptor? */ for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { - - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) + page_index = &lun->mode_pages.index[i]; + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; - if ((lun->mode_pages.index[i].page_code & SMPH_PC_MASK) != + if ((page_index->page_code & SMPH_PC_MASK) != (page_header->page_code & SMPH_PC_MASK)) continue; @@ -5947,9 +5983,8 @@ do_next_page: * If neither page has a subpage code, then we've got a * match. */ - if (((lun->mode_pages.index[i].page_code & SMPH_SPF) == 0) + if (((page_index->page_code & SMPH_SPF) == 0) && ((page_header->page_code & SMPH_SPF) == 0)) { - page_index = &lun->mode_pages.index[i]; page_len = page_header->page_length; break; } @@ -5958,15 +5993,12 @@ do_next_page: * If both pages have subpages, then the subpage numbers * have to match. */ - if ((lun->mode_pages.index[i].page_code & SMPH_SPF) + if ((page_index->page_code & SMPH_SPF) && (page_header->page_code & SMPH_SPF)) { struct scsi_mode_page_header_sp *sph; sph = (struct scsi_mode_page_header_sp *)page_header; - - if (lun->mode_pages.index[i].subpage == - sph->subpage) { - page_index = &lun->mode_pages.index[i]; + if (page_index->subpage == sph->subpage) { page_len = scsi_2btoul(sph->page_length); break; } @@ -5977,7 +6009,7 @@ do_next_page: * If we couldn't find the page, or if we don't have a mode select * handler for it, send back an error to the user. */ - if ((page_index == NULL) + if ((i >= CTL_NUM_MODE_PAGES) || (page_index->select_handler == NULL)) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -6236,7 +6268,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) dbd = 0; llba = 0; block_desc = NULL; - page_index = NULL; CTL_DEBUG_PRINT(("ctl_mode_sense\n")); @@ -6313,26 +6344,33 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) } for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) + page_index = &lun->mode_pages.index[i]; + + /* Make sure the page is supported for this dev type */ + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* * We don't use this subpage if the user didn't * request all subpages. */ - if ((lun->mode_pages.index[i].subpage != 0) + if ((page_index->subpage != 0) && (subpage == SMS_SUBPAGE_PAGE_0)) continue; #if 0 printf("found page %#x len %d\n", - lun->mode_pages.index[i].page_code & - SMPH_PC_MASK, - lun->mode_pages.index[i].page_len); + page_index->page_code & SMPH_PC_MASK, + page_index->page_len); #endif - page_len += lun->mode_pages.index[i].page_len; + page_len += page_index->page_len; } break; } @@ -6342,30 +6380,35 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) page_len = 0; for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { + page_index = &lun->mode_pages.index[i]; + + /* Make sure the page is supported for this dev type */ + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) + continue; + /* Look for the right page code */ - if ((lun->mode_pages.index[i].page_code & - SMPH_PC_MASK) != page_code) + if ((page_index->page_code & SMPH_PC_MASK) != page_code) continue; /* Look for the right subpage or the subpage wildcard*/ - if ((lun->mode_pages.index[i].subpage != subpage) + if ((page_index->subpage != subpage) && (subpage != SMS_SUBPAGE_ALL)) continue; - /* Make sure the page is supported for this dev type */ - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) - continue; - #if 0 printf("found page %#x len %d\n", - lun->mode_pages.index[i].page_code & - SMPH_PC_MASK, - lun->mode_pages.index[i].page_len); + page_index->page_code & SMPH_PC_MASK, + page_index->page_len); #endif - page_len += lun->mode_pages.index[i].page_len; + page_len += page_index->page_len; } if (page_len == 0) { @@ -6473,9 +6516,14 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) struct ctl_page_index *page_index; page_index = &lun->mode_pages.index[i]; - - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* @@ -6523,8 +6571,14 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) continue; /* Make sure the page is supported for this dev type */ - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* @@ -10050,6 +10104,8 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | lun->be_lun->lun_type; } + if (lun->flags & CTL_LUN_REMOVABLE) + inq_ptr->dev_qual2 |= SID_RMB; } else inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE; @@ -10114,6 +10170,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio strncpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT, sizeof(inq_ptr->product)); break; + case T_CDROM: + strncpy(inq_ptr->product, CTL_CDROM_PRODUCT, + sizeof(inq_ptr->product)); + break; default: strncpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT, sizeof(inq_ptr->product)); @@ -10176,6 +10236,11 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio scsi_ulto2b(0x0600, inq_ptr->version4); break; case T_PROCESSOR: + break; + case T_CDROM: + /* MMC-6 (no version claimed) */ + scsi_ulto2b(0x04E0, inq_ptr->version4); + break; default: break; } @@ -10215,6 +10280,344 @@ ctl_inquiry(struct ctl_scsiio *ctsio) return (retval); } +int +ctl_get_config(struct ctl_scsiio *ctsio) +{ + struct scsi_get_config_header *hdr; + struct scsi_get_config_feature *feature; + struct scsi_get_config *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int rt, starting; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_get_config *)ctsio->cdb; + rt = (cdb->rt & SGC_RT_MASK); + starting = scsi_2btoul(cdb->starting_feature); + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_get_config_header) + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4; + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + hdr = (struct scsi_get_config_header *)ctsio->kern_data_ptr; + if (lun->flags & CTL_LUN_OFFLINE) + scsi_ulto2b(0x0000, hdr->current_profile); + else + scsi_ulto2b(0x0010, hdr->current_profile); + feature = (struct scsi_get_config_feature *)(hdr + 1); + + if (starting > 0x001f) + goto done; + if (starting > 0x001e) + goto f1f; + if (starting > 0x001d) + goto f1e; + if (starting > 0x0010) + goto f1d; + if (starting > 0x0003) + goto f10; + if (starting > 0x0002) + goto f3; + if (starting > 0x0001) + goto f2; + if (starting > 0x0000) + goto f1; + + /* Profile List */ + scsi_ulto2b(0x0000, feature->feature_code); + feature->flags = SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto2b(0x0008, &feature->feature_data[0]); /* CD-ROM */ + feature->feature_data[2] = 0x00; + scsi_ulto2b(0x0010, &feature->feature_data[4]); /* DVD-ROM */ + feature->feature_data[6] = 0x01; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1: /* Core */ + scsi_ulto2b(0x0001, feature->feature_code); + feature->flags = 0x08 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto4b(0x00000000, &feature->feature_data[0]); + feature->feature_data[4] = 0x03; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f2: /* Morphing */ + scsi_ulto2b(0x0002, feature->feature_code); + feature->flags = 0x04 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x02; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3: /* Removable Medium */ + scsi_ulto2b(0x0003, feature->feature_code); + feature->flags = 0x04 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x39; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + + if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_OFFLINE)) + goto done; + +f10: /* Random Read */ + scsi_ulto2b(0x0010, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto4b(lun->be_lun->blocksize, &feature->feature_data[0]); + scsi_ulto2b(1, &feature->feature_data[4]); + feature->feature_data[6] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1d: /* Multi-Read */ + scsi_ulto2b(0x001D, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 0; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1e: /* CD Read */ + scsi_ulto2b(0x001E, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1f: /* DVD Read */ + scsi_ulto2b(0x001F, feature->feature_code); + feature->flags = 0x08; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x01; + feature->feature_data[2] = 0x03; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +done: + data_len = (uint8_t *)feature - (uint8_t *)hdr; + if (rt == SGC_RT_SPECIFIC && data_len > 4) { + feature = (struct scsi_get_config_feature *)(hdr + 1); + if (scsi_2btoul(feature->feature_code) == starting) + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + data_len = (uint8_t *)feature - (uint8_t *)hdr; + } + scsi_ulto4b(data_len - 4, hdr->data_length); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_get_event_status(struct ctl_scsiio *ctsio) +{ + struct scsi_get_event_status_header *hdr; + struct scsi_get_event_status *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int notif_class; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_get_event_status *)ctsio->cdb; + if ((cdb->byte2 & SGESN_POLLED) == 0) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, + /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + notif_class = cdb->notif_class; + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_get_event_status_header); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_get_event_status_header *)ctsio->kern_data_ptr; + scsi_ulto2b(0, hdr->descr_length); + hdr->nea_class = SGESN_NEA; + hdr->supported_class = 0; + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_mechanism_status(struct ctl_scsiio *ctsio) +{ + struct scsi_mechanism_status_header *hdr; + struct scsi_mechanism_status *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_mechanism_status *)ctsio->cdb; + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_mechanism_status_header); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_mechanism_status_header *)ctsio->kern_data_ptr; + hdr->state1 = 0x00; + hdr->state2 = 0xe0; + scsi_ulto3b(0, hdr->lba); + hdr->slots_num = 0; + scsi_ulto2b(0, hdr->slots_length); + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +static void +ctl_ultomsf(uint32_t lba, uint8_t *buf) +{ + + lba += 150; + buf[0] = 0; + buf[1] = bin2bcd((lba / 75) / 60); + buf[2] = bin2bcd((lba / 75) % 60); + buf[3] = bin2bcd(lba % 75); +} + +int +ctl_read_toc(struct ctl_scsiio *ctsio) +{ + struct scsi_read_toc_hdr *hdr; + struct scsi_read_toc_type01_descr *descr; + struct scsi_read_toc *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int format, msf; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_read_toc *)ctsio->cdb; + msf = (cdb->byte2 & CD_MSF) != 0; + format = cdb->format; + alloc_len = scsi_2btoul(cdb->data_len); + + data_len = sizeof(struct scsi_read_toc_hdr); + if (format == 0) + data_len += 2 * sizeof(struct scsi_read_toc_type01_descr); + else + data_len += sizeof(struct scsi_read_toc_type01_descr); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_read_toc_hdr *)ctsio->kern_data_ptr; + if (format == 0) { + scsi_ulto2b(0x12, hdr->data_length); + hdr->first = 1; + hdr->last = 1; + descr = (struct scsi_read_toc_type01_descr *)(hdr + 1); + descr->addr_ctl = 0x14; + descr->track_number = 1; + if (msf) + ctl_ultomsf(0, descr->track_start); + else + scsi_ulto4b(0, descr->track_start); + descr++; + descr->addr_ctl = 0x14; + descr->track_number = 0xaa; + if (msf) + ctl_ultomsf(lun->be_lun->maxlba+1, descr->track_start); + else + scsi_ulto4b(lun->be_lun->maxlba+1, descr->track_start); + } else { + scsi_ulto2b(0x0a, hdr->data_length); + hdr->first = 1; + hdr->last = 1; + descr = (struct scsi_read_toc_type01_descr *)(hdr + 1); + descr->addr_ctl = 0x14; + descr->track_number = 1; + if (msf) + ctl_ultomsf(0, descr->track_start); + else + scsi_ulto4b(0, descr->track_start); + } + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + /* * For known CDB types, parse the LBA and length. */ @@ -11264,12 +11667,16 @@ ctl_cmd_applicable(uint8_t lun_type, con { switch (lun_type) { + case T_DIRECT: + if ((entry->flags & CTL_CMD_FLAG_OK_ON_DIRECT) == 0) + return (0); + break; case T_PROCESSOR: if ((entry->flags & CTL_CMD_FLAG_OK_ON_PROC) == 0) return (0); break; - case T_DIRECT: - if ((entry->flags & CTL_CMD_FLAG_OK_ON_SLUN) == 0) + case T_CDROM: + if ((entry->flags & CTL_CMD_FLAG_OK_ON_CDROM) == 0) return (0); break; default: Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_backend_block.c Sun Sep 27 13:47:28 2015 (r288310) @@ -1869,6 +1869,8 @@ ctl_be_block_open_file(struct ctl_be_blo */ if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; @@ -1997,7 +1999,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc "requested blocksize %u < backing device " "blocksize %u", params->blocksize_bytes, tmp); return (EINVAL); - } else + } else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = MAX(tmp, 2048); + else cbe_lun->blocksize = tmp; error = csw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&otmp, FREAD, @@ -2157,7 +2161,10 @@ ctl_be_block_open(struct ctl_be_block_so flags = FREAD; value = ctl_get_opt(&cbe_lun->options, "readonly"); - if (value == NULL || strcmp(value, "on") != 0) + if (value != NULL) { + if (strcmp(value, "on") != 0) + flags |= FWRITE; + } else if (cbe_lun->lun_type == T_DIRECT) flags |= FWRITE; again: @@ -2273,10 +2280,13 @@ ctl_be_block_create(struct ctl_be_block_ } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; - if (cbe_lun->lun_type == T_DIRECT) { + if (cbe_lun->lun_type == T_DIRECT || + cbe_lun->lun_type == T_CDROM) { be_lun->size_bytes = params->lun_size_bytes; if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; @@ -2761,6 +2771,10 @@ ctl_be_block_config_write(union ctl_io * ctl_config_write_done(io); break; } + case PREVENT_ALLOW: + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; default: ctl_set_invalid_opcode(&io->scsiio); ctl_config_write_done(io); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 27 13:47:28 2015 (r288310) @@ -530,9 +530,12 @@ ctl_backend_ramdisk_create(struct ctl_be } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; - if (cbe_lun->lun_type == T_DIRECT) { + if (cbe_lun->lun_type == T_DIRECT || + cbe_lun->lun_type == T_CDROM) { if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; if (params->lun_size_bytes < cbe_lun->blocksize) { @@ -556,7 +559,10 @@ ctl_backend_ramdisk_create(struct ctl_be if (value != NULL && strcmp(value, "on") == 0) cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; value = ctl_get_opt(&cbe_lun->options, "readonly"); - if (value != NULL && strcmp(value, "on") == 0) + if (value != NULL) { + if (strcmp(value, "on") == 0) + cbe_lun->flags |= CTL_LUN_FLAG_READONLY; + } else if (cbe_lun->lun_type != T_DIRECT) cbe_lun->flags |= CTL_LUN_FLAG_READONLY; cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; value = ctl_get_opt(&cbe_lun->options, "serseq"); @@ -896,6 +902,7 @@ ctl_backend_ramdisk_config_write(union c ctl_config_write_done(io); break; } + case PREVENT_ALLOW: case WRITE_SAME_10: case WRITE_SAME_16: case UNMAP: Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_cmd_table.c Sun Sep 27 13:47:28 2015 (r288310) @@ -255,7 +255,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 10 POPULATE TOKEN */ -{ctl_populate_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_populate_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, @@ -263,7 +263,7 @@ const struct ctl_cmd_entry ctl_cmd_table 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 11 WRITE USING TOKEN */ -{ctl_write_using_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_write_using_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x11, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, @@ -422,7 +422,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 10 READ CAPACITY(16) */ -{ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | @@ -434,7 +434,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 12 GET LBA STATUS */ -{ctl_get_lba_status, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_get_lba_status, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, @@ -559,7 +559,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0xff, 0x07}}, /* 04 FORMAT UNIT */ -{ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0xff, 0, 0, 0, 0x07}}, @@ -574,7 +574,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 08 READ(6) */ -{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, @@ -583,7 +583,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0A WRITE(6) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, @@ -669,7 +669,8 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0x08, 0xff, 0xff, 0xff, 0x07}}, /* 1B START STOP UNIT */ -{ctl_start_stop, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_start_stop, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_NONE | @@ -683,7 +684,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 1E PREVENT ALLOW MEDIUM REMOVAL */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_prevent_allow, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_FLAG_DATA_NONE, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0x03, 0x07}}, /* 1F */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -704,7 +710,8 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 25 READ CAPACITY(10) */ -{ctl_read_capacity, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN| +{ctl_read_capacity, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | @@ -718,7 +725,8 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 28 READ(10) */ -{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, @@ -728,7 +736,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 2A WRITE(10) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT| CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, 10, {0x1a, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, @@ -742,12 +750,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 2E WRITE AND VERIFY(10) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT| CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 27 14:58:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 253F7A0AA0D; Sun, 27 Sep 2015 14:58:52 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward19p.cmail.yandex.net (forward19p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::aa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D023D5FA; Sun, 27 Sep 2015 14:58:51 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web20g.yandex.ru (web20g.yandex.ru [IPv6:2a02:6b8:0:1402::30]) by forward19p.cmail.yandex.net (Yandex) with ESMTP id F1A2220B42; Sun, 27 Sep 2015 17:58:36 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web20g.yandex.ru (Yandex) with ESMTP id 133456AC132B; Sun, 27 Sep 2015 17:58:35 +0300 (MSK) Received: by web20g.yandex.ru with HTTP; Sun, 27 Sep 2015 17:58:35 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Bjoern A. Zeeb , George Neville-Neil Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: References: <201509270529.t8R5TYRf095540@repo.freebsd.org> Subject: Re: svn commit: r288301 - in head/sys: net netinet netinet6 MIME-Version: 1.0 Message-Id: <2804821443365915@web20g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sun, 27 Sep 2015 17:58:35 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 14:58:52 -0000 27.09.2015, 15:26, "Bjoern A. Zeeb" : > On Sun, 27 Sep 2015, Alexander V. Chernikov wrote: > >> šAuthor: melifaro >> šDate: Sun Sep 27 05:29:34 2015 >> šNew Revision: 288301 >> šURL: https://svnweb.freebsd.org/changeset/base/288301 >> >> šLog: >> ššEliminate nd6_nud_hint() and its TCP bindings. >> >> ššInitially function was introduced in r53541 (KAME initial commit) to >> šššš"provide hints from upper layer protocols that indicate a connection >> ššššis making "forward progress"" (quote from RFC 2461 7.3.1 Reachability >> ššššConfirmation). >> ššHowever, it was converted to do nothing (e.g. just return) in r122922 >> šššš(tcp_hostcache implementation) back in 2003. Some defines were moved >> ššššto tcp_var.h in r169541. Then, it was broken (for non-corner cases) >> ššššby r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, >> ššššright now this code is broken and has no "real" base users. >> >> ššDifferential Revision: https://reviews.freebsd.org/D3699 > > PR: 165692 > > It would be nice to have the feature back though it would be very > expensive locking wise if it'd remain a per-packet operation. It looks like there are options to implement this without significant overhead (like, on proper TCP session teardown, or on delayed-ack timer, or/and with some sort of sampling + special "no-gw" flag). I'd prefer not to shift my focus from projects/routing now, but I can cooperate with someone from TCP side and resurrect/test nd6_nud_hint() > > -- > Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@freebsd.org Sun Sep 27 18:21:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 526F1A0AD31; Sun, 27 Sep 2015 18:21:23 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D081E12; Sun, 27 Sep 2015 18:21:23 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RILNaY012463; Sun, 27 Sep 2015 18:21:23 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RILNtA012462; Sun, 27 Sep 2015 18:21:23 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201509271821.t8RILNtA012462@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, 27 Sep 2015 18:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288311 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 18:21:23 -0000 Author: loos Date: Sun Sep 27 18:21:22 2015 New Revision: 288311 URL: https://svnweb.freebsd.org/changeset/base/288311 Log: Set the #address-cells and #size-cells for the I2C controllers in RPi2. This allows the use of I2C addresses in 'reg' property. Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sun Sep 27 13:47:28 2015 (r288310) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sun Sep 27 18:21:22 2015 (r288311) @@ -379,6 +379,8 @@ }; bsc0 { + #address-cells = <1>; + #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x205000 0x20>; @@ -387,6 +389,8 @@ }; bsc1 { + #address-cells = <1>; + #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x804000 0x20>; From owner-svn-src-all@freebsd.org Sun Sep 27 22:02:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24F559D07B7; Sun, 27 Sep 2015 22:02:47 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 162E9936; Sun, 27 Sep 2015 22:02:47 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RM2kCN006432; Sun, 27 Sep 2015 22:02:46 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RM2k2P006431; Sun, 27 Sep 2015 22:02:46 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509272202.t8RM2k2P006431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Sep 2015 22:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288312 - head/bin/ls 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 22:02:47 -0000 Author: allanjude Date: Sun Sep 27 22:02:46 2015 New Revision: 288312 URL: https://svnweb.freebsd.org/changeset/base/288312 Log: Use one fewer made up words in the ls(1) man page PR: 203337 Submitted by: Mike Dame Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Modified: head/bin/ls/ls.1 Modified: head/bin/ls/ls.1 ============================================================================== --- head/bin/ls/ls.1 Sun Sep 27 18:21:22 2015 (r288311) +++ head/bin/ls/ls.1 Sun Sep 27 22:02:46 2015 (r288312) @@ -32,7 +32,7 @@ .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD$ .\" -.Dd June 8, 2015 +.Dd September 27, 2015 .Dt LS 1 .Os .Sh NAME @@ -320,7 +320,7 @@ or use the option. This causes .Nm -to reverse the lexicographal sort order when sorting files with the +to reverse the lexicographical sort order when sorting files with the same modification timestamp. .It Fl u Use time of last access, From owner-svn-src-all@freebsd.org Sun Sep 27 22:05:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84B6A9D090F; Sun, 27 Sep 2015 22:05:21 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75AF9AFF; Sun, 27 Sep 2015 22:05:21 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RM5LI1006602; Sun, 27 Sep 2015 22:05:21 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RM5LTl006601; Sun, 27 Sep 2015 22:05:21 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509272205.t8RM5LTl006601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Sep 2015 22:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288313 - head/bin/ls 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.20 Precedence: list List-Id: "SVN commit messages 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, 27 Sep 2015 22:05:21 -0000 Author: allanjude Date: Sun Sep 27 22:05:20 2015 New Revision: 288313 URL: https://svnweb.freebsd.org/changeset/base/288313 Log: Fix whitespace error in ls(1) detected by igor Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Modified: head/bin/ls/ls.1 Modified: head/bin/ls/ls.1 ============================================================================== --- head/bin/ls/ls.1 Sun Sep 27 22:02:46 2015 (r288312) +++ head/bin/ls/ls.1 Sun Sep 27 22:05:20 2015 (r288313) @@ -296,9 +296,9 @@ subsection below, except (if the long fo the directory totals are not output when the output is in a single column, even if multi-column output is requested. .It Fl t -Sort by descending time modified (most recently modified first). If two files -have the same modification timestamp, sort their names in ascending -lexicographical order. +Sort by descending time modified (most recently modified first). +If two files have the same modification timestamp, sort their names +in ascending lexicographical order. The .Fl r option reverses both of these sort orders. From owner-svn-src-all@freebsd.org Mon Sep 28 00:17:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32594A0AD0B; Mon, 28 Sep 2015 00:17:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 176B2BC4; Mon, 28 Sep 2015 00:17:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0Hq7R060643; Mon, 28 Sep 2015 00:17:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0HqUN060641; Mon, 28 Sep 2015 00:17:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280017.t8S0HqUN060641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288315 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 00:17:53 -0000 Author: adrian Date: Mon Sep 28 00:17:51 2015 New Revision: 288315 URL: https://svnweb.freebsd.org/changeset/base/288315 Log: Abstract out the ampdu TX pps initialisation code so it can be reused in the superg fast-frames code. This harks back to an earlier commit (r280349) where I found that initialising the pps code with ticks=0 would cause hilariously bad hz ticks wraparound failures, leading to never actually aggregating traffic. This is still true for the superg path and so I have to do the same thing there. This is a big no-op; a subsequent commit will flip this on so it works with the fast-frames transmit path. Tested: * AR9170, otus(4) - STA mode, 11bg operation * AR9331, AP mode Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Sep 27 23:33:54 2015 (r288314) +++ head/sys/net80211/ieee80211_ht.c Mon Sep 28 00:17:51 2015 (r288315) @@ -1081,7 +1081,7 @@ ieee80211_ht_node_init(struct ieee80211_ tap = &ni->ni_tx_ampdu[tid]; tap->txa_tid = tid; tap->txa_ni = ni; - tap->txa_lastsample = ticks; + ieee80211_txampdu_init_pps(tap); /* NB: further initialization deferred */ } ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU; @@ -1251,7 +1251,7 @@ ieee80211_ht_wds_init(struct ieee80211_n for (tid = 0; tid < WME_NUM_TID; tid++) { tap = &ni->ni_tx_ampdu[tid]; tap->txa_tid = tid; - tap->txa_lastsample = ticks; + ieee80211_txampdu_init_pps(tap); } /* NB: AMPDU tx/rx governed by IEEE80211_FHT_AMPDU_{TX,RX} */ ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU; @@ -1752,8 +1752,7 @@ ampdu_tx_stop(struct ieee80211_tx_ampdu /* * Reset packet estimate. */ - tap->txa_lastsample = ticks; - tap->txa_avgpps = 0; + ieee80211_txampdu_init_pps(tap); /* NB: clearing NAK means we may re-send ADDBA */ tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK); Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Sun Sep 27 23:33:54 2015 (r288314) +++ head/sys/net80211/ieee80211_ht.h Mon Sep 28 00:17:51 2015 (r288315) @@ -84,8 +84,19 @@ struct ieee80211_tx_ampdu { */ static __inline void +ieee80211_txampdu_init_pps(struct ieee80211_tx_ampdu *tap) +{ + /* + * Reset packet estimate. + */ + tap->txa_lastsample = ticks; + tap->txa_avgpps = 0; +} + +static __inline void ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap) { + /* NB: scale factor of 2 was picked heuristically */ tap->txa_avgpps = ((tap->txa_avgpps << 2) - tap->txa_avgpps + tap->txa_pkts) >> 2; @@ -97,6 +108,7 @@ ieee80211_txampdu_update_pps(struct ieee static __inline void ieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap) { + /* XXX bound loop/do more crude estimate? */ while (ticks - tap->txa_lastsample >= hz) { ieee80211_txampdu_update_pps(tap); From owner-svn-src-all@freebsd.org Mon Sep 28 00:51:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 209D2A0A1D5; Mon, 28 Sep 2015 00:51:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11BBCCDF; Mon, 28 Sep 2015 00:51:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0pOeR078107; Mon, 28 Sep 2015 00:51:24 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0pOKx078106; Mon, 28 Sep 2015 00:51:24 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280051.t8S0pOKx078106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288317 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 00:51:25 -0000 Author: adrian Date: Mon Sep 28 00:51:24 2015 New Revision: 288317 URL: https://svnweb.freebsd.org/changeset/base/288317 Log: Comments, mostly to remind myself of what's going on and why. Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Mon Sep 28 00:20:14 2015 (r288316) +++ head/sys/net80211/ieee80211_output.c Mon Sep 28 00:51:24 2015 (r288317) @@ -213,6 +213,22 @@ ieee80211_vap_pkt_send_dest(struct ieee8 } } + /* + * XXX If we aren't doing AMPDU TX then we /could/ do + * fast-frames encapsulation, however right now this + * output logic doesn't handle that case. + * + * So we'll be limited to "fast-frames" xmit for non-11n STA + * and "no fast frames" xmit for 11n STAs. + * It'd be nice to eventually test fast-frames out by + * gracefully falling from failing A-MPDU transmission + * (driver says no, fail to negotiate it with peer) to + * using fast-frames. + * + * Note: we can actually put A-MSDU's inside an A-MPDU, + * so hopefully we can figure out how to make that particular + * combination work right. + */ #ifdef IEEE80211_SUPPORT_SUPERG else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { m = ieee80211_ff_check(ni, m); @@ -230,6 +246,11 @@ ieee80211_vap_pkt_send_dest(struct ieee8 */ IEEE80211_TX_LOCK(ic); + /* + * XXX make the encap and transmit code a separate function + * so things like the FF (and later A-MSDU) path can just call + * it for flushed frames. + */ if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { /* * Encapsulate the packet in prep for transmission. From owner-svn-src-all@freebsd.org Mon Sep 28 00:59:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F1DFA0A595; Mon, 28 Sep 2015 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FAD194; Mon, 28 Sep 2015 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0x83O079125; Mon, 28 Sep 2015 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0x8UM079123; Mon, 28 Sep 2015 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280059.t8S0x8UM079123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288318 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 00:59:09 -0000 Author: adrian Date: Mon Sep 28 00:59:07 2015 New Revision: 288318 URL: https://svnweb.freebsd.org/changeset/base/288318 Log: Migrate the fast-frames transmit support away from using the txa_private field and into a separate fast-frames staging pointer in ieee80211_node. The A-MPDU TX path allows txa_private to be used by drivers. So it will clash with any attempt to use fast-frames. Now, fast-frames is not really anything special - it's just a custom ethernet frame type that contains two MSDUs into one MPDU. So all the NIC has to support doing is transmitting up to a 4KiB frame with an arbitrary ethertype and bam! Fast-frames. However, using txa_private means we can /either/ do fast-frames or A-MPDU TX, so fast frames has been turned off in the Atheros HAL for 11n chipsets. This is a bit silly - it actually means that 802.11 performance to/from 11abg Atheros chips is actually better than between an 11abg atheros device and an 11n Atheros device. So: * create a new mbuf staging queue for fast frames. It only queues a single frame in the staging queue (and there's a top-level ic staging queue used for expiry/tracking) so it's just an mbuf pointer per TID. * Still use the ampdu TX packet counter to determine whether to do aggregation or not. It'll double count if we start doing both A-MPDU TX and fast frames, but that's not all that important right now. * Initialise the pps tracker so ticks isn't zero. This ensures that fast-frames actually gets used - without it, the ticks math overflows and the pps math always sets txa_pps=0. This is the same bug that plagued A-MPDU TX starting logic. This actually allows fast-frames transmit to occur between the AR9331 (in 11n HT/20 mode) and AR9170 (if_otus) in 11bg mode. Now, this is a great big no-op on atheros 11n hardware, so don't worry. It may mean you start seeing more reliable fast-frames transmission on 11abg hardware which may expose some more amusing bugs. TODO: * further testing and debugging of all of this before flipping on fast-frames in if_ath (for 11n) and if_otus. Modified: head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Mon Sep 28 00:51:24 2015 (r288317) +++ head/sys/net80211/ieee80211_node.h Mon Sep 28 00:59:07 2015 (r288318) @@ -219,6 +219,9 @@ struct ieee80211_node { struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID]; struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID]; + /* fast-frames state */ + struct mbuf * ni_tx_superg[WME_NUM_TID]; + /* others */ short ni_inact; /* inactivity mark count */ short ni_inact_reload;/* inactivity reload value */ Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Mon Sep 28 00:51:24 2015 (r288317) +++ head/sys/net80211/ieee80211_superg.c Mon Sep 28 00:59:07 2015 (r288318) @@ -530,7 +530,6 @@ ieee80211_ff_age(struct ieee80211com *ic { struct mbuf *m, *head; struct ieee80211_node *ni; - struct ieee80211_tx_ampdu *tap; #if 0 KASSERT(sq->head != NULL, ("stageq empty")); @@ -541,11 +540,10 @@ ieee80211_ff_age(struct ieee80211com *ic while ((m = sq->head) != NULL && M_AGE_GET(m) < quanta) { int tid = WME_AC_TO_TID(M_WME_GETAC(m)); - /* clear tap ref to frame */ + /* clear staging ref to frame */ ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; - tap = &ni->ni_tx_ampdu[tid]; - KASSERT(tap->txa_private == m, ("staging queue empty")); - tap->txa_private = NULL; + KASSERT(ni->ni_tx_superg[tid] == m, ("staging queue empty")); + ni->ni_tx_superg[tid] = NULL; sq->head = m->m_nextpkt; sq->depth--; @@ -658,7 +656,12 @@ ieee80211_ff_check(struct ieee80211_node */ IEEE80211_LOCK(ic); tap = &ni->ni_tx_ampdu[WME_AC_TO_TID(pri)]; - mstaged = tap->txa_private; /* NB: we reuse AMPDU state */ + mstaged = ni->ni_tx_superg[WME_AC_TO_TID(pri)]; + /* XXX NOTE: reusing packet counter state from A-MPDU */ + /* + * XXX NOTE: this means we're double-counting; it should just + * be done in ieee80211_output.c once for both superg and A-MPDU. + */ ieee80211_txampdu_count_packet(tap); /* @@ -676,6 +679,8 @@ ieee80211_ff_check(struct ieee80211_node * If there is no frame to combine with and the pps is * too low; then do not attempt to aggregate this frame. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, + "%s: staged: %p; pps: %d\n", __func__, mstaged, ieee80211_txampdu_getpps(tap)); if (mstaged == NULL && ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) { IEEE80211_UNLOCK(ic); @@ -698,7 +703,7 @@ ieee80211_ff_check(struct ieee80211_node "%s: txtime %u exceeds txop limit %u\n", __func__, txtime, limit); - tap->txa_private = NULL; + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL; if (mstaged != NULL) stageq_remove(ic, sq, mstaged); IEEE80211_UNLOCK(ic); @@ -721,7 +726,7 @@ ieee80211_ff_check(struct ieee80211_node * hold their node reference. */ if (mstaged != NULL) { - tap->txa_private = NULL; + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL; stageq_remove(ic, sq, mstaged); IEEE80211_UNLOCK(ic); @@ -739,9 +744,10 @@ ieee80211_ff_check(struct ieee80211_node mstaged->m_nextpkt = m; mstaged->m_flags |= M_FF; /* NB: mark for encap work */ } else { - KASSERT(tap->txa_private == NULL, - ("txa_private %p", tap->txa_private)); - tap->txa_private = m; + KASSERT(ni->ni_tx_superg[WME_AC_TO_TID(pri)]== NULL, + ("ni_tx_superg[]: %p", + ni->ni_tx_superg[WME_AC_TO_TID(pri)])); + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = m; stageq_add(ic, sq, m); IEEE80211_UNLOCK(ic); @@ -769,7 +775,6 @@ ieee80211_ff_node_cleanup(struct ieee802 { struct ieee80211com *ic = ni->ni_ic; struct ieee80211_superg *sg = ic->ic_superg; - struct ieee80211_tx_ampdu *tap; struct mbuf *m, *next_m, *head; int tid; @@ -777,11 +782,16 @@ ieee80211_ff_node_cleanup(struct ieee802 head = NULL; for (tid = 0; tid < WME_NUM_TID; tid++) { int ac = TID_TO_WME_AC(tid); - - tap = &ni->ni_tx_ampdu[tid]; - m = tap->txa_private; + /* + * XXX Initialise the packet counter. + * + * This may be double-work for 11n stations; + * but without it we never setup things. + */ + ieee80211_txampdu_init_pps(&ni->ni_tx_ampdu[tid]); + m = ni->ni_tx_superg[tid]; if (m != NULL) { - tap->txa_private = NULL; + ni->ni_tx_superg[tid] = NULL; stageq_remove(ic, &sg->ff_stageq[ac], m); m->m_nextpkt = head; head = m; From owner-svn-src-all@freebsd.org Mon Sep 28 01:09:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26751A0ACD7; Mon, 28 Sep 2015 01:09:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1765AAA4; Mon, 28 Sep 2015 01:09:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S19mMM083337; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S19mH8083335; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280109.t8S19mH8083335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 01:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288319 - head/sys/dev/otus 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 01:09:49 -0000 Author: adrian Date: Mon Sep 28 01:09:48 2015 New Revision: 288319 URL: https://svnweb.freebsd.org/changeset/base/288319 Log: if_otus fixes; add fast-frames support. Fast-frames: * include opt_wlan.h ; tsk to not doing it earlier; * add a tx pending tracking counter for seeing how deep the hardware TX queue is; * add the frame aging code from if_ath; * add fast-frames capability to the driver setup. Bugs: * free the buffers (and node references) before detaching net80211 state. This prevents a use-after-free in the node free path where we've destroyed net80211 underneath it. Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otus.c Mon Sep 28 01:09:48 2015 (r288319) @@ -24,6 +24,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_wlan.h" + #include #include #include @@ -60,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef IEEE80211_SUPPORT_SUPERG +#include +#endif #include #include @@ -340,6 +345,7 @@ otus_detach(device_t self) taskqueue_drain(taskqueue_thread, &sc->tx_task); taskqueue_drain(taskqueue_thread, &sc->wme_update_task); + otus_close_pipes(sc); #if 0 /* Wait for all queued asynchronous commands to complete. */ usb_rem_wait_task(sc->sc_udev, &sc->sc_task); @@ -348,7 +354,6 @@ otus_detach(device_t self) #endif ieee80211_ifdetach(ic); - otus_close_pipes(sc); mtx_destroy(&sc->sc_mtx); return 0; } @@ -949,9 +954,12 @@ fail: otus_close_pipes(sc); void otus_close_pipes(struct otus_softc *sc) { + + OTUS_LOCK(sc); otus_free_tx_cmd_list(sc); otus_free_tx_list(sc); otus_free_rx_list(sc); + OTUS_UNLOCK(sc); usbd_transfer_unsetup(sc->sc_xfer, OTUS_N_XFER); } @@ -1838,6 +1846,9 @@ tr_setup: } else (void)ieee80211_input_mimo_all(ic, m, NULL); } +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_ff_age_all(ic, 100); +#endif OTUS_LOCK(sc); break; default: @@ -1866,6 +1877,14 @@ otus_txeof(struct usb_xfer *xfer, struct OTUS_LOCK_ASSERT(sc); + if (sc->sc_tx_n_active == 0) { + device_printf(sc->sc_dev, + "%s: completed but tx_active=0\n", + __func__); + } else { + sc->sc_tx_n_active--; + } + if (data->m) { /* XXX status? */ /* XXX we get TX status via the RX path.. */ @@ -1926,6 +1945,7 @@ tr_setup: if (data == NULL) { OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: empty pending queue sc %p\n", __func__, sc); + sc->sc_tx_n_active = 0; goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending[which], next); @@ -1934,6 +1954,7 @@ tr_setup: OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: submitting transfer %p\n", __func__, data); usbd_transfer_submit(xfer); + sc->sc_tx_n_active++; break; default: data = STAILQ_FIRST(&sc->sc_tx_active[which]); @@ -1952,6 +1973,22 @@ tr_setup: } finish: +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * If the TX active queue drops below a certain + * threshold, ensure we age fast-frames out so they're + * transmitted. + */ + if (sc->sc_tx_n_active < 2) { + /* XXX ew - net80211 should defer this for us! */ + OTUS_UNLOCK(sc); + ieee80211_ff_flush(ic, WME_AC_VO); + ieee80211_ff_flush(ic, WME_AC_VI); + ieee80211_ff_flush(ic, WME_AC_BE); + ieee80211_ff_flush(ic, WME_AC_BK); + OTUS_LOCK(sc); + } +#endif /* Kick TX */ otus_tx_start(sc); } Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otusreg.h Mon Sep 28 01:09:48 2015 (r288319) @@ -984,6 +984,10 @@ struct otus_softc { /* current noisefloor, from SET_FREQUENCY */ int sc_nf[OTUS_NUM_CHAINS]; + /* How many pending, active transmit frames */ + int sc_tx_n_pending; + int sc_tx_n_active; + const uint32_t *phy_vals; struct { From owner-svn-src-all@freebsd.org Mon Sep 28 01:16:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18D64A0B45B; Mon, 28 Sep 2015 01:16:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09CDF13A; Mon, 28 Sep 2015 01:16:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S1Gil7087464; Mon, 28 Sep 2015 01:16:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S1GiYS087463; Mon, 28 Sep 2015 01:16:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280116.t8S1GiYS087463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 01:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288320 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 01:16:45 -0000 Author: adrian Date: Mon Sep 28 01:16:44 2015 New Revision: 288320 URL: https://svnweb.freebsd.org/changeset/base/288320 Log: include opt_wlan.h . Tsk adrian. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 01:09:48 2015 (r288319) +++ head/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 01:16:44 2015 (r288320) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); * o power-save operation */ +#include "opt_wlan.h" + #include #include #include From owner-svn-src-all@freebsd.org Mon Sep 28 03:28:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB59BA0A57B; Mon, 28 Sep 2015 03:28:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3D1181; Mon, 28 Sep 2015 03:28:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S3SNiL041531; Mon, 28 Sep 2015 03:28:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S3SNaC041530; Mon, 28 Sep 2015 03:28:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509280328.t8S3SNaC041530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Sep 2015 03:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288328 - head/etc 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 03:28:23 -0000 Author: ngie Date: Mon Sep 28 03:28:22 2015 New Revision: 288328 URL: https://svnweb.freebsd.org/changeset/base/288328 Log: Delete stray svn:mergeinfo Modified: Directory Properties: head/etc/ (props changed) From owner-svn-src-all@freebsd.org Mon Sep 28 03:36:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D986A0AB18; Mon, 28 Sep 2015 03:36:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E0B1A00; Mon, 28 Sep 2015 03:36:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S3aG2S045877; Mon, 28 Sep 2015 03:36:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S3aGE1045873; Mon, 28 Sep 2015 03:36:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509280336.t8S3aGE1045873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Sep 2015 03:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288330 - in head: bin/ls bin/ls/tests etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 03:36:17 -0000 Author: ngie Date: Mon Sep 28 03:36:15 2015 New Revision: 288330 URL: https://svnweb.freebsd.org/changeset/base/288330 Log: Add initial testcases for bin/ls MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Added: head/bin/ls/tests/ - copied from r284388, user/ngie/more-tests/bin/ls/tests/ Modified: head/bin/ls/Makefile head/bin/ls/tests/Makefile head/bin/ls/tests/ls_tests.sh head/etc/mtree/BSD.tests.dist Directory Properties: head/ (props changed) Modified: head/bin/ls/Makefile ============================================================================== --- head/bin/ls/Makefile Mon Sep 28 03:31:01 2015 (r288329) +++ head/bin/ls/Makefile Mon Sep 28 03:36:15 2015 (r288330) @@ -13,4 +13,8 @@ CFLAGS+= -DCOLORLS LIBADD+= termcapw .endif +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: head/bin/ls/tests/Makefile ============================================================================== --- user/ngie/more-tests/bin/ls/tests/Makefile Sun Jun 14 20:52:52 2015 (r284388) +++ head/bin/ls/tests/Makefile Mon Sep 28 03:36:15 2015 (r288330) @@ -1,8 +1,11 @@ +# $FreeBSD$ + TESTSDIR= ${TESTSBASE}/bin/ls ATF_TESTS_SH+= ls_tests # This seems like overkill, but the idea in mind is that all of the testcases # should be runnable as !root TEST_METADATA.ls_tests+= required_user="unprivileged" +TEST_METADATA.ls_tests+= required_files="/usr/bin/nc" .include Modified: head/bin/ls/tests/ls_tests.sh ============================================================================== --- user/ngie/more-tests/bin/ls/tests/ls_tests.sh Sun Jun 14 20:52:52 2015 (r284388) +++ head/bin/ls/tests/ls_tests.sh Mon Sep 28 03:36:15 2015 (r288330) @@ -27,9 +27,11 @@ # $FreeBSD$ # -create_test_inputs() +create_test_dir() { - ATF_TMPDIR=$(pwd) + [ -z "$ATF_TMPDIR" ] || return 0 + + export ATF_TMPDIR=$(pwd) # XXX: need to nest this because of how kyua creates $TMPDIR; otherwise # it will run into EPERM issues later @@ -37,6 +39,12 @@ create_test_inputs() atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR cd $TEST_INPUTS_DIR +} + +create_test_inputs() +{ + create_test_dir + atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b atf_check -e empty -s exit:0 ln -s a/b c atf_check -e empty -s exit:0 touch d @@ -44,16 +52,76 @@ create_test_inputs() atf_check -e empty -s exit:0 touch .f atf_check -e empty -s exit:0 mkdir .g atf_check -e empty -s exit:0 mkfifo h + atf_check -e ignore -s exit:0 dd if=/dev/zero of=i count=1000 bs=1 + atf_check -e empty -s exit:0 \ + sh -c "pid=${ATF_TMPDIR}/nc.pid; daemon -p \$pid nc -lU j; sleep 2; pkill -F \$pid" + atf_check -e empty -s exit:0 touch klmn + atf_check -e empty -s exit:0 touch opqr + atf_check -e empty -s exit:0 touch stuv + atf_check -e empty -s exit:0 touch wxyz + atf_check -e empty -s exit:0 touch 0b00000001 + atf_check -e empty -s exit:0 touch 0b00000010 + atf_check -e empty -s exit:0 touch 0b00000011 + atf_check -e empty -s exit:0 touch 0b00000100 + atf_check -e empty -s exit:0 touch 0b00000101 + atf_check -e empty -s exit:0 touch 0b00000110 + atf_check -e empty -s exit:0 touch 0b00000111 + atf_check -e empty -s exit:0 touch 0b00001000 + atf_check -e empty -s exit:0 touch 0b00001001 + atf_check -e empty -s exit:0 touch 0b00001010 + atf_check -e empty -s exit:0 touch 0b00001011 + atf_check -e empty -s exit:0 touch 0b00001100 + atf_check -e empty -s exit:0 touch 0b00001101 + atf_check -e empty -s exit:0 touch 0b00001110 + atf_check -e empty -s exit:0 touch 0b00001111 +} + +atf_test_case a_flag +a_flag_head() +{ + atf_set "descr" "Verify -a support" +} + +a_flag_body() +{ + create_test_dir + + # Make sure "." and ".." show up with -a + atf_check -e empty -o match:'\.[[:space:]]+\.\.' -s exit:0 ls -ax + + create_test_inputs + + WITH_a=$PWD/../with_a.out + WITHOUT_a=$PWD/../without_a.out + + atf_check -e empty -o save:$WITH_a -s exit:0 ls -A + atf_check -e empty -o save:$WITHOUT_a -s exit:0 ls + + echo "-A usage" + cat $WITH_a + echo "No -A usage" + cat $WITHOUT_a + + for dot_path in '\.f' '\.g'; do + atf_check -e empty -o not-empty -s exit:0 grep "${dot_path}" \ + $WITH_a + atf_check -e empty -o empty -s not-exit:0 grep "${dot_path}" \ + $WITHOUT_a + done } atf_test_case A_flag A_flag_head() { - atf_set "require.user" "unprivileged" + atf_set "descr" "Verify -A support with unprivileged users" } A_flag_body() { + create_test_dir + + atf_check -e empty -o empty -s exit:0 ls -A + create_test_inputs WITH_A=$PWD/../with_A.out @@ -84,6 +152,10 @@ A_flag_implied_when_root_head() A_flag_implied_when_root_body() { + create_test_dir + + atf_check -e empty -o empty -s exit:0 ls -A + create_test_inputs WITH_EXPLICIT=$PWD/../with_explicit_A.out @@ -100,9 +172,187 @@ A_flag_implied_when_root_body() atf_check_equal "$(cat $WITH_EXPLICIT)" "$(cat $WITH_IMPLIED)" } +atf_test_case B_flag +B_flag_head() +{ + atf_set "descr" "Verify that the output from ls -B prints out non-printable characters" +} + +B_flag_body() +{ + + atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" + atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B +} + +atf_test_case C_flag +C_flag_head() +{ + atf_set "descr" "Verify that the output from ls -C is multi-column, sorted down" +} + +C_flag_body() +{ + create_test_inputs + + WITH_C=$PWD/../with_C.out + + atf_check -e empty -o save:$WITH_C -s exit:0 ls -C + + echo "With -C usage" + cat $WITH_C + + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "0b00000001[[:space:]]+0b00000111[[:space:]]+0b00001101[[:space:]]+e[[:space:]]+stuv" $WITH_C + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "0b00000010[[:space:]]+0b00001000[[:space:]]+0b00001110[[:space:]]+h[[:space:]]+wxyz" $WITH_C +} + +atf_test_case I_flag +I_flag_head() +{ + atf_set "descr" "Verify that the output from ls -I is the same as ls for an unprivileged user" +} + +I_flag_body() +{ + create_test_inputs + + WITH_I=$PWD/../with_I.out + WITHOUT_I=$PWD/../without_I.out + + atf_check -e empty -o save:$WITH_I -s exit:0 ls -I + atf_check -e empty -o save:$WITHOUT_I -s exit:0 ls + + echo "Explicit -I usage" + cat $WITH_I + echo "No -I usage" + cat $WITHOUT_I + + atf_check_equal "$(cat $WITH_I)" "$(cat $WITHOUT_I)" +} + +atf_test_case I_flag_voids_implied_A_flag_when_root +I_flag_voids_implied_A_flag_when_root_head() +{ + atf_set "descr" "Verify that -I voids out implied -A for root" + atf_set "require.user" "root" +} + +I_flag_voids_implied_A_flag_when_root_body() +{ + create_test_inputs + + atf_check -o not-match:'\.f' -s exit:0 ls -I + atf_check -o not-match:'\.g' -s exit:0 ls -I + + atf_check -o match:'\.f' -s exit:0 ls -A -I + atf_check -o match:'\.g' -s exit:0 ls -A -I +} + +lcomma_flag_head() +{ + atf_set "descr" "Verify that -l, prints out the size with , delimiters" +} + +lcomma_flag_body() +{ + create_test_inputs + + atf_check \ + -o match:'\-rw\-r\-\-r\-\-[[:space:]]+.+[[:space:]]+1,000[[:space:]]+.+i' \ + env LC_ALL=en_US.ISO8859-1 ls -l, i +} + +x_flag_head() +{ + atf_set "descr" "Verify that -x prints out one item per line" +} + +x_flag_body() +{ + create_test_inputs + + WITH_x=$PWD/../with_x.out + + atf_check -e empty -o save:$WITH_x -s exit:0 ls -x + + echo "With -x usage" + cat $WITH_x + + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "a[[:space:]]+c[[:space:]]+d[[:space:]]+e[[:space:]]+h" $WITH_x + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "i[[:space:]]+j[[:space:]]+klmn[[:space:]]+opqr[[:space:]]+stuv" $WITH_x +} + +1_flag_head() +{ + atf_set "descr" "Verify that -1 prints out one item per line" +} + +1_flag_body() +{ + create_test_inputs + + WITH_1=$PWD/../with_1.out + WITHOUT_1=$PWD/../without_1.out + + atf_check -e empty -o save:$WITH_1 -s exit:0 ls -1 + atf_check -e empty -o save:$WITHOUT_1 -s exit:0 \ + sh -c 'for i in $(ls); do echo $i; done' + + echo "Explicit -1 usage" + cat $WITH_1 + echo "No -1 usage" + cat $WITHOUT_1 + + atf_check_equal "$(cat $WITH_1)" "$(cat $WITHOUT_1)" +} + atf_init_test_cases() { atf_add_test_case A_flag atf_add_test_case A_flag_implied_when_root + atf_add_test_case B_flag + atf_add_test_case C_flag + #atf_add_test_case D_flag + #atf_add_test_case F_flag + #atf_add_test_case G_flag + #atf_add_test_case H_flag + atf_add_test_case I_flag + atf_add_test_case I_flag_voids_implied_A_flag_when_root + #atf_add_test_case L_flag + #atf_add_test_case P_flag + #atf_add_test_case R_flag + #atf_add_test_case S_flag + #atf_add_test_case T_flag + #atf_add_test_case U_flag + #atf_add_test_case W_flag + #atf_add_test_case Z_flag + atf_add_test_case a_flag + #atf_add_test_case b_flag + #atf_add_test_case c_flag + #atf_add_test_case d_flag + #atf_add_test_case f_flag + #atf_add_test_case g_flag + #atf_add_test_case h_flag + #atf_add_test_case i_flag + #atf_add_test_case k_flag + #atf_add_test_case l_flag + atf_add_test_case lcomma_flag + #atf_add_test_case m_flag + #atf_add_test_case n_flag + #atf_add_test_case o_flag + #atf_add_test_case p_flag + #atf_add_test_case q_flag + #atf_add_test_case r_flag + #atf_add_test_case s_flag + #atf_add_test_case t_flag + #atf_add_test_case u_flag + #atf_add_test_case w_flag + atf_add_test_case x_flag + #atf_add_test_case y_flag + atf_add_test_case 1_flag } Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Sep 28 03:31:01 2015 (r288329) +++ head/etc/mtree/BSD.tests.dist Mon Sep 28 03:36:15 2015 (r288330) @@ -14,6 +14,8 @@ .. expr .. + ls + .. mv .. pax From owner-svn-src-all@freebsd.org Mon Sep 28 06:26:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C2269CFC3D; Mon, 28 Sep 2015 06:26:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2381F89; Mon, 28 Sep 2015 06:26:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S6QlN7017862; Mon, 28 Sep 2015 06:26:47 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S6Qllp017861; Mon, 28 Sep 2015 06:26:47 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280626.t8S6Qllp017861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 06:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288334 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 06:26:47 -0000 Author: adrian Date: Mon Sep 28 06:26:46 2015 New Revision: 288334 URL: https://svnweb.freebsd.org/changeset/base/288334 Log: Remove some debugging that wasn't supposed to be there. Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Mon Sep 28 03:43:05 2015 (r288333) +++ head/sys/net80211/ieee80211_superg.c Mon Sep 28 06:26:46 2015 (r288334) @@ -679,8 +679,6 @@ ieee80211_ff_check(struct ieee80211_node * If there is no frame to combine with and the pps is * too low; then do not attempt to aggregate this frame. */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: staged: %p; pps: %d\n", __func__, mstaged, ieee80211_txampdu_getpps(tap)); if (mstaged == NULL && ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) { IEEE80211_UNLOCK(ic); From owner-svn-src-all@freebsd.org Mon Sep 28 07:23:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7E5BA0A402; Mon, 28 Sep 2015 07:23:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D81621C7F; Mon, 28 Sep 2015 07:23:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S7N5BU042277; Mon, 28 Sep 2015 07:23:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S7N5XW042276; Mon, 28 Sep 2015 07:23:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201509280723.t8S7N5XW042276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Sep 2015 07:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288335 - head/usr.bin/usbhidaction 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 07:23:06 -0000 Author: hselasky Date: Mon Sep 28 07:23:05 2015 New Revision: 288335 URL: https://svnweb.freebsd.org/changeset/base/288335 Log: Store PID after becoming a daemon() and not before to ensure the correct PID gets written to the PID file. Submitted by: Maxime Soule PR: 203252 MFC after: 2 weeks Modified: head/usr.bin/usbhidaction/usbhidaction.c Modified: head/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- head/usr.bin/usbhidaction/usbhidaction.c Mon Sep 28 06:26:46 2015 (r288334) +++ head/usr.bin/usbhidaction/usbhidaction.c Mon Sep 28 07:23:05 2015 (r288335) @@ -166,17 +166,15 @@ main(int argc, char **argv) if (demon) { fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH); - if (fp >= 0) { - sz1 = snprintf(buf, sizeof buf, "%ld\n", - (long)getpid()); - if (sz1 > sizeof buf) - sz1 = sizeof buf; - write(fp, buf, sz1); - close(fp); - } else + if (fp < 0) err(1, "%s", pidfile); if (daemon(0, 0) < 0) err(1, "daemon()"); + snprintf(buf, sizeof(buf), "%ld\n", (long)getpid()); + sz1 = strlen(buf); + if (write(fp, buf, sz1) < 0) + err(1, "%s", pidfile); + close(fp); isdemon = 1; } From owner-svn-src-all@freebsd.org Mon Sep 28 12:14:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DBEBA0B489; Mon, 28 Sep 2015 12:14:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3771D59; Mon, 28 Sep 2015 12:14:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCEK2d062631; Mon, 28 Sep 2015 12:14:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCEGBU062616; Mon, 28 Sep 2015 12:14:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281214.t8SCEGBU062616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288336 - in head/sys: compat/linux kern 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 12:14:20 -0000 Author: avg Date: Mon Sep 28 12:14:16 2015 New Revision: 288336 URL: https://svnweb.freebsd.org/changeset/base/288336 Log: save some bytes by using more concise SDT_PROBE instead of SDT_PROBE SDT_PROBE requires 5 parameters whereas SDT_PROBE requires n parameters where n is typically smaller than 5. Perhaps SDT_PROBE should be made a private implementation detail. MFC after: 20 days Modified: head/sys/compat/linux/linux_dtrace.h head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/kern/kern_racct.c head/sys/kern/kern_sig.c head/sys/kern/kern_timeout.c head/sys/kern/vfs_cache.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_syscalls.c head/sys/tools/vnode_if.awk Modified: head/sys/compat/linux/linux_dtrace.h ============================================================================== --- head/sys/compat/linux/linux_dtrace.h Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/compat/linux/linux_dtrace.h Mon Sep 28 12:14:16 2015 (r288336) @@ -82,7 +82,7 @@ c, d, e, f) #define LIN_SDT_PROBE4(a, b, c, d, e, f, g) SDT_PROBE4(LINUX_DTRACE, a, b, \ c, d, e, f, g) -#define _LIN_SDT_PROBE5(a, b, c, d, e, f, g, h, i) SDT_PROBE(a, b, c, d, \ +#define _LIN_SDT_PROBE5(a, b, c, d, e, f, g, h, i) SDT_PROBE5(a, b, c, d, \ e, f, g, h, i) #define LIN_SDT_PROBE5(a, b, c, d, e, f, g, h) _LIN_SDT_PROBE5(LINUX_DTRACE, \ a, b, c, d, e, f, g, h) Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_exec.c Mon Sep 28 12:14:16 2015 (r288336) @@ -418,7 +418,7 @@ do_execve(td, args, mac_p) | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); } - SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); + SDT_PROBE1(proc, kernel, , exec, args->fname); interpret: if (args->fname != NULL) { @@ -846,7 +846,7 @@ interpret: vfs_mark_atime(imgp->vp, td->td_ucred); - SDT_PROBE(proc, kernel, , exec__success, args->fname, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exec__success, args->fname); VOP_UNLOCK(imgp->vp, 0); done1: @@ -918,7 +918,7 @@ exec_fail: p->p_flag &= ~P_INEXEC; PROC_UNLOCK(p); - SDT_PROBE(proc, kernel, , exec__failure, error, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exec__failure, error); done2: #ifdef MAC Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_exit.c Mon Sep 28 12:14:16 2015 (r288336) @@ -569,7 +569,7 @@ exit1(struct thread *td, int rval, int s reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; - SDT_PROBE(proc, kernel, , exit, reason, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exit, reason); #endif /* Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_fork.c Mon Sep 28 12:14:16 2015 (r288336) @@ -753,7 +753,7 @@ do_fork(struct thread *td, int flags, st * Tell any interested parties about the new process. */ knote_fork(&p1->p_klist, p2->p_pid); - SDT_PROBE(proc, kernel, , create, p2, p1, flags, 0, 0); + SDT_PROBE3(proc, kernel, , create, p2, p1, flags); /* * Wait until debugger is attached to child. Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_proc.c Mon Sep 28 12:14:16 2015 (r288336) @@ -181,9 +181,9 @@ proc_ctor(void *mem, int size, void *arg struct proc *p; p = (struct proc *)mem; - SDT_PROBE(proc, kernel, ctor , entry, p, size, arg, flags, 0); + SDT_PROBE4(proc, kernel, ctor , entry, p, size, arg, flags); EVENTHANDLER_INVOKE(process_ctor, p); - SDT_PROBE(proc, kernel, ctor , return, p, size, arg, flags, 0); + SDT_PROBE4(proc, kernel, ctor , return, p, size, arg, flags); return (0); } @@ -199,7 +199,7 @@ proc_dtor(void *mem, int size, void *arg /* INVARIANTS checks go here */ p = (struct proc *)mem; td = FIRST_THREAD_IN_PROC(p); - SDT_PROBE(proc, kernel, dtor, entry, p, size, arg, td, 0); + SDT_PROBE4(proc, kernel, dtor, entry, p, size, arg, td); if (td != NULL) { #ifdef INVARIANTS KASSERT((p->p_numthreads == 1), @@ -212,7 +212,7 @@ proc_dtor(void *mem, int size, void *arg EVENTHANDLER_INVOKE(process_dtor, p); if (p->p_ksi != NULL) KASSERT(! KSI_ONQ(p->p_ksi), ("SIGCHLD queue")); - SDT_PROBE(proc, kernel, dtor, return, p, size, arg, 0, 0); + SDT_PROBE3(proc, kernel, dtor, return, p, size, arg); } /* @@ -224,7 +224,7 @@ proc_init(void *mem, int size, int flags struct proc *p; p = (struct proc *)mem; - SDT_PROBE(proc, kernel, init, entry, p, size, flags, 0, 0); + SDT_PROBE3(proc, kernel, init, entry, p, size, flags); p->p_sched = (struct p_sched *)&p[1]; mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW); mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_NEW); @@ -236,7 +236,7 @@ proc_init(void *mem, int size, int flags TAILQ_INIT(&p->p_threads); /* all threads in proc */ EVENTHANDLER_INVOKE(process_init, p); p->p_stats = pstats_alloc(); - SDT_PROBE(proc, kernel, init, return, p, size, flags, 0, 0); + SDT_PROBE3(proc, kernel, init, return, p, size, flags); return (0); } Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_racct.c Mon Sep 28 12:14:16 2015 (r288336) @@ -445,7 +445,7 @@ racct_create(struct racct **racctp) if (!racct_enable) return; - SDT_PROBE(racct, kernel, racct, create, racctp, 0, 0, 0, 0); + SDT_PROBE1(racct, kernel, racct, create, racctp); KASSERT(*racctp == NULL, ("racct already allocated")); @@ -460,7 +460,7 @@ racct_destroy_locked(struct racct **racc ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, racct, destroy, racctp, 0, 0, 0, 0); + SDT_PROBE1(racct, kernel, racct, destroy, racctp); mtx_assert(&racct_lock, MA_OWNED); KASSERT(racctp != NULL, ("NULL racctp")); @@ -538,7 +538,7 @@ racct_add_locked(struct proc *p, int res ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -548,8 +548,8 @@ racct_add_locked(struct proc *p, int res #ifdef RCTL error = rctl_enforce(p, resource, amount); if (error && RACCT_IS_DENIABLE(resource)) { - SDT_PROBE(racct, kernel, rusage, add__failure, p, resource, - amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__failure, p, resource, + amount); return (error); } #endif @@ -584,8 +584,7 @@ racct_add_cred_locked(struct ucred *cred ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, add__cred, cred, resource, amount, - 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__cred, cred, resource, amount); racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, amount); for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) @@ -623,7 +622,7 @@ racct_add_force(struct proc *p, int reso if (!racct_enable) return; - SDT_PROBE(racct, kernel, rusage, add__force, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__force, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -647,7 +646,7 @@ racct_set_locked(struct proc *p, int res ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -679,8 +678,8 @@ racct_set_locked(struct proc *p, int res if (diff_proc > 0) { error = rctl_enforce(p, resource, diff_proc); if (error && RACCT_IS_DENIABLE(resource)) { - SDT_PROBE(racct, kernel, rusage, set__failure, p, - resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set__failure, p, + resource, amount); return (error); } } @@ -723,7 +722,7 @@ racct_set_force_locked(struct proc *p, i ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -834,7 +833,7 @@ racct_sub(struct proc *p, int resource, if (!racct_enable) return; - SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, sub, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -861,8 +860,7 @@ racct_sub_cred_locked(struct ucred *cred ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, sub__cred, cred, resource, amount, - 0, 0); + SDT_PROBE3(racct, kernel, rusage, sub__cred, cred, resource, amount); #ifdef notyet KASSERT(RACCT_CAN_DROP(resource), Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_sig.c Mon Sep 28 12:14:16 2015 (r288336) @@ -1308,7 +1308,7 @@ kern_sigtimedwait(struct thread *td, sig reschedule_signals(p, new_block, 0); if (error == 0) { - SDT_PROBE(proc, kernel, , signal__clear, sig, ksi, 0, 0, 0); + SDT_PROBE2(proc, kernel, , signal__clear, sig, ksi); if (ksi->ksi_code == SI_TIMER) itimer_accept(p, ksi->ksi_timerid, ksi); @@ -2121,7 +2121,7 @@ tdsendsignal(struct proc *p, struct thre } else sigqueue = &td->td_sigqueue; - SDT_PROBE(proc, kernel, , signal__send, td, p, sig, 0, 0 ); + SDT_PROBE3(proc, kernel, , signal__send, td, p, sig); /* * If the signal is being ignored, @@ -2132,7 +2132,7 @@ tdsendsignal(struct proc *p, struct thre */ mtx_lock(&ps->ps_mtx); if (SIGISMEMBER(ps->ps_sigignore, sig)) { - SDT_PROBE(proc, kernel, , signal__discard, td, p, sig, 0, 0 ); + SDT_PROBE3(proc, kernel, , signal__discard, td, p, sig); mtx_unlock(&ps->ps_mtx); if (ksi && (ksi->ksi_flags & KSI_INS)) Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_timeout.c Mon Sep 28 12:14:16 2015 (r288336) @@ -718,9 +718,9 @@ softclock_call_cc(struct callout *c, str sbt1 = sbinuptime(); #endif THREAD_NO_SLEEPING(); - SDT_PROBE(callout_execute, kernel, , callout__start, c, 0, 0, 0, 0); + SDT_PROBE1(callout_execute, kernel, , callout__start, c); c_func(c_arg); - SDT_PROBE(callout_execute, kernel, , callout__end, c, 0, 0, 0, 0); + SDT_PROBE1(callout_execute, kernel, , callout__end, c); THREAD_SLEEPING_OK(); #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) sbt2 = sbinuptime(); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_cache.c Mon Sep 28 12:14:16 2015 (r288336) @@ -419,11 +419,11 @@ cache_zap(ncp) CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { - SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - nc_get_name(ncp), ncp->nc_vp, 0, 0); + SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, + nc_get_name(ncp), ncp->nc_vp); } else { - SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - nc_get_name(ncp), 0, 0, 0); + SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, + nc_get_name(ncp)); } #endif vp = NULL; @@ -498,8 +498,7 @@ retry_wlocked: CTR2(KTR_VFS, "cache_lookup(%p, %s) found via .", dvp, cnp->cn_nameptr); dothits++; - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ".", - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ".", *vpp); if (tsp != NULL) timespecclear(tsp); if (ticksp != NULL) @@ -509,8 +508,8 @@ retry_wlocked: if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { dotdothits++; if (dvp->v_cache_dd == NULL) { - SDT_PROBE(vfs, namecache, lookup, miss, dvp, - "..", NULL, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, miss, dvp, + "..", NULL); goto unlock; } if ((cnp->cn_flags & MAKEENTRY) == 0) { @@ -532,8 +531,8 @@ retry_wlocked: goto negative_success; CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", dvp, cnp->cn_nameptr, *vpp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, "..", + *vpp); cache_out_ts(ncp, tsp, ticksp); if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == NCF_DTS && tsp != NULL) @@ -554,8 +553,8 @@ retry_wlocked: /* We failed to find an entry */ if (ncp == NULL) { - SDT_PROBE(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, + NULL); if ((cnp->cn_flags & MAKEENTRY) == 0) { nummisszap++; } else { @@ -583,8 +582,8 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), + *vpp); cache_out_ts(ncp, tsp, ticksp); goto success; } @@ -615,8 +614,8 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit__negative, dvp, nc_get_name(ncp), - 0, 0, 0); + SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, + nc_get_name(ncp)); cache_out_ts(ncp, tsp, ticksp); CACHE_WUNLOCK(); return (ENOENT); @@ -769,8 +768,7 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp return; } dvp->v_cache_dd = NULL; - SDT_PROBE(vfs, namecache, enter, done, dvp, "..", vp, - 0, 0); + SDT_PROBE3(vfs, namecache, enter, done, dvp, "..", vp); CACHE_WUNLOCK(); flag = NCF_ISDOTDOT; } @@ -890,12 +888,12 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), - vp, 0, 0); + SDT_PROBE3(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - nc_get_name(ncp), 0, 0, 0); + SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, + nc_get_name(ncp)); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -984,7 +982,7 @@ cache_purge(vp) { CTR1(KTR_VFS, "cache_purge(%p)", vp); - SDT_PROBE(vfs, namecache, purge, done, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purge, done, vp); CACHE_WLOCK(); while (!LIST_EMPTY(&vp->v_cache_src)) cache_zap(LIST_FIRST(&vp->v_cache_src)); @@ -1009,7 +1007,7 @@ cache_purge_negative(vp) struct namecache *cp, *ncp; CTR1(KTR_VFS, "cache_purge_negative(%p)", vp); - SDT_PROBE(vfs, namecache, purge_negative, done, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purge_negative, done, vp); CACHE_WLOCK(); LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) { if (cp->nc_vp == NULL) @@ -1029,7 +1027,7 @@ cache_purgevfs(mp) struct namecache *ncp, *nnp; /* Scan hash tables for applicable entries */ - SDT_PROBE(vfs, namecache, purgevfs, done, mp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purgevfs, done, mp); CACHE_WLOCK(); for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { @@ -1253,14 +1251,14 @@ vn_vptocnp_locked(struct vnode **vp, str vrele(*vp); numfullpathfail4++; error = ENOMEM; - SDT_PROBE(vfs, namecache, fullpath, return, error, - vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, + vp, NULL); return (error); } *buflen -= ncp->nc_nlen; memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); - SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - nc_get_name(ncp), vp, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, hit, ncp->nc_dvp, + nc_get_name(ncp), vp); dvp = *vp; *vp = ncp->nc_dvp; vref(*vp); @@ -1269,7 +1267,7 @@ vn_vptocnp_locked(struct vnode **vp, str CACHE_RLOCK(); return (0); } - SDT_PROBE(vfs, namecache, fullpath, miss, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, fullpath, miss, vp); CACHE_RUNLOCK(); vn_lock(*vp, LK_SHARED | LK_RETRY); @@ -1277,8 +1275,7 @@ vn_vptocnp_locked(struct vnode **vp, str vput(*vp); if (error) { numfullpathfail2++; - SDT_PROBE(vfs, namecache, fullpath, return, error, vp, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, vp, NULL); return (error); } @@ -1289,8 +1286,7 @@ vn_vptocnp_locked(struct vnode **vp, str CACHE_RUNLOCK(); vrele(dvp); error = ENOENT; - SDT_PROBE(vfs, namecache, fullpath, return, error, vp, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, vp, NULL); return (error); } /* @@ -1318,7 +1314,7 @@ vn_fullpath1(struct thread *td, struct v error = 0; slash_prefixed = 0; - SDT_PROBE(vfs, namecache, fullpath, entry, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, fullpath, entry, vp); numfullpathcalls++; vref(vp); CACHE_RLOCK(); @@ -1340,8 +1336,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); error = ENOENT; - SDT_PROBE(vfs, namecache, fullpath, return, - error, vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, + error, vp, NULL); break; } vp1 = vp->v_mount->mnt_vnodecovered; @@ -1357,8 +1353,8 @@ vn_fullpath1(struct thread *td, struct v vrele(vp); numfullpathfail1++; error = ENOTDIR; - SDT_PROBE(vfs, namecache, fullpath, return, - error, vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, + error, vp, NULL); break; } error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen); @@ -1368,8 +1364,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); error = ENOMEM; - SDT_PROBE(vfs, namecache, fullpath, return, error, - startvp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, + startvp, NULL); break; } buf[--buflen] = '/'; @@ -1382,8 +1378,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); numfullpathfail4++; - SDT_PROBE(vfs, namecache, fullpath, return, ENOMEM, - startvp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, ENOMEM, + startvp, NULL); return (ENOMEM); } buf[--buflen] = '/'; @@ -1392,8 +1388,7 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); - SDT_PROBE(vfs, namecache, fullpath, return, 0, startvp, buf + buflen, - 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, 0, startvp, buf + buflen); *retbuf = buf + buflen; return (0); } Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_lookup.c Mon Sep 28 12:14:16 2015 (r288336) @@ -299,16 +299,15 @@ namei(struct nameidata *ndp) namei_cleanup_cnp(cnp); return (error); } - SDT_PROBE(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, - cnp->cn_flags, 0, 0); + SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, + cnp->cn_flags); for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); if (error != 0) { vrele(ndp->ni_rootdir); namei_cleanup_cnp(cnp); - SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, - 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, error, NULL); return (error); } /* @@ -321,8 +320,7 @@ namei(struct nameidata *ndp) } else cnp->cn_flags |= HASBUF; - SDT_PROBE(vfs, namei, lookup, return, 0, ndp->ni_vp, - 0, 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, 0, ndp->ni_vp); return (0); } if (ndp->ni_loopcnt++ >= MAXSYMLINKS) { @@ -397,7 +395,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); - SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, error, NULL); return (error); } Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_syscalls.c Mon Sep 28 12:14:16 2015 (r288336) @@ -2160,9 +2160,9 @@ kern_statat(struct thread *td, int flag, return (error); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); if (error == 0) { - SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0); + SDT_PROBE2(vfs, , stat, mode, path, sb.st_mode); if (S_ISREG(sb.st_mode)) - SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0); + SDT_PROBE2(vfs, , stat, reg, path, pathseg); if (__predict_false(hook != NULL)) hook(nd.ni_vp, &sb); } Modified: head/sys/tools/vnode_if.awk ============================================================================== --- head/sys/tools/vnode_if.awk Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/tools/vnode_if.awk Mon Sep 28 12:14:16 2015 (r288336) @@ -359,7 +359,7 @@ while ((getline < srcfile) > 0) { printc("\t vop->"name" == NULL && vop->vop_bypass == NULL)") printc("\t\tvop = vop->vop_default;") printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));") - printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n"); + printc("\tSDT_PROBE2(vfs, vop, " name ", entry, a->a_" args[0] ", a);\n"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "Entry", "\t"); printc("\tKTR_START" ctrstr); @@ -370,7 +370,7 @@ while ((getline < srcfile) > 0) { printc("\telse") printc("\t\trc = vop->vop_bypass(&a->a_gen);") printc("\tVFS_EPILOGUE(a->a_" args[0]"->v_mount);") - printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n"); + printc("\tSDT_PROBE3(vfs, vop, " name ", return, a->a_" args[0] ", a, rc);\n"); printc("\tif (rc == 0) {"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "OK", "\t\t"); From owner-svn-src-all@freebsd.org Mon Sep 28 12:23:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B95E3A0B919; Mon, 28 Sep 2015 12:23:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92168126B; Mon, 28 Sep 2015 12:23:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCNBTi066906; Mon, 28 Sep 2015 12:23:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCNBs7066905; Mon, 28 Sep 2015 12:23:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281223.t8SCNBs7066905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288337 - head/cddl/contrib/opensolaris/common/avl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 12:23:11 -0000 Author: avg Date: Mon Sep 28 12:23:10 2015 New Revision: 288337 URL: https://svnweb.freebsd.org/changeset/base/288337 Log: remove an extra copy of avl.c from illumos contrib code MFC after: 20 days Deleted: head/cddl/contrib/opensolaris/common/avl/avl.c From owner-svn-src-all@freebsd.org Mon Sep 28 12:30:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E223DA0BC7C; Mon, 28 Sep 2015 12:30:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C66481760; Mon, 28 Sep 2015 12:30:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCUOaL068187; Mon, 28 Sep 2015 12:30:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCUMNA068177; Mon, 28 Sep 2015 12:30:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509281230.t8SCUMNA068177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 28 Sep 2015 12:30:22 +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: r288338 - in stable/10/sys/cam: ata 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 12:30:25 -0000 Author: mav Date: Mon Sep 28 12:30:22 2015 New Revision: 288338 URL: https://svnweb.freebsd.org/changeset/base/288338 Log: MFC r287289: Attach pass driver to LUNs is OFFLINE state. Previously such LUNs were silently ignored. But while they indeed unable to process most of SCSI commands, some, like RTPG, they still can. Modified: stable/10/sys/cam/ata/ata_xpt.c stable/10/sys/cam/scsi/scsi_cd.c stable/10/sys/cam/scsi/scsi_ch.c stable/10/sys/cam/scsi/scsi_da.c stable/10/sys/cam/scsi/scsi_pt.c stable/10/sys/cam/scsi/scsi_sa.c stable/10/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/10/sys/cam/ata/ata_xpt.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/ata/ata_xpt.c Mon Sep 28 12:30:22 2015 (r288338) @@ -1090,7 +1090,8 @@ notsata: periph_qual = SID_QUAL(inq_buf); - if (periph_qual != SID_QUAL_LU_CONNECTED) + if (periph_qual != SID_QUAL_LU_CONNECTED && + periph_qual != SID_QUAL_LU_OFFLINE) break; /* Modified: stable/10/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_cd.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_cd.c Mon Sep 28 12:30:22 2015 (r288338) @@ -392,7 +392,8 @@ cdasync(void *callback_arg, u_int32_t co if (cgd->protocol != PROTO_SCSI) break; - + if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) + break; if (SID_TYPE(&cgd->inq_data) != T_CDROM && SID_TYPE(&cgd->inq_data) != T_WORM) break; Modified: stable/10/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_ch.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_ch.c Mon Sep 28 12:30:22 2015 (r288338) @@ -337,7 +337,8 @@ chasync(void *callback_arg, u_int32_t co if (cgd->protocol != PROTO_SCSI) break; - + if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) + break; if (SID_TYPE(&cgd->inq_data)!= T_CHANGER) break; Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_da.c Mon Sep 28 12:30:22 2015 (r288338) @@ -1667,7 +1667,8 @@ daasync(void *callback_arg, u_int32_t co if (cgd->protocol != PROTO_SCSI) break; - + if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) + break; if (SID_TYPE(&cgd->inq_data) != T_DIRECT && SID_TYPE(&cgd->inq_data) != T_RBC && SID_TYPE(&cgd->inq_data) != T_OPTICAL) Modified: stable/10/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_pt.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_pt.c Mon Sep 28 12:30:22 2015 (r288338) @@ -366,7 +366,8 @@ ptasync(void *callback_arg, u_int32_t co if (cgd->protocol != PROTO_SCSI) break; - + if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) + break; if (SID_TYPE(&cgd->inq_data) != T_PROCESSOR) break; Modified: stable/10/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_sa.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_sa.c Mon Sep 28 12:30:22 2015 (r288338) @@ -2254,7 +2254,8 @@ saasync(void *callback_arg, u_int32_t co if (cgd->protocol != PROTO_SCSI) break; - + if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED) + break; if (SID_TYPE(&cgd->inq_data) != T_SEQUENTIAL) break; Modified: stable/10/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_xpt.c Mon Sep 28 12:23:10 2015 (r288337) +++ stable/10/sys/cam/scsi/scsi_xpt.c Mon Sep 28 12:30:22 2015 (r288338) @@ -1126,6 +1126,7 @@ probedone(struct cam_periph *periph, uni { probe_softc *softc; struct cam_path *path; + struct scsi_inquiry_data *inq_buf; u_int32_t priority; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n")); @@ -1165,7 +1166,6 @@ out: case PROBE_FULL_INQUIRY: { if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) { - struct scsi_inquiry_data *inq_buf; u_int8_t periph_qual; path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID; @@ -1174,7 +1174,8 @@ out: periph_qual = SID_QUAL(inq_buf); - if (periph_qual == SID_QUAL_LU_CONNECTED) { + if (periph_qual == SID_QUAL_LU_CONNECTED || + periph_qual == SID_QUAL_LU_OFFLINE) { u_int8_t len; /* @@ -1350,10 +1351,10 @@ out: probe_purge_old(path, lp, softc->flags); lp = NULL; } + inq_buf = &path->device->inq_data; if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID && - SID_QUAL(&path->device->inq_data) == SID_QUAL_LU_CONNECTED) { - struct scsi_inquiry_data *inq_buf; - inq_buf = &path->device->inq_data; + (SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED || + SID_QUAL(inq_buf) == SID_QUAL_LU_OFFLINE)) { if (INQ_DATA_TQ_ENABLED(inq_buf)) PROBE_SET_ACTION(softc, PROBE_MODE_SENSE); else From owner-svn-src-all@freebsd.org Mon Sep 28 12:38:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FB1CA0A023; Mon, 28 Sep 2015 12:38:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C0D61B5D; Mon, 28 Sep 2015 12:38:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCcxLl072137; Mon, 28 Sep 2015 12:38:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCcwCJ072132; Mon, 28 Sep 2015 12:38:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281238.t8SCcwCJ072132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288339 - in head: . cddl/contrib/opensolaris/cmd/sgs cddl/usr.bin cddl/usr.bin/sgsmsg targets/pseudo/userland/cddl 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 12:38:59 -0000 Author: avg Date: Mon Sep 28 12:38:57 2015 New Revision: 288339 URL: https://svnweb.freebsd.org/changeset/base/288339 Log: remove unused sgsmsg utility (originally imported from opensolaris) MFC after: 25 days Deleted: head/cddl/contrib/opensolaris/cmd/sgs/ head/cddl/usr.bin/sgsmsg/ Modified: head/Makefile.inc1 head/ObsoleteFiles.inc head/cddl/usr.bin/Makefile head/targets/pseudo/userland/cddl/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Sep 28 12:30:22 2015 (r288338) +++ head/Makefile.inc1 Mon Sep 28 12:38:57 2015 (r288339) @@ -1497,7 +1497,7 @@ _btxld= usr.sbin/btxld # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures # resulting from missing bug fixes or ELF Toolchain updates. .if ${MK_CDDL} != "no" -_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \ +_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ cddl/usr.bin/ctfmerge .endif Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Sep 28 12:30:22 2015 (r288338) +++ head/ObsoleteFiles.inc Mon Sep 28 12:38:57 2015 (r288339) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150928: unused sgsmsg utility is removed +OLD_FILES+=usr/bin/sgsmsg # 20150926: remove links to removed/unimplemented mbuf(9) macros OLD_FILES+=usr/share/man/man9/MEXT_ADD_REF.9.gz OLD_FILES+=usr/share/man/man9/MEXTFREE.9.gz Modified: head/cddl/usr.bin/Makefile ============================================================================== --- head/cddl/usr.bin/Makefile Mon Sep 28 12:30:22 2015 (r288338) +++ head/cddl/usr.bin/Makefile Mon Sep 28 12:38:57 2015 (r288339) @@ -6,7 +6,6 @@ SUBDIR= \ ctfconvert \ ctfdump \ ctfmerge \ - sgsmsg \ ${_tests} \ ${_zinject} \ ${_zlook} \ Modified: head/targets/pseudo/userland/cddl/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/cddl/Makefile.depend Mon Sep 28 12:30:22 2015 (r288338) +++ head/targets/pseudo/userland/cddl/Makefile.depend Mon Sep 28 12:38:57 2015 (r288339) @@ -12,7 +12,6 @@ DIRDEPS = \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ - cddl/usr.bin/sgsmsg \ DIRDEPS.CTF = \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 28 12:30:22 2015 (r288338) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 28 12:38:57 2015 (r288339) @@ -910,7 +910,6 @@ OLD_LIBS+=lib/libuutil.so.2 OLD_FILES+=usr/bin/ctfconvert OLD_FILES+=usr/bin/ctfdump OLD_FILES+=usr/bin/ctfmerge -OLD_FILES+=usr/bin/sgsmsg OLD_FILES+=usr/lib/dtrace/drti.o OLD_FILES+=usr/lib/dtrace/errno.d OLD_FILES+=usr/lib/dtrace/io.d From owner-svn-src-all@freebsd.org Mon Sep 28 15:25:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1984EA0AA61; Mon, 28 Sep 2015 15:25:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E37A01ADF; Mon, 28 Sep 2015 15:25:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SFPbt7041708; Mon, 28 Sep 2015 15:25:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SFPbIk041704; Mon, 28 Sep 2015 15:25:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281525.t8SFPbIk041704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 15:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288340 - in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/contrib/opensolaris/common/nvpair 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 15:25:38 -0000 Author: avg Date: Mon Sep 28 15:25:36 2015 New Revision: 288340 URL: https://svnweb.freebsd.org/changeset/base/288340 Log: define aok in libnvpair which is linked to all zfs libraries that need aok This removes the circular dependency of libnvpair on libzfs / libzpool. PR: 199811 Obtained from: bapt MFC after: 23 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 28 15:25:36 2015 (r288340) @@ -55,7 +55,6 @@ #include "zfs_prop.h" #include "zfeature_common.h" -int aok; int libzfs_errno(libzfs_handle_t *hdl) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Sep 28 15:25:36 2015 (r288340) @@ -45,7 +45,9 @@ * Emulation of kernel services in userland. */ +#ifndef __FreeBSD__ int aok; +#endif uint64_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; char hw_serial[HW_HOSTID_LEN]; Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Mon Sep 28 15:25:36 2015 (r288340) @@ -44,6 +44,14 @@ #endif #define skip_whitespace(p) while ((*(p) == ' ') || (*(p) == '\t')) p++ +#if defined(__FreeBSD__) && !defined(_KERNEL) +/* + * libnvpair is the lowest commen denominator for ZFS related libraries, + * defining aok here makes it usable by all ZFS related libraries + */ +int aok; +#endif + /* * nvpair.c - Provides kernel & userland interfaces for manipulating * name-value pairs. From owner-svn-src-all@freebsd.org Mon Sep 28 16:33:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E429A0B3CB; Mon, 28 Sep 2015 16:33:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9C913AA; Mon, 28 Sep 2015 16:33:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SGXdZq071069; Mon, 28 Sep 2015 16:33:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SGXdEN071068; Mon, 28 Sep 2015 16:33:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281633.t8SGXdEN071068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 16:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288341 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 16:33:39 -0000 Author: gjb Date: Mon Sep 28 16:33:38 2015 New Revision: 288341 URL: https://svnweb.freebsd.org/changeset/base/288341 Log: Honor VMFORMATS and VMSIZE if set in release.conf. PR: 203420 Submitted by: luca pizzamiglio gmail com MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 15:25:36 2015 (r288340) +++ head/release/release.sh Mon Sep 28 16:33:38 2015 (r288341) @@ -208,6 +208,7 @@ env_check() { RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${DOCPORTS} \ WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ + VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE} \ WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" return 0 From owner-svn-src-all@freebsd.org Mon Sep 28 18:19:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC7E1A0B44D; Mon, 28 Sep 2015 18:19:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6CE104B; Mon, 28 Sep 2015 18:19:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SIJN4u012601; Mon, 28 Sep 2015 18:19:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SIJNDr012600; Mon, 28 Sep 2015 18:19:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509281819.t8SIJNDr012600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 28 Sep 2015 18:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288344 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 18:19:23 -0000 Author: delphij Date: Mon Sep 28 18:19:22 2015 New Revision: 288344 URL: https://svnweb.freebsd.org/changeset/base/288344 Log: Use _PATH_DEVNULL instead of direct hardcoding. MFC after: 2 weeks Modified: head/usr.bin/systat/main.c Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Mon Sep 28 17:30:07 2015 (r288343) +++ head/usr.bin/systat/main.c Mon Sep 28 18:19:22 2015 (r288344) @@ -178,7 +178,7 @@ main(int argc, char **argv) * devices. We can now use sysctl only. */ use_kvm = 0; - kd = kvm_openfiles("/dev/null", "/dev/null", "/dev/null", + kd = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, _PATH_DEVNULL, O_RDONLY, errbuf); if (kd == NULL) { error("%s", errbuf); From owner-svn-src-all@freebsd.org Mon Sep 28 18:39:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C9EFA0A376; Mon, 28 Sep 2015 18:39:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B14713BA; Mon, 28 Sep 2015 18:39:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SIdMWY021923; Mon, 28 Sep 2015 18:39:22 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SIdMOw021922; Mon, 28 Sep 2015 18:39:22 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281839.t8SIdMOw021922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 18:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288345 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 18:39:22 -0000 Author: gjb Date: Mon Sep 28 18:39:21 2015 New Revision: 288345 URL: https://svnweb.freebsd.org/changeset/base/288345 Log: In followup to r288341, ensure VMFORMATS and VMSIZE are not set to empty values, which would result in nonintuitive build errors. MFC after: 3 days X-MFC-With: r288341 PR: 203420 (related to) Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 18:19:22 2015 (r288344) +++ head/release/release.sh Mon Sep 28 18:39:21 2015 (r288345) @@ -208,7 +208,6 @@ env_check() { RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${DOCPORTS} \ WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ - VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE} \ WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" return 0 @@ -312,6 +311,18 @@ chroot_build_target() { # chroot_build_release(): Invoke the 'make release' target. chroot_build_release() { load_target_env + if [ ! -z "${WITH_VMIMAGES}" ]; then + if [ -z "${VMFORMATS}" ]; then + VMFORMATS="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMFORMATS)" + fi + if [ -z "${VMSIZE}" ]; then + VMSIZE="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMSIZE)" + fi + fi + RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} VMFORMATS=\"${VMFORMATS}\" \ + VMSIZE=${VMSIZE}" eval chroot ${CHROOTDIR} make -C /usr/src/release \ ${RELEASE_RMAKEFLAGS} release eval chroot ${CHROOTDIR} make -C /usr/src/release \ From owner-svn-src-all@freebsd.org Mon Sep 28 18:58:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7136A0B57C; Mon, 28 Sep 2015 18:58:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6BD91354; Mon, 28 Sep 2015 18:58:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SIwShi030146; Mon, 28 Sep 2015 18:58:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SIwSfD030144; Mon, 28 Sep 2015 18:58:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509281858.t8SIwSfD030144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 28 Sep 2015 18:58:28 +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: r288346 - stable/10/cddl/contrib/opensolaris/cmd/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 18:58:29 -0000 Author: delphij Date: Mon Sep 28 18:58:27 2015 New Revision: 288346 URL: https://svnweb.freebsd.org/changeset/base/288346 Log: MFC r287770: MFV r277429: Document -S option when zfs inherit fails on quota and in manual pages. Illumos ZFS issues: 5410 Document -S option to zfs inherit https://illumos.org/issues/5410 5412 Mention -S option when zfs inherit fails on quota https://illumos.org/issues/5412 illumos/illumos-gate@5ff8cfa92ec8ea0f8593ad21aa2a04829b0ef5ea Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Sep 28 18:39:21 2015 (r288345) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Sep 28 18:58:27 2015 (r288346) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 2015 +.Dd September 14, 2015 .Dt ZFS 8 .Os .Sh NAME @@ -2126,7 +2126,8 @@ Property name .It value Property value .It source -Property source. Can either be local, default, temporary, inherited, or none +Property source. Can either be local, default, temporary, inherited, received, +or none (\&-). .El .Pp @@ -2192,8 +2193,11 @@ The default value is all sources. .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ... .Xc .Pp -Clears the specified property, causing it to be inherited from an ancestor. If -no ancestor has the property set, then the default value is used. See the +Clears the specified property, causing it to be inherited from an ancestor, +restored to default if no ancestor has the property set, or with the +.Fl S +option reverted to the received value if one exists. +See the .Qq Sx Properties section for a listing of default values, and details on which properties can be inherited. @@ -2201,8 +2205,10 @@ inherited. .It Fl r Recursively inherit the given property for all children. .It Fl S -For properties with a received value, revert to this value. This flag has no -effect on properties that do not have a received value. +Revert the property to the received value if one exists; otherwise operate as +if the +.Fl S +option was not specified. .El .It Xo .Nm Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Sep 28 18:39:21 2015 (r288345) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Sep 28 18:58:27 2015 (r288346) @@ -1927,9 +1927,13 @@ zfs_do_inherit(int argc, char **argv) if (prop == ZFS_PROP_QUOTA || prop == ZFS_PROP_RESERVATION || prop == ZFS_PROP_REFQUOTA || - prop == ZFS_PROP_REFRESERVATION) + prop == ZFS_PROP_REFRESERVATION) { (void) fprintf(stderr, gettext("use 'zfs set " "%s=none' to clear\n"), propname); + (void) fprintf(stderr, gettext("use 'zfs " + "inherit -S %s' to revert to received " + "value\n"), propname); + } return (1); } if (received && (prop == ZFS_PROP_VOLSIZE || From owner-svn-src-all@freebsd.org Mon Sep 28 19:19:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0317A0A39E; Mon, 28 Sep 2015 19:19:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1688134A; Mon, 28 Sep 2015 19:19:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SJJrOP038606; Mon, 28 Sep 2015 19:19:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SJJrQM038605; Mon, 28 Sep 2015 19:19:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281919.t8SJJrQM038605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 19:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288347 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 19:19:53 -0000 Author: gjb Date: Mon Sep 28 19:19:53 2015 New Revision: 288347 URL: https://svnweb.freebsd.org/changeset/base/288347 Log: Append VMFORMATS and VMSIZE to RELEASE_RMAKEFLAGS only if WITH_VMIMAGES is set. MFC after: 3 days X-MFC-With: r288341, r288345 Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 18:58:27 2015 (r288346) +++ head/release/release.sh Mon Sep 28 19:19:53 2015 (r288347) @@ -320,9 +320,9 @@ chroot_build_release() { VMSIZE="$(eval chroot ${CHROOTDIR} \ make -C /usr/src/release -V VMSIZE)" fi + RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} \ + VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE}" fi - RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} VMFORMATS=\"${VMFORMATS}\" \ - VMSIZE=${VMSIZE}" eval chroot ${CHROOTDIR} make -C /usr/src/release \ ${RELEASE_RMAKEFLAGS} release eval chroot ${CHROOTDIR} make -C /usr/src/release \ From owner-svn-src-all@freebsd.org Mon Sep 28 20:54:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B9D0A0A267; Mon, 28 Sep 2015 20:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BCFE1577; Mon, 28 Sep 2015 20:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SKsK2W080356; Mon, 28 Sep 2015 20:54:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SKsIrA080346; Mon, 28 Sep 2015 20:54:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509282054.t8SKsIrA080346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 28 Sep 2015 20:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288348 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 28 Sep 2015 20:54:20 -0000 Author: mav Date: Mon Sep 28 20:54:18 2015 New Revision: 288348 URL: https://svnweb.freebsd.org/changeset/base/288348 Log: Umplement media load/eject support for removable devices. In case of block backend eject really closes the backing store, while load tries to open it back. Failed store open is reported as no media. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl.c Mon Sep 28 20:54:18 2015 (r288348) @@ -3716,46 +3716,6 @@ ctl_zero_io(union ctl_io *io) io->io_hdr.pool = pool_ref; } -/* - * This routine is currently used for internal copies of ctl_ios that need - * to persist for some reason after we've already returned status to the - * FETD. (Thus the flag set.) - * - * XXX XXX - * Note that this makes a blind copy of all fields in the ctl_io, except - * for the pool reference. This includes any memory that has been - * allocated! That memory will no longer be valid after done has been - * called, so this would be VERY DANGEROUS for command that actually does - * any reads or writes. Right now (11/7/2005), this is only used for immediate - * start and stop commands, which don't transfer any data, so this is not a - * problem. If it is used for anything else, the caller would also need to - * allocate data buffer space and this routine would need to be modified to - * copy the data buffer(s) as well. - */ -void -ctl_copy_io(union ctl_io *src, union ctl_io *dest) -{ - void *pool_ref; - - if ((src == NULL) - || (dest == NULL)) - return; - - /* - * May need to preserve linked list pointers at some point too. - */ - pool_ref = dest->io_hdr.pool; - - memcpy(dest, src, MIN(sizeof(*src), sizeof(*dest))); - - dest->io_hdr.pool = pool_ref; - /* - * We need to know that this is an internal copy, and doesn't need - * to get passed back to the FETD that allocated it. - */ - dest->io_hdr.flags |= CTL_FLAG_INT_COPY; -} - int ctl_expand_number(const char *buf, uint64_t *num) { @@ -4449,15 +4409,13 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; atomic_add_int(&be_lun->be->num_luns, 1); - if (be_lun->flags & CTL_LUN_FLAG_OFFLINE) - lun->flags |= CTL_LUN_OFFLINE; - - if (be_lun->flags & CTL_LUN_FLAG_POWERED_OFF) + if (be_lun->flags & CTL_LUN_FLAG_EJECTED) + lun->flags |= CTL_LUN_EJECTED; + if (be_lun->flags & CTL_LUN_FLAG_NO_MEDIA) + lun->flags |= CTL_LUN_NO_MEDIA; + if (be_lun->flags & CTL_LUN_FLAG_STOPPED) lun->flags |= CTL_LUN_STOPPED; - if (be_lun->flags & CTL_LUN_FLAG_INOPERABLE) - lun->flags |= CTL_LUN_INOPERABLE; - if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; @@ -4717,23 +4675,51 @@ ctl_stop_lun(struct ctl_be_lun *be_lun) } int -ctl_lun_offline(struct ctl_be_lun *be_lun) +ctl_lun_no_media(struct ctl_be_lun *be_lun) +{ + struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; + + mtx_lock(&lun->lun_lock); + lun->flags |= CTL_LUN_NO_MEDIA; + mtx_unlock(&lun->lun_lock); + return (0); +} + +int +ctl_lun_has_media(struct ctl_be_lun *be_lun) { struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; + union ctl_ha_msg msg; mtx_lock(&lun->lun_lock); - lun->flags |= CTL_LUN_OFFLINE; + lun->flags &= ~(CTL_LUN_NO_MEDIA | CTL_LUN_EJECTED); + if (lun->flags & CTL_LUN_REMOVABLE) + ctl_est_ua_all(lun, -1, CTL_UA_MEDIUM_CHANGE); mtx_unlock(&lun->lun_lock); + if ((lun->flags & CTL_LUN_REMOVABLE) && + lun->ctl_softc->ha_mode == CTL_HA_MODE_XFER) { + bzero(&msg.ua, sizeof(msg.ua)); + msg.hdr.msg_type = CTL_MSG_UA; + msg.hdr.nexus.initid = -1; + msg.hdr.nexus.targ_port = -1; + msg.hdr.nexus.targ_lun = lun->lun; + msg.hdr.nexus.targ_mapped_lun = lun->lun; + msg.ua.ua_all = 1; + msg.ua.ua_set = 1; + msg.ua.ua_type = CTL_UA_MEDIUM_CHANGE; + ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg.ua), + M_WAITOK); + } return (0); } int -ctl_lun_online(struct ctl_be_lun *be_lun) +ctl_lun_ejected(struct ctl_be_lun *be_lun) { struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_OFFLINE; + lun->flags |= CTL_LUN_EJECTED; mtx_unlock(&lun->lun_lock); return (0); } @@ -4803,28 +4789,6 @@ ctl_invalidate_lun(struct ctl_be_lun *be return (0); } -int -ctl_lun_inoperable(struct ctl_be_lun *be_lun) -{ - struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; - - mtx_lock(&lun->lun_lock); - lun->flags |= CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - return (0); -} - -int -ctl_lun_operable(struct ctl_be_lun *be_lun) -{ - struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; - - mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - return (0); -} - void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) { @@ -4832,7 +4796,7 @@ ctl_lun_capacity_changed(struct ctl_be_l union ctl_ha_msg msg; mtx_lock(&lun->lun_lock); - ctl_est_ua_all(lun, -1, CTL_UA_CAPACITY_CHANGED); + ctl_est_ua_all(lun, -1, CTL_UA_CAPACITY_CHANGE); mtx_unlock(&lun->lun_lock); if (lun->ctl_softc->ha_mode == CTL_HA_MODE_XFER) { /* Send msg to other side. */ @@ -4844,7 +4808,7 @@ ctl_lun_capacity_changed(struct ctl_be_l msg.hdr.nexus.targ_mapped_lun = lun->lun; msg.ua.ua_all = 1; msg.ua.ua_set = 1; - msg.ua.ua_type = CTL_UA_CAPACITY_CHANGED; + msg.ua.ua_type = CTL_UA_CAPACITY_CHANGE; ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg.ua), M_WAITOK); } @@ -5102,34 +5066,6 @@ ctl_start_stop(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; - /* - * XXX KDM - * We don't support the immediate bit on a stop unit. In order to - * do that, we would need to code up a way to know that a stop is - * pending, and hold off any new commands until it completes, one - * way or another. Then we could accept or reject those commands - * depending on its status. We would almost need to do the reverse - * of what we do below for an immediate start -- return the copy of - * the ctl_io to the FETD with status to send to the host (and to - * free the copy!) and then free the original I/O once the stop - * actually completes. That way, the OOA queue mechanism can work - * to block commands that shouldn't proceed. Another alternative - * would be to put the copy in the queue in place of the original, - * and return the original back to the caller. That could be - * slightly safer.. - */ - if ((cdb->byte2 & SSS_IMMED) - && ((cdb->how & SSS_START) == 0)) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if ((lun->flags & CTL_LUN_PR_RESERVED) && ((cdb->how & SSS_START)==0)) { uint32_t residx; @@ -5156,28 +5092,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - /* - * In the non-immediate case, we send the request to - * the backend and return status to the user when - * it is done. - * - * In the immediate case, we allocate a new ctl_io - * to hold a copy of the request, and send that to - * the backend. We then set good status on the - * user's request and return it immediately. - */ - if (cdb->byte2 & SSS_IMMED) { - union ctl_io *new_io; - - new_io = ctl_alloc_io(ctsio->io_hdr.pool); - ctl_copy_io((union ctl_io *)ctsio, new_io); - retval = lun->backend->config_write(new_io); - ctl_set_success(ctsio); - ctl_done((union ctl_io *)ctsio); - } else { - retval = lun->backend->config_write( - (union ctl_io *)ctsio); - } + retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); } @@ -5346,17 +5261,6 @@ ctl_format(struct ctl_scsiio *ctsio) } } - /* - * The format command will clear out the "Medium format corrupted" - * status if set by the configuration code. That status is really - * just a way to notify the host that we have lost the media, and - * get them to issue a command that will basically make them think - * they're blowing away the media. - */ - mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - ctl_set_success(ctsio); bailout: @@ -10311,7 +10215,7 @@ ctl_get_config(struct ctl_scsiio *ctsio) ctsio->kern_rel_offset = 0; hdr = (struct scsi_get_config_header *)ctsio->kern_data_ptr; - if (lun->flags & CTL_LUN_OFFLINE) + if (lun->flags & CTL_LUN_NO_MEDIA) scsi_ulto2b(0x0000, hdr->current_profile); else scsi_ulto2b(0x0010, hdr->current_profile); @@ -10370,13 +10274,13 @@ f3: /* Removable Medium */ feature = (struct scsi_get_config_feature *) &feature->feature_data[feature->add_length]; - if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_OFFLINE)) + if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_NO_MEDIA)) goto done; f10: /* Random Read */ scsi_ulto2b(0x0010, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 8; scsi_ulto4b(lun->be_lun->blocksize, &feature->feature_data[0]); @@ -10388,7 +10292,7 @@ f10: /* Random Read */ f1d: /* Multi-Read */ scsi_ulto2b(0x001D, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 0; feature = (struct scsi_get_config_feature *) @@ -10397,7 +10301,7 @@ f1d: /* Multi-Read */ f1e: /* CD Read */ scsi_ulto2b(0x001E, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 4; feature->feature_data[0] = 0x00; @@ -10407,7 +10311,7 @@ f1e: /* CD Read */ f1f: /* DVD Read */ scsi_ulto2b(0x001F, feature->feature_code); feature->flags = 0x08; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 4; feature->feature_data[0] = 0x01; @@ -11261,25 +11165,18 @@ ctl_scsiio_lun_check(struct ctl_lun *lun } } - if ((lun->flags & CTL_LUN_OFFLINE) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_STANDBY) == 0)) { - ctl_set_lun_not_ready(ctsio); - retval = 1; - goto bailout; - } - - if ((lun->flags & CTL_LUN_STOPPED) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_STOPPED) == 0)) { - /* "Logical unit not ready, initializing cmd. required" */ - ctl_set_lun_stopped(ctsio); - retval = 1; - goto bailout; - } - - if ((lun->flags & CTL_LUN_INOPERABLE) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_INOPERABLE) == 0)) { - /* "Medium format corrupted" */ - ctl_set_medium_format_corrupted(ctsio); + if ((entry->flags & CTL_CMD_FLAG_OK_ON_NO_MEDIA) == 0) { + if (lun->flags & CTL_LUN_EJECTED) + ctl_set_lun_ejected(ctsio); + else if (lun->flags & CTL_LUN_NO_MEDIA) { + if (lun->flags & CTL_LUN_REMOVABLE) + ctl_set_lun_no_media(ctsio); + else + ctl_set_lun_int_reqd(ctsio); + } else if (lun->flags & CTL_LUN_STOPPED) + ctl_set_lun_stopped(ctsio); + else + goto bailout; retval = 1; goto bailout; } @@ -13484,7 +13381,7 @@ ctl_thresh_thread(void *arg) mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { if ((lun->flags & CTL_LUN_DISABLED) || - (lun->flags & CTL_LUN_OFFLINE) || + (lun->flags & CTL_LUN_NO_MEDIA) || lun->backend->lun_attr == NULL) continue; if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl.h Mon Sep 28 20:54:18 2015 (r288348) @@ -123,10 +123,11 @@ typedef enum { CTL_UA_INQ_CHANGE = 0x0100, CTL_UA_RES_PREEMPT = 0x0400, CTL_UA_RES_RELEASE = 0x0800, - CTL_UA_REG_PREEMPT = 0x1000, - CTL_UA_ASYM_ACC_CHANGE = 0x2000, - CTL_UA_CAPACITY_CHANGED = 0x4000, - CTL_UA_THIN_PROV_THRES = 0x8000 + CTL_UA_REG_PREEMPT = 0x1000, + CTL_UA_ASYM_ACC_CHANGE = 0x2000, + CTL_UA_CAPACITY_CHANGE = 0x4000, + CTL_UA_THIN_PROV_THRES = 0x8000, + CTL_UA_MEDIUM_CHANGE = 0x10000 } ctl_ua_type; #ifdef _KERNEL Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend.h Mon Sep 28 20:54:18 2015 (r288348) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,14 +50,11 @@ * particular LUN ID in the req_lun_id field. If we cannot allocate that * LUN ID, the ctl_add_lun() call will fail. * - * The POWERED_OFF flag tells us that the LUN should default to the powered + * 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 INOPERABLE flag tells us that this LUN is not operable for whatever - * reason. This means that user data may have been (or has been?) lost. - * We will return 0x31,0x00 ("Medium format corrupted") until the host - * issues a FORMAT UNIT command to clear the error. + * 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 @@ -72,20 +70,22 @@ * * 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_POWERED_OFF = 0x02, - CTL_LUN_FLAG_INOPERABLE = 0x04, + 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_OFFLINE = 0x100, + CTL_LUN_FLAG_EJECTED = 0x100, CTL_LUN_FLAG_READONLY = 0x200 } ctl_backend_lun_flags; @@ -289,23 +289,11 @@ int ctl_start_lun(struct ctl_be_lun *be_ int ctl_stop_lun(struct ctl_be_lun *be_lun); /* - * If a LUN is inoperable, call ctl_lun_inoperable(). Generally the LUN - * will become operable once again when the user issues the SCSI FORMAT UNIT - * command. (CTL will automatically clear the inoperable flag.) If we - * need to re-enable the LUN, we can call ctl_lun_operable() to enable it - * without a SCSI command. - */ -int ctl_lun_inoperable(struct ctl_be_lun *be_lun); -int ctl_lun_operable(struct ctl_be_lun *be_lun); - -/* - * To take a LUN offline, call ctl_lun_offline(). Generally the LUN will - * be online again once the user sends a SCSI START STOP UNIT command with - * the start and on/offline bits set. The backend can bring the LUN back - * online via the ctl_lun_online() function, if necessary. + * Methods to notify about media and tray status changes. */ -int ctl_lun_offline(struct ctl_be_lun *be_lun); -int ctl_lun_online(struct ctl_be_lun *be_lun); +int ctl_lun_no_media(struct ctl_be_lun *be_lun); +int ctl_lun_has_media(struct ctl_be_lun *be_lun); +int ctl_lun_ejected(struct ctl_be_lun *be_lun); /* * Called on LUN HA role change. @@ -314,7 +302,7 @@ int ctl_lun_primary(struct ctl_be_lun *b int ctl_lun_secondary(struct ctl_be_lun *be_lun); /* - * Let the backend notify the initiator about changed capacity. + * Let the backend notify the initiators about changes. */ void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun); Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Sep 28 20:54:18 2015 (r288348) @@ -2,6 +2,7 @@ * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2009-2011 Spectra Logic Corporation * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -256,8 +257,7 @@ static int ctl_be_block_open_file(struct static int ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req); static int ctl_be_block_close(struct ctl_be_block_lun *be_lun); -static int ctl_be_block_open(struct ctl_be_block_softc *softc, - struct ctl_be_block_lun *be_lun, +static int ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req); static int ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req); @@ -1660,7 +1660,7 @@ ctl_be_block_worker(void *context, int p DPRINTF("entered\n"); /* * Fetch and process I/Os from all queues. If we detect LUN - * CTL_LUN_FLAG_OFFLINE status here -- it is result of a race, + * CTL_LUN_FLAG_NO_MEDIA status here -- it is result of a race, * so make response maximally opaque to not confuse initiator. */ for (;;) { @@ -1672,7 +1672,7 @@ ctl_be_block_worker(void *context, int p ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_complete_beio(beio); return; @@ -1686,7 +1686,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_write_done(io); return; @@ -1700,7 +1700,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_read_done(io); return; @@ -1714,7 +1714,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_data_submit_done(io); return; @@ -2134,8 +2134,7 @@ ctl_be_block_close(struct ctl_be_block_l } static int -ctl_be_block_open(struct ctl_be_block_softc *softc, - struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) +ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) { struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct nameidata nd; @@ -2295,7 +2294,7 @@ ctl_be_block_create(struct ctl_be_block_ if ((cbe_lun->flags & CTL_LUN_FLAG_PRIMARY) || control_softc->ha_mode == CTL_HA_MODE_SER_ONLY) { - retval = ctl_be_block_open(softc, be_lun, req); + retval = ctl_be_block_open(be_lun, req); if (retval != 0) { retval = 0; req->status = CTL_LUN_WARNING; @@ -2325,7 +2324,7 @@ ctl_be_block_create(struct ctl_be_block_ } if (be_lun->vn == NULL) - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; /* Tell the user the blocksize we ended up using */ params->lun_size_bytes = be_lun->size_bytes; params->blocksize_bytes = cbe_lun->blocksize; @@ -2512,8 +2511,8 @@ ctl_be_block_rm(struct ctl_be_block_soft } if (be_lun->vn != NULL) { - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; - ctl_lun_offline(cbe_lun); + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); taskqueue_drain_all(be_lun->io_taskqueue); ctl_be_block_close(be_lun); } @@ -2621,22 +2620,27 @@ ctl_be_block_modify(struct ctl_be_block_ if ((cbe_lun->flags & CTL_LUN_FLAG_PRIMARY) || control_softc->ha_mode == CTL_HA_MODE_SER_ONLY) { if (be_lun->vn == NULL) - error = ctl_be_block_open(softc, be_lun, req); + error = ctl_be_block_open(be_lun, req); else if (vn_isdisk(be_lun->vn, &error)) error = ctl_be_block_open_dev(be_lun, req); else if (be_lun->vn->v_type == VREG) error = ctl_be_block_open_file(be_lun, req); else error = EINVAL; - if ((cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) && + if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) && be_lun->vn != NULL) { - cbe_lun->flags &= ~CTL_LUN_FLAG_OFFLINE; - ctl_lun_online(cbe_lun); + cbe_lun->flags &= ~CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_has_media(cbe_lun); + } else if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) == 0 && + be_lun->vn == NULL) { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); } + cbe_lun->flags &= ~CTL_LUN_FLAG_EJECTED; } else { if (be_lun->vn != NULL) { - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; - ctl_lun_offline(cbe_lun); + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); taskqueue_drain_all(be_lun->io_taskqueue); error = ctl_be_block_close(be_lun); } else @@ -2747,27 +2751,34 @@ ctl_be_block_config_write(union ctl_io * break; case START_STOP_UNIT: { struct scsi_start_stop_unit *cdb; + struct ctl_lun_req req; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; - - if (cdb->how & SSS_START) - retval = ctl_start_lun(cbe_lun); - else - retval = ctl_stop_lun(cbe_lun); - - /* - * In general, the above routines should not fail. They - * just set state for the LUN. So we've got something - * pretty wrong here if we can't start or stop the LUN. - */ - if (retval != 0) { - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ 0xf051); - retval = CTL_RETVAL_COMPLETE; + if (cdb->how & SSS_START) { + if ((cdb->how & SSS_LOEJ) && be_lun->vn == NULL) { + retval = ctl_be_block_open(be_lun, &req); + cbe_lun->flags &= ~CTL_LUN_FLAG_EJECTED; + if (retval == 0) { + cbe_lun->flags &= ~CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_has_media(cbe_lun); + } else { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); + } + } + ctl_start_lun(cbe_lun); } else { - ctl_set_success(&io->scsiio); + ctl_stop_lun(cbe_lun); + if (cdb->how & SSS_LOEJ) { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + cbe_lun->flags |= CTL_LUN_FLAG_EJECTED; + ctl_lun_ejected(cbe_lun); + if (be_lun->vn != NULL) + ctl_be_block_close(be_lun); + } } + + ctl_set_success(&io->scsiio); ctl_config_write_done(io); break; } Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Sep 28 20:54:18 2015 (r288348) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003, 2008 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -848,8 +849,11 @@ ctl_backend_ramdisk_lun_config_status(vo static int ctl_backend_ramdisk_config_write(union ctl_io *io) { + struct ctl_be_lun *cbe_lun; int retval; + cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ + CTL_PRIV_BACKEND_LUN].ptr; retval = 0; switch (io->scsiio.cdb[0]) { case SYNCHRONIZE_CACHE: @@ -874,31 +878,18 @@ ctl_backend_ramdisk_config_write(union c break; case START_STOP_UNIT: { struct scsi_start_stop_unit *cdb; - struct ctl_be_lun *cbe_lun; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; - - cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ - CTL_PRIV_BACKEND_LUN].ptr; - - if (cdb->how & SSS_START) - retval = ctl_start_lun(cbe_lun); - else - retval = ctl_stop_lun(cbe_lun); - - /* - * In general, the above routines should not fail. They - * just set state for the LUN. So we've got something - * pretty wrong here if we can't start or stop the LUN. - */ - if (retval != 0) { - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ 0xf051); - retval = CTL_RETVAL_COMPLETE; + if (cdb->how & SSS_START) { + if (cdb->how & SSS_LOEJ) + ctl_lun_has_media(cbe_lun); + ctl_start_lun(cbe_lun); } else { - ctl_set_success(&io->scsiio); + 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; } Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_cmd_table.c Mon Sep 28 20:54:18 2015 (r288348) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2009 Silicon Graphics International Corp. + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,8 +68,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 READ KEYS */ {ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -78,8 +78,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 01 READ RESERVATION */ {ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -89,8 +88,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 02 REPORT CAPABILITIES */ {ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -100,8 +98,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 READ FULL STATUS */ {ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -117,8 +114,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 REGISTER */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -128,8 +124,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 01 RESERVE */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -139,8 +134,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 02 RELEASE */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -150,8 +144,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 CLEAR */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -161,8 +154,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 PREEMPT */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -172,8 +164,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 05 PREEMPT AND ABORT */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -183,8 +174,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 06 REGISTER AND IGNORE EXISTING KEY */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -202,12 +192,14 @@ const struct ctl_cmd_entry ctl_cmd_table { /* 00 EXTENDED COPY (LID1) */ {ctl_extended_copy_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 01 EXTENDED COPY (LID4) */ {ctl_extended_copy_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -301,6 +293,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 1C COPY OPERATION ABORT */ {ctl_copy_operation_abort, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, @@ -312,6 +305,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 RECEIVE COPY STATUS (LID1) */ {ctl_receive_copy_status_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -326,8 +320,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 RECEIVE COPY OPERATING PARAMETERS */ {ctl_receive_copy_operating_parameters, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -337,6 +330,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 RECEIVE COPY FAILURE DETAILS (LID1) */ {ctl_receive_copy_failure_details, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -345,6 +339,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 05 RECEIVE COPY STATUS (LID4) */ {ctl_receive_copy_status_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -356,6 +351,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 07 RECEIVE ROD TOKEN INFORMATION */ {ctl_receive_rod_token_information, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -364,6 +360,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 08 REPORT ALL ROD TOKENS */ {ctl_report_all_rod_tokens, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -423,8 +420,6 @@ const struct ctl_cmd_entry ctl_cmd_table /* 10 READ CAPACITY(16) */ {ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_READCAP, @@ -479,8 +474,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0A REPORT TARGET PORT GROUPS */ {ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -493,8 +487,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0C REPORT SUPPORTED_OPCODES */ {ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -504,8 +497,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0D REPORT SUPPORTED_TASK MANAGEMENT FUNCTIONS */ {ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -518,8 +510,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0F REPORT TIMESTAMP */ {ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -550,8 +541,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_NO_SENSE | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_CMD_FLAG_ALLOW_ON_PR_RESV | @@ -560,7 +550,6 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 FORMAT UNIT */ {ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_DIRECT | - CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0xff, 0, 0, 0, 0x07}}, @@ -613,8 +602,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_NO_SENSE | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -629,8 +617,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 15 MODE SELECT(6) */ {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, @@ -638,8 +625,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 16 RESERVE(6) */ {ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Sep 29 03:37:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A07FA0B363; Tue, 29 Sep 2015 03:37:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AC061A1A; Tue, 29 Sep 2015 03:37:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T3bJt6045255; Tue, 29 Sep 2015 03:37:19 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T3bIKh045252; Tue, 29 Sep 2015 03:37:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290337.t8T3bIKh045252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 03:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288349 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 03:37:19 -0000 Author: adrian Date: Tue Sep 29 03:37:17 2015 New Revision: 288349 URL: https://svnweb.freebsd.org/changeset/base/288349 Log: Remove the references to the TX IC lock - i ended up solving this using net80211 to seralise encap+xmit, so now it's a non-issue. Modified: head/sys/dev/ath/if_ath_ahb.c head/sys/dev/ath/if_ath_pci.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_ahb.c ============================================================================== --- head/sys/dev/ath/if_ath_ahb.c Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_ath_ahb.c Tue Sep 29 03:37:17 2015 (r288349) @@ -261,7 +261,6 @@ ath_ahb_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); - ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); error = ath_attach(device_id, sc); @@ -271,7 +270,6 @@ ath_ahb_attach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); bus_dma_tag_destroy(sc->sc_dmat); @@ -315,7 +313,6 @@ ath_ahb_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_ath_pci.c Tue Sep 29 03:37:17 2015 (r288349) @@ -283,7 +283,6 @@ ath_pci_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); - ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); /* @@ -371,7 +370,6 @@ bad1: ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); @@ -408,7 +406,6 @@ ath_pci_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_athvar.h Tue Sep 29 03:37:17 2015 (r288349) @@ -941,26 +941,6 @@ struct ath_softc { mtx_trylock(&(_sc)->sc_tx_mtx)) /* - * The IC TX lock is non-reentrant and serialises packet queuing from - * the upper layers. - */ -#define ATH_TX_IC_LOCK_INIT(_sc) do {\ - snprintf((_sc)->sc_tx_ic_mtx_name, \ - sizeof((_sc)->sc_tx_ic_mtx_name), \ - "%s IC TX lock", \ - device_get_nameunit((_sc)->sc_dev)); \ - mtx_init(&(_sc)->sc_tx_ic_mtx, (_sc)->sc_tx_ic_mtx_name, \ - NULL, MTX_DEF); \ - } while (0) -#define ATH_TX_IC_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_LOCK(_sc) mtx_lock(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ - MA_OWNED) -#define ATH_TX_IC_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ - MA_NOTOWNED) - -/* * The PCU lock is non-recursive and should be treated as a spinlock. * Although currently the interrupt code is run in netisr context and * doesn't require this, this may change in the future. From owner-svn-src-all@freebsd.org Tue Sep 29 03:40:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19DB2A0B633; Tue, 29 Sep 2015 03:40:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F22D91E99; Tue, 29 Sep 2015 03:40:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T3eMpu045853; Tue, 29 Sep 2015 03:40:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T3eMIi045851; Tue, 29 Sep 2015 03:40:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290340.t8T3eMIi045851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 03:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288350 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 03:40:23 -0000 Author: adrian Date: Tue Sep 29 03:40:21 2015 New Revision: 288350 URL: https://svnweb.freebsd.org/changeset/base/288350 Log: Defer calling into the driver to update the QOS (WME) configuration. This gets called from the driver RX path which leads to driver re-entry. Modified: head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Tue Sep 29 03:37:17 2015 (r288349) +++ head/sys/net80211/ieee80211_proto.c Tue Sep 29 03:40:21 2015 (r288350) @@ -107,6 +107,7 @@ static void update_mcast(void *, int); static void update_promisc(void *, int); static void update_channel(void *, int); static void update_chw(void *, int); +static void update_wme(void *, int); static void ieee80211_newstate_cb(void *, int); static int @@ -144,6 +145,7 @@ ieee80211_proto_attach(struct ieee80211c TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic); TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); + TASK_INIT(&ic->ic_wme_task, 0, update_wme, ic); ic->ic_wme.wme_hipri_switch_hysteresis = AGGRESSIVE_MODE_SWITCH_HYSTERESIS; @@ -1133,7 +1135,8 @@ ieee80211_wme_updateparams_locked(struct ieee80211_beacon_notify(vap, IEEE80211_BEACON_WME); } - wme->wme_update(ic); + /* schedule the deferred WME update */ + ieee80211_runtask(ic, &ic->ic_wme_task); IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, "%s: WME params updated, cap_info 0x%x\n", __func__, @@ -1198,6 +1201,17 @@ update_chw(void *arg, int npending) ic->ic_update_chw(ic); } +static void +update_wme(void *arg, int npending) +{ + struct ieee80211com *ic = arg; + + /* + * XXX should we defer the WME configuration update until now? + */ + ic->ic_wme.wme_update(ic); +} + /* * Block until the parent is in a known state. This is * used after any operations that dispatch a task (e.g. @@ -1213,6 +1227,7 @@ ieee80211_waitfor_parent(struct ieee8021 ieee80211_draintask(ic, &ic->ic_chan_task); ieee80211_draintask(ic, &ic->ic_bmiss_task); ieee80211_draintask(ic, &ic->ic_chw_task); + ieee80211_draintask(ic, &ic->ic_wme_task); taskqueue_unblock(ic->ic_tq); } Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Sep 29 03:37:17 2015 (r288349) +++ head/sys/net80211/ieee80211_var.h Tue Sep 29 03:40:21 2015 (r288350) @@ -133,6 +133,7 @@ struct ieee80211com { struct task ic_chan_task; /* deferred channel change */ struct task ic_bmiss_task; /* deferred beacon miss hndlr */ struct task ic_chw_task; /* deferred HT CHW update */ + struct task ic_wme_task; /* deferred WME update */ counter_u64_t ic_ierrors; /* input errors */ counter_u64_t ic_oerrors; /* output errors */ From owner-svn-src-all@freebsd.org Tue Sep 29 04:47:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA555A0A23C; Tue, 29 Sep 2015 04:47:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB3981CDD; Tue, 29 Sep 2015 04:47:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T4lWfK074245; Tue, 29 Sep 2015 04:47:32 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T4lWjl074244; Tue, 29 Sep 2015 04:47:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509290447.t8T4lWjl074244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 04:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288351 - head/lib/libc/gen 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 04:47:32 -0000 Author: delphij Date: Tue Sep 29 04:47:31 2015 New Revision: 288351 URL: https://svnweb.freebsd.org/changeset/base/288351 Log: Use calloc() instead of malloc + memset. MFC after: 2 weeks Modified: head/lib/libc/gen/fts-compat.c Modified: head/lib/libc/gen/fts-compat.c ============================================================================== --- head/lib/libc/gen/fts-compat.c Tue Sep 29 03:40:21 2015 (r288350) +++ head/lib/libc/gen/fts-compat.c Tue Sep 29 04:47:31 2015 (r288351) @@ -137,9 +137,8 @@ __fts_open_44bsd(char * const *argv, int } /* Allocate/initialize the stream. */ - if ((priv = malloc(sizeof(*priv))) == NULL) + if ((priv = calloc(1, sizeof(*priv))) == NULL) return (NULL); - memset(priv, 0, sizeof(*priv)); sp = &priv->ftsp_fts; sp->fts_compar = compar; sp->fts_options = options; From owner-svn-src-all@freebsd.org Tue Sep 29 04:56:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F95AA0A815; Tue, 29 Sep 2015 04:56:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 805DE1136; Tue, 29 Sep 2015 04:56:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T4uSLk078264; Tue, 29 Sep 2015 04:56:28 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T4uShO078262; Tue, 29 Sep 2015 04:56:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290456.t8T4uShO078262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 04:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288352 - in head/sys/modules/usb: rsu urtwn 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 04:56:28 -0000 Author: adrian Date: Tue Sep 29 04:56:27 2015 New Revision: 288352 URL: https://svnweb.freebsd.org/changeset/base/288352 Log: Add opt_wlan.h as requirements for the two drivers I'm currently working on. Modified: head/sys/modules/usb/rsu/Makefile head/sys/modules/usb/urtwn/Makefile Modified: head/sys/modules/usb/rsu/Makefile ============================================================================== --- head/sys/modules/usb/rsu/Makefile Tue Sep 29 04:47:31 2015 (r288351) +++ head/sys/modules/usb/rsu/Makefile Tue Sep 29 04:56:27 2015 (r288352) @@ -5,6 +5,6 @@ KMOD = if_rsu SRCS = if_rsu.c if_rsureg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include Modified: head/sys/modules/usb/urtwn/Makefile ============================================================================== --- head/sys/modules/usb/urtwn/Makefile Tue Sep 29 04:47:31 2015 (r288351) +++ head/sys/modules/usb/urtwn/Makefile Tue Sep 29 04:56:27 2015 (r288352) @@ -5,6 +5,6 @@ KMOD = if_urtwn SRCS = if_urtwn.c if_urtwnreg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include From owner-svn-src-all@freebsd.org Tue Sep 29 05:03:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70AE3A0AE0B; Tue, 29 Sep 2015 05:03:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E9871637; Tue, 29 Sep 2015 05:03:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T53PJr082231; Tue, 29 Sep 2015 05:03:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T53P6w082230; Tue, 29 Sep 2015 05:03:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290503.t8T53P6w082230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 05:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288353 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 05:03:25 -0000 Author: adrian Date: Tue Sep 29 05:03:24 2015 New Revision: 288353 URL: https://svnweb.freebsd.org/changeset/base/288353 Log: urtwn driver fixes - missing include, free node references, shut down xfers first * include opt_wlan.h like a good little wlan driver; * add a function to free the mbufq /and/ the node references on it, or we will leak said node references; * free the mbufq upon NIC shutdown otherwise we may end up with a full list that we never begin transmit work on, and thus never drain it; * .. which frees it upon NIC detach too; * ensure urtwn_start() gets called after the completion of frame TX even if the pending queue is empty, otherwise transmit will stall. It's highly unlikely that the usb tx queue would be empty whilst the incoming send queue is full, but hey, who knows. This passes some iperf testing with and without the NIC being actively removed during said active iperf test. Tested: * urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R ; STA mode Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Tue Sep 29 04:56:27 2015 (r288352) +++ head/sys/dev/usb/wlan/if_urtwn.c Tue Sep 29 05:03:24 2015 (r288353) @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. */ +#include "opt_wlan.h" + #include #include #include @@ -169,6 +171,7 @@ static device_detach_t urtwn_detach; static usb_callback_t urtwn_bulk_tx_callback; static usb_callback_t urtwn_bulk_rx_callback; +static void urtwn_drain_mbufq(struct urtwn_softc *sc); static usb_error_t urtwn_do_request(struct urtwn_softc *, struct usb_device_request *, void *); static struct ieee80211vap *urtwn_vap_create(struct ieee80211com *, @@ -467,6 +470,20 @@ detach: return (ENXIO); /* failure */ } +static void +urtwn_drain_mbufq(struct urtwn_softc *sc) +{ + struct mbuf *m; + struct ieee80211_node *ni; + URTWN_ASSERT_LOCKED(sc); + while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + m->m_pkthdr.rcvif = NULL; + ieee80211_free_node(ni); + m_freem(m); + } +} + static int urtwn_detach(device_t self) { @@ -482,6 +499,9 @@ urtwn_detach(device_t self) callout_drain(&sc->sc_watchdog_ch); + /* stop all USB transfers */ + usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); + /* Prevent further allocations from RX/TX data lists. */ URTWN_LOCK(sc); STAILQ_INIT(&sc->sc_tx_active); @@ -502,10 +522,7 @@ urtwn_detach(device_t self) urtwn_free_rx_list(sc); URTWN_UNLOCK(sc); - /* stop all USB transfers */ - usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); ieee80211_ifdetach(ic); - mbufq_drain(&sc->sc_snd); mtx_destroy(&sc->sc_mtx); return (0); @@ -879,13 +896,12 @@ tr_setup: data = STAILQ_FIRST(&sc->sc_tx_pending); if (data == NULL) { DPRINTF("%s: empty pending queue\n", __func__); - return; + goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending, next); STAILQ_INSERT_TAIL(&sc->sc_tx_active, data, next); usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); usbd_transfer_submit(xfer); - urtwn_start(sc); break; default: data = STAILQ_FIRST(&sc->sc_tx_active); @@ -903,6 +919,9 @@ tr_setup: } break; } +finish: + /* Kick-start more transmit */ + urtwn_start(sc); } static struct urtwn_data * @@ -1778,7 +1797,6 @@ urtwn_tx_start(struct urtwn_softc *sc, s device_printf(sc->sc_dev, "ieee80211_crypto_encap returns NULL.\n"); /* XXX we don't expect the fragmented frames */ - m_freem(m0); return (ENOBUFS); } @@ -1931,6 +1949,7 @@ urtwn_start(struct urtwn_softc *sc) if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1); STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next); + m_freem(m); ieee80211_free_node(ni); break; } @@ -3417,6 +3436,8 @@ urtwn_stop(struct urtwn_softc *sc) sc->sc_flags &= ~URTWN_RUNNING; callout_stop(&sc->sc_watchdog_ch); urtwn_abort_xfers(sc); + + urtwn_drain_mbufq(sc); } static void @@ -3455,14 +3476,15 @@ urtwn_raw_xmit(struct ieee80211_node *ni } if (urtwn_tx_start(sc, ni, m, bf) != 0) { + m_freem(m); ieee80211_free_node(ni); STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next); URTWN_UNLOCK(sc); return (EIO); } + sc->sc_txtimer = 5; URTWN_UNLOCK(sc); - sc->sc_txtimer = 5; return (0); } From owner-svn-src-all@freebsd.org Tue Sep 29 05:23:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 152C5A0BB2B; Tue, 29 Sep 2015 05:23:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4DBE1286; Tue, 29 Sep 2015 05:23:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T5NR72090550; Tue, 29 Sep 2015 05:23:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T5NRSq090546; Tue, 29 Sep 2015 05:23:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509290523.t8T5NRSq090546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 05:23: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: r288354 - stable/10/sys/cam/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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 05:23:28 -0000 Author: mav Date: Tue Sep 29 05:23:26 2015 New Revision: 288354 URL: https://svnweb.freebsd.org/changeset/base/288354 Log: MFC r287819: Make CAM log errors that make it wait. Waiting can take minutes, and it would be good for user to know what is going on. Modified: stable/10/sys/cam/scsi/scsi_all.c stable/10/sys/cam/scsi/scsi_all.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Tue Sep 29 05:03:24 2015 (r288353) +++ stable/10/sys/cam/scsi/scsi_all.c Tue Sep 29 05:23:26 2015 (r288354) @@ -1079,7 +1079,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x00, SS_RDEF, "Logical unit not ready, cause not reportable") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x01, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, + { SST(0x04, 0x01, SS_WAIT | EBUSY, "Logical unit is in process of becoming ready") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x02, SS_START | SSQ_DECREMENT_COUNT | ENXIO, @@ -1106,7 +1106,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0A, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | ENXIO, + { SST(0x04, 0x0A, SS_WAIT | ENXIO, "Logical unit not accessible, asymmetric access state transition")}, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0B, SS_FATAL | ENXIO, @@ -1121,7 +1121,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | EBUSY, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ Modified: stable/10/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.h Tue Sep 29 05:03:24 2015 (r288353) +++ stable/10/sys/cam/scsi/scsi_all.h Tue Sep 29 05:23:26 2015 (r288354) @@ -103,6 +103,9 @@ typedef enum { /* The retyable, error action, with table specified error code */ #define SS_RET SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE +/* Wait for transient error status to change */ +#define SS_WAIT SS_TUR|SSQ_MANY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE + /* Fatal error action, with table specified error code */ #define SS_FATAL SS_FAIL|SSQ_PRINT_SENSE From owner-svn-src-all@freebsd.org Tue Sep 29 05:24:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C403A0BBFC; Tue, 29 Sep 2015 05:24:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72D0513D0; Tue, 29 Sep 2015 05:24:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T5OH0k090651; Tue, 29 Sep 2015 05:24:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T5OHiH090649; Tue, 29 Sep 2015 05:24:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509290524.t8T5OHiH090649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 05:24:17 +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: r288355 - stable/9/sys/cam/scsi 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 05:24:17 -0000 Author: mav Date: Tue Sep 29 05:24:16 2015 New Revision: 288355 URL: https://svnweb.freebsd.org/changeset/base/288355 Log: MFC r287819: Make CAM log errors that make it wait. Waiting can take minutes, and it would be good for user to know what is going on. Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Tue Sep 29 05:23:26 2015 (r288354) +++ stable/9/sys/cam/scsi/scsi_all.c Tue Sep 29 05:24:16 2015 (r288355) @@ -1076,7 +1076,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x00, SS_RDEF, "Logical unit not ready, cause not reportable") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x01, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, + { SST(0x04, 0x01, SS_WAIT | EBUSY, "Logical unit is in process of becoming ready") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x02, SS_START | SSQ_DECREMENT_COUNT | ENXIO, @@ -1103,7 +1103,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x0A, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | ENXIO, + { SST(0x04, 0x0A, SS_WAIT | ENXIO, "Logical unit not accessible, asymmetric access state transition")}, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0B, SS_FATAL | ENXIO, @@ -1118,7 +1118,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | EBUSY, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Tue Sep 29 05:23:26 2015 (r288354) +++ stable/9/sys/cam/scsi/scsi_all.h Tue Sep 29 05:24:16 2015 (r288355) @@ -103,6 +103,9 @@ typedef enum { /* The retyable, error action, with table specified error code */ #define SS_RET SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE +/* Wait for transient error status to change */ +#define SS_WAIT SS_TUR|SSQ_MANY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE + /* Fatal error action, with table specified error code */ #define SS_FATAL SS_FAIL|SSQ_PRINT_SENSE From owner-svn-src-all@freebsd.org Tue Sep 29 05:25:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5435A0BD0C; Tue, 29 Sep 2015 05:25:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5BA215C3; Tue, 29 Sep 2015 05:25:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T5PZ4h090771; Tue, 29 Sep 2015 05:25:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T5PZjt090770; Tue, 29 Sep 2015 05:25:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509290525.t8T5PZjt090770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 05:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288356 - stable/10/sys/dev/ahci 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 05:25:35 -0000 Author: mav Date: Tue Sep 29 05:25:34 2015 New Revision: 288356 URL: https://svnweb.freebsd.org/changeset/base/288356 Log: MFC r288111: Allow AHCI driver attach to all known chips reporting RAID class. Reported by: Michael BlackHeart Modified: stable/10/sys/dev/ahci/ahci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/10/sys/dev/ahci/ahci_pci.c Tue Sep 29 05:24:16 2015 (r288355) +++ stable/10/sys/dev/ahci/ahci_pci.c Tue Sep 29 05:25:34 2015 (r288356) @@ -326,6 +326,9 @@ ahci_probe(device_t dev) pci_get_subclass(dev) == PCIS_STORAGE_SATA && pci_get_progif(dev) == PCIP_STORAGE_SATA_AHCI_1_0) valid = 1; + else if (pci_get_class(dev) == PCIC_STORAGE && + pci_get_subclass(dev) == PCIS_STORAGE_RAID) + valid = 2; /* Is this a known AHCI chip? */ for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid && @@ -342,7 +345,7 @@ ahci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } } - if (!valid) + if (valid != 1) return (ENXIO); device_set_desc_copy(dev, "AHCI SATA controller"); return (BUS_PROBE_DEFAULT); From owner-svn-src-all@freebsd.org Tue Sep 29 06:56:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8440EA0AA26; Tue, 29 Sep 2015 06:56:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7229E10B8; Tue, 29 Sep 2015 06:56:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T6u1hh027531; Tue, 29 Sep 2015 06:56:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T6u1de027529; Tue, 29 Sep 2015 06:56:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290656.t8T6u1de027529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 06:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288357 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 06:56:01 -0000 Author: adrian Date: Tue Sep 29 06:56:00 2015 New Revision: 288357 URL: https://svnweb.freebsd.org/changeset/base/288357 Log: rsu(4): Add support for 1T2R and 2T2R NICs. This logic is mostly crimed from the reference driver and the linux r92su driver. I verified that it (a) worked on the rsu hardware I have, and (b) did traffic testing whilst watching what ath(4) sent as a hostap. It successfully sent MCS8..15 rates (which requires 2-stream reception) as well as MCS0..7 (which is 1-stream.) Tested: * RTL8712, 1T1R NIC, MCS rates 0..7. * RTL8712, 1T2R NIC, MCS rates 0..15 TODO: * Find a 2T2R NIC! Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Tue Sep 29 05:25:34 2015 (r288356) +++ head/sys/dev/usb/wlan/if_rsu.c Tue Sep 29 06:56:00 2015 (r288357) @@ -403,6 +403,7 @@ rsu_attach(device_t self) int error; uint8_t iface_index, bands; struct usb_interface *iface; + const char *rft; device_set_usb_desc(self); sc->sc_udev = uaa->device; @@ -462,8 +463,37 @@ rsu_attach(device_t self) device_printf(self, "could not read ROM\n"); goto fail_rom; } + + /* Figure out TX/RX streams */ + switch (sc->rom[84]) { + case 0x0: + sc->sc_rftype = RTL8712_RFCONFIG_1T1R; + sc->sc_nrxstream = 1; + sc->sc_ntxstream = 1; + rft = "1T1R"; + break; + case 0x1: + sc->sc_rftype = RTL8712_RFCONFIG_1T2R; + sc->sc_nrxstream = 2; + sc->sc_ntxstream = 1; + rft = "1T2R"; + break; + case 0x2: + sc->sc_rftype = RTL8712_RFCONFIG_2T2R; + sc->sc_nrxstream = 2; + sc->sc_ntxstream = 2; + rft = "2T2R"; + break; + default: + device_printf(sc->sc_dev, + "%s: unknown board type (rfconfig=0x%02x)\n", + __func__, + sc->rom[84]); + goto fail_rom; + } + IEEE80211_ADDR_COPY(ic->ic_macaddr, &sc->rom[0x12]); - device_printf(self, "MAC/BB RTL8712 cut %d\n", sc->cut); + device_printf(self, "MAC/BB RTL8712 cut %d %s\n", sc->cut, rft); ic->ic_softc = sc; ic->ic_name = device_get_nameunit(self); @@ -494,8 +524,8 @@ rsu_attach(device_t self) ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40; /* set number of spatial streams */ - ic->ic_txstream = 1; - ic->ic_rxstream = 1; + ic->ic_txstream = sc->sc_ntxstream; + ic->ic_rxstream = sc->sc_nrxstream; } /* Set supported .11b and .11g rates. */ @@ -2664,8 +2694,7 @@ rsu_load_firmware(struct rsu_softc *sc) dmem->hci_sel = R92S_HCI_SEL_USB | R92S_HCI_SEL_8172; dmem->nendpoints = sc->sc_nendpoints; dmem->chip_version = sc->cut; - /* XXX TODO: rf_config should come from ROM */ - dmem->rf_config = 0x11; /* 1T1R */ + dmem->rf_config = sc->sc_rftype; dmem->vcs_type = R92S_VCS_TYPE_AUTO; dmem->vcs_mode = R92S_VCS_MODE_RTS_CTS; dmem->turbo_mode = 0; Modified: head/sys/dev/usb/wlan/if_rsureg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rsureg.h Tue Sep 29 05:25:34 2015 (r288356) +++ head/sys/dev/usb/wlan/if_rsureg.h Tue Sep 29 06:56:00 2015 (r288357) @@ -158,6 +158,20 @@ (((var) & ~field##_M) | SM(field, val)) /* + * ROM field with RF config. + */ +enum { + RTL8712_RFCONFIG_1T = 0x10, + RTL8712_RFCONFIG_2T = 0x20, + RTL8712_RFCONFIG_1R = 0x01, + RTL8712_RFCONFIG_2R = 0x02, + RTL8712_RFCONFIG_1T1R = 0x11, + RTL8712_RFCONFIG_1T2R = 0x12, + RTL8712_RFCONFIG_TURBO = 0x92, + RTL8712_RFCONFIG_2T2R = 0x22 +}; + +/* * Firmware image header. */ struct r92s_fw_priv { @@ -173,6 +187,7 @@ struct r92s_fw_priv { uint8_t chip_version; uint16_t custid; uint8_t rf_config; +//0x11: 1T1R, 0x12: 1T2R, 0x92: 1T2R turbo, 0x22: 2T2R uint8_t nendpoints; /* QWORD1 */ uint32_t regulatory; @@ -755,6 +770,9 @@ struct rsu_softc { sc_scanning:1, sc_scan_pass:1; u_int cut; + uint8_t sc_rftype; + int8_t sc_nrxstream; + int8_t sc_ntxstream; struct rsu_host_cmd_ring cmdq; struct rsu_data sc_rx[RSU_RX_LIST_COUNT]; struct rsu_data sc_tx[RSU_TX_LIST_COUNT]; From owner-svn-src-all@freebsd.org Tue Sep 29 09:09:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5A59A0B7BB; Tue, 29 Sep 2015 09:09:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99FED117D; Tue, 29 Sep 2015 09:09:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T99cRJ081729; Tue, 29 Sep 2015 09:09:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T99bjq081726; Tue, 29 Sep 2015 09:09:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509290909.t8T99bjq081726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 09:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288358 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 09:09:38 -0000 Author: mav Date: Tue Sep 29 09:09:37 2015 New Revision: 288358 URL: https://svnweb.freebsd.org/changeset/base/288358 Log: Add CD/DVD Capabilities and Mechanical Status Page. This page is obsolete since MMC-4, but still used by some software. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_cd.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 09:09:37 2015 (r288358) @@ -354,6 +354,52 @@ const static struct ctl_logical_block_pr } }; +const static struct scsi_cddvd_capabilities_page cddvd_page_default = { + /*page_code*/SMS_CDDVD_CAPS_PAGE, + /*page_length*/sizeof(struct scsi_cddvd_capabilities_page) - 2, + /*caps1*/0x3f, + /*caps2*/0x00, + /*caps3*/0xf0, + /*caps4*/0x00, + /*caps5*/0x29, + /*caps6*/0x00, + /*obsolete*/{0, 0}, + /*nvol_levels*/{0, 0}, + /*buffer_size*/{8, 0}, + /*obsolete2*/{0, 0}, + /*reserved*/0, + /*digital*/0, + /*obsolete3*/0, + /*copy_management*/0, + /*reserved2*/0, + /*rotation_control*/0, + /*cur_write_speed*/0, + /*num_speed_descr*/0, +}; + +const static struct scsi_cddvd_capabilities_page cddvd_page_changeable = { + /*page_code*/SMS_CDDVD_CAPS_PAGE, + /*page_length*/sizeof(struct scsi_cddvd_capabilities_page) - 2, + /*caps1*/0, + /*caps2*/0, + /*caps3*/0, + /*caps4*/0, + /*caps5*/0, + /*caps6*/0, + /*obsolete*/{0, 0}, + /*nvol_levels*/{0, 0}, + /*buffer_size*/{0, 0}, + /*obsolete2*/{0, 0}, + /*reserved*/0, + /*digital*/0, + /*obsolete3*/0, + /*copy_management*/0, + /*reserved2*/0, + /*rotation_control*/0, + /*cur_write_speed*/0, + /*num_speed_descr*/0, +}; + SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); static int worker_threads = -1; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, @@ -4119,6 +4165,23 @@ ctl_init_page_index(struct ctl_lun *lun) }} break; } + case SMS_CDDVD_CAPS_PAGE:{ + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_DEFAULT], + &cddvd_page_default, + sizeof(cddvd_page_default)); + memcpy(&lun->mode_pages.cddvd_page[ + CTL_PAGE_CHANGEABLE], &cddvd_page_changeable, + sizeof(cddvd_page_changeable)); + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_SAVED], + &cddvd_page_default, + sizeof(cddvd_page_default)); + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_CURRENT], + &lun->mode_pages.cddvd_page[CTL_PAGE_SAVED], + sizeof(cddvd_page_default)); + page_index->page_data = + (uint8_t *)lun->mode_pages.cddvd_page; + break; + } case SMS_VENDOR_SPECIFIC_PAGE:{ switch (page_index->subpage) { case DBGCNF_SUBPAGE_CODE: { Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/ctl/ctl_private.h Tue Sep 29 09:09:37 2015 (r288358) @@ -40,6 +40,10 @@ #ifndef _CTL_PRIVATE_H_ #define _CTL_PRIVATE_H_ +#include +#include +#include + /* * SCSI vendor and product names. */ @@ -286,6 +290,9 @@ static const struct ctl_page_index page_ {SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02, sizeof(struct ctl_logical_block_provisioning_page), NULL, CTL_PAGE_FLAG_DIRECT, NULL, NULL}, + {SMS_CDDVD_CAPS_PAGE, 0, + sizeof(struct scsi_cddvd_capabilities_page), NULL, + CTL_PAGE_FLAG_CDROM, NULL, NULL}, {SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, DBGCNF_SUBPAGE_CODE, sizeof(struct copan_debugconf_subpage), NULL, CTL_PAGE_FLAG_ALL, ctl_debugconf_sp_sense_handler, ctl_debugconf_sp_select_handler}, @@ -303,6 +310,7 @@ struct ctl_mode_pages { struct scsi_control_ext_page control_ext_page[4]; struct scsi_info_exceptions_page ie_page[4]; struct ctl_logical_block_provisioning_page lbp_page[4]; + struct scsi_cddvd_capabilities_page cddvd_page[4]; struct copan_debugconf_subpage debugconf_subpage[4]; struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; Modified: head/sys/cam/scsi/scsi_cd.h ============================================================================== --- head/sys/cam/scsi/scsi_cd.h Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/scsi/scsi_cd.h Tue Sep 29 09:09:37 2015 (r288358) @@ -783,6 +783,37 @@ struct cd_audio_page #define RIGHT_PORT 1 }; +struct scsi_cddvd_capabilities_page_sd { + uint8_t reserved; + uint8_t rotation_control; + uint8_t write_speed_supported[2]; +}; + +struct scsi_cddvd_capabilities_page { + uint8_t page_code; +#define SMS_CDDVD_CAPS_PAGE 0x2a + uint8_t page_length; + uint8_t caps1; + uint8_t caps2; + uint8_t caps3; + uint8_t caps4; + uint8_t caps5; + uint8_t caps6; + uint8_t obsolete[2]; + uint8_t nvol_levels[2]; + uint8_t buffer_size[2]; + uint8_t obsolete2[2]; + uint8_t reserved; + uint8_t digital; + uint8_t obsolete3; + uint8_t copy_management; + uint8_t reserved2; + uint8_t rotation_control; + uint8_t cur_write_speed; + uint8_t num_speed_descr; + struct scsi_cddvd_capabilities_page_sd speed_descr[]; +}; + union cd_pages { struct cd_audio_page audio; From owner-svn-src-all@freebsd.org Tue Sep 29 10:44:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEAF6A0B964; Tue, 29 Sep 2015 10:44:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C32CA1DF2; Tue, 29 Sep 2015 10:44:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TAiclE022885; Tue, 29 Sep 2015 10:44:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TAicAB022884; Tue, 29 Sep 2015 10:44:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291044.t8TAicAB022884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 10:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288359 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 10:44:39 -0000 Author: mav Date: Tue Sep 29 10:44:37 2015 New Revision: 288359 URL: https://svnweb.freebsd.org/changeset/base/288359 Log: Report that we can read all flavours of DVD. Why not? Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 09:09:37 2015 (r288358) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 10:44:37 2015 (r288359) @@ -10271,6 +10271,10 @@ ctl_get_config(struct ctl_scsiio *ctsio) sizeof(struct scsi_get_config_feature) + 8 + sizeof(struct scsi_get_config_feature) + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + sizeof(struct scsi_get_config_feature) + 4; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; @@ -10284,8 +10288,16 @@ ctl_get_config(struct ctl_scsiio *ctsio) scsi_ulto2b(0x0010, hdr->current_profile); feature = (struct scsi_get_config_feature *)(hdr + 1); - if (starting > 0x001f) + if (starting > 0x003b) goto done; + if (starting > 0x003a) + goto f3b; + if (starting > 0x002b) + goto f3a; + if (starting > 0x002a) + goto f2b; + if (starting > 0x001f) + goto f2a; if (starting > 0x001e) goto f1f; if (starting > 0x001d) @@ -10382,6 +10394,48 @@ f1f: /* DVD Read */ feature = (struct scsi_get_config_feature *) &feature->feature_data[feature->add_length]; +f2a: /* DVD+RW */ + scsi_ulto2b(0x002A, feature->feature_code); + feature->flags = 0x04; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature->feature_data[1] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f2b: /* DVD+R */ + scsi_ulto2b(0x002B, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3a: /* DVD+RW Dual Layer */ + scsi_ulto2b(0x003A, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature->feature_data[1] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3b: /* DVD+R Dual Layer */ + scsi_ulto2b(0x003B, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + done: data_len = (uint8_t *)feature - (uint8_t *)hdr; if (rt == SGC_RT_SPECIFIC && data_len > 4) { From owner-svn-src-all@freebsd.org Tue Sep 29 11:48:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2DC6A0B9AC; Tue, 29 Sep 2015 11:48:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3A891504; Tue, 29 Sep 2015 11:48:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBmmlU048254; Tue, 29 Sep 2015 11:48:48 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBmmYN048253; Tue, 29 Sep 2015 11:48:48 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509291148.t8TBmmYN048253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 29 Sep 2015 11:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288360 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 11:48:48 -0000 Author: brueffer Date: Tue Sep 29 11:48:47 2015 New Revision: 288360 URL: https://svnweb.freebsd.org/changeset/base/288360 Log: The Dt argument should be in capital letters. Modified: head/share/man/man4/otusfw.4 Modified: head/share/man/man4/otusfw.4 ============================================================================== --- head/share/man/man4/otusfw.4 Tue Sep 29 10:44:37 2015 (r288359) +++ head/share/man/man4/otusfw.4 Tue Sep 29 11:48:47 2015 (r288360) @@ -14,7 +14,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd September 25, 2015 -.Dt otusfw 4 +.Dt OTUSFW 4 .Os .Sh NAME .Nm otusfw From owner-svn-src-all@freebsd.org Tue Sep 29 11:55:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2990EA0BE6B; Tue, 29 Sep 2015 11:55:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A43E1BED; Tue, 29 Sep 2015 11:55:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBtRMM052333; Tue, 29 Sep 2015 11:55:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBtRfh052331; Tue, 29 Sep 2015 11:55:27 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291155.t8TBtRfh052331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 11:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288361 - in head/sys/cddl/dev/dtrace: amd64 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 11:55:28 -0000 Author: avg Date: Tue Sep 29 11:55:26 2015 New Revision: 288361 URL: https://svnweb.freebsd.org/changeset/base/288361 Log: dtrace_getarg: remove stray return statement on amd64, powerpc MFC after: 10 days Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Sep 29 11:48:47 2015 (r288360) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Sep 29 11:55:26 2015 (r288361) @@ -448,7 +448,6 @@ load: DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); return (val); - return (0); } int Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Tue Sep 29 11:48:47 2015 (r288360) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Tue Sep 29 11:55:26 2015 (r288361) @@ -520,7 +520,6 @@ load: DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); return (val); - return (0); } int From owner-svn-src-all@freebsd.org Tue Sep 29 11:58:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C04AA0B011; Tue, 29 Sep 2015 11:58:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D1541DB2; Tue, 29 Sep 2015 11:58:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBwLgZ052485; Tue, 29 Sep 2015 11:58:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBwLd1052484; Tue, 29 Sep 2015 11:58:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291158.t8TBwLd1052484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 11:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288362 - head/sys/cddl/dev/sdt 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 11:58:22 -0000 Author: avg Date: Tue Sep 29 11:58:21 2015 New Revision: 288362 URL: https://svnweb.freebsd.org/changeset/base/288362 Log: sdt: start checking version field when parsing probe definitions This is an extra safety measure. MFC after: 21 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 (r288361) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 (r288362) @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe char *to; size_t len; + if (probe->version != (int)sizeof(*probe)) { + printf("ignoring probe %p, version %u expected %u\n", + probe, probe->version, (int)sizeof(*probe)); + return; + } + TAILQ_FOREACH(prov, &sdt_prov_list, prov_entry) if (strcmp(prov->name, probe->prov->name) == 0) break; From owner-svn-src-all@freebsd.org Tue Sep 29 12:02:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1CDCA0B7F5; Tue, 29 Sep 2015 12:02:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E020B131F; Tue, 29 Sep 2015 12:02:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TC2Nk2056327; Tue, 29 Sep 2015 12:02:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TC2NpG056326; Tue, 29 Sep 2015 12:02:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291202.t8TC2NpG056326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288363 - head/sys/cddl/dev/sdt 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 12:02:24 -0000 Author: avg Date: Tue Sep 29 12:02:23 2015 New Revision: 288363 URL: https://svnweb.freebsd.org/changeset/base/288363 Log: std: it is important that func name is never an empty string otherwise DTRACE_ANCHORED() returns false and that makes stack() insert a bogus frame at the top. For example: dtrace -n 'test:dtrace_test::sdttest { stack(); } This change is not really a solution, but just a work-around. The real solution is to record the probe's call site and to use that for resolving a function name. PR: 195222 MFC after: 22 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 (r288362) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:02:23 2015 (r288363) @@ -168,6 +168,8 @@ sdt_create_probe(struct sdt_probe *probe * in the C compiler, so we have to respect const vs non-const. */ strlcpy(func, probe->func, sizeof(func)); + if (func[0] == '\0') + strcpy(func, "none"); from = probe->name; to = name; From owner-svn-src-all@freebsd.org Tue Sep 29 12:13:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2DABA0A01D; Tue, 29 Sep 2015 12:13:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E35261AFA; Tue, 29 Sep 2015 12:13:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCDVkf060604; Tue, 29 Sep 2015 12:13:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCDV5f060603; Tue, 29 Sep 2015 12:13:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291213.t8TCDV5f060603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288364 - head/sys/cddl/dev/sdt 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 12:13:32 -0000 Author: avg Date: Tue Sep 29 12:13:31 2015 New Revision: 288364 URL: https://svnweb.freebsd.org/changeset/base/288364 Log: sdt module does not seem to actually use any symbol from opensolaris module MFC after: 11 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:02:23 2015 (r288363) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:13:31 2015 (r288364) @@ -409,4 +409,3 @@ sdt_modevent(module_t mod __unused, int DEV_MODULE(sdt, sdt_modevent, NULL); MODULE_VERSION(sdt, 1); MODULE_DEPEND(sdt, dtrace, 1, 1, 1); -MODULE_DEPEND(sdt, opensolaris, 1, 1, 1); From owner-svn-src-all@freebsd.org Tue Sep 29 12:14:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1ED5A0A0B1; Tue, 29 Sep 2015 12:14:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2F771C67; Tue, 29 Sep 2015 12:14:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCENo0060683; Tue, 29 Sep 2015 12:14:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCENt0060681; Tue, 29 Sep 2015 12:14:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291214.t8TCENt0060681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288365 - head/sys/cddl/dev/sdt 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 12:14:23 -0000 Author: avg Date: Tue Sep 29 12:14:22 2015 New Revision: 288365 URL: https://svnweb.freebsd.org/changeset/base/288365 Log: sdt: static-ize couple of variables MFC after: 11 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:13:31 2015 (r288364) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:14:22 2015 (r288365) @@ -99,8 +99,8 @@ static dtrace_pops_t sdt_pops = { static TAILQ_HEAD(, sdt_provider) sdt_prov_list; -eventhandler_tag sdt_kld_load_tag; -eventhandler_tag sdt_kld_unload_try_tag; +static eventhandler_tag sdt_kld_load_tag; +static eventhandler_tag sdt_kld_unload_try_tag; static void sdt_create_provider(struct sdt_provider *prov) From owner-svn-src-all@freebsd.org Tue Sep 29 12:15:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF778A0A156; Tue, 29 Sep 2015 12:15:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0BE91DCC; Tue, 29 Sep 2015 12:15:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCF0jL060762; Tue, 29 Sep 2015 12:15:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCF0ss060761; Tue, 29 Sep 2015 12:15:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291215.t8TCF0ss060761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288366 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 12:15:00 -0000 Author: avg Date: Tue Sep 29 12:14:59 2015 New Revision: 288366 URL: https://svnweb.freebsd.org/changeset/base/288366 Log: sdt.h: no need for argtype_list_head MFC after: 12 days Modified: head/sys/sys/sdt.h Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Sep 29 12:14:22 2015 (r288365) +++ head/sys/sys/sdt.h Tue Sep 29 12:14:59 2015 (r288366) @@ -398,7 +398,7 @@ struct sdt_probe { struct sdt_provider *prov; /* Ptr to the provider structure. */ TAILQ_ENTRY(sdt_probe) probe_entry; /* SDT probe list entry. */ - TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list; + TAILQ_HEAD(, sdt_argtype) argtype_list; const char *mod; const char *func; const char *name; From owner-svn-src-all@freebsd.org Tue Sep 29 12:53:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A807EA0C1E2; Tue, 29 Sep 2015 12:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BC5F1284; Tue, 29 Sep 2015 12:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCrgC3077073; Tue, 29 Sep 2015 12:53:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCrgwk077072; Tue, 29 Sep 2015 12:53:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291253.t8TCrgwk077072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 12:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288367 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 12:53:42 -0000 Author: mav Date: Tue Sep 29 12:53:41 2015 New Revision: 288367 URL: https://svnweb.freebsd.org/changeset/base/288367 Log: Fix arguments order. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Tue Sep 29 12:14:59 2015 (r288366) +++ head/sys/cam/ctl/ctl_tpc.c Tue Sep 29 12:53:41 2015 (r288367) @@ -837,7 +837,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -854,7 +854,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -885,7 +885,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x26, /*ascq*/ 0x0A, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -986,7 +986,7 @@ tpc_process_verify(struct tpc_list *list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } else @@ -1000,7 +1000,7 @@ tpc_process_verify(struct tpc_list *list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -1050,7 +1050,7 @@ tpc_process_register_key(struct tpc_list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } else @@ -1064,7 +1064,7 @@ tpc_process_register_key(struct tpc_list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -1398,7 +1398,7 @@ tpc_process(struct tpc_list *list) ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x26, /*ascq*/ 0x09, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); goto done; } From owner-svn-src-all@freebsd.org Tue Sep 29 13:58:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 222EEA0C16A; Tue, 29 Sep 2015 13:58:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EFEC1A74; Tue, 29 Sep 2015 13:58:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TDwRMd002221; Tue, 29 Sep 2015 13:58:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TDwRnk002220; Tue, 29 Sep 2015 13:58:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291358.t8TDwRnk002220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 13:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288368 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 13:58:28 -0000 Author: mav Date: Tue Sep 29 13:58:27 2015 New Revision: 288368 URL: https://svnweb.freebsd.org/changeset/base/288368 Log: Don't report SYNC_NV bit set in SYNCHRONIZE CACHE as error. While this bit is obsolete in SBC-3, behavior controlled by it is allowed on device discretion. Modified: head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 12:53:41 2015 (r288367) +++ head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 13:58:27 2015 (r288368) @@ -760,7 +760,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_sync_cache, CTL_SERIDX_SYNC, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_WRITE, - 10, {0x02, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, + 10, {0x06, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 36 LOCK UNLOCK CACHE(10) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -1119,7 +1119,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_sync_cache, CTL_SERIDX_SYNC, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_WRITE, - 16, {0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 16, {0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 92 LOCK UNLOCK CACHE(16) */ From owner-svn-src-all@freebsd.org Tue Sep 29 15:12:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2E51A0CD20; Tue, 29 Sep 2015 15:12:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3CC61FFA; Tue, 29 Sep 2015 15:12:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFCgTZ035897; Tue, 29 Sep 2015 15:12:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFCfb1035892; Tue, 29 Sep 2015 15:12:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291512.t8TFCfb1035892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 15:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288369 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 15:12:43 -0000 Author: mav Date: Tue Sep 29 15:12:40 2015 New Revision: 288369 URL: https://svnweb.freebsd.org/changeset/base/288369 Log: Really implement PREVENT ALLOW MEDIUM REMOVAL command. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 15:12:40 2015 (r288369) @@ -5129,30 +5129,43 @@ ctl_start_stop(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; - if ((lun->flags & CTL_LUN_PR_RESERVED) - && ((cdb->how & SSS_START)==0)) { - uint32_t residx; + if ((cdb->how & SSS_PC_MASK) == 0) { + if ((lun->flags & CTL_LUN_PR_RESERVED) && + (cdb->how & SSS_START) == 0) { + uint32_t residx; + + residx = ctl_get_initindex(&ctsio->io_hdr.nexus); + if (ctl_get_prkey(lun, residx) == 0 || + (lun->pr_res_idx != residx && lun->res_type < 4)) { - residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - if (ctl_get_prkey(lun, residx) == 0 - || (lun->pr_res_idx!=residx && lun->res_type < 4)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } - ctl_set_reservation_conflict(ctsio); + if ((cdb->how & SSS_LOEJ) && + (lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 4, + /*bit_valid*/ 1, + /*bit*/ 1); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - } - if ((cdb->how & SSS_LOEJ) && - (lun->flags & CTL_LUN_REMOVABLE) == 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 4, - /*bit_valid*/ 1, - /*bit*/ 1); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + if ((cdb->how & SSS_START) == 0 && (cdb->how & SSS_LOEJ) && + lun->prevent_count > 0) { + /* "Medium removal prevented" */ + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/(lun->flags & CTL_LUN_NO_MEDIA) ? + SSD_KEY_NOT_READY : SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x53, /*ascq*/ 0x02, SSD_ELEM_NONE); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } } retval = lun->backend->config_write((union ctl_io *)ctsio); @@ -5163,11 +5176,14 @@ int ctl_prevent_allow(struct ctl_scsiio *ctsio) { struct ctl_lun *lun; + 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) { ctl_set_invalid_opcode(ctsio); @@ -5175,6 +5191,18 @@ ctl_prevent_allow(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } + initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); + mtx_lock(&lun->lun_lock); + if ((cdb->how & PR_PREVENT) && + ctl_is_set(lun->prevent, initidx) == 0) { + ctl_set_mask(lun->prevent, initidx); + lun->prevent_count++; + } else if ((cdb->how & PR_PREVENT) == 0 && + ctl_is_set(lun->prevent, initidx)) { + ctl_clear_mask(lun->prevent, initidx); + lun->prevent_count--; + } + mtx_unlock(&lun->lun_lock); retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); } @@ -11805,9 +11833,7 @@ ctl_do_lun_reset(struct ctl_lun *lun, un #if 0 uint32_t initidx; #endif -#ifdef CTL_WITH_CA int i; -#endif mtx_lock(&lun->lun_lock); /* @@ -11842,6 +11868,9 @@ ctl_do_lun_reset(struct ctl_lun *lun, un for (i = 0; i < CTL_MAX_INITIATORS; i++) 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); mtx_unlock(&lun->lun_lock); return (0); @@ -11987,6 +12016,10 @@ 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)) { + ctl_clear_mask(lun->prevent, initidx); + lun->prevent_count--; + } ctl_est_ua(lun, initidx, CTL_UA_I_T_NEXUS_LOSS); mtx_unlock(&lun->lun_lock); } Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_backend_block.c Tue Sep 29 15:12:40 2015 (r288369) @@ -2754,6 +2754,11 @@ ctl_be_block_config_write(union ctl_io * struct ctl_lun_req req; 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) && be_lun->vn == NULL) { retval = ctl_be_block_open(be_lun, &req); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 29 15:12:40 2015 (r288369) @@ -880,6 +880,11 @@ ctl_backend_ramdisk_config_write(union c 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); Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 15:12:40 2015 (r288369) @@ -658,7 +658,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_NONE | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0x03, 0x07}}, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0x0f, 0xf7, 0x07}}, /* 1C RECEIVE DIAGNOSTIC RESULTS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_private.h Tue Sep 29 15:12:40 2015 (r288369) @@ -397,6 +397,8 @@ struct ctl_lun { int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; + int prevent_count; + uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-all@freebsd.org Tue Sep 29 15:30:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EE7EA0AB11; Tue, 29 Sep 2015 15:30:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 408A51C4D; Tue, 29 Sep 2015 15:30:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFUSOu040980; Tue, 29 Sep 2015 15:30:28 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFUSHa040979; Tue, 29 Sep 2015 15:30:28 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291530.t8TFUSHa040979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 15:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288370 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 15:30:28 -0000 Author: gjb Date: Tue Sep 29 15:30:27 2015 New Revision: 288370 URL: https://svnweb.freebsd.org/changeset/base/288370 Log: In vm_copy_base(), turn off SU+J on the resultant filesystem, leaving only SU enabled. Discussed with: kib (a few weeks ago) MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/vmimage.subr Modified: head/release/tools/vmimage.subr ============================================================================== --- head/release/tools/vmimage.subr Tue Sep 29 15:12:40 2015 (r288369) +++ head/release/tools/vmimage.subr Tue Sep 29 15:30:27 2015 (r288370) @@ -108,7 +108,7 @@ vm_copy_base() { umount_loop /dev/${mdnew} rmdir ${DESTDIR}/new - tunefs -j enable /dev/${mdnew} + tunefs -n enable /dev/${mdnew} mdconfig -d -u ${mdnew} mv ${VMBASE}.tmp ${VMBASE} } From owner-svn-src-all@freebsd.org Tue Sep 29 15:47:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB08EA0B819; Tue, 29 Sep 2015 15:47:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC0BD1814; Tue, 29 Sep 2015 15:47:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFlgMp048469; Tue, 29 Sep 2015 15:47:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFlgfr048468; Tue, 29 Sep 2015 15:47:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509291547.t8TFlgfr048468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 15:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288371 - head/gnu/usr.bin/gdb/kgdb 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 15:47:43 -0000 Author: jhb Date: Tue Sep 29 15:47:42 2015 New Revision: 288371 URL: https://svnweb.freebsd.org/changeset/base/288371 Log: When XSAVE support was added on amd64, the FPU save area was moved out of 'struct pcb' and into a variable-sized region after the structure. The kgdb code currently only reads the pcb. It does not read in the FPU save area but instead passes stack garbage as the FPU's saved context. Fixing this would mean determining the proper size of the area and fetching it. However, this state is not saved for running CPUs in stoppcbs[], so the callback would also have to know to ignore those pcbs. Instead, just remove the call since it is of limited usefulness. It results in kgdb reporting the state of the FPU/SIMD registers in userland, not their current values in the kernel. In particular, it does not report the correct state for any code in the kernel which does use the FPU and would report incorrect values in that case. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3743 Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Tue Sep 29 15:30:27 2015 (r288370) +++ head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Tue Sep 29 15:47:42 2015 (r288371) @@ -72,7 +72,6 @@ kgdb_trgt_fetch_registers(int regno __un supply_register(AMD64_R8_REGNUM + 6, (char *)&pcb.pcb_r14); supply_register(AMD64_R15_REGNUM, (char *)&pcb.pcb_r15); supply_register(AMD64_RIP_REGNUM, (char *)&pcb.pcb_rip); - amd64_supply_fxsave(current_regcache, -1, (struct fpusave *)(&pcb + 1)); } void From owner-svn-src-all@freebsd.org Tue Sep 29 15:49:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABDBEA0B923; Tue, 29 Sep 2015 15:49:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D24A1A0B; Tue, 29 Sep 2015 15:49:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFnsZr048596; Tue, 29 Sep 2015 15:49:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFns1o048595; Tue, 29 Sep 2015 15:49:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509291549.t8TFns1o048595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 15:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288372 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 15:49:54 -0000 Author: jhb Date: Tue Sep 29 15:49:53 2015 New Revision: 288372 URL: https://svnweb.freebsd.org/changeset/base/288372 Log: Use EFI page size constants instead of hardcoding 4096. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3692 Modified: head/sys/boot/efi/loader/copy.c Modified: head/sys/boot/efi/loader/copy.c ============================================================================== --- head/sys/boot/efi/loader/copy.c Tue Sep 29 15:47:42 2015 (r288371) +++ head/sys/boot/efi/loader/copy.c Tue Sep 29 15:49:53 2015 (r288372) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #define EFI_STAGING_SIZE 48 #endif -#define STAGE_PAGES ((EFI_STAGING_SIZE) * 1024 * 1024 / 4096) +#define STAGE_PAGES EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024) EFI_PHYSICAL_ADDRESS staging, staging_end; int stage_offset_set = 0; @@ -59,7 +59,7 @@ efi_copy_init(void) (unsigned long)(status & EFI_ERROR_MASK)); return (status); } - staging_end = staging + STAGE_PAGES * 4096; + staging_end = staging + STAGE_PAGES * EFI_PAGE_SIZE; #if defined(__aarch64__) || defined(__arm__) /* @@ -132,7 +132,7 @@ efi_copy_finish(void) src = (uint64_t *)staging; dst = (uint64_t *)(staging - stage_offset); - last = (uint64_t *)(staging + STAGE_PAGES * EFI_PAGE_SIZE); + last = (uint64_t *)staging_end; while (src < last) *dst++ = *src++; From owner-svn-src-all@freebsd.org Tue Sep 29 16:10:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA9C4A0C4D2; Tue, 29 Sep 2015 16:10:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B067C1391; Tue, 29 Sep 2015 16:10:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGA3lE056823; Tue, 29 Sep 2015 16:10:03 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TGA00r056809; Tue, 29 Sep 2015 16:10:00 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291610.t8TGA00r056809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 16:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288374 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 16:10:03 -0000 Author: gjb Date: Tue Sep 29 16:09:59 2015 New Revision: 288374 URL: https://svnweb.freebsd.org/changeset/base/288374 Log: In addition to the ubldr file, also copy ubldr.bin to the MS-DOS partition. This will help with transitioning to a single arm/armv6 userland build which could be used for all FreeBSD/armv6 images without UBLDR_LOADADDR being set for each board (ultimately requiring a separate buildworld for each currently). Requested by: ian MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BEAGLEBONE.conf head/release/arm/CUBOX-HUMMINGBOARD.conf head/release/arm/GUMSTIX.conf head/release/arm/PANDABOARD.conf head/release/arm/RPI-B.conf head/release/arm/RPI2.conf head/release/arm/WANDBOARD.conf Modified: head/release/arm/BEAGLEBONE.conf ============================================================================== --- head/release/arm/BEAGLEBONE.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/BEAGLEBONE.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- head/release/arm/CUBOX-HUMMINGBOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/CUBOX-HUMMINGBOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -28,6 +28,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/GUMSTIX.conf ============================================================================== --- head/release/arm/GUMSTIX.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/GUMSTIX.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/PANDABOARD.conf ============================================================================== --- head/release/arm/PANDABOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/PANDABOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/RPI-B.conf ============================================================================== --- head/release/arm/RPI-B.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/RPI-B.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -30,6 +30,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi.dtb \ ${FATMOUNT}/rpi.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: head/release/arm/RPI2.conf ============================================================================== --- head/release/arm/RPI2.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/RPI2.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -30,6 +30,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi2.dtb \ ${FATMOUNT}/rpi2.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: head/release/arm/WANDBOARD.conf ============================================================================== --- head/release/arm/WANDBOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/WANDBOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -28,6 +28,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} From owner-svn-src-all@freebsd.org Tue Sep 29 16:10:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8008A0C503; Tue, 29 Sep 2015 16:10:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5D831553; Tue, 29 Sep 2015 16:10:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGACu4056870; Tue, 29 Sep 2015 16:10:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TG9w7K056737; Tue, 29 Sep 2015 16:09:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509291609.t8TG9w7K056737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Sep 2015 16:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288373 - in head: contrib/compiler-rt/lib/builtins/arm contrib/gcc/config/arm lib/csu/arm lib/libc/arm/aeabi lib/libc/arm/gen lib/libc/arm/string lib/libc/arm/sys lib/libc/sys lib/libc... 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 16:10:12 -0000 Author: kib Date: Tue Sep 29 16:09:58 2015 New Revision: 288373 URL: https://svnweb.freebsd.org/changeset/base/288373 Log: Annotate arm userspace assembler sources stating their tolerance to the non-executable stack. Reviewed by: andrew Sponsored by: The FreeBSD Foundation Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S head/contrib/gcc/config/arm/crti.asm head/contrib/gcc/config/arm/crtn.asm head/contrib/gcc/config/arm/lib1funcs.asm head/lib/csu/arm/crti.S head/lib/csu/arm/crtn.S head/lib/libc/arm/aeabi/aeabi_asm_double.S head/lib/libc/arm/aeabi/aeabi_asm_float.S head/lib/libc/arm/aeabi/aeabi_vfp_double.S head/lib/libc/arm/aeabi/aeabi_vfp_float.S head/lib/libc/arm/gen/__aeabi_read_tp.S head/lib/libc/arm/gen/_ctx_start.S head/lib/libc/arm/gen/_setjmp.S head/lib/libc/arm/gen/alloca.S head/lib/libc/arm/gen/divsi3.S head/lib/libc/arm/gen/setjmp.S head/lib/libc/arm/gen/sigsetjmp.S head/lib/libc/arm/string/ffs.S head/lib/libc/arm/string/memcmp.S head/lib/libc/arm/string/memcpy_arm.S head/lib/libc/arm/string/memcpy_xscale.S head/lib/libc/arm/string/memmove.S head/lib/libc/arm/string/memset.S head/lib/libc/arm/string/strcmp.S head/lib/libc/arm/string/strlen.S head/lib/libc/arm/string/strncmp.S head/lib/libc/arm/sys/Ovfork.S head/lib/libc/arm/sys/brk.S head/lib/libc/arm/sys/cerror.S head/lib/libc/arm/sys/pipe.S head/lib/libc/arm/sys/ptrace.S head/lib/libc/arm/sys/sbrk.S head/lib/libc/arm/sys/shmat.S head/lib/libc/arm/sys/sigreturn.S head/lib/libc/arm/sys/syscall.S head/lib/libc/sys/Makefile.inc head/lib/libcompiler_rt/Makefile head/libexec/rtld-elf/arm/rtld_start.S Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memcmp) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp4, __aeabi_memcmp) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp8, __aeabi_memcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memcpy) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy4, __aeabi_memcpy) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy8, __aeabi_memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memmove) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove4, __aeabi_memmove) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove8, __aeabi_memmove) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S Tue Sep 29 16:09:58 2015 (r288373) @@ -32,3 +32,4 @@ END_COMPILERRT_FUNCTION(__aeabi_memclr) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr) + .section .note.GNU-stack,"",%progbits Modified: head/contrib/gcc/config/arm/crti.asm ============================================================================== --- head/contrib/gcc/config/arm/crti.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/crti.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -60,6 +60,8 @@ .file "crti.asm" + .section .note.GNU-stack,"",%progbits + .section ".init" .align 2 .global _init Modified: head/contrib/gcc/config/arm/crtn.asm ============================================================================== --- head/contrib/gcc/config/arm/crtn.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/crtn.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -68,6 +68,8 @@ .file "crtn.asm" + .section .note.GNU-stack,"",%progbits + .section ".init" ;; FUNC_END Modified: head/contrib/gcc/config/arm/lib1funcs.asm ============================================================================== --- head/contrib/gcc/config/arm/lib1funcs.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/lib1funcs.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -1305,3 +1305,5 @@ LSYM(Lchange_\register): #include "ieee754-sf.S" #include "bpabi.S" #endif /* __symbian__ */ + + .section .note.GNU-stack,"",%progbits Modified: head/lib/csu/arm/crti.S ============================================================================== --- head/lib/csu/arm/crti.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/csu/arm/crti.S Tue Sep 29 16:09:58 2015 (r288373) @@ -19,3 +19,4 @@ _fini: stmdb sp!, {fp, ip, lr, pc} sub fp, ip, #4 + .section .note.GNU-stack,"",%progbits Modified: head/lib/csu/arm/crtn.S ============================================================================== --- head/lib/csu/arm/crtn.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/csu/arm/crtn.S Tue Sep 29 16:09:58 2015 (r288373) @@ -8,3 +8,5 @@ __FBSDID("$FreeBSD$"); .section .fini,"ax",%progbits ldmea fp, {fp, sp, pc} mov pc, lr + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_asm_double.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_asm_double.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_asm_double.S Tue Sep 29 16:09:58 2015 (r288373) @@ -117,3 +117,5 @@ ENTRY(__aeabi_cdcmpeq) msr cpsr_c, ip RET END(__aeabi_cdcmpeq) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_asm_float.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_asm_float.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_asm_float.S Tue Sep 29 16:09:58 2015 (r288373) @@ -108,3 +108,5 @@ ENTRY(__aeabi_cfcmpeq) msr cpsr_c, ip RET END(__aeabi_cfcmpeq) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_vfp_double.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp_double.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_vfp_double.S Tue Sep 29 16:09:58 2015 (r288373) @@ -201,3 +201,4 @@ AEABI_ENTRY(dsub) RET AEABI_END(dsub) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_vfp_float.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp_float.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_vfp_float.S Tue Sep 29 16:09:58 2015 (r288373) @@ -188,3 +188,4 @@ AEABI_ENTRY(fsub) RET AEABI_END(fsub) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/__aeabi_read_tp.S ============================================================================== --- head/lib/libc/arm/gen/__aeabi_read_tp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/__aeabi_read_tp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -45,3 +45,4 @@ END(__aeabi_read_tp) .word ARM_TP_ADDRESS #endif + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/_ctx_start.S ============================================================================== --- head/lib/libc/arm/gen/_ctx_start.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/_ctx_start.S Tue Sep 29 16:09:58 2015 (r288373) @@ -8,3 +8,5 @@ ENTRY(_ctx_start) bl _C_LABEL(ctx_done) bl _C_LABEL(abort) END(_ctx_start) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/_setjmp.S ============================================================================== --- head/lib/libc/arm/gen/_setjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/_setjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -157,3 +157,5 @@ botch: b . #endif END(_longjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/alloca.S ============================================================================== --- head/lib/libc/arm/gen/alloca.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/alloca.S Tue Sep 29 16:09:58 2015 (r288373) @@ -44,3 +44,5 @@ ENTRY(alloca) mov r0, sp /* r0 = base of new space */ RET END(alloca) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/divsi3.S ============================================================================== --- head/lib/libc/arm/gen/divsi3.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/divsi3.S Tue Sep 29 16:09:58 2015 (r288373) @@ -389,3 +389,5 @@ ENTRY(__divsi3) mov r0, r3 RET END(__divsi3) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/setjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -158,3 +158,5 @@ ENTRY(__longjmp) bl PIC_SYM(_C_LABEL(abort), PLT) 1: b 1b /* Cannot get here */ END(__longjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/arm/gen/sigsetjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/sigsetjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -66,3 +66,5 @@ ENTRY(siglongjmp) beq PIC_SYM(_C_LABEL(_longjmp), PLT) b PIC_SYM(_C_LABEL(longjmp), PLT) END(siglongjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/ffs.S ============================================================================== --- head/lib/libc/arm/string/ffs.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/ffs.S Tue Sep 29 16:09:58 2015 (r288373) @@ -84,3 +84,5 @@ ENTRY(ffs) RET #endif END(ffs) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcmp.S ============================================================================== --- head/lib/libc/arm/string/memcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -181,3 +181,5 @@ ENTRY(memcmp) RET #endif END(memcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcpy_arm.S ============================================================================== --- head/lib/libc/arm/string/memcpy_arm.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcpy_arm.S Tue Sep 29 16:09:58 2015 (r288373) @@ -334,3 +334,5 @@ ENTRY(memcpy) sub r1, r1, #1 b .Lmemcpy_l4 END(memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcpy_xscale.S ============================================================================== --- head/lib/libc/arm/string/memcpy_xscale.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcpy_xscale.S Tue Sep 29 16:09:58 2015 (r288373) @@ -1784,3 +1784,5 @@ ENTRY(memcpy) bx lr #endif /* !_STANDALONE */ END(memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memmove.S ============================================================================== --- head/lib/libc/arm/string/memmove.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memmove.S Tue Sep 29 16:09:58 2015 (r288373) @@ -609,3 +609,5 @@ END(memmove) #else END(bcopy) #endif + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memset.S ============================================================================== --- head/lib/libc/arm/string/memset.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memset.S Tue Sep 29 16:09:58 2015 (r288373) @@ -263,3 +263,5 @@ END(bzero) #else END(memset) #endif + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strcmp.S ============================================================================== --- head/lib/libc/arm/string/strcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -43,3 +43,5 @@ ENTRY(strcmp) sub r0, r2, r3 RET END(strcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strlen.S ============================================================================== --- head/lib/libc/arm/string/strlen.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strlen.S Tue Sep 29 16:09:58 2015 (r288373) @@ -83,3 +83,5 @@ ENTRY(strlen) mov r0, r1 RET END(strlen) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strncmp.S ============================================================================== --- head/lib/libc/arm/string/strncmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strncmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -56,3 +56,5 @@ ENTRY(strncmp) sub r0, r2, r3 RET END(strncmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/Ovfork.S ============================================================================== --- head/lib/libc/arm/sys/Ovfork.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/Ovfork.S Tue Sep 29 16:09:58 2015 (r288373) @@ -53,3 +53,5 @@ ENTRY(vfork) and r0, r0, r1 /* r0 == 0 if child, else unchanged */ mov r15, r2 END(vfork) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/brk.S ============================================================================== --- head/lib/libc/arm/sys/brk.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/brk.S Tue Sep 29 16:09:58 2015 (r288373) @@ -91,3 +91,5 @@ ENTRY(_brk) .Lcurbrk: .word PIC_SYM(CURBRK, GOT) END(_brk) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/cerror.S ============================================================================== --- head/lib/libc/arm/sys/cerror.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/cerror.S Tue Sep 29 16:09:58 2015 (r288373) @@ -47,3 +47,5 @@ ASENTRY(CERROR) mvn r1, #0x00000000 ldmfd sp!, {r4, pc} END(CERROR) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/pipe.S ============================================================================== --- head/lib/libc/arm/sys/pipe.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/pipe.S Tue Sep 29 16:09:58 2015 (r288373) @@ -49,3 +49,5 @@ ENTRY(_pipe) mov r0, #0x00000000 RET END(_pipe) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/ptrace.S ============================================================================== --- head/lib/libc/arm/sys/ptrace.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/ptrace.S Tue Sep 29 16:09:58 2015 (r288373) @@ -47,3 +47,5 @@ ENTRY(ptrace) bcs PIC_SYM(CERROR, PLT) RET END(ptrace) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/sbrk.S ============================================================================== --- head/lib/libc/arm/sys/sbrk.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/sbrk.S Tue Sep 29 16:09:58 2015 (r288373) @@ -78,3 +78,5 @@ ENTRY(_sbrk) .Lcurbrk: .word PIC_SYM(CURBRK, GOT) END(_sbrk) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/shmat.S ============================================================================== --- head/lib/libc/arm/sys/shmat.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/shmat.S Tue Sep 29 16:09:58 2015 (r288373) @@ -5,3 +5,5 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" RSYSCALL(shmat) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/sigreturn.S ============================================================================== --- head/lib/libc/arm/sys/sigreturn.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/sigreturn.S Tue Sep 29 16:09:58 2015 (r288373) @@ -40,3 +40,5 @@ __FBSDID("$FreeBSD$"); */ RSYSCALL(sigreturn) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/syscall.S ============================================================================== --- head/lib/libc/arm/sys/syscall.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/syscall.S Tue Sep 29 16:09:58 2015 (r288373) @@ -36,3 +36,5 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" RSYSCALL(syscall) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/sys/Makefile.inc Tue Sep 29 16:09:58 2015 (r288373) @@ -102,7 +102,7 @@ SYM_MAPS+= ${LIBC_SRCTOP}/sys/Symbol.map CLEANFILES+= ${SASM} ${SPSEUDO} .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "powerpc" + ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*} NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n' .else NOTE_GNU_STACK='' Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libcompiler_rt/Makefile Tue Sep 29 16:09:58 2015 (r288373) @@ -230,7 +230,7 @@ SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/l .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "powerpc" + ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*} AFLAGS+=--noexecstack ACFLAGS+=-Wa,--noexecstack .endif Modified: head/libexec/rtld-elf/arm/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/arm/rtld_start.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/libexec/rtld-elf/arm/rtld_start.S Tue Sep 29 16:09:58 2015 (r288373) @@ -97,3 +97,4 @@ _rtld_bind_start: ldmia sp!,{r0-r5,sl,fp,lr} /* restore the stack */ mov pc, ip /* jump to the new address */ + .section .note.GNU-stack,"",%progbits From owner-svn-src-all@freebsd.org Tue Sep 29 16:54:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A730A0B0AD; Tue, 29 Sep 2015 16:54:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF1221EDC; Tue, 29 Sep 2015 16:54:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGsMVs076785; Tue, 29 Sep 2015 16:54:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TGsMCI076784; Tue, 29 Sep 2015 16:54:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291654.t8TGsMCI076784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 16:54:22 +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: r288375 - stable/10/share/mk 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 16:54:23 -0000 Author: bdrewery Date: Tue Sep 29 16:54:22 2015 New Revision: 288375 URL: https://svnweb.freebsd.org/changeset/base/288375 Log: MFC r287978: Fix LIBRARIES_ONLY Modified: stable/10/share/mk/bsd.lib.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.lib.mk ============================================================================== --- stable/10/share/mk/bsd.lib.mk Tue Sep 29 16:09:59 2015 (r288374) +++ stable/10/share/mk/bsd.lib.mk Tue Sep 29 16:54:22 2015 (r288375) @@ -258,7 +258,7 @@ ${LINTLIB}: ${LINTOBJS} all: ${_LIBS} -.if ${MK_MAN} != "no" +.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) all: _manpages .endif From owner-svn-src-all@freebsd.org Tue Sep 29 16:56:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03A9AA0B20A; Tue, 29 Sep 2015 16:56:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E811A110F; Tue, 29 Sep 2015 16:56:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGuS4b076946; Tue, 29 Sep 2015 16:56:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TGuSVJ076945; Tue, 29 Sep 2015 16:56:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291656.t8TGuSVJ076945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 16:56:28 +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: r288376 - stable/10/lib/libc/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 16:56:29 -0000 Author: bdrewery Date: Tue Sep 29 16:56:28 2015 New Revision: 288376 URL: https://svnweb.freebsd.org/changeset/base/288376 Log: MFC r288092: Avoid adding duplicates into OBJS. bsd.lib.mk already handles adding entries to OBJS based on SRCS. Modified: stable/10/lib/libc/sys/Makefile.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/Makefile.inc ============================================================================== --- stable/10/lib/libc/sys/Makefile.inc Tue Sep 29 16:54:22 2015 (r288375) +++ stable/10/lib/libc/sys/Makefile.inc Tue Sep 29 16:56:28 2015 (r288376) @@ -100,8 +100,6 @@ ASM+=$(_asm) .endif .endfor -OBJS+= ${ASM} ${PSEUDO} - SASM= ${ASM:S/.o/.S/} SPSEUDO= ${PSEUDO:S/.o/.S/} From owner-svn-src-all@freebsd.org Tue Sep 29 17:02:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EF2CA0B7E6; Tue, 29 Sep 2015 17:02:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EFFC182F; Tue, 29 Sep 2015 17:02:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TH2SLM080951; Tue, 29 Sep 2015 17:02:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TH2S3d080950; Tue, 29 Sep 2015 17:02:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291702.t8TH2S3d080950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:02:28 +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: r288377 - stable/9/lib/libc/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:02:28 -0000 Author: bdrewery Date: Tue Sep 29 17:02:27 2015 New Revision: 288377 URL: https://svnweb.freebsd.org/changeset/base/288377 Log: MFC r288092: Avoid adding duplicates into OBJS. bsd.lib.mk already handles adding entries to OBJS based on SRCS. Modified: stable/9/lib/libc/sys/Makefile.inc Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/Makefile.inc ============================================================================== --- stable/9/lib/libc/sys/Makefile.inc Tue Sep 29 16:56:28 2015 (r288376) +++ stable/9/lib/libc/sys/Makefile.inc Tue Sep 29 17:02:27 2015 (r288377) @@ -47,8 +47,6 @@ ASM+=$(_asm) .endif .endfor -OBJS+= ${ASM} ${PSEUDO} - SASM= ${ASM:S/.o/.S/} SPSEUDO= ${PSEUDO:S/.o/.S/} From owner-svn-src-all@freebsd.org Tue Sep 29 17:04:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 653CDA0B91D; Tue, 29 Sep 2015 17:04:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55BE719BB; Tue, 29 Sep 2015 17:04:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TH4LUn081072; Tue, 29 Sep 2015 17:04:21 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TH4Kik081069; Tue, 29 Sep 2015 17:04:20 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509291704.t8TH4Kik081069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 29 Sep 2015 17:04:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288378 - in head/release/doc: en_US.ISO8859-1/hardware 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:04:21 -0000 Author: brueffer Date: Tue Sep 29 17:04:20 2015 New Revision: 288378 URL: https://svnweb.freebsd.org/changeset/base/288378 Log: Add otus(4) to the hardware notes. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Tue Sep 29 17:02:27 2015 (r288377) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Tue Sep 29 17:04:20 2015 (r288378) @@ -1011,6 +1011,8 @@ Marvell 88W8363 IEEE 802.11n wireless network adapters (&man.mwl.4; driver) + &hwlist.otus; + &hwlist.ral; &hwlist.rsu; Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Tue Sep 29 17:02:27 2015 (r288377) +++ head/release/doc/share/misc/dev.archlist.txt Tue Sep 29 17:04:20 2015 (r288378) @@ -101,6 +101,7 @@ nxge i386,amd64 oce i386,amd64 ohci i386,pc98,amd64,powerpc oltr i386 +otus i386,amd64 pcn i386,pc98,amd64 pst i386 qlxgb amd64 From owner-svn-src-all@freebsd.org Tue Sep 29 17:05:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D702AA0B9C8; Tue, 29 Sep 2015 17:05:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C78FF1B24; Tue, 29 Sep 2015 17:05:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TH5DpW081158; Tue, 29 Sep 2015 17:05:13 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TH5DK5081157; Tue, 29 Sep 2015 17:05:13 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291705.t8TH5DK5081157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:05:13 +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: r288379 - stable/9/share/mk 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:05:13 -0000 Author: bdrewery Date: Tue Sep 29 17:05:12 2015 New Revision: 288379 URL: https://svnweb.freebsd.org/changeset/base/288379 Log: MFC r287978: Fix LIBRARIES_ONLY Modified: stable/9/share/mk/bsd.lib.mk Directory Properties: stable/9/share/mk/ (props changed) Modified: stable/9/share/mk/bsd.lib.mk ============================================================================== --- stable/9/share/mk/bsd.lib.mk Tue Sep 29 17:04:20 2015 (r288378) +++ stable/9/share/mk/bsd.lib.mk Tue Sep 29 17:05:12 2015 (r288379) @@ -250,7 +250,7 @@ ${LINTLIB}: ${LINTOBJS} all: ${_LIBS} -.if ${MK_MAN} != "no" +.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) all: _manpages .endif From owner-svn-src-all@freebsd.org Tue Sep 29 17:50:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1034A0A6B2; Tue, 29 Sep 2015 17:50:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D777010AD; Tue, 29 Sep 2015 17:50:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THo0bB097630; Tue, 29 Sep 2015 17:50:00 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THo0AQ097629; Tue, 29 Sep 2015 17:50:00 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291750.t8THo0AQ097629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:50:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288380 - head/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:50:01 -0000 Author: bdrewery Date: Tue Sep 29 17:49:59 2015 New Revision: 288380 URL: https://svnweb.freebsd.org/changeset/base/288380 Log: Document the post-merge actions of calling tzsetup(8) and services_mkdb(8) added in r259134. MFC after: 3 days Modified: head/usr.sbin/etcupdate/etcupdate.8 Modified: head/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.8 Tue Sep 29 17:05:12 2015 (r288379) +++ head/usr.sbin/etcupdate/etcupdate.8 Tue Sep 29 17:49:59 2015 (r288380) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd September 29, 2015 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -233,6 +233,16 @@ is changed, is invoked if .Pa /etc/mail/aliases is changed, +.Xr services_mkdb 8 +is invoked if +.Pa /etc/services +is changed, +.Xr tzsetup 8 +is invoked if +.Pa /etc/localtime +is changed and if +.Fa /var/db/zoneinfo +exists, and .Pa /etc/rc.d/motd is invoked if @@ -843,7 +853,9 @@ but it has been removed in the destinati .Xr make 1 , .Xr newaliases 1 , .Xr sh 1 , -.Xr pwd_mkdb 8 +.Xr pwd_mkdb 8 , +.Xr services_mkdb 8 , +.Xr tzsetup 8 .Sh HISTORY The .Nm From owner-svn-src-all@freebsd.org Tue Sep 29 17:54:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D445A0A965; Tue, 29 Sep 2015 17:54:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DF3E1519; Tue, 29 Sep 2015 17:54:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THs2gM001544; Tue, 29 Sep 2015 17:54:02 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THs2Vl001543; Tue, 29 Sep 2015 17:54:02 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291754.t8THs2Vl001543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288381 - head/usr.sbin/mergemaster 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:54:02 -0000 Author: bdrewery Date: Tue Sep 29 17:54:01 2015 New Revision: 288381 URL: https://svnweb.freebsd.org/changeset/base/288381 Log: All supported releases have the -m support from r186678, so remove the mention of it and reword this a bit to remove 'you'. MFC after: 3 days Modified: head/usr.sbin/mergemaster/mergemaster.8 Modified: head/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.8 Tue Sep 29 17:49:59 2015 (r288380) +++ head/usr.sbin/mergemaster/mergemaster.8 Tue Sep 29 17:54:01 2015 (r288381) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2011 +.Dd September 29, 2015 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -257,14 +257,13 @@ Specify the path to the directory where .Xr make 1 . (In other words, where your sources are, but -s was already taken.) -In previous versions of +In older versions of .Nm -you needed to specify the path all the way to -.Pa src/etc . -Starting with r186678 you only need to specify the path to -.Pa src . +the path to +.Pa src/etc +was required. .Nm -will convert the path for you if you use the old method. +will convert the path if this older method is used. .It Fl t Ar /path/to/temp/root Create the temporary root environment in .Pa /path/to/temp/root From owner-svn-src-all@freebsd.org Tue Sep 29 17:54:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45BCEA0AA00; Tue, 29 Sep 2015 17:54:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36DAF179C; Tue, 29 Sep 2015 17:54:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THsTqc001607; Tue, 29 Sep 2015 17:54:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THsT3X001606; Tue, 29 Sep 2015 17:54:29 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291754.t8THsT3X001606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 17:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288382 - head/lib/libc/tests/stdio 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 17:54:29 -0000 Author: delphij Date: Tue Sep 29 17:54:28 2015 New Revision: 288382 URL: https://svnweb.freebsd.org/changeset/base/288382 Log: In this context fclose() can never fail, so assert it in the test case. Modified: head/lib/libc/tests/stdio/fmemopen2_test.c Modified: head/lib/libc/tests/stdio/fmemopen2_test.c ============================================================================== --- head/lib/libc/tests/stdio/fmemopen2_test.c Tue Sep 29 17:54:01 2015 (r288381) +++ head/lib/libc/tests/stdio/fmemopen2_test.c Tue Sep 29 17:54:28 2015 (r288382) @@ -97,6 +97,7 @@ ATF_TC_BODY(test_preexisting, tc) /* Close the FILE *. */ rc = fclose(fp); + ATF_REQUIRE(rc == 0); /* Check that the string was not modified after the first 4 bytes. */ ATF_REQUIRE(strcmp(str, str3) == 0); From owner-svn-src-all@freebsd.org Tue Sep 29 18:05:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12E80A0B1F4; Tue, 29 Sep 2015 18:05:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC20A1DA3; Tue, 29 Sep 2015 18:05:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TI5srB005962; Tue, 29 Sep 2015 18:05:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TI5sBE005961; Tue, 29 Sep 2015 18:05:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291805.t8TI5sBE005961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 18:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288383 - head/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:05:55 -0000 Author: delphij Date: Tue Sep 29 18:05:54 2015 New Revision: 288383 URL: https://svnweb.freebsd.org/changeset/base/288383 Log: The Sun RPC framework uses a netbuf structure to represent the transport specific form of a universal transport address. The structure is expected to be opaque to consumers. In the current implementation, the structure contains a pointer to a buffer that holds the actual address. In rpcbind(8), netbuf structures are copied directly, which would result in two netbuf structures that reference to one shared address buffer. When one of the two netbuf structures is freed, access to the other netbuf structure would result in an undefined result that may crash the rpcbind(8) daemon. Fix this by making a copy of the buffer that is going to be freed instead of doing a shallow copy. Security: FreeBSD-SA-15:24.rpcbind Security: CVE-2015-7236 Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 17:54:28 2015 (r288382) +++ head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:05:54 2015 (r288383) @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1047,19 +1048,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1067,6 +1080,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1184,7 +1198,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } From owner-svn-src-all@freebsd.org Tue Sep 29 18:06:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45536A0B26A; Tue, 29 Sep 2015 18:06:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27D2F1EF3; Tue, 29 Sep 2015 18:06:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TI6SMu006056; Tue, 29 Sep 2015 18:06:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TI6SZR006055; Tue, 29 Sep 2015 18:06:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291806.t8TI6SZR006055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 18:06:28 +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: r288384 - in stable: 10/usr.sbin/rpcbind 9/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:06:28 -0000 Author: delphij Date: Tue Sep 29 18:06:27 2015 New Revision: 288384 URL: https://svnweb.freebsd.org/changeset/base/288384 Log: The Sun RPC framework uses a netbuf structure to represent the transport specific form of a universal transport address. The structure is expected to be opaque to consumers. In the current implementation, the structure contains a pointer to a buffer that holds the actual address. In rpcbind(8), netbuf structures are copied directly, which would result in two netbuf structures that reference to one shared address buffer. When one of the two netbuf structures is freed, access to the other netbuf structure would result in an undefined result that may crash the rpcbind(8) daemon. Fix this by making a copy of the buffer that is going to be freed instead of doing a shallow copy. Security: FreeBSD-SA-15:24.rpcbind Security: CVE-2015-7236 Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Changes in other areas also in this revision: Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:05:54 2015 (r288383) +++ stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:06:27 2015 (r288384) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1048,19 +1049,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1068,6 +1081,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1185,7 +1199,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } From owner-svn-src-all@freebsd.org Tue Sep 29 18:06:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0545A0B26E; Tue, 29 Sep 2015 18:06:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4DF41EF4; Tue, 29 Sep 2015 18:06:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TI6SXb006064; Tue, 29 Sep 2015 18:06:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TI6SKt006063; Tue, 29 Sep 2015 18:06:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291806.t8TI6SKt006063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 18:06:28 +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: r288384 - in stable: 10/usr.sbin/rpcbind 9/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:06:29 -0000 Author: delphij Date: Tue Sep 29 18:06:27 2015 New Revision: 288384 URL: https://svnweb.freebsd.org/changeset/base/288384 Log: The Sun RPC framework uses a netbuf structure to represent the transport specific form of a universal transport address. The structure is expected to be opaque to consumers. In the current implementation, the structure contains a pointer to a buffer that holds the actual address. In rpcbind(8), netbuf structures are copied directly, which would result in two netbuf structures that reference to one shared address buffer. When one of the two netbuf structures is freed, access to the other netbuf structure would result in an undefined result that may crash the rpcbind(8) daemon. Fix this by making a copy of the buffer that is going to be freed instead of doing a shallow copy. Security: FreeBSD-SA-15:24.rpcbind Security: CVE-2015-7236 Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Changes in other areas also in this revision: Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:05:54 2015 (r288383) +++ stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:06:27 2015 (r288384) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1048,19 +1049,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1068,6 +1081,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1185,7 +1199,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } From owner-svn-src-all@freebsd.org Tue Sep 29 18:07:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8125A0B3B5; Tue, 29 Sep 2015 18:07:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A69C211B8; Tue, 29 Sep 2015 18:07:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TI7LG2006188; Tue, 29 Sep 2015 18:07:21 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TI7JWC006177; Tue, 29 Sep 2015 18:07:19 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291807.t8TI7JWC006177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 18:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r288385 - in releng: 10.1 10.1/sys/conf 10.1/usr.sbin/rpcbind 10.2 10.2/sys/conf 10.2/usr.sbin/rpcbind 9.3 9.3/sys/conf 9.3/usr.sbin/rpcbind X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:07:21 -0000 Author: delphij Date: Tue Sep 29 18:07:18 2015 New Revision: 288385 URL: https://svnweb.freebsd.org/changeset/base/288385 Log: The Sun RPC framework uses a netbuf structure to represent the transport specific form of a universal transport address. The structure is expected to be opaque to consumers. In the current implementation, the structure contains a pointer to a buffer that holds the actual address. In rpcbind(8), netbuf structures are copied directly, which would result in two netbuf structures that reference to one shared address buffer. When one of the two netbuf structures is freed, access to the other netbuf structure would result in an undefined result that may crash the rpcbind(8) daemon. Fix this by making a copy of the buffer that is going to be freed instead of doing a shallow copy. Security: FreeBSD-SA-15:24.rpcbind Security: CVE-2015-7236 Approved by: so Modified: releng/10.1/UPDATING releng/10.1/sys/conf/newvers.sh releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c releng/10.2/UPDATING releng/10.2/sys/conf/newvers.sh releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c releng/9.3/UPDATING releng/9.3/sys/conf/newvers.sh releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.1/UPDATING Tue Sep 29 18:07:18 2015 (r288385) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150929: p21 FreeBSD-SA-15:24.rpcbind + + Fix rpcbind(8) remote denial of service. [SA-15:24] + 20150916: p20 FreeBSD-EN-15:18.pkg Implement pubkey support for pkg(7) bootstrap. [EN-15:18] Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.1/sys/conf/newvers.sh Tue Sep 29 18:07:18 2015 (r288385) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RELEASE-p20" +BRANCH="RELEASE-p21" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:07:18 2015 (r288385) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1048,19 +1049,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1068,6 +1081,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1185,7 +1199,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } Modified: releng/10.2/UPDATING ============================================================================== --- releng/10.2/UPDATING Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.2/UPDATING Tue Sep 29 18:07:18 2015 (r288385) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150929: p4 FreeBSD-SA-15:24.rpcbind + + Fix rpcbind(8) remote denial of service. [SA-15:24] + 20150916: p3 FreeBSD-EN-15:16.pw FreeBSD-EN-15:17.libc FreeBSD-EN-15:18.pkg Modified: releng/10.2/sys/conf/newvers.sh ============================================================================== --- releng/10.2/sys/conf/newvers.sh Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.2/sys/conf/newvers.sh Tue Sep 29 18:07:18 2015 (r288385) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.2" -BRANCH="RELEASE-p3" +BRANCH="RELEASE-p4" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:06:27 2015 (r288384) +++ releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:07:18 2015 (r288385) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1048,19 +1049,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1068,6 +1081,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1185,7 +1199,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } Modified: releng/9.3/UPDATING ============================================================================== --- releng/9.3/UPDATING Tue Sep 29 18:06:27 2015 (r288384) +++ releng/9.3/UPDATING Tue Sep 29 18:07:18 2015 (r288385) @@ -11,6 +11,10 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20150929: p27 FreeBSD-SA-15:24.rpcbind + + Fix rpcbind(8) remote denial of service. [SA-15:24] + 20150916: p26 FreeBSD-EN-15:18.pkg Implement pubkey support for pkg(7) bootstrap. [EN-15:18] Modified: releng/9.3/sys/conf/newvers.sh ============================================================================== --- releng/9.3/sys/conf/newvers.sh Tue Sep 29 18:06:27 2015 (r288384) +++ releng/9.3/sys/conf/newvers.sh Tue Sep 29 18:07:18 2015 (r288385) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.3" -BRANCH="RELEASE-p26" +BRANCH="RELEASE-p27" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:06:27 2015 (r288384) +++ releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:07:18 2015 (r288385) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1048,19 +1049,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1068,6 +1081,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1185,7 +1199,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } From owner-svn-src-all@freebsd.org Tue Sep 29 18:33:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 527DBA0C5EB; Tue, 29 Sep 2015 18:33:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F3B21302; Tue, 29 Sep 2015 18:33:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIXIEh019002; Tue, 29 Sep 2015 18:33:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIXHX3019000; Tue, 29 Sep 2015 18:33:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291833.t8TIXHX3019000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:33:17 +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: r288386 - stable/9/sys/dev/filemon 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:33:18 -0000 Author: bdrewery Date: Tue Sep 29 18:33:17 2015 New Revision: 288386 URL: https://svnweb.freebsd.org/changeset/base/288386 Log: MFC r284383,r284477,r284600,r284601: Latest clang uses openat(2). Bump the version since we now handle openat filemon_pid_check needs to hold proctree_lock sx_sunlock for sx_slock Modified: stable/9/sys/dev/filemon/filemon.h stable/9/sys/dev/filemon/filemon_wrapper.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/filemon/filemon.h ============================================================================== --- stable/9/sys/dev/filemon/filemon.h Tue Sep 29 18:07:18 2015 (r288385) +++ stable/9/sys/dev/filemon/filemon.h Tue Sep 29 18:33:17 2015 (r288386) @@ -30,5 +30,5 @@ #define FILEMON_SET_FD _IOWR('S', 1, int) #define FILEMON_SET_PID _IOWR('S', 2, pid_t) -#define FILEMON_VERSION 4 /* output format +#define FILEMON_VERSION 5 /* output format (bump when adding record types) */ Modified: stable/9/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/9/sys/dev/filemon/filemon_wrapper.c Tue Sep 29 18:07:18 2015 (r288385) +++ stable/9/sys/dev/filemon/filemon_wrapper.c Tue Sep 29 18:33:17 2015 (r288386) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "opt_compat.h" #if __FreeBSD_version > 800032 @@ -84,13 +86,17 @@ filemon_pid_check(struct proc *p) { struct filemon *filemon; - while (p->p_pptr) { + sx_slock(&proctree_lock); + while (p != initproc) { TAILQ_FOREACH(filemon, &filemons_inuse, link) { - if (p->p_pid == filemon->pid) + if (p->p_pid == filemon->pid) { + sx_sunlock(&proctree_lock); return (filemon); + } } - p = p->p_pptr; + p = proc_realparent(p); } + sx_sunlock(&proctree_lock); return (NULL); } @@ -316,6 +322,68 @@ filemon_wrapper_open(struct thread *td, } static int +filemon_wrapper_openat(struct thread *td, struct openat_args *uap) +{ + int ret; + size_t done; + size_t len; + struct filemon *filemon; + + if ((ret = sys_openat(td, uap)) == 0) { + /* Grab a read lock on the filemon inuse list. */ + filemon_lock_read(); + + if ((filemon = filemon_pid_check(curproc)) != NULL) { + /* Lock the found filemon structure. */ + filemon_filemon_lock(filemon); + + copyinstr(uap->path, filemon->fname1, + sizeof(filemon->fname1), &done); + + filemon->fname2[0] = '\0'; + if (filemon->fname1[0] != '/' && uap->fd != AT_FDCWD) { + /* + * rats - we cannot do too much about this. + * the trace should show a dir we read + * recently.. output an A record as a clue + * until we can do better. + */ + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "A %d %s\n", + curproc->p_pid, filemon->fname1); + filemon_output(filemon, filemon->msgbufr, len); + } + if (uap->flag & O_RDWR) { + /* + * We'll get the W record below, but need + * to also output an R to distingish from + * O_WRONLY. + */ + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "R %d %s%s\n", + curproc->p_pid, filemon->fname2, filemon->fname1); + filemon_output(filemon, filemon->msgbufr, len); + } + + + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "%c %d %s%s\n", + (uap->flag & O_ACCMODE) ? 'W':'R', + curproc->p_pid, filemon->fname2, filemon->fname1); + filemon_output(filemon, filemon->msgbufr, len); + + /* Unlock the found filemon structure. */ + filemon_filemon_unlock(filemon); + } + + /* Release the read lock. */ + filemon_unlock_read(); + } + + return (ret); +} + +static int filemon_wrapper_rename(struct thread *td, struct rename_args *uap) { int ret; @@ -671,6 +739,7 @@ filemon_wrapper_install(void) sv_table[SYS_execve].sy_call = (sy_call_t *) filemon_wrapper_execve; sv_table[SYS_fork].sy_call = (sy_call_t *) filemon_wrapper_fork; sv_table[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + sv_table[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; sv_table[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; sv_table[SYS_stat].sy_call = (sy_call_t *) filemon_wrapper_stat; sv_table[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; @@ -689,6 +758,7 @@ filemon_wrapper_install(void) sv_table[FREEBSD32_SYS_freebsd32_execve].sy_call = (sy_call_t *) filemon_wrapper_freebsd32_execve; sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *) filemon_wrapper_fork; sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *) filemon_wrapper_freebsd32_stat; sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; @@ -717,6 +787,7 @@ filemon_wrapper_deinstall(void) sv_table[SYS_execve].sy_call = (sy_call_t *)sys_execve; sv_table[SYS_fork].sy_call = (sy_call_t *)sys_fork; sv_table[SYS_open].sy_call = (sy_call_t *)sys_open; + sv_table[SYS_openat].sy_call = (sy_call_t *)sys_openat; sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename; sv_table[SYS_stat].sy_call = (sy_call_t *)sys_stat; sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; @@ -735,6 +806,7 @@ filemon_wrapper_deinstall(void) sv_table[FREEBSD32_SYS_freebsd32_execve].sy_call = (sy_call_t *)freebsd32_execve; sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *)sys_fork; sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; + sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat; sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *)freebsd32_stat; sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; From owner-svn-src-all@freebsd.org Tue Sep 29 18:40:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E853A0C9AD; Tue, 29 Sep 2015 18:40:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EF75189F; Tue, 29 Sep 2015 18:40:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIdxUg019336; Tue, 29 Sep 2015 18:39:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIdxAh019334; Tue, 29 Sep 2015 18:39:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509291839.t8TIdxAh019334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 18:39: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: r288387 - stable/10/usr.sbin/pmcstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:40:00 -0000 Author: jhb Date: Tue Sep 29 18:39:58 2015 New Revision: 288387 URL: https://svnweb.freebsd.org/changeset/base/288387 Log: MFC 283613,287374: Use the cpuset API more consistently: - Fetch the root set from cpuset_getaffinity() instead of assuming all CPUs from 0 to hw.ncpu are the root set. - Use CPU_SETSIZE and CPU_FFS. - The original notion of halted CPUs the manpage and code refers to is gone. Use the term "available" instead. Modified: stable/10/usr.sbin/pmcstat/pmcstat.8 stable/10/usr.sbin/pmcstat/pmcstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- stable/10/usr.sbin/pmcstat/pmcstat.8 Tue Sep 29 18:33:17 2015 (r288386) +++ stable/10/usr.sbin/pmcstat/pmcstat.8 Tue Sep 29 18:39:58 2015 (r288387) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 8, 2015 +.Dd May 27, 2015 .Dt PMCSTAT 8 .Os .Sh NAME @@ -246,8 +246,8 @@ Argument .Ar cpu-spec is a comma separated list of CPU numbers, or the literal .Sq * -denoting all unhalted CPUs. -The default is to allocate system mode PMCs on all unhalted +denoting all available CPUs. +The default is to allocate system mode PMCs on all available CPUs. .It Fl d Toggle between process mode PMCs measuring events for the target Modified: stable/10/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/10/usr.sbin/pmcstat/pmcstat.c Tue Sep 29 18:33:17 2015 (r288386) +++ stable/10/usr.sbin/pmcstat/pmcstat.c Tue Sep 29 18:39:58 2015 (r288387) @@ -116,11 +116,10 @@ struct pmcstat_args args; static void pmcstat_clone_event_descriptor(struct pmcstat_ev *ev, const cpuset_t *cpumask) { - int cpu, mcpu; + int cpu; struct pmcstat_ev *ev_clone; - mcpu = sizeof(*cpumask) * NBBY; - for (cpu = 0; cpu < mcpu; cpu++) { + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) { if (!CPU_ISSET(cpu, cpumask)) continue; @@ -161,6 +160,7 @@ pmcstat_get_cpumask(const char *cpuspec, CPU_SET(cpu, cpumask); s = end + strspn(end, ", \t"); } while (*s); + assert(!CPU_EMPTY(cpumask)); } void @@ -550,10 +550,10 @@ pmcstat_topexit(void) int main(int argc, char **argv) { - cpuset_t cpumask; + cpuset_t cpumask, rootmask; double interval; double duration; - int hcpu, option, npmc, ncpu; + int option, npmc; int c, check_driver_stats, current_sampling_count; int do_callchain, do_descendants, do_logproccsw, do_logprocexit; int do_print, do_read; @@ -618,14 +618,13 @@ main(int argc, char **argv) err(EX_OSERR, "ERROR: Cannot determine path of running kernel"); /* - * The initial CPU mask specifies all non-halted CPUS in the - * system. + * The initial CPU mask specifies the root mask of this process + * which is usually all CPUs in the system. */ - len = sizeof(int); - if (sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0) < 0) - err(EX_OSERR, "ERROR: Cannot determine the number of CPUs"); - for (hcpu = 0; hcpu < ncpu; hcpu++) - CPU_SET(hcpu, &cpumask); + if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, + sizeof(rootmask), &rootmask) == -1) + err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); + CPU_COPY(&rootmask, &cpumask); while ((option = getopt(argc, argv, "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:l:m:n:o:p:qr:s:t:vw:z:")) != -1) @@ -642,11 +641,9 @@ main(int argc, char **argv) break; case 'c': /* CPU */ - - if (optarg[0] == '*' && optarg[1] == '\0') { - for (hcpu = 0; hcpu < ncpu; hcpu++) - CPU_SET(hcpu, &cpumask); - } else + if (optarg[0] == '*' && optarg[1] == '\0') + CPU_COPY(&rootmask, &cpumask); + else pmcstat_get_cpumask(optarg, &cpumask); args.pa_flags |= FLAGS_HAS_CPUMASK; @@ -771,13 +768,9 @@ main(int argc, char **argv) else ev->ev_count = -1; - if (option == 'S' || option == 's') { - hcpu = sizeof(cpumask) * NBBY; - for (hcpu--; hcpu >= 0; hcpu--) - if (CPU_ISSET(hcpu, &cpumask)) - break; - ev->ev_cpu = hcpu; - } else + if (option == 'S' || option == 's') + ev->ev_cpu = CPU_FFS(&cpumask) - 1; + else ev->ev_cpu = PMC_CPU_ANY; ev->ev_flags = 0; @@ -804,11 +797,9 @@ main(int argc, char **argv) STAILQ_INSERT_TAIL(&args.pa_events, ev, ev_next); if (option == 's' || option == 'S') { - hcpu = CPU_ISSET(ev->ev_cpu, &cpumask); CPU_CLR(ev->ev_cpu, &cpumask); pmcstat_clone_event_descriptor(ev, &cpumask); - if (hcpu != 0) - CPU_SET(ev->ev_cpu, &cpumask); + CPU_SET(ev->ev_cpu, &cpumask); } break; From owner-svn-src-all@freebsd.org Tue Sep 29 18:46:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DF0AA0A25A; Tue, 29 Sep 2015 18:46:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C7C21343; Tue, 29 Sep 2015 18:46:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIkeuf023370; Tue, 29 Sep 2015 18:46:40 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIkdGX023365; Tue, 29 Sep 2015 18:46:39 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291846.t8TIkdGX023365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:46:39 +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: r288388 - stable/9/sys/dev/filemon 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:46:40 -0000 Author: bdrewery Date: Tue Sep 29 18:46:39 2015 New Revision: 288388 URL: https://svnweb.freebsd.org/changeset/base/288388 Log: MFC r287151,r287152,r287153,r287155: r287151: Move common locking for filemon_inuse and struct filemon* to filemon_pid_check(). r287152: Remove unneeded inuse list locking in filemon_comment(). r287153: Avoid taking proctree_lock and searching parents in wrappers if not needed. r287155: Fix filemon locking races. Modified: stable/9/sys/dev/filemon/filemon.c stable/9/sys/dev/filemon/filemon_lock.c stable/9/sys/dev/filemon/filemon_wrapper.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/filemon/filemon.c ============================================================================== --- stable/9/sys/dev/filemon/filemon.c Tue Sep 29 18:39:58 2015 (r288387) +++ stable/9/sys/dev/filemon/filemon.c Tue Sep 29 18:46:39 2015 (r288388) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2011, David E. O'Brien. * Copyright (c) 2009-2011, Juniper Networks, Inc. + * Copyright (c) 2015, EMC Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,12 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -85,12 +88,8 @@ MALLOC_DEFINE(M_FILEMON, "filemon", "Fil struct filemon { TAILQ_ENTRY(filemon) link; /* Link into the in-use list. */ - struct mtx mtx; /* Lock mutex for this filemon. */ - struct cv cv; /* Lock condition variable for this - filemon. */ + struct sx lock; /* Lock mutex for this filemon. */ struct file *fp; /* Output file pointer. */ - struct thread *locker; /* Ptr to the thread locking this - filemon. */ pid_t pid; /* The process ID being monitored. */ char fname1[MAXPATHLEN]; /* Temporary filename buffer. */ char fname2[MAXPATHLEN]; /* Temporary filename buffer. */ @@ -99,11 +98,7 @@ struct filemon { static TAILQ_HEAD(, filemon) filemons_inuse = TAILQ_HEAD_INITIALIZER(filemons_inuse); static TAILQ_HEAD(, filemon) filemons_free = TAILQ_HEAD_INITIALIZER(filemons_free); -static int n_readers = 0; -static struct mtx access_mtx; -static struct cv access_cv; -static struct thread *access_owner = NULL; -static struct thread *access_requester = NULL; +static struct sx access_lock; #if __FreeBSD_version < 701000 static struct clonedevs *filemon_clones; @@ -240,8 +235,7 @@ filemon_open(struct cdev *dev, int oflag filemon->fp = NULL; - mtx_init(&filemon->mtx, "filemon", "filemon", MTX_DEF); - cv_init(&filemon->cv, "filemon"); + sx_init(&filemon->lock, "filemon"); } filemon->pid = curproc->p_pid; @@ -283,8 +277,7 @@ filemon_close(struct cdev *dev __unused, static void filemon_load(void *dummy __unused) { - mtx_init(&access_mtx, "filemon", "filemon", MTX_DEF); - cv_init(&access_cv, "filemon"); + sx_init(&access_lock, "filemons_inuse"); /* Install the syscall wrappers. */ filemon_wrapper_install(); @@ -342,14 +335,12 @@ filemon_unload(void) filemon_lock_write(); while ((filemon = TAILQ_FIRST(&filemons_free)) != NULL) { TAILQ_REMOVE(&filemons_free, filemon, link); - mtx_destroy(&filemon->mtx); - cv_destroy(&filemon->cv); + sx_destroy(&filemon->lock); free(filemon, M_FILEMON); } filemon_unlock_write(); - mtx_destroy(&access_mtx); - cv_destroy(&access_cv); + sx_destroy(&access_lock); } return (error); Modified: stable/9/sys/dev/filemon/filemon_lock.c ============================================================================== --- stable/9/sys/dev/filemon/filemon_lock.c Tue Sep 29 18:39:58 2015 (r288387) +++ stable/9/sys/dev/filemon/filemon_lock.c Tue Sep 29 18:46:39 2015 (r288388) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2009-2011, Juniper Networks, Inc. + * Copyright (c) 2015, EMC Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,96 +28,44 @@ #include __FBSDID("$FreeBSD$"); -static void +static __inline void filemon_filemon_lock(struct filemon *filemon) { - mtx_lock(&filemon->mtx); - while (filemon->locker != NULL && filemon->locker != curthread) - cv_wait(&filemon->cv, &filemon->mtx); - - filemon->locker = curthread; - - mtx_unlock(&filemon->mtx); + sx_xlock(&filemon->lock); } -static void +static __inline void filemon_filemon_unlock(struct filemon *filemon) { - mtx_lock(&filemon->mtx); - - if (filemon->locker == curthread) - filemon->locker = NULL; - /* Wake up threads waiting. */ - cv_broadcast(&filemon->cv); - - mtx_unlock(&filemon->mtx); + sx_xunlock(&filemon->lock); } -static void +static __inline void filemon_lock_read(void) { - mtx_lock(&access_mtx); - - while (access_owner != NULL || access_requester != NULL) - cv_wait(&access_cv, &access_mtx); - - n_readers++; - /* Wake up threads waiting. */ - cv_broadcast(&access_cv); - - mtx_unlock(&access_mtx); + sx_slock(&access_lock); } -static void +static __inline void filemon_unlock_read(void) { - mtx_lock(&access_mtx); - - if (n_readers > 0) - n_readers--; - - /* Wake up a thread waiting. */ - cv_broadcast(&access_cv); - mtx_unlock(&access_mtx); + sx_sunlock(&access_lock); } -static void +static __inline void filemon_lock_write(void) { - mtx_lock(&access_mtx); - while (access_owner != curthread) { - if (access_owner == NULL && - (access_requester == NULL || - access_requester == curthread)) { - access_owner = curthread; - access_requester = NULL; - } else { - if (access_requester == NULL) - access_requester = curthread; - - cv_wait(&access_cv, &access_mtx); - } - } - - mtx_unlock(&access_mtx); + sx_xlock(&access_lock); } -static void +static __inline void filemon_unlock_write(void) { - mtx_lock(&access_mtx); - - /* Sanity check that the current thread actually has the write lock. */ - if (access_owner == curthread) - access_owner = NULL; - - /* Wake up a thread waiting. */ - cv_broadcast(&access_cv); - mtx_unlock(&access_mtx); + sx_xunlock(&access_lock); } Modified: stable/9/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/9/sys/dev/filemon/filemon_wrapper.c Tue Sep 29 18:39:58 2015 (r288387) +++ stable/9/sys/dev/filemon/filemon_wrapper.c Tue Sep 29 18:46:39 2015 (r288388) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2011, David E. O'Brien. * Copyright (c) 2009-2011, Juniper Networks, Inc. + * Copyright (c) 2015, EMC Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,17 +87,25 @@ filemon_pid_check(struct proc *p) { struct filemon *filemon; + filemon_lock_read(); + if (TAILQ_EMPTY(&filemons_inuse)) { + filemon_unlock_read(); + return (NULL); + } sx_slock(&proctree_lock); while (p != initproc) { TAILQ_FOREACH(filemon, &filemons_inuse, link) { if (p->p_pid == filemon->pid) { sx_sunlock(&proctree_lock); + filemon_filemon_lock(filemon); + filemon_unlock_read(); return (filemon); } } p = proc_realparent(p); } sx_sunlock(&proctree_lock); + filemon_unlock_read(); return (NULL); } @@ -109,9 +118,6 @@ filemon_comment(struct filemon *filemon) /* Load timestamp before locking. Less accurate but less contention. */ getmicrotime(&now); - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - /* Lock the found filemon structure. */ filemon_filemon_lock(filemon); @@ -124,9 +130,6 @@ filemon_comment(struct filemon *filemon) /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); - - /* Release the read lock. */ - filemon_unlock_read(); } static int @@ -138,13 +141,7 @@ filemon_wrapper_chdir(struct thread *td, struct filemon *filemon; if ((ret = sys_chdir(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -157,9 +154,6 @@ filemon_wrapper_chdir(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -177,13 +171,7 @@ filemon_wrapper_execve(struct thread *td copyinstr(uap->fname, fname, sizeof(fname), &done); if ((ret = sys_execve(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "E %d %s\n", curproc->p_pid, fname); @@ -193,9 +181,6 @@ filemon_wrapper_execve(struct thread *td /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -215,13 +200,7 @@ filemon_wrapper_freebsd32_execve(struct copyinstr(uap->fname, fname, sizeof(fname), &done); if ((ret = freebsd32_execve(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "E %d %s\n", curproc->p_pid, fname); @@ -231,9 +210,6 @@ filemon_wrapper_freebsd32_execve(struct /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -248,13 +224,7 @@ filemon_wrapper_fork(struct thread *td, struct filemon *filemon; if ((ret = sys_fork(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "F %d %ld\n", curproc->p_pid, (long)curthread->td_retval[0]); @@ -264,9 +234,6 @@ filemon_wrapper_fork(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -281,13 +248,7 @@ filemon_wrapper_open(struct thread *td, struct filemon *filemon; if ((ret = sys_open(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -313,9 +274,6 @@ filemon_wrapper_open(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -330,13 +288,7 @@ filemon_wrapper_openat(struct thread *td struct filemon *filemon; if ((ret = sys_openat(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -375,9 +327,6 @@ filemon_wrapper_openat(struct thread *td /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -392,13 +341,7 @@ filemon_wrapper_rename(struct thread *td struct filemon *filemon; if ((ret = sys_rename(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->from, filemon->fname1, sizeof(filemon->fname1), &done); copyinstr(uap->to, filemon->fname2, @@ -413,9 +356,6 @@ filemon_wrapper_rename(struct thread *td /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -430,13 +370,7 @@ filemon_wrapper_link(struct thread *td, struct filemon *filemon; if ((ret = sys_link(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); copyinstr(uap->link, filemon->fname2, @@ -451,9 +385,6 @@ filemon_wrapper_link(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -468,13 +399,7 @@ filemon_wrapper_symlink(struct thread *t struct filemon *filemon; if ((ret = sys_symlink(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); copyinstr(uap->link, filemon->fname2, @@ -489,9 +414,6 @@ filemon_wrapper_symlink(struct thread *t /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -507,13 +429,7 @@ filemon_wrapper_linkat(struct thread *td struct filemon *filemon; if ((ret = sys_linkat(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path1, filemon->fname1, sizeof(filemon->fname1), &done); copyinstr(uap->path2, filemon->fname2, @@ -528,9 +444,6 @@ filemon_wrapper_linkat(struct thread *td /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -546,13 +459,7 @@ filemon_wrapper_stat(struct thread *td, struct filemon *filemon; if ((ret = sys_stat(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -565,9 +472,6 @@ filemon_wrapper_stat(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -584,13 +488,7 @@ filemon_wrapper_freebsd32_stat(struct th struct filemon *filemon; if ((ret = freebsd32_stat(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -603,9 +501,6 @@ filemon_wrapper_freebsd32_stat(struct th /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -622,13 +517,7 @@ filemon_wrapper_sys_exit(struct thread * /* Get timestamp before locking. */ getmicrotime(&now); - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "X %d %d\n", curproc->p_pid, uap->rval); @@ -649,9 +538,6 @@ filemon_wrapper_sys_exit(struct thread * filemon_filemon_unlock(filemon); } - /* Release the read lock. */ - filemon_unlock_read(); - sys_sys_exit(td, uap); } @@ -664,13 +550,7 @@ filemon_wrapper_unlink(struct thread *td struct filemon *filemon; if ((ret = sys_unlink(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done); @@ -683,9 +563,6 @@ filemon_wrapper_unlink(struct thread *td /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); @@ -699,13 +576,7 @@ filemon_wrapper_vfork(struct thread *td, struct filemon *filemon; if ((ret = sys_vfork(td, uap)) == 0) { - /* Grab a read lock on the filemon inuse list. */ - filemon_lock_read(); - if ((filemon = filemon_pid_check(curproc)) != NULL) { - /* Lock the found filemon structure. */ - filemon_filemon_lock(filemon); - len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "F %d %ld\n", curproc->p_pid, (long)curthread->td_retval[0]); @@ -715,9 +586,6 @@ filemon_wrapper_vfork(struct thread *td, /* Unlock the found filemon structure. */ filemon_filemon_unlock(filemon); } - - /* Release the read lock. */ - filemon_unlock_read(); } return (ret); From owner-svn-src-all@freebsd.org Tue Sep 29 18:48:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42EB8A0A3DE; Tue, 29 Sep 2015 18:48:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30E881574; Tue, 29 Sep 2015 18:48:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TImDuS023484; Tue, 29 Sep 2015 18:48:13 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TImDMS023483; Tue, 29 Sep 2015 18:48:13 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291848.t8TImDMS023483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288389 - head/lib/libugidfw 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:48:13 -0000 Author: bdrewery Date: Tue Sep 29 18:48:12 2015 New Revision: 288389 URL: https://svnweb.freebsd.org/changeset/base/288389 Log: Fix 'ugidfw remove' after r284251 incorrectly changed it. The sysctl_rule() node removes entries when given a newptr and newlen == 0. Modified: head/lib/libugidfw/ugidfw.c Modified: head/lib/libugidfw/ugidfw.c ============================================================================== --- head/lib/libugidfw/ugidfw.c Tue Sep 29 18:46:39 2015 (r288388) +++ head/lib/libugidfw/ugidfw.c Tue Sep 29 18:48:12 2015 (r288389) @@ -1233,7 +1233,7 @@ bsde_delete_rule(int rulenum, size_t buf name[len] = rulenum; len++; - error = sysctl(name, len, NULL, NULL, &rule, sizeof(rule)); + error = sysctl(name, len, NULL, NULL, &rule, 0); if (error) { len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); From owner-svn-src-all@freebsd.org Tue Sep 29 18:51:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3800CA0A7AA; Tue, 29 Sep 2015 18:51:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2900D1AAE; Tue, 29 Sep 2015 18:51:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIpvlA027290; Tue, 29 Sep 2015 18:51:57 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIpvYc027289; Tue, 29 Sep 2015 18:51:57 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291851.t8TIpvYc027289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288390 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:51:57 -0000 Author: bdrewery Date: Tue Sep 29 18:51:56 2015 New Revision: 288390 URL: https://svnweb.freebsd.org/changeset/base/288390 Log: When stopping ugidfw, it is not enough to just try unloading the module. If the module is built-in to the kernel then the kldunload will fail. Rather than do this just check if there are rules and then remove them all. Add requirement on FILESYSTEMS to ensure /usr is present for /usr/sbin/ugidfw and /usr/bin/xargs. This was already effectively the ordering from rcorder(8). MFC after: 2 weeks Relnotes: yes Modified: head/etc/rc.d/ugidfw Modified: head/etc/rc.d/ugidfw ============================================================================== --- head/etc/rc.d/ugidfw Tue Sep 29 18:48:12 2015 (r288389) +++ head/etc/rc.d/ugidfw Tue Sep 29 18:51:56 2015 (r288390) @@ -3,6 +3,7 @@ # $FreeBSD$ # PROVIDE: ugidfw +# REQUIRE: FILESYSTEMS # BEFORE: LOGIN # KEYWORD: nojail shutdown @@ -33,9 +34,17 @@ ugidfw_start() ugidfw_stop() { + local rulecount + # Disable the policy # - kldunload mac_bsdextended + # Check for the existence of rules and flush them if needed. + rulecount=$(sysctl -in security.mac.bsdextended.rule_count) + if [ ${rulecount:-0} -gt 0 ]; then + ugidfw list | sed -n '2,$p' | cut -d ' ' -f 1 | sort -r -n | + xargs -n 1 ugidfw remove + echo "MAC bsdextended rules flushed." + fi } load_rc_config $name From owner-svn-src-all@freebsd.org Tue Sep 29 18:57:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B78C3A0ABE1; Tue, 29 Sep 2015 18:57:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A87AB1CE2; Tue, 29 Sep 2015 18:57:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIvVuO027580; Tue, 29 Sep 2015 18:57:31 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIvVJH027579; Tue, 29 Sep 2015 18:57:31 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291857.t8TIvVJH027579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288391 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 18:57:31 -0000 Author: bdrewery Date: Tue Sep 29 18:57:30 2015 New Revision: 288391 URL: https://svnweb.freebsd.org/changeset/base/288391 Log: Fix the .MAKE added in r251750 to properly support the historical -n -n. The condition used matches the condition in sys.mk for setting _+_ to blank or +. With this -n will continue to not descend into Makefile.inc1, while -n -n will and cause Makefile.inc1's target to run with -n. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Tue Sep 29 18:51:56 2015 (r288390) +++ head/Makefile Tue Sep 29 18:57:30 2015 (r288391) @@ -243,9 +243,9 @@ cleanworld: # Handle the user-driven targets, using the source relative mk files. # -.if empty(.MAKEFLAGS:M-n) +.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n") # skip this for -n to avoid changing previous behavior of -# 'make -n buildworld' etc. +# 'make -n buildworld' etc. Using -n -n will run it. ${TGTS}: .MAKE tinderbox toolchains kernel-toolchains: .MAKE .endif From owner-svn-src-all@freebsd.org Tue Sep 29 19:14:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFFAEA0BB6C; Tue, 29 Sep 2015 19:14:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E00FA1AE9; Tue, 29 Sep 2015 19:14:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TJEqD6035789; Tue, 29 Sep 2015 19:14:52 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TJEqbw035788; Tue, 29 Sep 2015 19:14:52 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291914.t8TJEqbw035788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 19:14:52 +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: r288392 - in stable: 10/release/doc/share/xml 9/release/doc/share/xml 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 19:14:53 -0000 Author: gjb Date: Tue Sep 29 19:14:52 2015 New Revision: 288392 URL: https://svnweb.freebsd.org/changeset/base/288392 Log: Document SA-15:24. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Tue Sep 29 18:57:30 2015 (r288391) +++ stable/10/release/doc/share/xml/security.xml Tue Sep 29 19:14:52 2015 (r288392) @@ -32,6 +32,13 @@ 25 August 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:24.rpcbind + 29 September 2015 + Remote denial of service + From owner-svn-src-all@freebsd.org Tue Sep 29 19:14:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0336A0BB70; Tue, 29 Sep 2015 19:14:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 905421AEA; Tue, 29 Sep 2015 19:14:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TJErSU035796; Tue, 29 Sep 2015 19:14:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TJErPD035795; Tue, 29 Sep 2015 19:14:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291914.t8TJErPD035795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 19:14:53 +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: r288392 - in stable: 10/release/doc/share/xml 9/release/doc/share/xml 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 19:14:53 -0000 Author: gjb Date: Tue Sep 29 19:14:52 2015 New Revision: 288392 URL: https://svnweb.freebsd.org/changeset/base/288392 Log: Document SA-15:24. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml Modified: stable/9/release/doc/share/xml/security.xml ============================================================================== --- stable/9/release/doc/share/xml/security.xml Tue Sep 29 18:57:30 2015 (r288391) +++ stable/9/release/doc/share/xml/security.xml Tue Sep 29 19:14:52 2015 (r288392) @@ -231,6 +231,13 @@ Remote denial of service vulnerability + + + FreeBSD-SA-15:24.rpcbind + 29 September 2015 + Remote denial of service + From owner-svn-src-all@freebsd.org Tue Sep 29 19:15:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2916A0BBF2; Tue, 29 Sep 2015 19:15:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8D21D60; Tue, 29 Sep 2015 19:15:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TJF9kp035884; Tue, 29 Sep 2015 19:15:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TJF9SE035883; Tue, 29 Sep 2015 19:15:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509291915.t8TJF9SE035883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 19:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288393 - head/sys/dev/iwn 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 19:15:09 -0000 Author: adrian Date: Tue Sep 29 19:15:08 2015 New Revision: 288393 URL: https://svnweb.freebsd.org/changeset/base/288393 Log: Fix locking after my EDCA update change. The net80211 lock is no longer held during this call, so we don't have to unlock/relock. Noticed by: David Wolfskill Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue Sep 29 19:14:52 2015 (r288392) +++ head/sys/dev/iwn/if_iwn.c Tue Sep 29 19:15:08 2015 (r288393) @@ -5344,6 +5344,8 @@ iwn_updateedca(struct ieee80211com *ic) memset(&cmd, 0, sizeof cmd); cmd.flags = htole32(IWN_EDCA_UPDATE); + + IEEE80211_LOCK(ic); for (aci = 0; aci < WME_NUM_AC; aci++) { const struct wmeParams *ac = &ic->ic_wme.wme_chanParams.cap_wmeParams[aci]; @@ -5354,10 +5356,10 @@ iwn_updateedca(struct ieee80211com *ic) htole16(IEEE80211_TXOP_TO_US(ac->wmep_txopLimit)); } IEEE80211_UNLOCK(ic); + IWN_LOCK(sc); (void)iwn_cmd(sc, IWN_CMD_EDCA_PARAMS, &cmd, sizeof cmd, 1); IWN_UNLOCK(sc); - IEEE80211_LOCK(ic); DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); From owner-svn-src-all@freebsd.org Tue Sep 29 21:45:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A0ABA0BA0B; Tue, 29 Sep 2015 21:45:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 215801E1B; Tue, 29 Sep 2015 21:45:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLjO1P096771; Tue, 29 Sep 2015 21:45:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLjNUb096770; Tue, 29 Sep 2015 21:45:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292145.t8TLjNUb096770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:45:23 +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: r288396 - stable/10/tools/build/options 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:45:24 -0000 Author: bdrewery Date: Tue Sep 29 21:45:23 2015 New Revision: 288396 URL: https://svnweb.freebsd.org/changeset/base/288396 Log: MFC r287935: Optimize makeman slightly by removing uneeded cat and extra test -s. Modified: stable/10/tools/build/options/makeman Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/build/options/makeman ============================================================================== --- stable/10/tools/build/options/makeman Tue Sep 29 21:16:35 2015 (r288395) +++ stable/10/tools/build/options/makeman Tue Sep 29 21:45:23 2015 (r288396) @@ -59,7 +59,7 @@ show_options() fi done - cat $t/settings | while read opt targets ; do + while read opt targets ; do if [ "${targets}" = "${ALL_TARGETS}" ] ; then echo "WITHOUT_${opt}" elif [ -z "${targets}" ] ; then @@ -68,7 +68,7 @@ show_options() echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}") echo "WITH_${opt} ${targets}" fi - done + done < $t/settings } # @@ -250,31 +250,33 @@ EOF :> $t/deps2 fi + havedeps=0 if [ -s $t/deps ] ; then + havedeps=1 echo 'When set, it also enforces the following options:' echo '.Pp' echo '.Bl -item -compact' - cat $t/deps | while read opt2 ; do + while read opt2 ; do echo '.It' echo ".Va ${opt2}" - done + done < $t/deps echo '.El' fi if [ -s $t/deps2 ] ; then - if [ -s $t/deps ] ; then + if [ ${havedeps} -eq 1 ] ; then echo '.Pp' fi echo 'When set, the following options are also in effect:' echo '.Pp' echo '.Bl -inset -compact' - cat $t/deps2 | while read opt2 ; do + while read opt2 ; do echo ".It Va ${opt2}" noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/') echo '(unless' echo ".Va ${noopt}" echo 'is set explicitly)' - done + done < $t/deps2 echo '.El' fi twiddle >&2 From owner-svn-src-all@freebsd.org Tue Sep 29 21:47:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 989C3A0BB5C; Tue, 29 Sep 2015 21:47:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 889501FBE; Tue, 29 Sep 2015 21:47:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLlppd096912; Tue, 29 Sep 2015 21:47:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLlpOf096910; Tue, 29 Sep 2015 21:47:51 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292147.t8TLlpOf096910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:47: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: r288397 - stable/10/usr.sbin/sysrc 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:47:51 -0000 Author: bdrewery Date: Tue Sep 29 21:47:50 2015 New Revision: 288397 URL: https://svnweb.freebsd.org/changeset/base/288397 Log: MFC r287979: Remove redundant beforeinstall. Modified: stable/10/usr.sbin/sysrc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/sysrc/Makefile ============================================================================== --- stable/10/usr.sbin/sysrc/Makefile Tue Sep 29 21:45:23 2015 (r288396) +++ stable/10/usr.sbin/sysrc/Makefile Tue Sep 29 21:47:50 2015 (r288397) @@ -4,8 +4,4 @@ SCRIPTS= sysrc MAN= sysrc.8 -beforeinstall: - mkdir -p ${DESTDIR}${SCRIPTSDIR} - mkdir -p ${DESTDIR}${MANDIR}8 - .include From owner-svn-src-all@freebsd.org Tue Sep 29 21:48:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D454A0BC44; Tue, 29 Sep 2015 21:48:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58D50118D; Tue, 29 Sep 2015 21:48:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLmqvr097111; Tue, 29 Sep 2015 21:48:52 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLmqCr097110; Tue, 29 Sep 2015 21:48:52 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292148.t8TLmqCr097110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:48:52 +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: r288398 - stable/9/usr.sbin/sysrc 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:48:52 -0000 Author: bdrewery Date: Tue Sep 29 21:48:51 2015 New Revision: 288398 URL: https://svnweb.freebsd.org/changeset/base/288398 Log: MFC r287979: Remove redundant beforeinstall. Modified: stable/9/usr.sbin/sysrc/Makefile Directory Properties: stable/9/usr.sbin/sysrc/ (props changed) Modified: stable/9/usr.sbin/sysrc/Makefile ============================================================================== --- stable/9/usr.sbin/sysrc/Makefile Tue Sep 29 21:47:50 2015 (r288397) +++ stable/9/usr.sbin/sysrc/Makefile Tue Sep 29 21:48:51 2015 (r288398) @@ -4,8 +4,4 @@ SCRIPTS= sysrc MAN= sysrc.8 -beforeinstall: - mkdir -p ${DESTDIR}${SCRIPTSDIR} - mkdir -p ${DESTDIR}${MANDIR}8 - .include From owner-svn-src-all@freebsd.org Tue Sep 29 21:52:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6177A0BFB7; Tue, 29 Sep 2015 21:52:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2D91627; Tue, 29 Sep 2015 21:52:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLqXjk001042; Tue, 29 Sep 2015 21:52:33 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLqXpH001041; Tue, 29 Sep 2015 21:52:33 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292152.t8TLqXpH001041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:52:33 +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: r288399 - stable/9/tools/build/options 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:52:33 -0000 Author: bdrewery Date: Tue Sep 29 21:52:32 2015 New Revision: 288399 URL: https://svnweb.freebsd.org/changeset/base/288399 Log: MFC r287935: Optimize makeman slightly by removing uneeded cat and extra test -s. Modified: stable/9/tools/build/options/makeman Directory Properties: stable/9/tools/build/options/ (props changed) Modified: stable/9/tools/build/options/makeman ============================================================================== --- stable/9/tools/build/options/makeman Tue Sep 29 21:48:51 2015 (r288398) +++ stable/9/tools/build/options/makeman Tue Sep 29 21:52:32 2015 (r288399) @@ -59,7 +59,7 @@ show_options() fi done - cat $t/settings | while read opt targets ; do + while read opt targets ; do if [ "${targets}" = "${ALL_TARGETS}" ] ; then echo "WITHOUT_${opt}" elif [ -z "${targets}" ] ; then @@ -68,7 +68,7 @@ show_options() echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}") echo "WITH_${opt} ${targets}" fi - done + done < $t/settings } # @@ -250,31 +250,33 @@ EOF :> $t/deps2 fi + havedeps=0 if [ -s $t/deps ] ; then + havedeps=1 echo 'When set, it also enforces the following options:' echo '.Pp' echo '.Bl -item -compact' - cat $t/deps | while read opt2 ; do + while read opt2 ; do echo '.It' echo ".Va ${opt2}" - done + done < $t/deps echo '.El' fi if [ -s $t/deps2 ] ; then - if [ -s $t/deps ] ; then + if [ ${havedeps} -eq 1 ] ; then echo '.Pp' fi echo 'When set, the following options are also in effect:' echo '.Pp' echo '.Bl -inset -compact' - cat $t/deps2 | while read opt2 ; do + while read opt2 ; do echo ".It Va ${opt2}" noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/') echo '(unless' echo ".Va ${noopt}" echo 'is set explicitly)' - done + done < $t/deps2 echo '.El' fi twiddle >&2 From owner-svn-src-all@freebsd.org Tue Sep 29 21:54:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE7E7A0C07E; Tue, 29 Sep 2015 21:54:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE37318B5; Tue, 29 Sep 2015 21:54:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLsAeA001168; Tue, 29 Sep 2015 21:54:10 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLsAh2001167; Tue, 29 Sep 2015 21:54:10 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292154.t8TLsAh2001167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:54:10 +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: r288400 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:54:11 -0000 Author: bdrewery Date: Tue Sep 29 21:54:09 2015 New Revision: 288400 URL: https://svnweb.freebsd.org/changeset/base/288400 Log: MFC r288091: vfs_mountroot_shuffle() never returns non-zero. Modified: stable/10/sys/kern/vfs_mountroot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_mountroot.c ============================================================================== --- stable/10/sys/kern/vfs_mountroot.c Tue Sep 29 21:52:32 2015 (r288399) +++ stable/10/sys/kern/vfs_mountroot.c Tue Sep 29 21:54:09 2015 (r288400) @@ -245,7 +245,7 @@ vfs_mountroot_devfs(struct thread *td, s return (error); } -static int +static void vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) { struct nameidata nd; @@ -355,8 +355,6 @@ vfs_mountroot_shuffle(struct thread *td, printf("mountroot: unable to unlink /dev/dev " "(error %d)\n", error); } - - return (0); } /* @@ -948,12 +946,10 @@ vfs_mountroot(void) while (!error) { error = vfs_mountroot_parse(sb, mp); if (!error) { - error = vfs_mountroot_shuffle(td, mp); - if (!error) { - sbuf_clear(sb); - error = vfs_mountroot_readconf(td, sb); - sbuf_finish(sb); - } + vfs_mountroot_shuffle(td, mp); + sbuf_clear(sb); + error = vfs_mountroot_readconf(td, sb); + sbuf_finish(sb); } } From owner-svn-src-all@freebsd.org Tue Sep 29 21:55:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F79DA0C1A9; Tue, 29 Sep 2015 21:55:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E74751A3B; Tue, 29 Sep 2015 21:55:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TLtjH4001303; Tue, 29 Sep 2015 21:55:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TLtjVR001302; Tue, 29 Sep 2015 21:55:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292155.t8TLtjVR001302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 21:55:45 +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: r288401 - stable/9/share/man/man5 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 21:55:46 -0000 Author: bdrewery Date: Tue Sep 29 21:55:45 2015 New Revision: 288401 URL: https://svnweb.freebsd.org/changeset/base/288401 Log: Regenerate after r280421. Modified: stable/9/share/man/man5/src.conf.5 Modified: stable/9/share/man/man5/src.conf.5 ============================================================================== --- stable/9/share/man/man5/src.conf.5 Tue Sep 29 21:54:09 2015 (r288400) +++ stable/9/share/man/man5/src.conf.5 Tue Sep 29 21:55:45 2015 (r288401) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. -.\" from FreeBSD: stable/9/tools/build/options/makeman 263058 2014-03-11 23:04:32Z gjb +.\" from FreeBSD: stable/9/tools/build/options/makeman 288399 2015-09-29 21:52:32Z bdrewery .\" $FreeBSD$ -.Dd February 13, 2015 +.Dd September 29, 2015 .Dt SRC.CONF 5 .Os .Sh NAME @@ -220,6 +220,14 @@ Set to not build Bluetooth related kerne .It Va WITHOUT_BOOT .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_BOOT 156932 2006-03-21 07:50:50Z ru Set to not build the boot blocks and loader. +.It Va WITHOUT_BOOTPARAMD +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_BOOTPARAMD 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr bootparamd 8 . +.It Va WITHOUT_BOOTPD +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_BOOTPD 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr bootpd 8 . .It Va WITHOUT_BSDINSTALL .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_BSDINSTALL 278714 2015-02-13 21:25:56Z ngie Set to not build @@ -425,6 +433,17 @@ This includes the device tree compiler ( .Pp It is a default setting on arm/arm, arm/armeb, powerpc/powerpc and powerpc/powerpc64. +.It Va WITHOUT_FILE +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_FILE 280421 2015-03-24 07:11:54Z ngie +Set to not build +.Xr file 1 +and related programs. +.It Va WITHOUT_FINGER +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_FINGER 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr finger 1 +and +.Xr fingerd 8 . .It Va WITHOUT_FLOPPY .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru Set to not build or install programs @@ -441,6 +460,12 @@ without floating-point support. .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_FREEBSD_UPDATE 183242 2008-09-21 22:02:26Z sam Set to not build .Xr freebsd-update 8 . +.It Va WITHOUT_FTP +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_FTP 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr ftp 1 +and +.Xr ftpd 8 . .It Va WITHOUT_GAMES .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru Set to not build games. @@ -539,6 +564,10 @@ When set, it also enforces the following .It Va WITHOUT_INET6_SUPPORT .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build libraries, programs, and kernel modules without IPv6 support. +.It Va WITHOUT_INETD +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_INETD 280421 2015-03-24 07:11:54Z ngie +Set to not build +.Xr inetd 8 . .It Va WITHOUT_INET_SUPPORT .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_INET_SUPPORT 221266 2011-04-30 17:58:28Z bz Set to build libraries, programs, and kernel modules without IPv4 support. @@ -640,9 +669,6 @@ and On amd64, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. -.It Va WITH_LIBCPLUSPLUS -.\" from FreeBSD: stable/9/tools/build/options/WITH_LIBCPLUSPLUS 246322 2013-02-04 16:13:55Z des -Set to build libcxxrt and libc++. .It Va WITHOUT_LIBPTHREAD .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_LIBPTHREAD 188848 2009-02-20 11:09:55Z mtm Set to not build the @@ -928,6 +954,16 @@ Set to avoid compiling profiled librarie Set to not build .Xr quota 8 and related programs. +.It Va WITHOUT_RADIUS_SUPPORT +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_RADIUS_SUPPORT 280421 2015-03-24 07:11:54Z ngie +Set to not build radius support into various applications, like +.Xr pam_radius 8 +and +.Xr ppp 8 . +.It Va WITHOUT_RBOOTD +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_RBOOTD 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr rbootd 8 . .It Va WITHOUT_RCMDS .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_RCMDS 156932 2006-03-21 07:50:50Z ru Disable building of the @@ -1012,6 +1048,11 @@ Set to not build or install .Xr talk 1 and .Xr talkd 8 . +.It Va WITHOUT_TCP_WRAPPERS +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_TCP_WRAPPERS 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr tcpd 8 , +and related utilities. .It Va WITHOUT_TCSH .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_TCSH 156932 2006-03-21 07:50:50Z ru Set to not build and install @@ -1033,6 +1074,16 @@ When set, it also enforces the following .It .Va WITHOUT_GROFF .El +.It Va WITHOUT_TFTP +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_TFTP 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr tftp 1 +and +.Xr tftpd 8 . +.It Va WITHOUT_TIMED +.\" from FreeBSD: stable/9/tools/build/options/WITHOUT_TIMED 280421 2015-03-24 07:11:54Z ngie +Set to not build or install +.Xr timed 8 . .It Va WITHOUT_TOOLCHAIN .\" from FreeBSD: stable/9/tools/build/options/WITHOUT_TOOLCHAIN 174550 2007-12-12 16:43:17Z ru Set to not install From owner-svn-src-all@freebsd.org Tue Sep 29 22:00:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FE51A0C466; Tue, 29 Sep 2015 22:00:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FE291E21; Tue, 29 Sep 2015 22:00:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TM04VQ001764; Tue, 29 Sep 2015 22:00:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TM04iV001763; Tue, 29 Sep 2015 22:00:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509292200.t8TM04iV001763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 22:00: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: r288403 - stable/10/usr.bin/bmake 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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 22:00:04 -0000 Author: bdrewery Date: Tue Sep 29 22:00:03 2015 New Revision: 288403 URL: https://svnweb.freebsd.org/changeset/base/288403 Log: MFC r288154: Similar to r266147, don't define PROG in the test subdirs. Modified: stable/10/usr.bin/bmake/Makefile.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/bmake/Makefile.inc ============================================================================== --- stable/10/usr.bin/bmake/Makefile.inc Tue Sep 29 21:57:52 2015 (r288402) +++ stable/10/usr.bin/bmake/Makefile.inc Tue Sep 29 22:00:03 2015 (r288403) @@ -13,7 +13,7 @@ MK_BMAKE= yes .endif -.if defined(MK_BMAKE) && ${MK_BMAKE} != "no" +.if defined(MK_BMAKE) && ${MK_BMAKE} != "no" && exists(${.CURDIR}/tests) PROG= make .endif From owner-svn-src-all@freebsd.org Tue Sep 29 23:54:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A41E8A0B3B1; Tue, 29 Sep 2015 23:54:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 957531B4B; Tue, 29 Sep 2015 23:54:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TNsR7u051200; Tue, 29 Sep 2015 23:54:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TNsRhg051199; Tue, 29 Sep 2015 23:54:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509292354.t8TNsRhg051199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 23:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288405 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 29 Sep 2015 23:54:27 -0000 Author: jhb Date: Tue Sep 29 23:54:26 2015 New Revision: 288405 URL: https://svnweb.freebsd.org/changeset/base/288405 Log: Decode recently added procctl(2) operations. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Sep 29 22:33:26 2015 (r288404) +++ head/usr.bin/truss/syscalls.c Tue Sep 29 23:54:26 2015 (r288405) @@ -534,7 +534,9 @@ static struct xlat idtype_arg[] = { }; static struct xlat procctl_arg[] = { - X(PROC_SPROTECT) XEND + X(PROC_SPROTECT) X(PROC_REAP_ACQUIRE) X(PROC_REAP_RELEASE) + X(PROC_REAP_STATUS) X(PROC_REAP_GETPIDS) X(PROC_REAP_KILL) + X(PROC_TRACE_CTL) X(PROC_TRACE_STATUS) XEND }; static struct xlat umtx_ops[] = { From owner-svn-src-all@freebsd.org Wed Sep 30 00:08:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCF5EA0C2A2; Wed, 30 Sep 2015 00:08:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A593912F6; Wed, 30 Sep 2015 00:08:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U08P6M055491; Wed, 30 Sep 2015 00:08:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U08Owa055488; Wed, 30 Sep 2015 00:08:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509300008.t8U08Owa055488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Sep 2015 00:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288406 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 00:08:25 -0000 Author: jhb Date: Wed Sep 30 00:08:24 2015 New Revision: 288406 URL: https://svnweb.freebsd.org/changeset/base/288406 Log: Trim trailing whitespace. Modified: head/usr.bin/truss/arm-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/arm-fbsd.c ============================================================================== --- head/usr.bin/truss/arm-fbsd.c Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/arm-fbsd.c Wed Sep 30 00:08:24 2015 (r288406) @@ -140,7 +140,7 @@ arm_syscall_entry(struct trussinfo *trus #ifdef __ARM_EABI__ syscall_num = regs.r[7]; #else - if ((syscall_num = ptrace(PT_READ_I, tid, + if ((syscall_num = ptrace(PT_READ_I, tid, (caddr_t)(regs.r[_REG_PC] - INSN_SIZE), 0)) == -1) { fprintf(trussinfo->outfile, "-- CANNOT READ PC --\n"); return; Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/syscall.h Wed Sep 30 00:08:24 2015 (r288406) @@ -86,11 +86,11 @@ char *print_arg(struct syscall_args *, u #define LINUX_SETSOCKOPT 14 #define LINUX_GETSOCKOPT 15 #define LINUX_SENDMSG 16 -#define LINUX_RECVMSG 17 +#define LINUX_RECVMSG 17 #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) - + #if BYTE_ORDER == LITTLE_ENDIAN #define PADL_(t) 0 #define PADR_(t) PAD_(t) Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/syscalls.c Wed Sep 30 00:08:24 2015 (r288406) @@ -811,7 +811,7 @@ print_kevent(FILE *fp, struct kevent *ke int ctrl, data; ctrl = ke->fflags & NOTE_FFCTRLMASK; - data = ke->fflags & NOTE_FFLAGSMASK; + data = ke->fflags & NOTE_FFLAGSMASK; if (input) { fputs(xlookup(kevent_user_ffctrl, ctrl), fp); if (ke->fflags & NOTE_TRIGGER) @@ -937,7 +937,7 @@ print_arg(struct syscall_args *sc, unsig fprintf(fp, "0x%lx", args[sc->offset]); break; } - + /* * Read a page of pointers at a time. Punt if the top-level * pointer is not aligned. Note that the first read is of From owner-svn-src-all@freebsd.org Wed Sep 30 00:11:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74609A0C4E4; Wed, 30 Sep 2015 00:11:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 618EA1641; Wed, 30 Sep 2015 00:11:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U0B7HU059284; Wed, 30 Sep 2015 00:11:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U0B6XC059282; Wed, 30 Sep 2015 00:11:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509300011.t8U0B6XC059282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Sep 2015 00:11: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: r288407 - stable/10/usr.bin/vmstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 00:11:07 -0000 Author: jhb Date: Wed Sep 30 00:11:06 2015 New Revision: 288407 URL: https://svnweb.freebsd.org/changeset/base/288407 Log: MFC 269727: Update vmstat usage for last-argument count/wait parameters Correct the usage in both the manpage and in usage() to indicate that the wait interval and repetition count may be given either with the respective -w/-c arguments, or as the final positional arguments. [0] The corresponding code to implement the positional arguments has been conditional on the (always-enabled) BACKWARD_COMPATIBILITY macro since the original 4.4-lite import. It's no longer reasonable to remove the functionality, so remove the macro and conditional instead. Note that multiple disks may be given on the command line. While here, sort arguments and apply minor mdoc fixes. PR: 184755 [0] Modified: stable/10/usr.bin/vmstat/vmstat.8 stable/10/usr.bin/vmstat/vmstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/vmstat/vmstat.8 ============================================================================== --- stable/10/usr.bin/vmstat/vmstat.8 Wed Sep 30 00:08:24 2015 (r288406) +++ stable/10/usr.bin/vmstat/vmstat.8 Wed Sep 30 00:11:06 2015 (r288407) @@ -28,7 +28,7 @@ .\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd October 21, 2006 +.Dd August 8, 2014 .Dt VMSTAT 8 .Os .Sh NAME @@ -38,9 +38,8 @@ .Nm .\" .Op Fl fimst .Op Fl afHhimPsz -.Op Fl c Ar count .Op Fl M Ar core Op Fl N Ar system -.Op Fl w Ar wait +.Op Fl c Ar count .Op Fl n Ar devs .Oo .Fl p @@ -48,7 +47,9 @@ .Ar type , if , pass .Sm on .Oc -.Op Ar disks +.Op Fl w Ar wait +.Op Ar disks ... +.Op wait Op count .Sh DESCRIPTION The .Nm @@ -91,10 +92,12 @@ and system calls since system startup, and the number of pages of virtual memory involved in each. .It Fl h -Changes memory columns into more easily human readable form. Default if +Changes memory columns into more easily human readable form. +The default if standard output is a terminal device. .It Fl H -Changes memory columns into straight numbers. Default if standard output +Changes memory columns into straight numbers. +The default if standard output is not a terminal device (such as a script). .It Fl i Report on the number of interrupts taken by each device since system @@ -214,6 +217,21 @@ Report on memory used by the kernel zone by zone. .El .Pp +The +.Ar wait +and +.Ar count +arguments may be given after their respective flags at any point +on the command line before the +.Ar disks +argument(s), or without their flags, as the final argument(s). +The latter form is accepted for backwards compatibility, but it is +preferred to use the forms with +.Fl w +and +.Fl c +to avoid ambiguity. +.Pp By default, .Nm displays the following information: Modified: stable/10/usr.bin/vmstat/vmstat.c ============================================================================== --- stable/10/usr.bin/vmstat/vmstat.c Wed Sep 30 00:08:24 2015 (r288406) +++ stable/10/usr.bin/vmstat/vmstat.c Wed Sep 30 00:11:06 2015 (r288407) @@ -289,15 +289,12 @@ main(int argc, char *argv[]) argv = getdrivedata(argv); } -#define BACKWARD_COMPATIBILITY -#ifdef BACKWARD_COMPATIBILITY if (*argv) { f = atof(*argv); interval = f * 1000; if (*++argv) reps = atoi(*argv); } -#endif if (interval) { if (!reps) @@ -1354,7 +1351,7 @@ static void usage(void) { (void)fprintf(stderr, "%s%s", - "usage: vmstat [-afHhimPsz] [-c count] [-M core [-N system]] [-w wait]\n", - " [-n devs] [-p type,if,pass] [disks]\n"); + "usage: vmstat [-afHhimPsz] [-M core [-N system]] [-c count] [-n devs]\n", + " [-p type,if,pass] [-w wait] [disks] [wait [count]]\n"); exit(1); } From owner-svn-src-all@freebsd.org Wed Sep 30 03:30:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C76C4A0C4A9; Wed, 30 Sep 2015 03:30:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B60C91A0A; Wed, 30 Sep 2015 03:30:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3UPh6042357; Wed, 30 Sep 2015 03:30:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3UPbZ042354; Wed, 30 Sep 2015 03:30:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300330.t8U3UPbZ042354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 03:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288408 - vendor-sys/illumos/dist/uts/common/dtrace vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/dtrace/test/tst/common/privs vendor/illumos/dist/cmd/dtrace/test/tst/c... 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:30:26 -0000 Author: markj Date: Wed Sep 30 03:30:24 2015 New Revision: 288408 URL: https://svnweb.freebsd.org/changeset/base/288408 Log: 6266 harden dtrace_difo_chunksize() with respect to malicious DIF illumos/illumos-gate@395c7a3dcfc66b8b671dc4b3c4a2f0ca26449922 Reviewed by: Alex Wilson Reviewed by: Dan McDonald Approved by: Garrett D'Amore Author: Bryan Cantrill Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.biglocal.d (contents, props changed) Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh Wed Sep 30 03:30:24 2015 (r288408) @@ -0,0 +1,112 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2015, Joyent, Inc. All rights reserved. +# + +err=/tmp/err.$$ + +ppriv -s A=basic,dtrace_user $$ + +# +# When we lack dtrace_kernel, we expect to not be able to get at kernel memory +# via any subroutine or other vector. +# +# trace(func((void *)&\`utsname)); } +/usr/sbin/dtrace -wq -Cs /dev/stdin 2> $err <mrbig.toomany[0] = '!'; + exit(0); +} From owner-svn-src-all@freebsd.org Wed Sep 30 03:30:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3530A0C4AF; Wed, 30 Sep 2015 03:30:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A79791A0C; Wed, 30 Sep 2015 03:30:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3UQ2P042366; Wed, 30 Sep 2015 03:30:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3UQDx042363; Wed, 30 Sep 2015 03:30:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300330.t8U3UQDx042363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 03:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288408 - vendor-sys/illumos/dist/uts/common/dtrace vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/dtrace/test/tst/common/privs vendor/illumos/dist/cmd/dtrace/test/tst/c... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:30:26 -0000 Author: markj Date: Wed Sep 30 03:30:24 2015 New Revision: 288408 URL: https://svnweb.freebsd.org/changeset/base/288408 Log: 6266 harden dtrace_difo_chunksize() with respect to malicious DIF illumos/illumos-gate@395c7a3dcfc66b8b671dc4b3c4a2f0ca26449922 Reviewed by: Alex Wilson Reviewed by: Dan McDonald Approved by: Garrett D'Amore Author: Bryan Cantrill Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h Changes in other areas also in this revision: Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d (contents, props changed) vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.biglocal.d (contents, props changed) Modified: vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c Wed Sep 30 00:11:06 2015 (r288407) +++ vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c Wed Sep 30 03:30:24 2015 (r288408) @@ -118,7 +118,7 @@ int dtrace_destructive_disallow = 0; dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); -size_t dtrace_global_maxsize = (16 * 1024); +size_t dtrace_statvar_maxsize = (16 * 1024); size_t dtrace_actions_max = (16 * 1024); size_t dtrace_retain_max = 1024; dtrace_optval_t dtrace_helper_actions_max = 1024; @@ -592,13 +592,33 @@ dtrace_canstore_statvar(uint64_t addr, s dtrace_statvar_t **svars, int nsvars) { int i; + size_t maxglobalsize, maxlocalsize; + + if (nsvars == 0) + return (0); + + maxglobalsize = dtrace_statvar_maxsize; + maxlocalsize = (maxglobalsize + sizeof (uint64_t)) * NCPU; for (i = 0; i < nsvars; i++) { dtrace_statvar_t *svar = svars[i]; + uint8_t scope; + size_t size; - if (svar == NULL || svar->dtsv_size == 0) + if (svar == NULL || (size = svar->dtsv_size) == 0) continue; + scope = svar->dtsv_var.dtdv_scope; + + /* + * We verify that our size is valid in the spirit of providing + * defense in depth: we want to prevent attackers from using + * DTrace to escalate an orthogonal kernel heap corruption bug + * into the ability to store to arbitrary locations in memory. + */ + VERIFY((scope == DIFV_SCOPE_GLOBAL && size < maxglobalsize) || + (scope == DIFV_SCOPE_LOCAL && size < maxlocalsize)); + if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size)) return (1); } @@ -4165,7 +4185,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state, mstate) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_canload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyout(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -4180,7 +4201,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state, mstate) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_strcanload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyoutstr(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -6078,6 +6100,11 @@ dtrace_dif_emulate(dtrace_difo_t *difo, regs[r2] ? regs[r2] : dtrace_strsize_default) + 1; } else { + if (regs[r2] > LONG_MAX) { + *flags |= CPU_DTRACE_ILLOP; + break; + } + tupregs[ttop].dttk_size = regs[r2]; } @@ -9344,9 +9371,10 @@ dtrace_difo_validate(dtrace_difo_t *dp, break; } - if (v->dtdv_scope == DIFV_SCOPE_GLOBAL && - vt->dtdt_size > dtrace_global_maxsize) { - err += efunc(i, "oversized by-ref global\n"); + if ((v->dtdv_scope == DIFV_SCOPE_GLOBAL || + v->dtdv_scope == DIFV_SCOPE_LOCAL) && + vt->dtdt_size > dtrace_statvar_maxsize) { + err += efunc(i, "oversized by-ref static\n"); break; } } @@ -9683,6 +9711,9 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, if (srd == 0) return; + if (sval > LONG_MAX) + return; + tupregs[ttop++].dttk_size = sval; } @@ -9744,6 +9775,19 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, */ size = P2ROUNDUP(size, sizeof (uint64_t)); + /* + * Before setting the chunk size, check that we're not going + * to set it to a negative value... + */ + if (size > LONG_MAX) + return; + + /* + * ...and make certain that we didn't badly overflow. + */ + if (size < ksize || size < sizeof (dtrace_dynvar_t)) + return; + if (size > vstate->dtvs_dynvars.dtds_chunksize) vstate->dtvs_dynvars.dtds_chunksize = size; } @@ -13184,6 +13228,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((dstate->dtds_chunksize = chunksize) == 0) dstate->dtds_chunksize = DTRACE_DYNVAR_CHUNKSIZE; + VERIFY(dstate->dtds_chunksize < LONG_MAX); + if (size < (min = dstate->dtds_chunksize + sizeof (dtrace_dynhash_t))) size = min; @@ -13224,6 +13270,9 @@ dtrace_dstate_init(dtrace_dstate_t *dsta ((uintptr_t)base + hashsize * sizeof (dtrace_dynhash_t)); limit = (uintptr_t)base + size; + VERIFY((uintptr_t)start < limit); + VERIFY((uintptr_t)start >= (uintptr_t)base); + maxper = (limit - (uintptr_t)start) / NCPU; maxper = (maxper / dstate->dtds_chunksize) * dstate->dtds_chunksize; @@ -13245,7 +13294,7 @@ dtrace_dstate_init(dtrace_dstate_t *dsta start = (dtrace_dynvar_t *)limit; } - ASSERT(limit <= (uintptr_t)base + size); + VERIFY(limit <= (uintptr_t)base + size); for (;;) { next = (dtrace_dynvar_t *)((uintptr_t)dvar + @@ -13254,6 +13303,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((uintptr_t)next + dstate->dtds_chunksize >= limit) break; + VERIFY((uintptr_t)dvar >= (uintptr_t)base && + (uintptr_t)dvar <= (uintptr_t)base + size); dvar->dtdv_next = next; dvar = next; } Modified: vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h Wed Sep 30 00:11:06 2015 (r288407) +++ vendor-sys/illumos/dist/uts/common/sys/dtrace_impl.h Wed Sep 30 03:30:24 2015 (r288408) @@ -1290,16 +1290,19 @@ extern void dtrace_copystr(uintptr_t, ui /* * DTrace Assertions * - * DTrace calls ASSERT from probe context. To assure that a failed ASSERT - * does not induce a markedly more catastrophic failure (e.g., one from which - * a dump cannot be gleaned), DTrace must define its own ASSERT to be one that - * may safely be called from probe context. This header file must thus be - * included by any DTrace component that calls ASSERT from probe context, and - * _only_ by those components. (The only exception to this is kernel - * debugging infrastructure at user-level that doesn't depend on calling - * ASSERT.) + * DTrace calls ASSERT and VERIFY from probe context. To assure that a failed + * ASSERT or VERIFY does not induce a markedly more catastrophic failure (e.g., + * one from which a dump cannot be gleaned), DTrace must define its own ASSERT + * and VERIFY macros to be ones that may safely be called from probe context. + * This header file must thus be included by any DTrace component that calls + * ASSERT and/or VERIFY from probe context, and _only_ by those components. + * (The only exception to this is kernel debugging infrastructure at user-level + * that doesn't depend on calling ASSERT.) */ #undef ASSERT +#undef VERIFY +#define VERIFY(EX) ((void)((EX) || \ + dtrace_assfail(#EX, __FILE__, __LINE__))) #ifdef DEBUG #define ASSERT(EX) ((void)((EX) || \ dtrace_assfail(#EX, __FILE__, __LINE__))) From owner-svn-src-all@freebsd.org Wed Sep 30 03:33:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2456CA0C765; Wed, 30 Sep 2015 03:33:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14C0B1ECE; Wed, 30 Sep 2015 03:33:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3XSI7046323; Wed, 30 Sep 2015 03:33:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3XSfr046322; Wed, 30 Sep 2015 03:33:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300333.t8U3XSfr046322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 03:33:28 +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: r288409 - stable/10/sys/cam/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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:33:29 -0000 Author: markj Date: Wed Sep 30 03:33:28 2015 New Revision: 288409 URL: https://svnweb.freebsd.org/changeset/base/288409 Log: MFC r287806: Preserve the device queue status before retrying a sense request in chdone(). Modified: stable/10/sys/cam/scsi/scsi_ch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_ch.c Wed Sep 30 03:30:24 2015 (r288408) +++ stable/10/sys/cam/scsi/scsi_ch.c Wed Sep 30 03:33:28 2015 (r288409) @@ -655,11 +655,13 @@ chdone(struct cam_periph *periph, union */ return; } else if (error != 0) { - int retry_scheduled; struct scsi_mode_sense_6 *sms; + int frozen, retry_scheduled; sms = (struct scsi_mode_sense_6 *) done_ccb->csio.cdb_io.cdb_bytes; + frozen = (done_ccb->ccb_h.status & + CAM_DEV_QFRZN) != 0; /* * Check to see if block descriptors were @@ -670,7 +672,8 @@ chdone(struct cam_periph *periph, union * block descriptors were disabled, enable * them and re-send the command. */ - if (sms->byte2 & SMS_DBD) { + if ((sms->byte2 & SMS_DBD) != 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { sms->byte2 &= ~SMS_DBD; xpt_action(done_ccb); softc->quirks |= CH_Q_NO_DBD; @@ -679,7 +682,7 @@ chdone(struct cam_periph *periph, union retry_scheduled = 0; /* Don't wedge this device's queue */ - if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + if (frozen) cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, /*reduction*/0, From owner-svn-src-all@freebsd.org Wed Sep 30 03:35:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9E97A0C956; Wed, 30 Sep 2015 03:35:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA6A11084; Wed, 30 Sep 2015 03:35:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3Zx4R046626; Wed, 30 Sep 2015 03:35:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3Zxs6046625; Wed, 30 Sep 2015 03:35:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300335.t8U3Zxs6046625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 03:35: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: r288410 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:36:00 -0000 Author: markj Date: Wed Sep 30 03:35:58 2015 New Revision: 288410 URL: https://svnweb.freebsd.org/changeset/base/288410 Log: MFC r288276: Fix argument ordering in vn_printf(). Modified: stable/10/sys/kern/vfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_subr.c ============================================================================== --- stable/10/sys/kern/vfs_subr.c Wed Sep 30 03:33:28 2015 (r288409) +++ stable/10/sys/kern/vfs_subr.c Wed Sep 30 03:35:58 2015 (r288410) @@ -3010,8 +3010,8 @@ vn_printf(struct vnode *vp, const char * "cleanbuf %d dirtybuf %d\n", vp->v_object, vp->v_object->ref_count, vp->v_object->resident_page_count, - vp->v_bufobj.bo_dirty.bv_cnt, - vp->v_bufobj.bo_clean.bv_cnt); + vp->v_bufobj.bo_clean.bv_cnt, + vp->v_bufobj.bo_dirty.bv_cnt); printf(" "); lockmgr_printinfo(vp->v_vnlock); if (vp->v_data != NULL) From owner-svn-src-all@freebsd.org Wed Sep 30 03:36:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C5E6A0C9FE; Wed, 30 Sep 2015 03:36:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CA0911D8; Wed, 30 Sep 2015 03:36:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3agnR046757; Wed, 30 Sep 2015 03:36:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3ag5x046756; Wed, 30 Sep 2015 03:36:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300336.t8U3ag5x046756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 03:36:42 +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: r288411 - stable/10/share/man/man9 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:36:42 -0000 Author: markj Date: Wed Sep 30 03:36:41 2015 New Revision: 288411 URL: https://svnweb.freebsd.org/changeset/base/288411 Log: MFC r288278: Document the interface for applying advice up to the end of a file. Modified: stable/10/share/man/man9/VOP_ADVISE.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/VOP_ADVISE.9 ============================================================================== --- stable/10/share/man/man9/VOP_ADVISE.9 Wed Sep 30 03:35:58 2015 (r288410) +++ stable/10/share/man/man9/VOP_ADVISE.9 Wed Sep 30 03:36:41 2015 (r288411) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 3, 2013 +.Dd September 26, 2015 .Dt VOP_ADVISE 9 .Os .Sh NAME @@ -52,6 +52,9 @@ The vnode of the file. The start of the range of file data. .It Fa end The end of the range of file data. +A value of +.Dv OFF_MAX +indicates that the advice is to be applied up to the end of the file. .It Fa advice The type of operation to apply to the file data. Possible values are: From owner-svn-src-all@freebsd.org Wed Sep 30 03:37:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56E78A0CAB3; Wed, 30 Sep 2015 03:37:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E09A1335; Wed, 30 Sep 2015 03:37:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3bclQ046893; Wed, 30 Sep 2015 03:37:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3bcoD046892; Wed, 30 Sep 2015 03:37:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201509300337.t8U3bcoD046892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 30 Sep 2015 03:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288412 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 03:37:38 -0000 Author: glebius Date: Wed Sep 30 03:37:37 2015 New Revision: 288412 URL: https://svnweb.freebsd.org/changeset/base/288412 Log: When processing ICMP need frag message, ignore the suggested MTU unless it is smaller than the current one for this connection. This is behavior specified by RFC 1191, and this is how original BSD stack behaved, but this was unintentionally regressed in r182851. Reported & tested by: Richard Russo Differential Revision: D3567 Sponsored by: Nginx, Inc. Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Sep 30 03:36:41 2015 (r288411) +++ head/sys/netinet/tcp_subr.c Wed Sep 30 03:37:37 2015 (r288412) @@ -1541,11 +1541,6 @@ tcp_ctlinput(int cmd, struct sockaddr *s * in the route to the suggested new * value (if given) and then notify. */ - bzero(&inc, sizeof(inc)); - inc.inc_faddr = faddr; - inc.inc_fibnum = - inp->inp_inc.inc_fibnum; - mtu = ntohs(icp->icmp_nextmtu); /* * If no alternative MTU was @@ -1560,14 +1555,18 @@ tcp_ctlinput(int cmd, struct sockaddr *s mtu = V_tcp_minmss + sizeof(struct tcpiphdr); /* - * Only cache the MTU if it - * is smaller than the interface - * or route MTU. tcp_mtudisc() - * will do right thing by itself. + * Only process the offered MTU if it + * is smaller than the current one. */ - if (mtu <= tcp_maxmtu(&inc, NULL)) + if (mtu < tp->t_maxopd + + sizeof(struct tcpiphdr)) { + bzero(&inc, sizeof(inc)); + inc.inc_faddr = faddr; + inc.inc_fibnum = + inp->inp_inc.inc_fibnum; tcp_hc_updatemtu(&inc, mtu); - tcp_mtudisc(inp, mtu); + tcp_mtudisc(inp, mtu); + } } else inp = (*notify)(inp, inetctlerrmap[cmd]); From owner-svn-src-all@freebsd.org Wed Sep 30 04:49:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7016A0C237; Wed, 30 Sep 2015 04:49:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92DB0101D; Wed, 30 Sep 2015 04:49:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U4n2ak079221; Wed, 30 Sep 2015 04:49:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U4mur9079187; Wed, 30 Sep 2015 04:48:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300448.t8U4mur9079187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 04:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288413 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 04:49:02 -0000 Author: markj Date: Wed Sep 30 04:48:56 2015 New Revision: 288413 URL: https://svnweb.freebsd.org/changeset/base/288413 Log: Stop hard-coding a 32-bit data model for USDT tests, and just use the native model. This was causing many of the tests to fail on amd64 since USDT support for 32-bit programs is currently non-functional. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Wed Sep 30 03:37:37 2015 (r288412) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Wed Sep 30 04:48:56 2015 (r288413) @@ -69,7 +69,7 @@ prov.h: prov.d $dtrace -h -s prov.d prov.o: prov.d main.o - $dtrace -G -32 -s prov.d main.o + $dtrace -G -s prov.d main.o EOF cat > prov.d < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49855A0B3F4; Wed, 30 Sep 2015 05:19:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3996D1D09; Wed, 30 Sep 2015 05:19:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5JH8m093089; Wed, 30 Sep 2015 05:19:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5JG4Y093086; Wed, 30 Sep 2015 05:19:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509300519.t8U5JG4Y093086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 30 Sep 2015 05:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288414 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 05:19:17 -0000 Author: adrian Date: Wed Sep 30 05:19:16 2015 New Revision: 288414 URL: https://svnweb.freebsd.org/changeset/base/288414 Log: modify the rssi logic a bit to actually return a useful rssi. The fullmac firmware doesn't seem to populate a useful rssi indicator in the RX descriptor, so if one plotted said values, they'd basically look like garbage. The reference driver implements a "get current rssi" firmware command which I guess is really meant for station operation only (as hostap operation would need rssi per station, not a single firmware read.) So: * populate sc_currssi during each calibration run; * use this in the RX path instead of trying to reconstruct the RSSI value and passing it around as a pointer; * do up a quick hack to map the rssi hardware value to some useful signal level; * the survey results provide an RSSI value between 0..100, so just do another quick hack to map it into some usefulish signal level; * supply a faked noise floor - I haven't yet found how to pull it out of the firmware. The scan results and the station RSSI information is now more useful for indicating signal strength / distance. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Wed Sep 30 04:48:56 2015 (r288413) +++ head/sys/dev/usb/wlan/if_rsu.c Wed Sep 30 05:19:16 2015 (r288414) @@ -203,17 +203,18 @@ static void rsu_delete_key(struct rsu_so static int rsu_site_survey(struct rsu_softc *, struct ieee80211vap *); static int rsu_join_bss(struct rsu_softc *, struct ieee80211_node *); static int rsu_disconnect(struct rsu_softc *); +static int rsu_hwrssi_to_rssi(struct rsu_softc *, int hw_rssi); static void rsu_event_survey(struct rsu_softc *, uint8_t *, int); static void rsu_event_join_bss(struct rsu_softc *, uint8_t *, int); static void rsu_rx_event(struct rsu_softc *, uint8_t, uint8_t *, int); static void rsu_rx_multi_event(struct rsu_softc *, uint8_t *, int); +#if 0 static int8_t rsu_get_rssi(struct rsu_softc *, int, void *); +#endif +static struct mbuf * rsu_rx_frame(struct rsu_softc *, uint8_t *, int); +static struct mbuf * rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int); static struct mbuf * - rsu_rx_frame(struct rsu_softc *, uint8_t *, int, int *); -static struct mbuf * - rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int, int *); -static struct mbuf * - rsu_rxeof(struct usb_xfer *, struct rsu_data *, int *); + rsu_rxeof(struct usb_xfer *, struct rsu_data *); static void rsu_txeof(struct usb_xfer *, struct rsu_data *); static int rsu_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -1082,7 +1083,9 @@ static void rsu_calib_task(void *arg, int pending __unused) { struct rsu_softc *sc = arg; +#ifdef notyet uint32_t reg; +#endif RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: running calibration task\n", __func__); @@ -1100,9 +1103,10 @@ rsu_calib_task(void *arg, int pending __ #endif /* Read current signal level. */ if (rsu_fw_iocmd(sc, 0xf4000001) == 0) { - reg = rsu_read_4(sc, R92S_IOCMD_DATA); - RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: RSSI=%d%%\n", - __func__, reg >> 4); + sc->sc_currssi = rsu_read_4(sc, R92S_IOCMD_DATA); + RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: RSSI=%d (%d)\n", + __func__, sc->sc_currssi, + rsu_hwrssi_to_rssi(sc, sc->sc_currssi)); } if (sc->sc_calibrating) taskqueue_enqueue_timeout(taskqueue_thread, &sc->calib_task, hz); @@ -1433,6 +1437,24 @@ rsu_disconnect(struct rsu_softc *sc) return (rsu_fw_cmd(sc, R92S_CMD_DISCONNECT, &zero, sizeof(zero))); } +/* + * Map the hardware provided RSSI value to a signal level. + * For the most part it's just something we divide by and cap + * so it doesn't overflow the representation by net80211. + */ +static int +rsu_hwrssi_to_rssi(struct rsu_softc *sc, int hw_rssi) +{ + int v; + + if (hw_rssi == 0) + return (0); + v = hw_rssi >> 4; + if (v > 80) + v = 80; + return (v); +} + static void rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) { @@ -1486,8 +1508,9 @@ rsu_event_survey(struct rsu_softc *sc, u rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; rxs.c_ieee = le32toh(bss->config.dsconfig); rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ); - rxs.rssi = le32toh(bss->rssi); - rxs.nf = 0; /* XXX */ + /* This is a number from 0..100; so let's just divide it down a bit */ + rxs.rssi = le32toh(bss->rssi) / 2; + rxs.nf = -96; /* XXX avoid a LOR */ RSU_UNLOCK(sc); @@ -1557,7 +1580,7 @@ rsu_event_addba_req_report(struct rsu_so if (vap == NULL) return; - device_printf(sc->sc_dev, "%s: mac=%s, tid=%d, ssn=%d\n", + RSU_DPRINTF(sc, RSU_DEBUG_AMPDU, "%s: mac=%s, tid=%d, ssn=%d\n", __func__, ether_sprintf(ba->mac_addr), (int) ba->tid, @@ -1670,6 +1693,7 @@ rsu_rx_multi_event(struct rsu_softc *sc, } } +#if 0 static int8_t rsu_get_rssi(struct rsu_softc *sc, int rate, void *physt) { @@ -1690,9 +1714,10 @@ rsu_get_rssi(struct rsu_softc *sc, int r } return (rssi); } +#endif static struct mbuf * -rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen, int *rssi) +rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_frame *wh; @@ -1718,16 +1743,17 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 rate = MS(rxdw3, R92S_RXDW3_RATE); infosz = MS(rxdw0, R92S_RXDW0_INFOSZ) * 8; +#if 0 /* Get RSSI from PHY status descriptor if present. */ if (infosz != 0) *rssi = rsu_get_rssi(sc, rate, &stat[1]); else *rssi = 0; +#endif RSU_DPRINTF(sc, RSU_DEBUG_RX, - "%s: Rx frame len=%d rate=%d infosz=%d rssi=%d\n", - __func__, - pktlen, rate, infosz, *rssi); + "%s: Rx frame len=%d rate=%d infosz=%d\n", + __func__, pktlen, rate, infosz); m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { @@ -1769,7 +1795,11 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 /* Bit 7 set means HT MCS instead of rate. */ tap->wr_rate = 0x80 | (rate - 12); } +#if 0 tap->wr_dbm_antsignal = *rssi; +#endif + /* XXX not nice */ + tap->wr_dbm_antsignal = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); } @@ -1778,7 +1808,7 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 } static struct mbuf * -rsu_rx_multi_frame(struct rsu_softc *sc, uint8_t *buf, int len, int *rssi) +rsu_rx_multi_frame(struct rsu_softc *sc, uint8_t *buf, int len) { struct r92s_rx_stat *stat; uint32_t rxdw0; @@ -1810,7 +1840,7 @@ rsu_rx_multi_frame(struct rsu_softc *sc, break; /* Process 802.11 frame. */ - m = rsu_rx_frame(sc, buf, pktlen, rssi); + m = rsu_rx_frame(sc, buf, pktlen); if (m0 == NULL) m0 = m; if (prevm == NULL) @@ -1829,7 +1859,7 @@ rsu_rx_multi_frame(struct rsu_softc *sc, } static struct mbuf * -rsu_rxeof(struct usb_xfer *xfer, struct rsu_data *data, int *rssi) +rsu_rxeof(struct usb_xfer *xfer, struct rsu_data *data) { struct rsu_softc *sc = data->sc; struct ieee80211com *ic = &sc->sc_ic; @@ -1850,7 +1880,7 @@ rsu_rxeof(struct usb_xfer *xfer, struct /* No packets to process. */ return (NULL); } else - return (rsu_rx_multi_frame(sc, data->buf, len, rssi)); + return (rsu_rx_multi_frame(sc, data->buf, len)); } static void @@ -1862,7 +1892,6 @@ rsu_bulk_rx_callback(struct usb_xfer *xf struct ieee80211_node *ni; struct mbuf *m = NULL, *next; struct rsu_data *data; - int rssi = 1; RSU_ASSERT_LOCKED(sc); @@ -1872,7 +1901,7 @@ rsu_bulk_rx_callback(struct usb_xfer *xf if (data == NULL) goto tr_setup; STAILQ_REMOVE_HEAD(&sc->sc_rx_active, next); - m = rsu_rxeof(xfer, data, &rssi); + m = rsu_rxeof(xfer, data); STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -1898,6 +1927,11 @@ tr_setup: */ RSU_UNLOCK(sc); while (m != NULL) { + int rssi; + + /* Cheat and get the last calibrated RSSI */ + rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); + next = m->m_next; m->m_next = NULL; wh = mtod(m, struct ieee80211_frame *); @@ -1906,10 +1940,10 @@ tr_setup: if (ni != NULL) { if (ni->ni_flags & IEEE80211_NODE_HT) m->m_flags |= M_AMPDU; - (void)ieee80211_input(ni, m, rssi, 0); + (void)ieee80211_input(ni, m, rssi, -96); ieee80211_free_node(ni); } else - (void)ieee80211_input_all(ic, m, rssi, 0); + (void)ieee80211_input_all(ic, m, rssi, -96); m = next; } RSU_LOCK(sc); @@ -2003,6 +2037,12 @@ tr_setup: } break; } + + /* + * XXX TODO: if the queue is low, flush out FF TX frames. + * Remember to unlock the driver for now; net80211 doesn't + * defer it for us. + */ } static void Modified: head/sys/dev/usb/wlan/if_rsureg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rsureg.h Wed Sep 30 04:48:56 2015 (r288413) +++ head/sys/dev/usb/wlan/if_rsureg.h Wed Sep 30 05:19:16 2015 (r288414) @@ -764,6 +764,7 @@ struct rsu_softc { int sc_ht; int sc_nendpoints; int sc_curpwrstate; + int sc_currssi; u_int sc_running:1, sc_calibrating:1, From owner-svn-src-all@freebsd.org Wed Sep 30 05:24:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85615A0C075; Wed, 30 Sep 2015 05:24:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 732DF12F0; Wed, 30 Sep 2015 05:24:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5OOXd097264; Wed, 30 Sep 2015 05:24:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5ONsG097254; Wed, 30 Sep 2015 05:24:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300524.t8U5ONsG097254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288415 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars sys/cddl/contrib/opensolaris/uts/common/dtrace s... 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 05:24:24 -0000 Author: markj Date: Wed Sep 30 05:24:22 2015 New Revision: 288415 URL: https://svnweb.freebsd.org/changeset/base/288415 Log: MFV r288408: 6266 harden dtrace_difo_chunksize() with respect to malicious DIF illumos/illumos-gate@395c7a3dcfc66b8b671dc4b3c4a2f0ca26449922 Reviewed by: Alex Wilson Reviewed by: Dan McDonald Approved by: Garrett D'Amore Author: Bryan Cantrill MFC after: 1 week Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.biglocal.d Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh (from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh Wed Sep 30 05:24:22 2015 (r288415, copy of r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh) @@ -0,0 +1,112 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2015, Joyent, Inc. All rights reserved. +# + +err=/tmp/err.$$ + +ppriv -s A=basic,dtrace_user $$ + +# +# When we lack dtrace_kernel, we expect to not be able to get at kernel memory +# via any subroutine or other vector. +# +# trace(func((void *)&\`utsname)); } +/usr/sbin/dtrace -wq -Cs /dev/stdin 2> $err <mrbig.toomany[0] = '!'; + exit(0); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 30 05:19:16 2015 (r288414) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 30 05:24:22 2015 (r288415) @@ -155,7 +155,7 @@ int dtrace_destructive_disallow = 0; dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); -size_t dtrace_global_maxsize = (16 * 1024); +size_t dtrace_statvar_maxsize = (16 * 1024); size_t dtrace_actions_max = (16 * 1024); size_t dtrace_retain_max = 1024; dtrace_optval_t dtrace_helper_actions_max = 128; @@ -699,13 +699,33 @@ dtrace_canstore_statvar(uint64_t addr, s dtrace_statvar_t **svars, int nsvars) { int i; + size_t maxglobalsize, maxlocalsize; + + if (nsvars == 0) + return (0); + + maxglobalsize = dtrace_statvar_maxsize; + maxlocalsize = (maxglobalsize + sizeof (uint64_t)) * NCPU; for (i = 0; i < nsvars; i++) { dtrace_statvar_t *svar = svars[i]; + uint8_t scope; + size_t size; - if (svar == NULL || svar->dtsv_size == 0) + if (svar == NULL || (size = svar->dtsv_size) == 0) continue; + scope = svar->dtsv_var.dtdv_scope; + + /* + * We verify that our size is valid in the spirit of providing + * defense in depth: we want to prevent attackers from using + * DTrace to escalate an orthogonal kernel heap corruption bug + * into the ability to store to arbitrary locations in memory. + */ + VERIFY((scope == DIFV_SCOPE_GLOBAL && size < maxglobalsize) || + (scope == DIFV_SCOPE_LOCAL && size < maxlocalsize)); + if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size)) return (1); } @@ -4455,7 +4475,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_canload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyout(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -4470,7 +4491,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_strcanload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyoutstr(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -6458,6 +6480,11 @@ dtrace_dif_emulate(dtrace_difo_t *difo, regs[r2] ? regs[r2] : dtrace_strsize_default) + 1; } else { + if (regs[r2] > LONG_MAX) { + *flags |= CPU_DTRACE_ILLOP; + break; + } + tupregs[ttop].dttk_size = regs[r2]; } @@ -9915,9 +9942,10 @@ dtrace_difo_validate(dtrace_difo_t *dp, break; } - if (v->dtdv_scope == DIFV_SCOPE_GLOBAL && - vt->dtdt_size > dtrace_global_maxsize) { - err += efunc(i, "oversized by-ref global\n"); + if ((v->dtdv_scope == DIFV_SCOPE_GLOBAL || + v->dtdv_scope == DIFV_SCOPE_LOCAL) && + vt->dtdt_size > dtrace_statvar_maxsize) { + err += efunc(i, "oversized by-ref static\n"); break; } } @@ -10261,6 +10289,9 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, if (srd == 0) return; + if (sval > LONG_MAX) + return; + tupregs[ttop++].dttk_size = sval; } @@ -10322,6 +10353,19 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, */ size = P2ROUNDUP(size, sizeof (uint64_t)); + /* + * Before setting the chunk size, check that we're not going + * to set it to a negative value... + */ + if (size > LONG_MAX) + return; + + /* + * ...and make certain that we didn't badly overflow. + */ + if (size < ksize || size < sizeof (dtrace_dynvar_t)) + return; + if (size > vstate->dtvs_dynvars.dtds_chunksize) vstate->dtvs_dynvars.dtds_chunksize = size; } @@ -13942,6 +13986,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((dstate->dtds_chunksize = chunksize) == 0) dstate->dtds_chunksize = DTRACE_DYNVAR_CHUNKSIZE; + VERIFY(dstate->dtds_chunksize < LONG_MAX); + if (size < (min = dstate->dtds_chunksize + sizeof (dtrace_dynhash_t))) size = min; @@ -13982,6 +14028,9 @@ dtrace_dstate_init(dtrace_dstate_t *dsta ((uintptr_t)base + hashsize * sizeof (dtrace_dynhash_t)); limit = (uintptr_t)base + size; + VERIFY((uintptr_t)start < limit); + VERIFY((uintptr_t)start >= (uintptr_t)base); + maxper = (limit - (uintptr_t)start) / NCPU; maxper = (maxper / dstate->dtds_chunksize) * dstate->dtds_chunksize; @@ -14007,7 +14056,7 @@ dtrace_dstate_init(dtrace_dstate_t *dsta start = (dtrace_dynvar_t *)limit; } - ASSERT(limit <= (uintptr_t)base + size); + VERIFY(limit <= (uintptr_t)base + size); for (;;) { next = (dtrace_dynvar_t *)((uintptr_t)dvar + @@ -14016,6 +14065,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((uintptr_t)next + dstate->dtds_chunksize >= limit) break; + VERIFY((uintptr_t)dvar >= (uintptr_t)base && + (uintptr_t)dvar <= (uintptr_t)base + size); dvar->dtdv_next = next; dvar = next; } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Wed Sep 30 05:19:16 2015 (r288414) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Wed Sep 30 05:24:22 2015 (r288415) @@ -1317,16 +1317,19 @@ extern void dtrace_copystr(uintptr_t, ui /* * DTrace Assertions * - * DTrace calls ASSERT from probe context. To assure that a failed ASSERT - * does not induce a markedly more catastrophic failure (e.g., one from which - * a dump cannot be gleaned), DTrace must define its own ASSERT to be one that - * may safely be called from probe context. This header file must thus be - * included by any DTrace component that calls ASSERT from probe context, and - * _only_ by those components. (The only exception to this is kernel - * debugging infrastructure at user-level that doesn't depend on calling - * ASSERT.) + * DTrace calls ASSERT and VERIFY from probe context. To assure that a failed + * ASSERT or VERIFY does not induce a markedly more catastrophic failure (e.g., + * one from which a dump cannot be gleaned), DTrace must define its own ASSERT + * and VERIFY macros to be ones that may safely be called from probe context. + * This header file must thus be included by any DTrace component that calls + * ASSERT and/or VERIFY from probe context, and _only_ by those components. + * (The only exception to this is kernel debugging infrastructure at user-level + * that doesn't depend on calling ASSERT.) */ #undef ASSERT +#undef VERIFY +#define VERIFY(EX) ((void)((EX) || \ + dtrace_assfail(#EX, __FILE__, __LINE__))) #ifdef DEBUG #define ASSERT(EX) ((void)((EX) || \ dtrace_assfail(#EX, __FILE__, __LINE__))) From owner-svn-src-all@freebsd.org Wed Sep 30 05:25:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A6F1A0C21E; Wed, 30 Sep 2015 05:25:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B1E314D0; Wed, 30 Sep 2015 05:25:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5Pdbw097431; Wed, 30 Sep 2015 05:25:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5Pd7w097429; Wed, 30 Sep 2015 05:25:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300525.t8U5Pd7w097429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288416 - in head/cddl/usr.sbin/dtrace/tests/common: privs scalars 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 05:25:40 -0000 Author: markj Date: Wed Sep 30 05:25:39 2015 New Revision: 288416 URL: https://svnweb.freebsd.org/changeset/base/288416 Log: Update DTrace test makefiles after r288415. Modified: head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Modified: head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Wed Sep 30 05:24:22 2015 (r288415) +++ head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Wed Sep 30 05:25:39 2015 (r288416) @@ -8,6 +8,7 @@ TESTFILES= \ tst.fds.ksh \ tst.func_access.ksh \ tst.getf.ksh \ + tst.kpriv.ksh \ tst.op_access.ksh \ tst.procpriv.ksh \ tst.providers.ksh \ Modified: head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Wed Sep 30 05:24:22 2015 (r288415) +++ head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Wed Sep 30 05:25:39 2015 (r288416) @@ -14,6 +14,8 @@ TESTFILES= \ err.D_OP_INCOMPAT.dupltype.d \ err.D_OP_INCOMPAT.dupttype.d \ err.D_SYNTAX.declare.d \ + err.bigglobal.d \ + err.biglocal.d \ tst.basicvar.d \ tst.basicvar.d.out \ tst.localvar.d \ From owner-svn-src-all@freebsd.org Wed Sep 30 05:46:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AC27A0B01A; Wed, 30 Sep 2015 05:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F32F1F21; Wed, 30 Sep 2015 05:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5kvPo006856; Wed, 30 Sep 2015 05:46:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5kv01006854; Wed, 30 Sep 2015 05:46:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300546.t8U5kv01006854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288417 - head/cddl/contrib/opensolaris/cmd/lockstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 05:46:58 -0000 Author: markj Date: Wed Sep 30 05:46:56 2015 New Revision: 288417 URL: https://svnweb.freebsd.org/changeset/base/288417 Log: Have lockstat(1) trace locks by name rather than by address. Previously, lockstat(1) would use a lock's address as its identifier when consuming data describing lock contention and hold events. After collecting the requested data, it would use ksyms(4) to resolve lock addresses to names. Of course, this doesn't work too well for locks contained in dynamically-allocated memory. This change modifies lockstat(1) to trace the lock names obtained from the base struct lock_object instead, leading to output that is generally much more useful. This change also removes the -c option, which is used to coalesce data for locks in an array. It's not possible to support this option without also tracing lock addresses, and since lock arrays in which the lock names are distinct are not very common in FreeBSD, it's simpler to just remove the option. Reviewed by: avg (earlier revision) Differential Revision: https://reviews.freebsd.org/D3661 Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Wed Sep 30 05:25:39 2015 (r288416) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Wed Sep 30 05:46:56 2015 (r288417) @@ -21,7 +21,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2015 +.Dd September 29, 2015 .Dt LOCKSTAT 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Op Fl d Ar duration .Op Fl f Ar function Oo Ns , Ns Ar size Oc .Op Fl T -.Op Fl ckgwWRpP +.Op Fl kgwWRpP .Op Fl D Ar count .Op Fl o filename .Op Fl x Ar opt Oo Ns = Ns Ar val Oc @@ -172,8 +172,6 @@ This is off by default. .El .Ss Data Reporting .Bl -tag -width indent -.It Fl c -Coalesce lock data for lock arrays. .It Fl D Ar count Only display the top .Ar count Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Sep 30 05:25:39 2015 (r288416) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Sep 30 05:46:56 2015 (r288417) @@ -65,7 +65,11 @@ typedef uintptr_t pc_t; typedef struct lsrec { struct lsrec *ls_next; /* next in hash chain */ +#ifdef illumos uintptr_t ls_lock; /* lock address */ +#else + char *ls_lock; /* lock name */ +#endif uintptr_t ls_caller; /* caller address */ uint32_t ls_count; /* cumulative event count */ uint32_t ls_event; /* type of event */ @@ -338,7 +342,9 @@ usage(void) " -d duration only watch events longer than \n" " -T trace (rather than sample) events\n" "\nData reporting options:\n\n" +#ifdef illumos " -c coalesce lock data for arrays like pse_mutex[]\n" +#endif " -k coalesce PCs within functions\n" " -g show total events generated by function\n" " -w wherever: don't distinguish events by caller\n" @@ -381,12 +387,16 @@ lockcmp(lsrec_t *a, lsrec_t *b) if (a->ls_caller > b->ls_caller) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); return (0); +#else + return (strcmp(a->ls_lock, b->ls_lock)); +#endif } static int @@ -424,26 +434,40 @@ lockcmp_anywhere(lsrec_t *a, lsrec_t *b) if (a->ls_event > b->ls_event) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); return (0); +#else + return (strcmp(a->ls_lock, b->ls_lock)); +#endif } static int lock_and_count_cmp_anywhere(lsrec_t *a, lsrec_t *b) { +#ifndef illumos + int cmp; +#endif + if (a->ls_event < b->ls_event) return (-1); if (a->ls_event > b->ls_event) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); +#else + cmp = strcmp(a->ls_lock, b->ls_lock); + if (cmp != 0) + return (cmp); +#endif return (b->ls_count - a->ls_count); } @@ -698,7 +722,11 @@ dprog_addevent(int event) caller = "(uintptr_t)arg0"; arg1 = "arg2"; } else { +#ifdef illumos arg0 = "(uintptr_t)arg0"; +#else + arg0 = "stringof(args[0]->lock_object.lo_name)"; +#endif caller = "caller"; } @@ -912,12 +940,17 @@ lsrec_fill(lsrec_t *lsrec, const dtrace_ lsrec->ls_event = (uint32_t)*((uint64_t *)(data + rec->dtrd_offset)); rec++; +#ifdef illumos if (rec->dtrd_size != sizeof (uintptr_t)) fail(0, "bad lock address size in second record"); /* LINTED - alignment */ lsrec->ls_lock = *((uintptr_t *)(data + rec->dtrd_offset)); rec++; +#else + lsrec->ls_lock = strdup((const char *)(data + rec->dtrd_offset)); + rec++; +#endif if (rec->dtrd_size != sizeof (uintptr_t)) fail(0, "bad caller size in third record"); @@ -1224,9 +1257,11 @@ main(int argc, char **argv) events_specified = 1; break; +#ifdef illumos case 'c': g_cflag = 1; break; +#endif case 'k': g_kflag = 1; @@ -1539,6 +1574,9 @@ main(int argc, char **argv) caller_in_stack = 1; bcopy(oldlsp, lsp, LS_TIME); lsp->ls_caller = oldlsp->ls_stack[fr]; +#ifndef illumos + lsp->ls_lock = strdup(oldlsp->ls_lock); +#endif /* LINTED - alignment */ lsp = (lsrec_t *)((char *)lsp + LS_TIME); } @@ -1547,6 +1585,9 @@ main(int argc, char **argv) /* LINTED - alignment */ lsp = (lsrec_t *)((char *)lsp + LS_TIME); } +#ifndef illumos + free(oldlsp->ls_lock); +#endif } g_nrecs = g_nrecs_used = ((uintptr_t)lsp - (uintptr_t)newlsp) / LS_TIME; @@ -1604,8 +1645,10 @@ main(int argc, char **argv) for (i = 0; i < g_nrecs_used; i++) { int fr; lsp = sort_buf[i]; +#ifdef illumos if (g_cflag) coalesce_symbol(&lsp->ls_lock); +#endif if (g_kflag) { for (fr = 0; fr < g_stkdepth; fr++) coalesce_symbol(&lsp->ls_stack[fr]); @@ -1659,6 +1702,15 @@ main(int argc, char **argv) first = current; } +#ifndef illumos + /* + * Free lock name buffers + */ + for (i = 0, lsp = (lsrec_t *)data_buf; i < g_nrecs_used; i++, + lsp = (lsrec_t *)((char *)lsp + g_recsize)) + free(lsp->ls_lock); +#endif + return (0); } @@ -1748,8 +1800,12 @@ report_stats(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%u %u", lsp->ls_event, lsp->ls_count); +#ifdef illumos (void) fprintf(out, " %s", format_symbol(buf, lsp->ls_lock, g_cflag)); +#else + (void) fprintf(out, " %s", lsp->ls_lock); +#endif (void) fprintf(out, " %s", format_symbol(buf, lsp->ls_caller, 0)); (void) fprintf(out, " %f", @@ -1811,8 +1867,12 @@ report_stats(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%4.2f %8s ", (double)lsp->ls_refcnt / lsp->ls_count, buf); +#ifdef illumos (void) fprintf(out, "%-22s ", format_symbol(buf, lsp->ls_lock, g_cflag)); +#else + (void) fprintf(out, "%-22s ", lsp->ls_lock); +#endif (void) fprintf(out, "%-24s\n", format_symbol(buf, lsp->ls_caller, 0)); @@ -1908,7 +1968,11 @@ report_trace(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%2d %10llu %11p %-24s %-24s\n", lsp->ls_event, (unsigned long long)lsp->ls_time, (void *)lsp->ls_next, +#ifdef illumos format_symbol(buf, lsp->ls_lock, 0), +#else + lsp->ls_lock, +#endif format_symbol(buf2, lsp->ls_caller, 0)); if (rectype <= LS_STACK(0)) From owner-svn-src-all@freebsd.org Wed Sep 30 08:16:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D157A0A12F; Wed, 30 Sep 2015 08:16:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A7F1B07; Wed, 30 Sep 2015 08:16:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U8GarL075933; Wed, 30 Sep 2015 08:16:36 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U8GYP1075923; Wed, 30 Sep 2015 08:16:34 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201509300816.t8U8GYP1075923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 30 Sep 2015 08:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288418 - in head/sys: netinet netinet6 netipsec 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 08:16:36 -0000 Author: ae Date: Wed Sep 30 08:16:33 2015 New Revision: 288418 URL: https://svnweb.freebsd.org/changeset/base/288418 Log: Take extra reference to security policy before calling crypto_dispatch(). Currently we perform crypto requests for IPSEC synchronous for most of crypto providers (software, aesni) and only VIA padlock calls crypto callback asynchronous. In synchronous mode it is possible, that security policy will be removed during the processing crypto request. And crypto callback will release the last reference to SP. Then upon return into ipsec[46]_process_packet() IPSECREQUEST_UNLOCK() will be called to already freed request. To prevent this we will take extra reference to SP. PR: 201876 Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netinet/ip_ipsec.c Wed Sep 30 08:16:33 2015 (r288418) @@ -199,9 +199,7 @@ ip_ipsec_output(struct mbuf **m, struct /* NB: callee frees mbuf */ *error = ipsec4_process_packet(*m, sp->req); - /* Release SP if an error occured */ - if (*error != 0) - KEY_FREESP(&sp); + KEY_FREESP(&sp); if (*error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netinet6/ip6_ipsec.c Wed Sep 30 08:16:33 2015 (r288418) @@ -200,9 +200,7 @@ ip6_ipsec_output(struct mbuf **m, struct /* NB: callee frees mbuf */ *error = ipsec6_process_packet(*m, sp->req); - /* Release SP if an error occured */ - if (*error != 0) - KEY_FREESP(&sp); + KEY_FREESP(&sp); if (*error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/ipsec_output.c Wed Sep 30 08:16:33 2015 (r288418) @@ -166,10 +166,6 @@ ipsec_process_done(struct mbuf *m, struc * If this is a problem we'll need to introduce a queue * to set the packet on so we can unwind the stack before * doing further processing. - * - * If ipsec[46]_process_packet() will successfully queue - * the request, we need to take additional reference to SP, - * because xform callback will release reference. */ if (isr->next) { /* XXX-BZ currently only support same AF bundles. */ @@ -177,11 +173,7 @@ ipsec_process_done(struct mbuf *m, struc #ifdef INET case AF_INET: IPSECSTAT_INC(ips_out_bundlesa); - key_addref(isr->sp); - error = ipsec4_process_packet(m, isr->next); - if (error != 0) - KEY_FREESP(&isr->sp); - return (error); + return (ipsec4_process_packet(m, isr->next)); /* NOTREACHED */ #endif #ifdef notyet @@ -189,11 +181,7 @@ ipsec_process_done(struct mbuf *m, struc case AF_INET6: /* XXX */ IPSEC6STAT_INC(ips_out_bundlesa); - key_addref(isr->sp); - error = ipsec6_process_packet(m, isr->next); - if (error != 0) - KEY_FREESP(&isr->sp); - return (error); + return (ipsec6_process_packet(m, isr->next)); /* NOTREACHED */ #endif /* INET6 */ #endif Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_ah.c Wed Sep 30 08:16:33 2015 (r288418) @@ -1068,6 +1068,7 @@ ah_output(struct mbuf *m, struct ipsecre crp->crp_opaque = (caddr_t) tc; /* These are passed as-is to the callback. */ + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_esp.c Wed Sep 30 08:16:33 2015 (r288418) @@ -874,6 +874,7 @@ esp_output(struct mbuf *m, struct ipsecr } /* Callback parameters */ + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_ipcomp.c Wed Sep 30 08:16:33 2015 (r288418) @@ -449,6 +449,7 @@ ipcomp_output(struct mbuf *m, struct ips goto bad; } + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; From owner-svn-src-all@freebsd.org Wed Sep 30 12:40:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8747DA0B46D; Wed, 30 Sep 2015 12:40:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77D6A1EF0; Wed, 30 Sep 2015 12:40:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UCeqA6087032; Wed, 30 Sep 2015 12:40:52 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UCeqbO087031; Wed, 30 Sep 2015 12:40:52 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509301240.t8UCeqbO087031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 30 Sep 2015 12:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288419 - head/share/examples/mdoc 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 12:40:52 -0000 Author: brueffer Date: Wed Sep 30 12:40:51 2015 New Revision: 288419 URL: https://svnweb.freebsd.org/changeset/base/288419 Log: Join excessive split lines. MFC after: 1 week Modified: head/share/examples/mdoc/example.4 Modified: head/share/examples/mdoc/example.4 ============================================================================== --- head/share/examples/mdoc/example.4 Wed Sep 30 08:16:33 2015 (r288418) +++ head/share/examples/mdoc/example.4 Wed Sep 30 12:40:51 2015 (r288419) @@ -26,15 +26,14 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd April 1, 2006 +.Dd July 31, 2015 .Dt EXAMPLE 4 i386 .Os .Sh NAME .Nm example .Nd "example device driver manual page" .Sh SYNOPSIS -To compile the -driver into the kernel, +To compile the driver into the kernel, place the following lines in the kernel configuration file: .Bd -ragged -offset indent @@ -42,8 +41,7 @@ kernel configuration file: .Cd "options EXAMPLE_DEBUG" .Ed .Pp -Alternatively, to load the -driver as a +Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent From owner-svn-src-all@freebsd.org Wed Sep 30 13:31:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF38EA0BA40; Wed, 30 Sep 2015 13:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF5591BDA; Wed, 30 Sep 2015 13:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UDVd0T010248; Wed, 30 Sep 2015 13:31:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UDVbYB010241; Wed, 30 Sep 2015 13:31:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509301331.t8UDVbYB010241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Sep 2015 13:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288420 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 13:31:40 -0000 Author: mav Date: Wed Sep 30 13:31:37 2015 New Revision: 288420 URL: https://svnweb.freebsd.org/changeset/base/288420 Log: Make pass, sg and targ drivers respect HBA's maxio. Previous limitation of 64K (DFLTPHYS) is quite annoying. Modified: head/sys/cam/cam_compat.c head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_target.c Modified: head/sys/cam/cam_compat.c ============================================================================== --- head/sys/cam/cam_compat.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_compat.c Wed Sep 30 13:31:37 2015 (r288420) @@ -300,7 +300,7 @@ cam_compat_translate_dev_match_0x18(unio /* Remap the CCB into kernel address space */ bzero(&mapinfo, sizeof(mapinfo)); - cam_periph_mapmem(ccb, &mapinfo); + cam_periph_mapmem(ccb, &mapinfo, MAXPHYS); dm = ccb->cdm.matches; /* Translate in-place: old fields are smaller */ Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_periph.c Wed Sep 30 13:31:37 2015 (r288420) @@ -716,16 +716,19 @@ camperiphfree(struct cam_periph *periph) * buffers to map stuff in and out, we're limited to the buffer size. */ int -cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo) +cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo, + u_int maxmap) { int numbufs, i, j; int flags[CAM_PERIPH_MAXMAPS]; u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS]; u_int32_t lengths[CAM_PERIPH_MAXMAPS]; u_int32_t dirs[CAM_PERIPH_MAXMAPS]; - /* Some controllers may not be able to handle more data. */ - size_t maxmap = DFLTPHYS; + if (maxmap == 0) + maxmap = DFLTPHYS; /* traditional default */ + else if (maxmap > MAXPHYS) + maxmap = MAXPHYS; /* for safety */ switch(ccb->ccb_h.func_code) { case XPT_DEV_MATCH: if (ccb->cdm.match_buf_len == 0) { Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_periph.h Wed Sep 30 13:31:37 2015 (r288420) @@ -160,7 +160,8 @@ int cam_periph_hold(struct cam_periph * void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); int cam_periph_mapmem(union ccb *ccb, - struct cam_periph_map_info *mapinfo); + struct cam_periph_map_info *mapinfo, + u_int maxmap); void cam_periph_unmapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo); union ccb *cam_periph_getccb(struct cam_periph *periph, Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_xpt.c Wed Sep 30 13:31:37 2015 (r288420) @@ -536,7 +536,7 @@ xptdoioctl(struct cdev *dev, u_long cmd, * Map the pattern and match buffers into kernel * virtual address space. */ - error = cam_periph_mapmem(inccb, &mapinfo); + error = cam_periph_mapmem(inccb, &mapinfo, MAXPHYS); if (error) { inccb->ccb_h.path = old_path; Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_pass.c Wed Sep 30 13:31:37 2015 (r288420) @@ -77,6 +77,7 @@ struct pass_softc { u_int8_t pd_type; union ccb saved_ccb; int open_count; + u_int maxio; struct devstat *device_stats; struct cdev *dev; struct cdev *alias_dev; @@ -366,6 +367,13 @@ passregister(struct cam_periph *periph, cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ + /* * We pass in 0 for a blocksize, since we don't * know what the blocksize of this device is, if @@ -657,7 +665,7 @@ passsendccb(struct cam_periph *periph, u * Dropping it here is reasonably safe. */ cam_periph_unlock(periph); - error = cam_periph_mapmem(ccb, &mapinfo); + error = cam_periph_mapmem(ccb, &mapinfo, softc->maxio); cam_periph_lock(periph); /* Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_sg.c Wed Sep 30 13:31:37 2015 (r288420) @@ -99,6 +99,7 @@ struct sg_softc { sg_state state; sg_flags flags; int open_count; + u_int maxio; struct devstat *device_stats; TAILQ_HEAD(, sg_rdwr) rdwr_done; struct cdev *dev; @@ -325,6 +326,13 @@ sgregister(struct cam_periph *periph, vo cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ + /* * We pass in 0 for all blocksize, since we don't know what the * blocksize of the device is, if it even has a blocksize. @@ -894,7 +902,7 @@ sgsendccb(struct cam_periph *periph, uni * need for additional checks. */ cam_periph_unlock(periph); - error = cam_periph_mapmem(ccb, &mapinfo); + error = cam_periph_mapmem(ccb, &mapinfo, softc->maxio); cam_periph_lock(periph); if (error) return (error); Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_target.c Wed Sep 30 13:31:37 2015 (r288420) @@ -94,6 +94,7 @@ struct targ_softc { struct cam_periph *periph; struct cam_path *path; targ_state state; + u_int maxio; struct selinfo read_select; struct devstat device_stats; }; @@ -403,6 +404,12 @@ targenable(struct targ_softc *softc, str status = CAM_FUNC_NOTAVAIL; goto enable_fail; } + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ /* Destroy any periph on our path if it is disabled */ periph = cam_periph_find(path, "targ"); @@ -725,7 +732,7 @@ targsendccb(struct targ_softc *softc, un if ((ccb_h->func_code == XPT_CONT_TARGET_IO) || (ccb_h->func_code == XPT_DEV_MATCH)) { - error = cam_periph_mapmem(ccb, mapinfo); + error = cam_periph_mapmem(ccb, mapinfo, softc->maxio); /* * cam_periph_mapmem returned an error, we can't continue. From owner-svn-src-all@freebsd.org Wed Sep 30 16:31:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09BF2A0CE5A; Wed, 30 Sep 2015 16:31:23 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E323E1E02; Wed, 30 Sep 2015 16:31:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UGVM2x081847; Wed, 30 Sep 2015 16:31:22 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UGVM82081843; Wed, 30 Sep 2015 16:31:22 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509301631.t8UGVM82081843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 30 Sep 2015 16:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288421 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 16:31:23 -0000 Author: gjb Date: Wed Sep 30 16:31:21 2015 New Revision: 288421 URL: https://svnweb.freebsd.org/changeset/base/288421 Log: Initial attempt to add support for building images for BANANAPI, CUBIEBOARD, and CUBIEBOARD2 SoCs. Obtained from: Crochet, FreeBSD/arm/Allwinner Wiki page Sponsored by: The FreeBSD Foundation Added: head/release/arm/BANANAPI.conf (contents, props changed) head/release/arm/CUBIEBOARD.conf (contents, props changed) head/release/arm/CUBIEBOARD2.conf (contents, props changed) Added: head/release/arm/BANANAPI.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/BANANAPI.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-bananapi" +KERNEL="A20" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 +export BOARDNAME="BANANAPI" + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-bananapi" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Added: head/release/arm/CUBIEBOARD.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/CUBIEBOARD.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-cubieboard" +KERNEL="CUBIEBOARD" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Added: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/CUBIEBOARD2.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-cubieboard2" +KERNEL="A20" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 +export BOARDNAME="CUBIEBOARD2" + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard2" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} From owner-svn-src-all@freebsd.org Wed Sep 30 17:43:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66DA7A0BD98; Wed, 30 Sep 2015 17:43:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 581C71887; Wed, 30 Sep 2015 17:43:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UHh3Yi012704; Wed, 30 Sep 2015 17:43:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UHh3hD012703; Wed, 30 Sep 2015 17:43:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509301743.t8UHh3hD012703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Sep 2015 17:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288423 - head/bin/ls/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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 17:43:03 -0000 Author: ngie Date: Wed Sep 30 17:43:02 2015 New Revision: 288423 URL: https://svnweb.freebsd.org/changeset/base/288423 Log: Skip the B_flag testcase to stop blowing up freebsd-current@ with "test failure emails" because kyua report-jenkins doesn't properly escape non-printable chars Modified: head/bin/ls/tests/ls_tests.sh Modified: head/bin/ls/tests/ls_tests.sh ============================================================================== --- head/bin/ls/tests/ls_tests.sh Wed Sep 30 17:40:09 2015 (r288422) +++ head/bin/ls/tests/ls_tests.sh Wed Sep 30 17:43:02 2015 (r288423) @@ -180,6 +180,7 @@ B_flag_head() B_flag_body() { + atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136" atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B From owner-svn-src-all@freebsd.org Wed Sep 30 19:13:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB95CA0C088; Wed, 30 Sep 2015 19:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB2851E7B; Wed, 30 Sep 2015 19:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UJDX5t050057; Wed, 30 Sep 2015 19:13:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UJDWL8050052; Wed, 30 Sep 2015 19:13:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509301913.t8UJDWL8050052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Sep 2015 19:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288424 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 19:13:34 -0000 Author: jhb Date: Wed Sep 30 19:13:32 2015 New Revision: 288424 URL: https://svnweb.freebsd.org/changeset/base/288424 Log: Several changes to truss. - Refactor the interface between the ABI-independent code and the ABI-specific backends. The backends now provide smaller hooks to fetch system call arguments and return values. The rest of the system call entry and exit handling that was previously duplicated among all the backends has been moved to one place. - Merge the loop when waiting for an event with the loop for handling stops. This also means not emulating a procfs-like interface on top of ptrace(). Instead, use a single event loop that fetches process events via waitid(). Among other things this allows us to report the full 32-bit exit value. - Use PT_FOLLOW_FORK to follow new child processes instead of forking a new truss process for each new child. This allows one truss process to monitor a tree of processes and truss -c should now display one total for the entire tree instead of separate summaries per process. - Use the recently added fields to ptrace_lwpinfo to determine the current system call number and argument count. The latter is especially useful and fixes a regression since the conversion from procfs. truss now generally prints the correct number of arguments for most system calls rather than printing extra arguments for any call not listed in the table in syscalls.c. - Actually check the new ABI when processes call exec. The comments claimed that this happened but it was not being done (perhaps this was another regression in the conversion to ptrace()). If the new ABI after exec is not supported, truss detaches from the process. If truss does not support the ABI for a newly executed process the process is killed before it returns from exec. - Along with the refactor, teach the various ABI-specific backends to fetch both return values, not just the first. Use this to properly report the full 64-bit return value from lseek(). In addition, the handler for "pipe" now pulls the pair of descriptors out of the return values (which is the true kernel system call interface) but displays them as an argument (which matches the interface exported by libc). - Each ABI handler adds entries to a linker set rather than requiring a statically defined table of handlers in main.c. - The arm and mips system call fetching code was changed to follow the same pattern as amd64 (and the in-kernel handler) of fetching register arguments first and then reading any remaining arguments from the stack. This should fix indirect system call arguments on at least arm. - The mipsn32 and n64 ABIs will now look for arguments in A4 through A7. - Use register %ebp for the 6th system call argument for Linux/i386 ABIs to match the in-kernel argument fetch code. - For powerpc binaries on a powerpc64 system, fetch the extra arguments on the stack as 32-bit values that are then copied into the 64-bit argument array instead of reading the 32-bit values directly into the 64-bit array. Reviewed by: kib (earlier version) Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version) Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D3575 Modified: head/usr.bin/truss/amd64-fbsd.c head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/arm-fbsd.c head/usr.bin/truss/extern.h head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/mips-fbsd.c head/usr.bin/truss/powerpc-fbsd.c head/usr.bin/truss/powerpc64-fbsd.c head/usr.bin/truss/setup.c head/usr.bin/truss/sparc64-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c head/usr.bin/truss/truss.h Modified: head/usr.bin/truss/amd64-fbsd.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-fbsd.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,290 +29,103 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * FreeBSD/amd64-specific system call handling. This is probably the most - * complex part of the entire truss program, although I've got lots of - * it handled relatively cleanly now. The system call names are generated - * automatically, thanks to /usr/src/sys/kern/syscalls.master. The - * names used for the various structures are confusing, I sadly admit. - */ +#include +__FBSDID("$FreeBSD$"); + +/* FreeBSD/amd64-specific system call handling. */ -#include #include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "syscalls.h" -static int nsyscalls = nitems(syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct freebsd_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long *args; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct freebsd_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct freebsd_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct freebsd_syscall *fsc) -{ - int i; - - free(fsc->args); - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in amd64/amd64/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct ptrace_io_desc iorequest; struct reg regs; - struct freebsd_syscall *fsc; - struct syscall *sc; + struct current_syscall *cs; lwpid_t tid; - int i, reg, syscall_num; + u_int i, reg; 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; + return (-1); } /* - * FreeBSD has two special kinds of system call redirctions -- + * 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 %rax if it contains + * either of these values. */ reg = 0; - syscall_num = regs.r_rax; - switch (syscall_num) { + switch (regs.r_rax) { case SYS_syscall: case SYS___syscall: - syscall_num = regs.r_rdi; reg++; break; } - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); - } - - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "fork") == 0 || - strcmp(fsc->name, "pdfork") == 0 || - strcmp(fsc->name, "rfork") == 0 || - strcmp(fsc->name, "vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - - fsc->args = malloc((1 + nargs) * sizeof(unsigned long)); - for (i = 0; i < nargs && reg < 6; i++, reg++) { + for (i = 0; i < narg && reg < 6; i++, reg++) { switch (reg) { - case 0: fsc->args[i] = regs.r_rdi; break; - case 1: fsc->args[i] = regs.r_rsi; break; - case 2: fsc->args[i] = regs.r_rdx; break; - case 3: fsc->args[i] = regs.r_rcx; break; - case 4: fsc->args[i] = regs.r_r8; break; - case 5: fsc->args[i] = regs.r_r9; break; + case 0: cs->args[i] = regs.r_rdi; break; + case 1: cs->args[i] = regs.r_rsi; break; + case 2: cs->args[i] = regs.r_rdx; break; + case 3: cs->args[i] = regs.r_rcx; break; + case 4: cs->args[i] = regs.r_r8; break; + case 5: cs->args[i] = regs.r_r9; break; } } - if (nargs > i) { + if (narg > i) { iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = (void *)(regs.r_rsp + sizeof(register_t)); - iorequest.piod_addr = &fsc->args[i]; - iorequest.piod_len = (nargs - i) * sizeof(register_t); + iorequest.piod_addr = &cs->args[i]; + iorequest.piod_len = (narg - i) * sizeof(register_t); ptrace(PT_IO, tid, (caddr_t)&iorequest, 0); if (iorequest.piod_len == 0) - return; + return (-1); } - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; - } - - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%lx%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif - } - -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + return (0); } -/* - * And when the system call is done, we handle it here. - * Currently, no attempt is made to ensure that the system calls - * match -- this needs to be fixed (and is, in fact, why S_SCX includes - * the system call number instead of, say, an error status). - */ - -long -amd64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +static int +amd64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) { struct reg regs; - struct freebsd_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; - } - } - } - - if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; - - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ + retval[0] = regs.r_rax; + retval[1] = regs.r_rdx; + *errorp = !!(regs.r_rflags & PSL_C); + return (0); +} - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_fbsd = { + "FreeBSD ELF64", + syscallnames, + nitems(syscallnames), + amd64_fetch_args, + amd64_fetch_retval +}; - return (retval); -} +PROCABI(amd64_fbsd); Modified: head/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd32.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-fbsd32.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,290 +29,109 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * FreeBSD/i386-specific system call handling. This is probably the most - * complex part of the entire truss program, although I've got lots of - * it handled relatively cleanly now. The system call names are generated - * automatically, thanks to /usr/src/sys/kern/syscalls.master. The - * names used for the various structures are confusing, I sadly admit. - */ +#include +__FBSDID("$FreeBSD$"); + +/* FreeBSD/i386-specific system call handling. */ -#include #include #include #include #include -#include -#include -#include #include #include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "freebsd32_syscalls.h" -static int nsyscalls = nitems(freebsd32_syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct freebsd32_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long *args; - unsigned int *args32; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct freebsd32_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct freebsd32_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct freebsd32_syscall *fsc) -{ - int i; - - free(fsc->args); - free(fsc->args32); - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_fbsd32_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct ptrace_io_desc iorequest; struct reg regs; - struct freebsd32_syscall *fsc; - struct syscall *sc; - lwpid_t tid; + struct current_syscall *cs; + unsigned int args32[narg]; unsigned long parm_offset; - int i, syscall_num; + lwpid_t tid; + u_int i; 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; + return (-1); } parm_offset = regs.r_rsp + sizeof(int); /* - * FreeBSD has two special kinds of system call redirctions -- + * 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.r_rax; - switch (syscall_num) { + switch (regs.r_rax) { case SYS_syscall: - syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0); parm_offset += sizeof(int); break; case SYS___syscall: - syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0); parm_offset += sizeof(quad_t); break; } - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : freebsd32_syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); - } - - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "fork") == 0 || - strcmp(fsc->name, "pdfork") == 0 || - strcmp(fsc->name, "rfork") == 0 || - strcmp(fsc->name, "vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - - fsc->args32 = malloc((1 + nargs) * sizeof(unsigned int)); iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = (void *)parm_offset; - iorequest.piod_addr = fsc->args32; - iorequest.piod_len = (1 + nargs) * sizeof(unsigned int); + iorequest.piod_addr = args32; + iorequest.piod_len = sizeof(args32); ptrace(PT_IO, tid, (caddr_t)&iorequest, 0); - if (iorequest.piod_len == 0) - return; - - fsc->args = malloc((1 + nargs) * sizeof(unsigned long)); - for (i = 0; i < nargs + 1; i++) - fsc->args[i] = fsc->args32[i]; - - sc = NULL; - if (fsc->name) - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; - } - - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%x%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif + if (iorequest.piod_len == 0) { + return (-1); } -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + for (i = 0; i < narg; i++) + cs->args[i] = args32[i]; + return (0); } -/* - * And when the system call is done, we handle it here. - * Currently, no attempt is made to ensure that the system calls - * match -- this needs to be fixed (and is, in fact, why S_SCX includes - * the system call number instead of, say, an error status). - */ - -long -amd64_fbsd32_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +static int +amd64_fbsd32_fetch_retval(struct trussinfo *trussinfo, long *retval, + int *errorp) { struct reg regs; - struct freebsd32_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; - } - } - } + retval[0] = regs.r_rax & 0xffffffff; + retval[1] = regs.r_rdx & 0xffffffff; + *errorp = !!(regs.r_rflags & PSL_C); + return (0); +} - if (fsc->name != NULL && (strcmp(fsc->name, "freebsd32_execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; +static struct procabi amd64_fbsd32 = { + "FreeBSD ELF32", + freebsd32_syscallnames, + nitems(freebsd32_syscallnames), + amd64_fbsd32_fetch_args, + amd64_fbsd32_fetch_retval +}; - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ +PROCABI(amd64_fbsd32); - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_fbsd32_aout = { + "FreeBSD a.out", + freebsd32_syscallnames, + nitems(freebsd32_syscallnames), + amd64_fbsd32_fetch_args, + amd64_fbsd32_fetch_retval +}; - return (retval); -} +PROCABI(amd64_fbsd32_aout); Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-linux32.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,123 +29,36 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); -/* - * Linux/i386-specific system call handling. Given how much of this code - * is taken from the freebsd equivalent, I can probably put even more of - * it in support routines that can be used by any personality support. - */ +/* Linux/i386-specific system call handling. */ -#include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "linux32_syscalls.h" -static int nsyscalls = nitems(linux32_syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct linux_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long args[5]; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct linux_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct linux_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct linux_syscall *fsc) -{ - int i; - - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_linux32_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct reg regs; - struct linux_syscall *fsc; - struct syscall *sc; + struct current_syscall *cs; lwpid_t tid; - int i, 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; - } - - syscall_num = regs.r_rax; - - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : linux32_syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); + return (-1); } - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "linux_fork") == 0 || - strcmp(fsc->name, "linux_vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - /* * Linux passes syscall arguments in registers, not * on the stack. Fortunately, we've got access to the @@ -153,60 +66,22 @@ amd64_linux32_syscall_entry(struct truss * number of arguments. And what does linux do for syscalls * that have more than five arguments? */ - - fsc->args[0] = regs.r_rbx; - fsc->args[1] = regs.r_rcx; - fsc->args[2] = regs.r_rdx; - fsc->args[3] = regs.r_rsi; - fsc->args[4] = regs.r_rdi; - - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; + switch (narg) { + default: + cs->args[5] = regs.r_rbp; /* Unconfirmed */ + case 5: + cs->args[4] = regs.r_rdi; + case 4: + cs->args[3] = regs.r_rsi; + case 3: + cs->args[2] = regs.r_rdx; + case 2: + cs->args[1] = regs.r_rcx; + case 1: + cs->args[0] = regs.r_rbx; } - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%x%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif - } - -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + return (0); } /* @@ -224,83 +99,43 @@ static const int bsd_to_linux_errno[] = -6, }; -long -amd64_linux32_syscall_exit(struct trussinfo *trussinfo, - int syscall_num __unused) +static int +amd64_linux32_fetch_retval(struct trussinfo *trussinfo, long *retval, + int *errorp) { struct reg regs; - struct linux_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); + size_t i; tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; + retval[0] = regs.r_rax & 0xffffffff; + retval[1] = regs.r_rdx & 0xffffffff; + *errorp = !!(regs.r_rflags & PSL_C); + + if (*errorp) { + for (i = 0; i < nitems(bsd_to_linux_errno); i++) { + if (retval[0] == bsd_to_linux_errno[i]) { + retval[0] = i; + return (0); } } - } - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ - if (errorp) { - for (i = 0; (size_t)i < nitems(bsd_to_linux_errno); i++) { - if (retval == bsd_to_linux_errno[i]) - break; - } + /* XXX: How to handle unknown errors? */ } + return (0); +} - if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; - - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - errorp ? i : retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_linux32 = { + "Linux ELF32", + linux32_syscallnames, + nitems(linux32_syscallnames), + amd64_linux32_fetch_args, + amd64_linux32_fetch_retval +}; - return (retval); -} +PROCABI(amd64_linux32); Modified: head/usr.bin/truss/arm-fbsd.c ============================================================================== --- head/usr.bin/truss/arm-fbsd.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/arm-fbsd.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,17 +29,11 @@ * SUCH DAMAGE. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 30 20:13:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A67ADA0CFC9; Wed, 30 Sep 2015 20:13:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93A4E179C; Wed, 30 Sep 2015 20:13:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKDZoB074544; Wed, 30 Sep 2015 20:13:35 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKDV0a074521; Wed, 30 Sep 2015 20:13:31 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201509302013.t8UKDV0a074521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 30 Sep 2015 20:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288425 - in vendor-sys/acpica/dist: . generate/unix generate/unix/iasl source/common source/compiler source/components/debugger source/components/disassembler source/components/execute... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 20:13:35 -0000 Author: jkim Date: Wed Sep 30 20:13:30 2015 New Revision: 288425 URL: https://svnweb.freebsd.org/changeset/base/288425 Log: Import ACPICA 20150930. Added: vendor-sys/acpica/dist/source/compiler/aslcstyle.y vendor-sys/acpica/dist/source/compiler/aslresources.y Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/Makefile.config vendor-sys/acpica/dist/generate/unix/iasl/Makefile vendor-sys/acpica/dist/source/common/adfile.c vendor-sys/acpica/dist/source/compiler/aslbtypes.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslcompiler.l vendor-sys/acpica/dist/source/compiler/asldefine.h vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslmap.c vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslparser.y vendor-sys/acpica/dist/source/compiler/aslrules.y vendor-sys/acpica/dist/source/compiler/asltokens.y vendor-sys/acpica/dist/source/compiler/asltree.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/asltypes.y vendor-sys/acpica/dist/source/compiler/aslwalks.c vendor-sys/acpica/dist/source/components/debugger/dbexec.c vendor-sys/acpica/dist/source/components/debugger/dbinput.c vendor-sys/acpica/dist/source/components/debugger/dbobject.c vendor-sys/acpica/dist/source/components/debugger/dbxface.c vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c vendor-sys/acpica/dist/source/components/executer/exconvrt.c vendor-sys/acpica/dist/source/components/executer/exresolv.c vendor-sys/acpica/dist/source/components/executer/exresop.c vendor-sys/acpica/dist/source/components/executer/exstore.c vendor-sys/acpica/dist/source/components/executer/exstoren.c vendor-sys/acpica/dist/source/components/namespace/nspredef.c vendor-sys/acpica/dist/source/components/utilities/utdecode.c vendor-sys/acpica/dist/source/components/utilities/utfileio.c vendor-sys/acpica/dist/source/components/utilities/utmutex.c vendor-sys/acpica/dist/source/include/acapps.h vendor-sys/acpica/dist/source/include/acexcep.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acopcode.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actbl1.h vendor-sys/acpica/dist/source/include/amlcode.h vendor-sys/acpica/dist/source/include/platform/acenv.h vendor-sys/acpica/dist/source/tools/acpidump/apfiles.c vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/changes.txt Wed Sep 30 20:13:30 2015 (r288425) @@ -1,7 +1,97 @@ ---------------------------------------- -18 August 2015. Summary of changes for version 20150818: +30 September 2015. Summary of changes for version 20150930: -This release is available at https://acpica.org/downloads +1) ACPICA kernel-resident subsystem: + +Debugger: Implemented several changes and bug fixes to assist support for +the in-kernel version of the AML debugger. Lv Zheng. +- Fix the "predefined" command for in-kernel debugger. +- Do not enter debug command loop for the help and version commands. +- Disallow "execute" command during execution/single-step of a method. + +Interpreter: Updated runtime typechecking for all operators that have +target operands. The operand is resolved and validated that it is legal. +For example, the target cannot be a non-data object such as a Device, +Mutex, ThermalZone, etc., as per the ACPI specification. + +Debugger: Fixed the double-mutex user I/O handshake to work when local +deadlock detection is enabled. + +Debugger: limited display of method locals and arguments (LocalX and +ArgX) to only those that have actually been initialized. This prevents +lines of extraneous output. + +Updated the definition of the NFIT table to correct the bit polarity of +one flag: ACPI_NFIT_MEM_ARMED --> ACPI_NFIT_MEM_NOT_ARMED + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total + Debug Version: 199.3K Code, 81.4K Data, 280.7K Total + Previous Release: + Non-Debug Version: 101.3K Code, 27.7K Data, 129.0K Total + Debug Version: 198.6K Code, 80.9K Data, 279.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Improved the compile-time typechecking for operands of many of the +ASL operators: + +-- Added an option to disable compiler operand/operator typechecking (- +ot). + +-- For the following operators, the TermArg operands are now validated +when possible to be Integer data objects: BankField, OperationRegion, +DataTableRegion, Buffer, and Package. + +-- Store (Source, Target): Both the source and target operands are +resolved and checked that the operands are both legal. For example, +neither operand can be a non-data object such as a Device, Mutex, +ThermalZone, etc. Note, as per the ACPI specification, the CopyObject +operator can be used to store an object to any type of target object. + +-- Store (Source, Target): If the source is a Package object, the target +must be a Package object, LocalX, ArgX, or Debug. Likewise, if the target +is a Package, the source must also be a Package. + +-- Store (Source, Target): A warning is issued if the source and target +resolve to the identical named object. + +-- Store (Source, ): An error is generated for the +target method invocation, as this construct is not supported by the AML +interpreter. + +-- For all ASL math and logic operators, the target operand must be a +data object (Integer, String, Buffer, LocalX, ArgX, or Debug). This +includes the function return value also. + +-- External declarations are also included in the typechecking where +possible. External objects defined using the UnknownObj keyword cannot be +typechecked, however. + +iASL and Disassembler: Added symbolic (ASL+) support for the ASL Index +operator: +- Legacy code: Index(PKG1, 3) +- New ASL+ code: PKG1[3] +This completes the ACPI 6.0 ASL+ support as it was the only operator not +supported. + +iASL: Fixed the file suffix for the preprocessor output file (.i). Two +spaces were inadvertently appended to the filename, causing file access +and deletion problems on some systems. + +ASL Test Suite (ASLTS): Updated the master makefile to generate all +possible compiler output files when building the test suite -- thus +exercising these features of the compiler. These files are automatically +deleted when the test suite exits. + +---------------------------------------- +18 August 2015. Summary of changes for version 20150818: 1) ACPICA kernel-resident subsystem: Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config ============================================================================== --- vendor-sys/acpica/dist/generate/unix/Makefile.config Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/generate/unix/Makefile.config Wed Sep 30 20:13:30 2015 (r288425) @@ -195,7 +195,6 @@ CWARNINGFLAGS += \ -Wmissing-field-initializers\ -Wnested-externs\ -Wold-style-definition\ - -Woverride-init\ -Wno-format-nonliteral\ -Wredundant-decls # @@ -207,10 +206,11 @@ ifneq ($(HOST), _FreeBSD) ifneq ($(HOST), _APPLE) CWARNINGFLAGS += \ - -Wlogical-op\ - -Wmissing-parameter-type\ - -Wold-style-declaration\ - -Wtype-limits + -Woverride-init\ + -Wlogical-op\ + -Wmissing-parameter-type\ + -Wold-style-declaration\ + -Wtype-limits endif endif Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Wed Sep 30 20:13:30 2015 (r288425) @@ -234,7 +234,9 @@ MISC = \ $(OBJDIR)/prparser.y.h ASL_PARSER = \ + $(ASL_COMPILER)/aslcstyle.y\ $(ASL_COMPILER)/aslparser.y\ + $(ASL_COMPILER)/aslresources.y\ $(ASL_COMPILER)/aslsupport.y\ $(ASL_COMPILER)/asltokens.y\ $(ASL_COMPILER)/asltypes.y\ Modified: vendor-sys/acpica/dist/source/common/adfile.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adfile.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/common/adfile.c Wed Sep 30 20:13:30 2015 (r288425) @@ -99,7 +99,7 @@ AdGenerateFilename ( } FilenameBuf[i] = 0; - strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX); + strcat (FilenameBuf, FILE_SUFFIX_BINARY_TABLE); return (FilenameBuf); } Modified: vendor-sys/acpica/dist/source/compiler/aslbtypes.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslbtypes.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslbtypes.c Wed Sep 30 20:13:30 2015 (r288425) @@ -100,9 +100,10 @@ AnMapArgTypeToBtype ( case ARGI_DDBHANDLE: /* * DDBHandleObject := SuperName - * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload + * ACPI_BTYPE_REFERENCE_OBJECT: + * Index reference as parameter of Load/Unload */ - return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE_OBJECT); /* Interchangeable types */ /* @@ -133,9 +134,24 @@ AnMapArgTypeToBtype ( case ARGI_REFERENCE: - return (ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_NAMED_REFERENCE); /* Name or Namestring */ case ARGI_TARGETREF: + + /* + * Target operand for most math and logic operators. + * Package objects not allowed as target. + */ + return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DEBUG_OBJECT | + ACPI_BTYPE_REFERENCE_OBJECT); + + case ARGI_STORE_TARGET: + + /* Special target for Store(), includes packages */ + + return (ACPI_BTYPE_DATA | ACPI_BTYPE_DEBUG_OBJECT | + ACPI_BTYPE_REFERENCE_OBJECT); + case ARGI_FIXED_TARGET: case ARGI_SIMPLE_TARGET: @@ -149,28 +165,33 @@ AnMapArgTypeToBtype ( * Used only by SizeOf operator */ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); + ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE_OBJECT); case ARGI_COMPLEXOBJ: /* Buffer, String, or package */ - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); + return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | + ACPI_BTYPE_PACKAGE); case ARGI_REF_OR_STRING: - return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE); + /* Used by DeRefOf operator only */ + + return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE_OBJECT); case ARGI_REGION_OR_BUFFER: /* Used by Load() only. Allow buffers in addition to regions/fields */ - return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT); + return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | + ACPI_BTYPE_FIELD_UNIT); case ARGI_DATAREFOBJ: - return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE); + /* Used by Store() only, as the source operand */ + + return (ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_REFERENCE_OBJECT); default: @@ -274,7 +295,7 @@ AnMapEtypeToBtype ( case ACPI_TYPE_LOCAL_RESOURCE: case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - return (ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_REFERENCE_OBJECT); default: @@ -401,12 +422,6 @@ AnGetBtype ( "could not map type"); } - /* - * Since it was a named reference, enable the - * reference bit also - */ - ThisNodeBtype |= ACPI_BTYPE_REFERENCE; - if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) { ReferencedNode = Node->Op; @@ -442,7 +457,6 @@ AnGetBtype ( return (ThisNodeBtype); } - /******************************************************************************* * * FUNCTION: AnMapObjTypeToBtype Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Wed Sep 30 20:13:30 2015 (r288425) @@ -302,8 +302,11 @@ CmDoCompile ( Event = UtBeginEvent ("Analyze AML operand types"); DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, - NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); + if (Gbl_DoTypechecking) + { + TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, + NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); + } UtEndEvent (Event); /* Semantic error checking part four - other miscellaneous checks */ Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.l Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.l Wed Sep 30 20:13:30 2015 (r288425) @@ -156,6 +156,9 @@ NamePathTail [.]{NameSeg} "^=" { count (3); return (PARSEOP_EXP_XOR_EQ); } "|=" { count (3); return (PARSEOP_EXP_OR_EQ); } +"[" { count (3); return(PARSEOP_EXP_INDEX_LEFT); } +"]" { count (0); return(PARSEOP_EXP_INDEX_RIGHT); } + /* * Begin standard ASL grammar Added: vendor-sys/acpica/dist/source/compiler/aslcstyle.y ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/acpica/dist/source/compiler/aslcstyle.y Wed Sep 30 20:13:30 2015 (r288425) @@ -0,0 +1,209 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslcstyle.y - Production rules for symbolic operators + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +') + +/******************************************************************************* + * + * Production rules for the symbolic (c-style) operators + * + ******************************************************************************/ + +/* + * ASL Extensions: C-style math/logical operators and expressions. + * The implementation transforms these operators into the standard + * AML opcodes and syntax. + * + * Supported operators and precedence rules (high-to-low) + * + * NOTE: The operator precedence and associativity rules are + * implemented by the tokens in asltokens.y + * + * (left-to-right): + * 1) ( ) expr++ expr-- + * + * (right-to-left): + * 2) ! ~ + * + * (left-to-right): + * 3) * / % + * 4) + - + * 5) >> << + * 6) < > <= >= + * 7) == != + * 8) & + * 9) ^ + * 10) | + * 11) && + * 12) || + * + * (right-to-left): + * 13) = += -= *= /= %= <<= >>= &= ^= |= + */ + +Expression + + /* Unary operators */ + + : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafNode (PARSEOP_LNOT);} + TermArg {$$ = TrLinkChildren ($2,1,$3);} + | PARSEOP_EXP_NOT {$$ = TrCreateLeafNode (PARSEOP_NOT);} + TermArg {$$ = TrLinkChildren ($2,2,$3,TrCreateNullTarget ());} + + | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} + {$$ = TrLinkChildren ($3,1,$1);} + | SuperName PARSEOP_EXP_DECREMENT {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + {$$ = TrLinkChildren ($3,1,$1);} + + /* Binary operators: math and logical */ + + | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), + TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + + | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4,TrCreateNullTarget ());} + + | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS {$$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_NOT_EQUAL {$$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_LOGICAL_AND {$$ = TrCreateLeafNode (PARSEOP_LAND);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_OR {$$ = TrCreateLeafNode (PARSEOP_LOR);} + TermArg {$$ = TrLinkChildren ($3,2,$1,$4);} + + /* Parentheses */ + + | '(' TermArg ')' { $$ = $2;} + + /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ + + | SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT + {$$ = TrCreateLeafNode (PARSEOP_INDEX); + TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} + ; + + /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ + +IndexExpTerm + + : SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT + {$$ = TrCreateLeafNode (PARSEOP_INDEX); + TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} + ; + +EqualsTerm + + /* All assignment-type operations */ + + : SuperName PARSEOP_EXP_EQUALS + TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + + | TermArg PARSEOP_EXP_ADD_EQ {$$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($3,4,$1,$4,TrCreateNullTarget (), + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MUL_EQ {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHL_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHR_EQ {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SUB_EQ {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_AND_EQ {$$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_OR_EQ {$$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_XOR_EQ {$$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + ; Modified: vendor-sys/acpica/dist/source/compiler/asldefine.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asldefine.h Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/asldefine.h Wed Sep 30 20:13:30 2015 (r288425) @@ -104,26 +104,6 @@ #define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD -/* filename suffixes for output files */ - -#define FILE_SUFFIX_PREPROC_USER "i " -#define FILE_SUFFIX_PREPROCESSOR "pre" -#define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_MAP "map" -#define FILE_SUFFIX_LISTING "lst" -#define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" -#define FILE_SUFFIX_NAMESPACE "nsp" -#define FILE_SUFFIX_ASM_SOURCE "asm" -#define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_ASM_INCLUDE "inc" -#define FILE_SUFFIX_C_INCLUDE "h" -#define FILE_SUFFIX_ASL_CODE "asl" -#define FILE_SUFFIX_C_OFFSET "offset.h" - - /* Types for input files */ #define ASL_INPUT_TYPE_BINARY 0 Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Wed Sep 30 20:13:30 2015 (r288425) @@ -177,6 +177,8 @@ ASL_EXTERN BOOLEAN ASL_ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE); #define HEX_OUTPUT_NONE 0 Modified: vendor-sys/acpica/dist/source/compiler/aslmain.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmain.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslmain.c Wed Sep 30 20:13:30 2015 (r288425) @@ -160,6 +160,7 @@ Usage ( ACPI_OPTION ("-of", "Disable constant folding"); ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); ACPI_OPTION ("-on", "Disable named reference string optimization"); + ACPI_OPTION ("-ot", "Disable typechecking"); ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking"); ACPI_OPTION ("-in", "Ignore NoOp operators"); ACPI_OPTION ("-r ", "Override table header Revision (1-255)"); @@ -203,7 +204,7 @@ Usage ( ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); ACPI_OPTION ("-m ", "Set internal line buffer size (in Kbytes)"); ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-ot", "Display compile times and statistics"); + ACPI_OPTION ("-oc", "Display compile times and statistics"); ACPI_OPTION ("-x ", "Set debug level for trace output"); ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } Modified: vendor-sys/acpica/dist/source/compiler/aslmap.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmap.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslmap.c Wed Sep 30 20:13:30 2015 (r288425) @@ -123,6 +123,7 @@ const ASL_MAPPING_ENTRY AslKeywordMa { /*! [Begin] no source code translation (keep the table structure) */ + /* AML Opcode Value Flags Btype */ /* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), /* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0), @@ -241,7 +242,7 @@ const ASL_MAPPING_ENTRY AslKeywordMa /* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE), +/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT), /* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), /* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), @@ -357,7 +358,7 @@ const ASL_MAPPING_ENTRY AslKeywordMa /* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), +/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT), /* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0), /* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0), /* REGIONSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0), Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloptions.c Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/asloptions.c Wed Sep 30 20:13:30 2015 (r288425) @@ -68,7 +68,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" /******************************************************************************* @@ -184,6 +184,24 @@ AslDoOptions ( } break; + case 'a': /* Debug options */ + + switch (AcpiGbl_Optarg[0]) + { + case 'r': + + Gbl_EnableReferenceTypechecking = TRUE; + break; + + default: + + printf ("Unknown option: -a%s\n", AcpiGbl_Optarg); + return (-1); + } + + break; + + case 'b': /* Debug options */ switch (AcpiGbl_Optarg[0]) @@ -506,6 +524,13 @@ AslDoOptions ( Gbl_ReferenceOptimizationFlag = FALSE; break; + case 'c': + + /* Display compile time(s) */ + + Gbl_CompileTimesFlag = TRUE; + break; + case 'f': /* Disable folding on "normal" expressions */ @@ -529,9 +554,9 @@ AslDoOptions ( case 't': - /* Display compile time(s) */ + /* Disable heavy typechecking */ - Gbl_CompileTimesFlag = TRUE; + Gbl_DoTypechecking = FALSE; break; default: Modified: vendor-sys/acpica/dist/source/compiler/aslparser.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslparser.y Wed Sep 30 19:13:32 2015 (r288424) +++ vendor-sys/acpica/dist/source/compiler/aslparser.y Wed Sep 30 20:13:30 2015 (r288425) @@ -122,6 +122,8 @@ m4_include(asltypes.y) /* Production rules */ m4_include(aslrules.y) +m4_include(aslcstyle.y) +m4_include(aslresources.y) %% /*! [End] no source code translation !*/ Added: vendor-sys/acpica/dist/source/compiler/aslresources.y ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/acpica/dist/source/compiler/aslresources.y Wed Sep 30 20:13:30 2015 (r288425) @@ -0,0 +1,1179 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslresources.y - Bison/Yacc production rules for resources + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +') + +/******************************************************************************* + * + * ASL Parameter Keyword Terms + * + ******************************************************************************/ + +AccessAttribKeyword + : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} + | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} + | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} + | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} + | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} + | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} + | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} + | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} + ByteConst + ')' {$$ = TrLinkChildren ($3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} + ByteConst + ')' {$$ = TrLinkChildren ($3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} + ByteConst + ')' {$$ = TrLinkChildren ($3,1,$4);} + ; + +AccessTypeKeyword + : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} + | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} + | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} + | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} + | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} + | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} + ; + +AddressingModeKeyword + : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} + | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} + ; + +AddressKeyword + : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} + | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} + | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} + | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} + ; + +AddressSpaceKeyword + : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + | RegionSpaceKeyword {} + ; + +BitsPerByteKeyword + : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} + | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} + | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} + | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} + | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} + ; + +ClockPhaseKeyword + : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} + | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} + ; + +ClockPolarityKeyword + : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} + | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} + ; + +DecodeKeyword + : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} + | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} + ; + +DevicePolarityKeyword + : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} + | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} + ; + +DMATypeKeyword + : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} + | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} + | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} + | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} + ; + +EndianKeyword + : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} + | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} + ; + +FlowControlKeyword + : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} + | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} + | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} + ; + +InterruptLevel + : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} + | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} + | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} + ; + +InterruptTypeKeyword + : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} + | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} + ; + +IODecodeKeyword + : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} + | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} + ; + +IoRestrictionKeyword + : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} + | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} + | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} + | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} + ; + +LockRuleKeyword + : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} + | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} + ; + +MatchOpKeyword + : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} + | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} + | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} + | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} + | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} + | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} + ; + +MaxKeyword + : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} + | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} + ; + +MemTypeKeyword + : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} + | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} + | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} + | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} + ; + +MinKeyword + : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} + | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} + ; + +ObjectTypeKeyword + : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} + | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} + | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} + | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} + | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} + | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} + | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} + | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} + | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} + | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} + | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} + | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} + | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} + | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} + | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} + | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} + ; + +ParityTypeKeyword + : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} + | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} + | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} + | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} + | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} + ; + +PinConfigByte + : PinConfigKeyword {$$ = $1;} + | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +PinConfigKeyword + : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} + | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} + | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} + | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} + ; + +PldKeyword + : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} + | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} + | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} + | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} + | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} + | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} + | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} + | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} + | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} + | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} + | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} + | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} + | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} + | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} + | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} + | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} + | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} + | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} + | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} + | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} + | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} + | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} + | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} + | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} + | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} + | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} + | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} + | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} + ; + +RangeTypeKeyword + : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} + | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} + | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} + ; + +RegionSpaceKeyword + : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} + | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} + | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} + | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} + | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} + | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} + | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} + | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} + | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} + | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} + ; + +ResourceTypeKeyword + : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} + ; + +SerializeRuleKeyword + : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} + | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} + ; + +ShareTypeKeyword + : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} + | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} + | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} + | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} + ; + +SlaveModeKeyword + : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} + | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} + ; + +StopBitsKeyword + : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} + | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} + | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} + | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} + ; + +TranslationKeyword + : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} + | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} + ; + +TypeKeyword + : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} + | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} + ; + +UpdateRuleKeyword + : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} + | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} + | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} + ; + +WireModeKeyword + : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Sep 30 20:14:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48386A0B0C3; Wed, 30 Sep 2015 20:14:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E4DC19F3; Wed, 30 Sep 2015 20:14:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKEYtV074625; Wed, 30 Sep 2015 20:14:34 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKEYDG074624; Wed, 30 Sep 2015 20:14:34 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201509302014.t8UKEYDG074624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 30 Sep 2015 20:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288426 - vendor-sys/acpica/20150930 X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 20:14:35 -0000 Author: jkim Date: Wed Sep 30 20:14:34 2015 New Revision: 288426 URL: https://svnweb.freebsd.org/changeset/base/288426 Log: Tag ACPICA 20150930. Added: vendor-sys/acpica/20150930/ - copied from r288425, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Wed Sep 30 20:38:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D427A0C3BA; Wed, 30 Sep 2015 20:38:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01B8E1479; Wed, 30 Sep 2015 20:38:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKcaf3082893; Wed, 30 Sep 2015 20:38:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKcaIN082891; Wed, 30 Sep 2015 20:38:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509302038.t8UKcaIN082891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Sep 2015 20:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288427 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 20:38:37 -0000 Author: mav Date: Wed Sep 30 20:38:35 2015 New Revision: 288427 URL: https://svnweb.freebsd.org/changeset/base/288427 Log: Use proper STAILQ_* macros where possible. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Sep 30 20:14:34 2015 (r288426) +++ head/sys/cam/ctl/ctl.c Wed Sep 30 20:38:35 2015 (r288427) @@ -1922,13 +1922,8 @@ ctl_shutdown(void) mtx_lock(&softc->ctl_lock); - /* - * Free up each LUN. - */ - for (lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; lun = next_lun){ - next_lun = STAILQ_NEXT(lun, links); + STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) ctl_free_lun(lun); - } mtx_unlock(&softc->ctl_lock); @@ -2780,9 +2775,9 @@ ctl_ioctl(struct cdev *dev, u_long cmd, * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ - for (i = 0, lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; - i++, lun = STAILQ_NEXT(lun, links)) { - retval = copyout(&lun->stats, &stats->lun_stats[i], + i = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; @@ -4637,8 +4632,7 @@ ctl_enable_lun(struct ctl_be_lun *be_lun lun->flags &= ~CTL_LUN_DISABLED; mtx_unlock(&lun->lun_lock); - for (port = STAILQ_FIRST(&softc->port_list); port != NULL; port = nport) { - nport = STAILQ_NEXT(port, links); + STAILQ_FOREACH_SAFE(port, &softc->port_list, links, nport) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0 || port->lun_map != NULL || port->lun_enable == NULL) continue; @@ -13130,7 +13124,7 @@ ctl_process_done(union ctl_io *io) * Check to see if we have any errors to inject here. We only * inject errors for commands that don't already have errors set. */ - if ((STAILQ_FIRST(&lun->error_list) != NULL) && + if (!STAILQ_EMPTY(&lun->error_list) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) && ((io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0)) ctl_inject_error(lun, io); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Sep 30 20:14:34 2015 (r288426) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Sep 30 20:38:35 2015 (r288427) @@ -180,14 +180,7 @@ ctl_backend_ramdisk_shutdown(void) #endif mtx_lock(&softc->lock); - for (lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; lun = next_lun){ - /* - * Grab the next LUN. The current LUN may get removed by - * ctl_invalidate_lun(), which will call our LUN shutdown - * routine, if there is no outstanding I/O for this LUN. - */ - next_lun = STAILQ_NEXT(lun, links); - + STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { /* * Drop our lock here. Since ctl_invalidate_lun() can call * back into us, this could potentially lead to a recursive From owner-svn-src-all@freebsd.org Wed Sep 30 20:40:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3CDA0C512; Wed, 30 Sep 2015 20:40:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B24D17ED; Wed, 30 Sep 2015 20:40:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKeqqd085466; Wed, 30 Sep 2015 20:40:52 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKeq54085465; Wed, 30 Sep 2015 20:40:52 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302040.t8UKeq54085465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 20:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288428 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 20:40:52 -0000 Author: bdrewery Date: Wed Sep 30 20:40:51 2015 New Revision: 288428 URL: https://svnweb.freebsd.org/changeset/base/288428 Log: META_MODE: Remove unneeded groff/tmac special GENDIRDEPS_FILTER. This is converting the path usr/share/tmac.*stage to something else, but nothing ever installs or reads from such a path. They might look in stage.*usr/share/tmac, but that's not what this is matching. Additionally the .dirdeps match all of the tmac files back to gnu/usr.bin/groff/tmac fine. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.gendirdeps.mk Modified: head/share/mk/local.gendirdeps.mk ============================================================================== --- head/share/mk/local.gendirdeps.mk Wed Sep 30 20:38:35 2015 (r288427) +++ head/share/mk/local.gendirdeps.mk Wed Sep 30 20:40:51 2015 (r288428) @@ -44,7 +44,3 @@ GENDIRDEPS_FILTER_VARS+= \ GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@} GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} - -# handle the non-standard way that gnu/usr.bin/groff/tmac is staged -GENDIRDEPS_FILTER+= C,.*usr/share/tmac.*stage,gnu/usr.bin/groff/tmac, - From owner-svn-src-all@freebsd.org Wed Sep 30 20:47:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE0B5A0C98E; Wed, 30 Sep 2015 20:47:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCA811C6C; Wed, 30 Sep 2015 20:47:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKlSUd087028; Wed, 30 Sep 2015 20:47:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKlR5R087024; Wed, 30 Sep 2015 20:47:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302047.t8UKlR5R087024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 20:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288429 - head/gnu/usr.bin/groff/tmac 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 20:47:29 -0000 Author: bdrewery Date: Wed Sep 30 20:47:27 2015 New Revision: 288429 URL: https://svnweb.freebsd.org/changeset/base/288429 Log: Replace most of the beforeinstall: hack with FILES mechanism. This now generates the files into the OBJDIR as needed. Some of the files are installed directly from the src directory. Files which are generated from the src directory are renamed to .in to generate them and avoid colliding with the checked-in file when CURDIR=OBJDIR. The remaining beforeinstall: handling still needs to be reworked as it does not work well with staging for packaging. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Added: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1 head/gnu/usr.bin/groff/tmac/mdoc.local.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/mdoc.local head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R Deleted: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1 head/gnu/usr.bin/groff/tmac/mdoc.local head/gnu/usr.bin/groff/tmac/ru.KOI8-R Modified: head/gnu/usr.bin/groff/tmac/Makefile Modified: head/gnu/usr.bin/groff/tmac/Makefile ============================================================================== --- head/gnu/usr.bin/groff/tmac/Makefile Wed Sep 30 20:40:51 2015 (r288428) +++ head/gnu/usr.bin/groff/tmac/Makefile Wed Sep 30 20:47:27 2015 (r288429) @@ -14,7 +14,7 @@ MLINKS= groff_ms.7 ms.7 MLINKS+= groff_me.7 me.7 MLINKS+= groff_mdoc.7 mdoc.samples.7 -CLEANFILES= ${MAN} ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +CLEANFILES= ${MAN} NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \ me.tmac \ @@ -39,45 +39,59 @@ NORMALFILES= mandoc.tmac andoc.tmac an-o composite.tmac \ eqnrc \ troffrc troffrc-end \ + koi8-r.tmac hyphen.ru \ hyphen.us hyphenex.us +# These are all generated into the OBJDIR. SPECIALFILES= an.tmac man.tmac s.tmac ms.tmac www.tmac STRIPFILES= e.tmac doc.tmac mdoc.local MDOCFILES= doc-common doc-ditroff doc-nroff doc-syms \ fr.ISO8859-1 ru.KOI8-R +# These are in srcdir and must be built special to avoid colliding with +# CURDIR=OBJDIR. +SRCFILES= fr.ISO8859-1 mdoc.local ru.KOI8-R +CLEANFILES+= ${SRCFILES} + +FILESGROUPS= FILES +FILES= ${NORMALFILES} +FILESOWN= ${TMACOWN} +FILESGRP= ${TMACGRP} +FILESMODE= ${TMACMODE} +FILESDIR= ${TMACDIR} +MDOCFILESDIR= ${MDOCDIR} + +# Setup handling for the generated and special file groups +.for var in SPECIAL STRIP MDOC +FILESGROUPS+= ${var}FILES +CLEANFILES+= ${${var}FILES} +${var}FILESOWN?=${TMACOWN} +${var}FILESGRP?=${TMACGRP} +${var}FILESMODE?=${TMACMODE} +${var}FILESDIR?=${TMACDIR} +.endfor -all: ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +beforeinstall: +.if !exists(${DESTDIR}${TMACDIR}/man.local) + ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ + ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR} +.endif +.include + +# Do this after ../Makefile.inc gets included so DIST_DIR is defined. .for f in ${MDOCFILES} ${STRIPFILES} -$f-s: $f +# Generate the file from the contrib dir or src dir as needed. +.if ${SRCFILES:M${f}} != "" +${f}: ${.CURDIR}/${f}.in +.else +${f}: ${DIST_DIR}/${f} +.endif sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET} .endfor .for f in ${SPECIALFILES} -$f-s: $f +${f}: ${DIST_DIR}/${f} sed -e "s;@TMAC_AN_PREFIX@;${tmac_an_prefix};g" \ -e "s;@TMAC_S_PREFIX@;${tmac_s_prefix};g" \ -e "s;@PNMTOPS_NOSETPAGE@;pnmtops;g" \ ${.ALLSRC} > ${.TARGET} .endfor - -beforeinstall: - (cd ${DIST_DIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - ${NORMALFILES} ${DESTDIR}${TMACDIR}) - (cd ${.CURDIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}) -.for f in ${STRIPFILES} ${SPECIALFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${TMACDIR}/$f -.endfor -.for f in ${MDOCFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${MDOCDIR}/$f -.endfor -.if !exists(${DESTDIR}${TMACDIR}/man.local) - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR} -.endif - -.include Copied: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in (from r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1) @@ -0,0 +1,139 @@ +.\" Copyright (c) 2002 Sebastien Gioria . +.\" 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$ +.\" +.\" %beginstrip% +. +.\" .Dt localization +.nr doc-volume-operating-system-ateol 1 +.ds doc-volume-ds-1 Manuel des commandes utilisateur +.ds doc-volume-ds-2 Manuel des appels systèmes +.ds doc-volume-ds-3 Manuel des fonctions de la librairie +.ds doc-volume-ds-4 Manuel des interfaces du noyau +.ds doc-volume-ds-5 Manuel des formats de fichier +.ds doc-volume-ds-6 Manuel des jeux +.ds doc-volume-ds-7 Manuel d'informations diverses +.ds doc-volume-ds-8 Manuel de l'administrateur +.ds doc-volume-ds-9 Manuel du développeur du noyau +. +.ds doc-volume-ds-USD Documentation supplémentaire utilisateur +.ds doc-volume-ds-PS1 Documentation supplémentaire du programmeur +.ds doc-volume-ds-AMD Documentation ancestrale +.ds doc-volume-ds-SMM Manuel de l'administrateur +.ds doc-volume-ds-URM Manuel de référence utilisateur +.ds doc-volume-ds-PRM Manuel du programmeur +.ds doc-volume-ds-KM Manuel du noyau +.ds doc-volume-ds-IND Index principal des manuels +.ds doc-volume-ds-LOCAL Manuel local +.ds doc-volume-ds-CON Manuel des logiciels contribués +. +.\" .Os localization +.ds doc-operating-system-ATT-7 7th\~Edition +.ds doc-operating-system-BSD-3 3rd\~Distribution de Berkeley +.ds doc-operating-system-BSD-4 4th\~Distribution de Berkeley +.ds doc-operating-system-BSD-4.1 Distribution\~4.1 de Berkeley +.ds doc-operating-system-BSD-4.2 Distribution\~4.2 de Berkeley +.ds doc-operating-system-BSD-4.3 Distribution\~4.3 de Berkeley +.ds doc-operating-system-BSD-4.3T Distribution 4.3-Tahoe de Berkeley +.ds doc-operating-system-BSD-4.3R Distribution 4.3-Reno de Berkeley +. +.\" .Sh localization +.ds doc-section-name NOM +.ds doc-section-synopsis SYNOPSIS +.ds doc-section-library BIBLIOTHÈQUE +.ds doc-section-description DESCRIPTION +.ds doc-section-see-also VOIR +.ds doc-section-files FICHIERS +.ds doc-section-authors AUTEURS +. +.\" .Lb localization +.ds doc-str-Lb-libarm32 Bibliothèque de l'architecture ARM32 (libarm32, \-larm32) +.ds doc-str-Lb-libc Bibliothèque\~C Standard (libc, \-lc) +.ds doc-str-Lb-libc_r Bibliothèque\~C réentrante (libc_r, \-lc_r) +.\" XXX ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) +.\" XXX ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) +.ds doc-str-Lb-libcipher Bibliothèque de cryptage FreeSec (libcipher, \-lcipher) +.ds doc-str-Lb-libcompat Bibliothèque de compatibilité (libcompat, \-lcompat) +.ds doc-str-Lb-libcrypt Bibliothèque de cryptage (libcrypt, \-lcrypt) +.ds doc-str-Lb-libcurses Bibliothèque de Curses (libcurses, \-lcurses) +.\" XXX ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-devinfo) +.ds doc-str-Lb-libdevstat Bibliothèque de statistiques des périphériques (libdevstat, \-ldevstat) +.ds doc-str-Lb-libdisk Bibliothèque d'accès à l'interface des labels de partitions (libdisk, \-ldisk) +.ds doc-str-Lb-libedit Bibliothèque de l'éditeur de ligne de commande (libedit, \-ledit) +.ds doc-str-Lb-libfetch Bibliothèque de transfert de fichier (libfetch, \-lfetch) +.\" XXX ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) +.ds doc-str-Lb-libi386 Bibliothèque de l'architecture i386 (libi386, \-li386) +.ds doc-str-Lb-libipsec Bibliothèque de contrôle de politique IPsec (libipsec, \-lipsec) +.ds doc-str-Lb-libkvm Bibliothèque d'accès aux données du noyau (libkvm, \-lkvm) +.ds doc-str-Lb-libm Bibliothèque mathématique (libm, \-lm) +.ds doc-str-Lb-libmd Bibliothèque de support des signatures (MD4, MD5, etc.) (libmd, \-lmd) +.ds doc-str-Lb-libmenu Bibliothèque Curses des Menus (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph Bibliothèque utilisateur Netgraph (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libossaudio Bibliothèque d'émulation audio OSS (libossaudio, \-lossaudio) +.ds doc-str-Lb-libpam Bibliothèque PAM (libpam, \-lpam) +.ds doc-str-Lb-libposix Bibliothèque de compatibilité \*[Px] (libposix, \-lposix) +.ds doc-str-Lb-libresolv Bibliothèque du résolveur DNS (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsvc Bibliothèque des services RPC (librpcsvc, \-lrpcsvc) +.ds doc-str-Lb-libtermcap Bibliothèque d'accès aux terminaux (libtermcap, \-ltermcap) +.\" XXX ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) +.\" XXX ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libusbhid Bibliothèque d'accès aux routines USB HID (libusbhid, \-lusbhid) +.ds doc-str-Lb-libutil Bibliothèque des utilitaires système (libutil, \-lutil) +.ds doc-str-Lb-libvgl Bibliothèque graphique vidéo (libvgl, \-lvgl) +.ds doc-str-Lb-libz Bibliothèque de compression (libz, \-lz) +. +.\" .Rv localization +.ds doc-str-Rv-std-prefix "La +.ds doc-str-Rv-std-suffix "fonction retourne la valeur\~0 si tout c'est bien passé; +.as doc-str-Rv-std-suffix " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-std-suffix " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-std-suffix " est positionnée pour indiquer l'erreur. +. +.ds doc-str-Rv-stds-prefix "Les +.ds doc-str-Rv-stds-and "et +.ds doc-str-Rv-stds-suffix "fonctions retournent la valeur\~0 si tout c'est bien passé; +.as doc-str-Rv-stds-suffix " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-stds-suffix " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-stds-suffix " est positionnée pour indiquer l'erreur. +. +.ds doc-str-Rv-std0 "Si tout c'est bien passé, la valeur\~0 est retournée; +.as doc-str-Rv-std0 " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-std0 " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-std0 " est positionnée pour indiquer l'erreur. +. +.\" .Ex localization +.ds doc-str-Ex-std-prefix "La commande +.ds doc-str-Ex-std-suffix " retourne\~0 si tout c'est bien passé, +.as doc-str-Ex-std-suffix " et\~>0 si une erreur survient. +. +.ds doc-str-Ex-stds-prefix "Les commandes +.ds doc-str-Ex-stds-suffix "retournent\~0 si tout c'est bien passé, +.as doc-str-Ex-stds-suffix " et\~>0 si une erreur survient. +. +.\" .Ar localization +.ds doc-str-Ar-default "fichier\ .\|.\|. +. +.\" .%A localization +.ds doc-str-dpra "et Copied: head/gnu/usr.bin/groff/tmac/mdoc.local.in (from r288405, head/gnu/usr.bin/groff/tmac/mdoc.local) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/mdoc.local.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/mdoc.local) @@ -0,0 +1,80 @@ +.\" Copyright (c) 2001-2004 Ruslan Ermilov . +.\" 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$ +.\" +.\" %beginstrip% +. +.eo +. +. +.ds doc-volume-operating-system FreeBSD +. +.\" FreeBSD .Lb values +.ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) +.ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) +.ds doc-str-Lb-libcapsicum Capsicum Library (libcapsicum, \-lcapsicum) +.ds doc-str-Lb-libcuse Userland Character Device Library (libcuse, \-lcuse) +.ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit) +.ds doc-str-Lb-libefi EFI Runtime Services Library (libefi, \-lefi) +.ds doc-str-Lb-libelf ELF Parsing Library (libelf, \-lelf) +.ds doc-str-Lb-libexecinfo Backtrace Access Library (libexecinfo, \-lexecinfo) +.ds doc-str-Lb-libfetch File Transfer Library (libfetch, \-lfetch) +.ds doc-str-Lb-libnv Name/value pairs library (libnv, \-lnv) +.ds doc-str-Lb-libpmc Performance Monitoring Counters Interface Library (libpmc, \-lpmc) +.ds doc-str-Lb-libproc Processor Monitoring and Analysis Library (libproc, \-lproc) +.ds doc-str-Lb-libprocstat Process and Files Information Retrieval (libprocstat, \-lprocstat) +.ds doc-str-Lb-librtld_db Run-time Linker Debugging Library (librtld_db, \-lrtld_db) +.ds doc-str-Lb-libsbuf Safe String Composition Library (libsbuf, \-lsbuf) +.ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads) +. +.\" Default .Os value +.ds doc-default-operating-system FreeBSD\~11.0 +. +.\" FreeBSD releases not found in doc-common +.ds doc-operating-system-FreeBSD-2.2.9 2.2.9 +.ds doc-operating-system-FreeBSD-7.4 7.4 +.ds doc-operating-system-FreeBSD-8.3 8.3 +.ds doc-operating-system-FreeBSD-8.4 8.4 +.ds doc-operating-system-FreeBSD-9.1 9.1 +.ds doc-operating-system-FreeBSD-9.2 9.2 +.ds doc-operating-system-FreeBSD-9.3 9.3 +.ds doc-operating-system-FreeBSD-10.0 10.0 +.ds doc-operating-system-FreeBSD-10.1 10.1 +.ds doc-operating-system-FreeBSD-11.0 11.0 +. +.\" Definitions for other *BSDs not (yet) in doc-common +.ds doc-operating-system-NetBSD-7.0 7.0 +. +.\" Definitions not (yet) in doc-syms +. +.ec +. +.\" Locale support +.if d doc-locale \{\ +. ie "\*[doc-locale]"ru.KOI8-R" \ +. mso mdoc/ru.KOI8-R +. el \{ .if "\*[doc-locale]"fr.ISO8859-1" \ +. mso mdoc/fr.ISO8859-1 +.\}\} Copied: head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in (from r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R) @@ -0,0 +1,139 @@ +.\" Copyright (c) 2001-2003 Ruslan Ermilov . +.\" 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$ +.\" +.\" %beginstrip% +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Dt +.nr doc-volume-operating-system-ateol 1 +.ds doc-volume-ds-1 óÐÒÁ×ÏÞÎÉË ÏÓÎÏ×ÎÙÈ ËÏÍÁÎÄ +.ds doc-volume-ds-2 óÐÒÁ×ÏÞÎÉË ÓÉÓÔÅÍÎÙÈ ×ÙÚÏ×Ï× +.ds doc-volume-ds-3 óÐÒÁ×ÏÞÎÉË ÂÉÂÌÉÏÔÅÞÎÙÈ ÆÕÎËÃÉÊ +.ds doc-volume-ds-4 óÐÒÁ×ÏÞÎÉË ÉÎÔÅÒÆÅÊÓÏ× ÑÄÒÁ +.ds doc-volume-ds-5 óÐÒÁ×ÏÞÎÉË ÆÏÒÍÁÔÏ× ÆÁÊÌÏ× +.ds doc-volume-ds-6 óÐÒÁ×ÏÞÎÉË ÉÇÒ +.ds doc-volume-ds-7 óÐÒÁ×ÏÞÎÉË ÒÁÚÎÏÊ ÉÎÆÏÒÍÁÃÉÉ +.ds doc-volume-ds-8 óÐÒÁ×ÏÞÎÉË ÓÉÓÔÅÍÎÏÇÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒÁ +.ds doc-volume-ds-9 óÐÒÁ×ÏÞÎÉË ÒÁÚÒÁÂÏÔÞÉËÁ ÑÄÒÁ +. +.ds doc-volume-ds-USD äÏÐÏÌÎÉÔÅÌØÎÙÅ ÄÏËÕÍÅÎÔÙ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ +.ds doc-volume-ds-PS1 äÏÐÏÌÎÉÔÅÌØÎÙÅ ÄÏËÕÍÅÎÔÙ ÄÌÑ ÐÒÏÇÒÁÍÍÉÓÔÁ +.ds doc-volume-ds-AMD äÏËÕÍÅÎÔÙ ÕÎÁÓÌÅÄÏ×ÁÎÎÏÇÏ ÓÐÒÁ×ÏÞÎÉËÁ +.ds doc-volume-ds-SMM òÕËÏ×ÏÄÓÔ×Ï ÓÉÓÔÅÍÎÏÇÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒÁ +.ds doc-volume-ds-URM óÐÒÁ×ÏÞÎÏÅ ÒÕËÏ×ÏÄÓÔ×Ï +.ds doc-volume-ds-PRM òÕËÏ×ÏÄÓÔ×Ï ÐÒÏÇÒÁÍÍÉÓÔÁ +.ds doc-volume-ds-KM òÕËÏ×ÏÄÓÔ×Ï ÐÏ ÑÄÒÕ +.ds doc-volume-ds-IND ïÓÎÏ×ÎÏÊ ÐÒÅÄÍÅÔÎÙÊ ÕËÁÚÁÔÅÌØ ÓÐÒÁ×ÏÞÎÉËÁ +.ds doc-volume-ds-LOCAL ìÏËÁÌØÎÙÊ ÓÐÒÁ×ÏÞÎÉË +.ds doc-volume-ds-CON óÐÒÁ×ÏÞÎÉË ÐÏ ÄÏÐÏÌÎÉÔÅÌØÎÏÍÕ ðï +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Os +.ds doc-operating-system-ATT-7 7Ñ\~ÒÅÄÁËÃÉÑ +.ds doc-operating-system-BSD-3 3Ê\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4 4Ê\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.1 4.1\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.2 4.2\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3 4.3\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3T 4.3-Tahoe ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3R 4.3-Reno ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Sh +.ds doc-section-name îáú÷áîéå +.ds doc-section-synopsis óéîôáëóéó +.ds doc-section-library âéâìéïôåëá +.ds doc-section-description ïðéóáîéå +.ds doc-section-see-also óíïôòé +.ds doc-section-files æáêìù +.ds doc-section-authors á÷ôïòù +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Lb (XXX) +.ds doc-str-Lb-libarm32 âÉÂÌÉÏÔÅËÁ ÁÒÈÉÔÅËÔÕÒÙ ARM32 (libarm32, \-larm32) +.ds doc-str-Lb-libc óÔÁÎÄÁÒÔÎÁÑ ÂÉÂÌÉÏÔÅËÁ\~C (libc, \-lc) +.ds doc-str-Lb-libc_r òÅÅÎÔÅÒÁÂÅÌØÎÁÑ ÂÉÂÌÉÏÔÅËÁ\~C (libc_r, \-lc_r) +.ds doc-str-Lb-libcalendar âÉÂÌÉÏÔÅËÁ ËÁÌÅÎÄÁÒÎÏÊ ÁÒÉÆÍÅÔÉËÉ (libcalendar, \-lcalendar) +.ds doc-str-Lb-libcam ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ ÂÉÂÌÉÏÔÅËÁ CAM (libcam, \-lcam) +.ds doc-str-Lb-libcipher âÉÂÌÉÏÔÅËÁ ËÒÉÐÔÏÇÒÁÆÉÉ FreeSec (libcipher, \-lcipher) +.ds doc-str-Lb-libcompat âÉÂÌÉÏÔÅËÁ ÓÏ×ÍÅÓÔÉÍÏÓÔÉ (libcompat, \-lcompat) +.ds doc-str-Lb-libcrypt âÉÂÌÉÏÔÅËÁ ËÒÉÐÔÏÇÒÁÆÉÉ (libcrypt, \-lcrypt) +.\" XXX ds doc-str-Lb-libcurses Curses Library (libcurses, \-lcurses) +.\" XXX ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) +.ds doc-str-Lb-libdevstat âÉÂÌÉÏÔÅËÁ ÓÔÁÔÉÓÔÉËÉ ÕÓÔÒÏÊÓÔ× (libdevstat, \-ldevstat) +.\" XXX ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) +.ds doc-str-Lb-libedit âÉÂÌÉÏÔÅËÁ ÒÅÄÁËÔÏÒÁ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ (libedit, \-ledit) +.ds doc-str-Lb-libfetch âÉÂÌÉÏÔÅËÁ ÆÁÊÌÏ×ÏÊ ÐÅÒÅÄÁÞÉ (libfetch, \-lfetch) +.ds doc-str-Lb-libgeom ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ API ÂÉÂÌÉÏÔÅËÁ ÐÏÄÓÉÓÔÅÍÙ ÑÄÒÁ GEOM (libgeom, \-lgeom) +.ds doc-str-Lb-libi386 âÉÂÌÉÏÔÅËÁ ÁÒÈÉÔÅËÔÕÒÙ i386 (libi386, \-li386) +.ds doc-str-Lb-libipsec âÉÂÌÉÏÔÅËÁ ÕÐÒÁ×ÌÅÎÉÑ IPsec Policy (libipsec, \-lipsec) +.ds doc-str-Lb-libkvm âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë ÄÁÎÎÙÍ ÑÄÒÁ (libkvm, \-lkvm) +.ds doc-str-Lb-libm âÉÂÌÉÏÔÅËÁ ÍÁÔÅÍÁÔÉÞÅÓËÉÈ ÆÕÎËÃÉÊ (libm, \-lm) +.\" XXX ds doc-str-Lb-libmd Message Digest (MD4, MD5, É Ô.Ä.) Support Library (libmd, \-lmd) +.\" XXX ds doc-str-Lb-libmenu Curses Menu Library (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ ÂÉÂÌÉÏÔÅËÁ Netgraph (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libossaudio âÉÂÌÉÏÔÅËÁ ÜÍÕÌÑÃÉÉ OSS Audio (libossaudio, \-lossaudio) +.ds doc-str-Lb-libpam âÉÂÌÉÏÔÅËÁ PAM (libpam, \-lpam) +.ds doc-str-Lb-libposix âÉÂÌÉÏÔÅËÁ \*[Px]\-ÓÏ×ÍÅÓÔÉÍÏÓÔÉ (libposix, \-lposix) +.\" XXX ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsvc âÉÂÌÉÏÔÅËÁ ÓÌÕÖ RPC (librpcsvc, \-lrpcsvc) +.ds doc-str-Lb-libtermcap âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë termcap (libtermcap, \-ltermcap) +.ds doc-str-Lb-libufs âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÅ UFS (libufs, \-lufs) +.\" XXX ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libusbhid âÉÂÌÉÏÔÅËÁ ÆÕÎËÃÉÊ ÄÏÓÔÕÐÁ Ë USB HID (libusbhid, \-lusbhid) +.ds doc-str-Lb-libutil âÉÂÌÉÏÔÅËÁ ÓÉÓÔÅÍÎÙÈ ÕÔÉÌÉÔ (libutil, \-lutil) +.ds doc-str-Lb-libvgl âÉÂÌÉÏÔÅËÁ ×ÉÄÅÏ-ÇÒÁÆÉËÉ (libvgl, \-lvgl) +.ds doc-str-Lb-libz âÉÂÌÉÏÔÅËÁ ËÏÍÐÒÅÓÓÉÉ (libz, \-lz) +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Rv +.ds doc-str-Rv-std-prefix "æÕÎËÃÉÑ +.ds doc-str-Rv-std-suffix "×ÏÚ×ÒÁÝÁÅÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ; +.as doc-str-Rv-std-suffix " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ÏÎÁ ×ÏÚ×ÒÁÝÁÅÔ\~-1, +.as doc-str-Rv-std-suffix " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-std-suffix " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.ds doc-str-Rv-stds-prefix "æÕÎËÃÉÉ +.ds doc-str-Rv-stds-and "É +.ds doc-str-Rv-stds-suffix "×ÏÚ×ÒÁÝÁÀÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ; +.as doc-str-Rv-stds-suffix " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ÏÎÉ ×ÏÚ×ÒÁÝÁÀÔ\~-1, +.as doc-str-Rv-stds-suffix " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-stds-suffix " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.ds doc-str-Rv-std0 "÷ ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ ×ÏÚ×ÒÁÝÁÅÔÓÑ\~0; +.as doc-str-Rv-std0 " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ×ÏÚ×ÒÁÝÁÅÔÓÑ\~-1, +.as doc-str-Rv-std0 " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-std0 " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Ex +.ds doc-str-Ex-std-prefix "õÔÉÌÉÔÁ +.ds doc-str-Ex-std-suffix "×ÏÚ×ÒÁÝÁÅÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ +.as doc-str-Ex-std-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ. +. +.ds doc-str-Ex-stds-prefix "õÔÉÌÉÔÙ +.ds doc-str-Ex-stds-suffix "×ÏÚ×ÒÁÝÁÀÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ +.as doc-str-Ex-stds-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Ar +.ds doc-str-Ar-default "ÆÁÊÌ\ .\|.\|. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .%A +.ds doc-str-dpra "É From owner-svn-src-all@freebsd.org Wed Sep 30 21:32:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6279A0C8DB; Wed, 30 Sep 2015 21:32:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95C001232; Wed, 30 Sep 2015 21:32:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8ULWVgL007084; Wed, 30 Sep 2015 21:32:31 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8ULWUnZ007076; Wed, 30 Sep 2015 21:32:30 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509302132.t8ULWUnZ007076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 30 Sep 2015 21:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288430 - in head: bin/sh lib/libc/gen 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 21:32:31 -0000 Author: jilles Date: Wed Sep 30 21:32:29 2015 New Revision: 288430 URL: https://svnweb.freebsd.org/changeset/base/288430 Log: wordexp: Rewrite to make WRDE_NOCMD reliable. Shell syntax is too complicated to detect command substitution and unquoted operators reliably without implementing much of sh's parser. Therefore, have sh do this detection. While changing sh's support anyway, also read input from a pipe instead of arguments to avoid {ARG_MAX} limits and improve privacy, and output count and length using 16 instead of 8 digits. The basic concept is: execl("/bin/sh", "sh", "-c", "freebsd_wordexp ${1:+\"$1\"} -f "$2", "", flags & WRDE_NOCMD ? "-p" : "", ); The WRDE_BADCHAR error is still implemented in libc. POSIX requires us to fail strings containing unquoted braces with code WRDE_BADCHAR. Since this is normally not a syntax error in sh, there is still a need for checking code in libc, we_check(). The new we_check() is an optimistic check that all the characters | & ; < > ( ) { } are quoted. To avoid duplicating too much sh logic, such characters are permitted when quoting characters are seen, even if the quoting characters may themselves be quoted. This code reports all WRDE_BADCHAR errors; bad characters that get past it and are a syntax error in sh return WRDE_SYNTAX. Although many implementations of WRDE_NOCMD erroneously allow some command substitutions (and ours even documented this), there appears to be code that relies on its security (codesearch.debian.net shows quite a few uses). Passing untrusted data to wordexp() still exposes a denial of service possibility and a fairly large attack surface. Reviewed by: wblock (man page only) MFC after: 2 weeks Relnotes: yes Security: fixes command execution with wordexp(untrusted, WRDE_NOCMD) Modified: head/bin/sh/builtins.def head/bin/sh/expand.c head/bin/sh/parser.c head/bin/sh/parser.h head/lib/libc/gen/wordexp.3 head/lib/libc/gen/wordexp.c Modified: head/bin/sh/builtins.def ============================================================================== --- head/bin/sh/builtins.def Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/builtins.def Wed Sep 30 21:32:29 2015 (r288430) @@ -65,6 +65,7 @@ exportcmd -s export -s readonly #exprcmd expr falsecmd false fgcmd -j fg +freebsd_wordexpcmd freebsd_wordexp getoptscmd getopts hashcmd hash histcmd -h fc Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/expand.c Wed Sep 30 21:32:29 2015 (r288430) @@ -1656,3 +1656,57 @@ wordexpcmd(int argc, char **argv) outbin(argv[i], strlen(argv[i]) + 1, out1); return (0); } + +/* + * Do most of the work for wordexp(3), new version. + */ + +int +freebsd_wordexpcmd(int argc __unused, char **argv __unused) +{ + struct arglist arglist; + union node *args, *n; + struct strlist *sp; + size_t count, len; + int ch; + int protected = 0; + int fd = -1; + + while ((ch = nextopt("f:p")) != '\0') { + switch (ch) { + case 'f': + fd = number(shoptarg); + break; + case 'p': + protected = 1; + break; + } + } + if (*argptr != NULL) + error("wrong number of arguments"); + if (fd < 0) + error("missing fd"); + INTOFF; + setinputfd(fd, 1); + INTON; + args = parsewordexp(); + popfile(); /* will also close fd */ + if (protected) + for (n = args; n != NULL; n = n->narg.next) { + if (n->narg.backquote != NULL) { + outcslow('C', out1); + error("command substitution disabled"); + } + } + outcslow(' ', out1); + arglist.lastp = &arglist.list; + for (n = args; n != NULL; n = n->narg.next) + expandarg(n, &arglist, EXP_FULL | EXP_TILDE); + *arglist.lastp = NULL; + for (sp = arglist.list, count = len = 0; sp; sp = sp->next) + count++, len += strlen(sp->text); + out1fmt("%016zx %016zx", count, len); + for (sp = arglist.list; sp; sp = sp->next) + outbin(sp->text, strlen(sp->text) + 1, out1); + return (0); +} Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/parser.c Wed Sep 30 21:32:29 2015 (r288430) @@ -231,6 +231,39 @@ parsecmd(int interact) } +/* + * Read and parse words for wordexp. + * Returns a list of NARG nodes; NULL if there are no words. + */ +union node * +parsewordexp(void) +{ + union node *n, *first = NULL, **pnext; + int t; + + /* This assumes the parser is not re-entered, + * which could happen if we add command substitution on PS1/PS2. + */ + parser_temp_free_all(); + heredoclist = NULL; + + tokpushback = 0; + checkkwd = 0; + doprompt = 0; + setprompt(0); + needprompt = 0; + pnext = &first; + while ((t = readtoken()) != TEOF) { + if (t != TWORD) + synexpect(TWORD); + n = makename(); + *pnext = n; + pnext = &n->narg.next; + } + return first; +} + + static union node * list(int nlflag) { Modified: head/bin/sh/parser.h ============================================================================== --- head/bin/sh/parser.h Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/parser.h Wed Sep 30 21:32:29 2015 (r288430) @@ -76,6 +76,7 @@ extern const char *const parsekwd[]; union node *parsecmd(int); +union node *parsewordexp(void); void forcealias(void); void fixredir(union node *, const char *, int); int goodname(const char *); Modified: head/lib/libc/gen/wordexp.3 ============================================================================== --- head/lib/libc/gen/wordexp.3 Wed Sep 30 20:47:27 2015 (r288429) +++ head/lib/libc/gen/wordexp.3 Wed Sep 30 21:32:29 2015 (r288430) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2015 +.Dd September 30, 2015 .Dt WORDEXP 3 .Os .Sh NAME @@ -108,8 +108,9 @@ function frees the memory allocated by .Sh IMPLEMENTATION NOTES The .Fn wordexp -function is implemented by executing -.Xr sh 1 . +function is implemented using the undocumented +.Ic freebsd_wordexp +shell built-in command. .Sh RETURN VALUES The .Fn wordexp @@ -191,18 +192,19 @@ and functions conform to .St -p1003.1-2001 . .Sh BUGS -Do not pass untrusted user data to -.Fn wordexp , -regardless of whether the -.Dv WRDE_NOCMD -flag is set. -The -.Fn wordexp -function attempts to detect input that would cause commands to be -executed before passing it to the shell -but it does not use the same parser so it may be fooled. -.Pp The current .Fn wordexp implementation does not recognize multibyte characters other than UTF-8, since the shell (which it invokes to perform expansions) does not. +.Sh SECURITY CONSIDERATIONS +Pathname generation may create output that is exponentially larger than the +input size. +.Pp +Although this implementation detects command substitution reliably for +.Dv WRDE_NOCMD , +the attack surface remains fairly large. +Also, some other implementations +(such as older versions of this one) +may execute command substitutions even if +.Dv WRDE_NOCMD +is set. Modified: head/lib/libc/gen/wordexp.c ============================================================================== --- head/lib/libc/gen/wordexp.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/lib/libc/gen/wordexp.c Wed Sep 30 21:32:29 2015 (r288430) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,7 @@ __FBSDID("$FreeBSD$"); static int we_askshell(const char *, wordexp_t *, int); -static int we_check(const char *, int); +static int we_check(const char *); /* * wordexp -- @@ -65,7 +66,7 @@ wordexp(const char * __restrict words, w we->we_strings = NULL; we->we_nbytes = 0; } - if ((error = we_check(words, flags)) != 0) { + if ((error = we_check(words)) != 0) { wordfree(we); return (error); } @@ -94,17 +95,37 @@ we_read_fully(int fd, char *buffer, size return done; } +static bool +we_write_fully(int fd, const char *buffer, size_t len) +{ + size_t done; + ssize_t nwritten; + + done = 0; + do { + nwritten = _write(fd, buffer + done, len - done); + if (nwritten == -1 && errno == EINTR) + continue; + if (nwritten <= 0) + return (false); + done += nwritten; + } while (done != len); + return (true); +} + /* * we_askshell -- - * Use the `wordexp' /bin/sh builtin function to do most of the work - * in expanding the word string. This function is complicated by + * Use the `freebsd_wordexp' /bin/sh builtin function to do most of the + * work in expanding the word string. This function is complicated by * memory management. */ static int we_askshell(const char *words, wordexp_t *we, int flags) { - int pdes[2]; /* Pipe to child */ - char buf[18]; /* Buffer for byte and word count */ + int pdesw[2]; /* Pipe for writing words */ + int pdes[2]; /* Pipe for reading output */ + char wfdstr[sizeof(int) * 3 + 1]; + char buf[35]; /* Buffer for byte and word count */ long nwords, nbytes; /* Number of words, bytes from child */ long i; /* Handy integer */ size_t sofs; /* Offset into we->we_strings */ @@ -119,18 +140,25 @@ we_askshell(const char *words, wordexp_t char **nwv; /* Temporary for realloc() */ sigset_t newsigblock, oldsigblock; const char *ifs; - char save; serrno = errno; ifs = getenv("IFS"); - if (pipe2(pdes, O_CLOEXEC) < 0) + if (pipe2(pdesw, O_CLOEXEC) < 0) + return (WRDE_NOSPACE); /* XXX */ + snprintf(wfdstr, sizeof(wfdstr), "%d", pdesw[0]); + if (pipe2(pdes, O_CLOEXEC) < 0) { + _close(pdesw[0]); + _close(pdesw[1]); return (WRDE_NOSPACE); /* XXX */ + } (void)sigemptyset(&newsigblock); (void)sigaddset(&newsigblock, SIGCHLD); (void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); if ((pid = fork()) < 0) { serrno = errno; + _close(pdesw[0]); + _close(pdesw[1]); _close(pdes[0]); _close(pdes[1]); (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); @@ -146,43 +174,54 @@ we_askshell(const char *words, wordexp_t _dup2(pdes[1], STDOUT_FILENO) : _fcntl(pdes[1], F_SETFD, 0)) < 0) _exit(1); + if (_fcntl(pdesw[0], F_SETFD, 0) < 0) + _exit(1); execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", - "-c", "IFS=$1;eval \"$2\";eval \"echo;set -- $3\";" - "IFS=;a=\"$*\";printf '%08x' \"$#\" \"${#a}\";" - "printf '%s\\0' \"$@\"", + "-c", "IFS=$1;eval \"$2\";" + "freebsd_wordexp -f \"$3\" ${4:+\"$4\"}", "", ifs != NULL ? ifs : " \t\n", - flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, + flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", + wfdstr, + flags & WRDE_NOCMD ? "-p" : "", (char *)NULL); _exit(1); } /* - * We are the parent; read the output of the shell wordexp function, - * which is a byte indicating that the words were parsed successfully, - * a 32-bit hexadecimal word count, a 32-bit hexadecimal byte count - * (not including terminating null bytes), followed by the expanded - * words separated by nulls. + * We are the parent; write the words. */ _close(pdes[1]); - switch (we_read_fully(pdes[0], buf, 17)) { + _close(pdesw[0]); + if (!we_write_fully(pdesw[1], words, strlen(words))) { + _close(pdesw[1]); + error = WRDE_SYNTAX; + goto cleanup; + } + _close(pdesw[1]); + /* + * Read the output of the shell wordexp function, + * which is a byte indicating that the words were parsed successfully, + * a 64-bit hexadecimal word count, a dummy byte, a 64-bit hexadecimal + * byte count (not including terminating null bytes), followed by the + * expanded words separated by nulls. + */ + switch (we_read_fully(pdes[0], buf, 34)) { case 1: - error = WRDE_BADVAL; + error = buf[0] == 'C' ? WRDE_CMDSUB : WRDE_BADVAL; serrno = errno; goto cleanup; - case 17: + case 34: break; default: error = WRDE_SYNTAX; serrno = errno; goto cleanup; } - save = buf[9]; - buf[9] = '\0'; - nwords = strtol(buf + 1, NULL, 16); - buf[9] = save; buf[17] = '\0'; - nbytes = strtol(buf + 9, NULL, 16) + nwords; + nwords = strtol(buf + 1, NULL, 16); + buf[34] = '\0'; + nbytes = strtol(buf + 18, NULL, 16) + nwords; /* * Allocate or reallocate (when flags & WRDE_APPEND) the word vector @@ -255,83 +294,96 @@ cleanup: * we_check -- * Check that the string contains none of the following unquoted * special characters: |&;<>(){} - * or command substitutions when WRDE_NOCMD is set in flags. + * This mainly serves for {} which are normally legal in sh. + * It deliberately does not attempt to model full sh syntax. */ static int -we_check(const char *words, int flags) +we_check(const char *words) { char c; - int dquote, level, quote, squote; + /* Saw \ or $, possibly not special: */ + bool quote = false, dollar = false; + /* Saw ', ", ${, ` or $(, possibly not special: */ + bool have_sq = false, have_dq = false, have_par_begin = false; + bool have_cmd = false; + /* Definitely saw a ', ", ${, ` or $(, need a closing character: */ + bool need_sq = false, need_dq = false, need_par_end = false; + bool need_cmd_old = false, need_cmd_new = false; - quote = squote = dquote = 0; while ((c = *words++) != '\0') { switch (c) { case '\\': - if (squote == 0) - quote ^= 1; + quote = !quote; + continue; + case '$': + if (quote) + quote = false; + else + dollar = !dollar; continue; case '\'': - if (quote + dquote == 0) - squote ^= 1; + if (!quote && !have_sq && !have_dq) + need_sq = true; + else + need_sq = false; + have_sq = true; break; case '"': - if (quote + squote == 0) - dquote ^= 1; + if (!quote && !have_sq && !have_dq) + need_dq = true; + else + need_dq = false; + have_dq = true; break; case '`': - if (quote + squote == 0 && flags & WRDE_NOCMD) - return (WRDE_CMDSUB); - while ((c = *words++) != '\0' && c != '`') - if (c == '\\' && (c = *words++) == '\0') - break; - if (c == '\0') - return (WRDE_SYNTAX); + if (!quote && !have_sq && !have_cmd) + need_cmd_old = true; + else + need_cmd_old = false; + have_cmd = true; break; - case '|': case '&': case ';': case '<': case '>': - case '{': case '}': case '(': case ')': case '\n': - if (quote + squote + dquote == 0) + case '{': + if (!quote && !dollar && !have_sq && !have_dq && + !have_cmd) return (WRDE_BADCHAR); + if (dollar) { + if (!quote && !have_sq) + need_par_end = true; + have_par_begin = true; + } break; - case '$': - if ((c = *words++) == '\0') - break; - else if (quote + squote == 0 && c == '(') { - if (flags & WRDE_NOCMD && *words != '(') - return (WRDE_CMDSUB); - level = 1; - while ((c = *words++) != '\0') { - if (c == '\\') { - if ((c = *words++) == '\0') - break; - } else if (c == '(') - level++; - else if (c == ')' && --level == 0) - break; - } - if (c == '\0' || level != 0) - return (WRDE_SYNTAX); - } else if (quote + squote == 0 && c == '{') { - level = 1; - while ((c = *words++) != '\0') { - if (c == '\\') { - if ((c = *words++) == '\0') - break; - } else if (c == '{') - level++; - else if (c == '}' && --level == 0) - break; - } - if (c == '\0' || level != 0) - return (WRDE_SYNTAX); - } else - --words; + case '}': + if (!quote && !have_sq && !have_dq && !have_par_begin && + !have_cmd) + return (WRDE_BADCHAR); + need_par_end = false; + break; + case '(': + if (!quote && !dollar && !have_sq && !have_dq && + !have_cmd) + return (WRDE_BADCHAR); + if (dollar) { + if (!quote && !have_sq) + need_cmd_new = true; + have_cmd = true; + } + break; + case ')': + if (!quote && !have_sq && !have_dq && !have_cmd) + return (WRDE_BADCHAR); + need_cmd_new = false; + break; + case '|': case '&': case ';': case '<': case '>': case '\n': + if (!quote && !have_sq && !have_dq && !have_cmd) + return (WRDE_BADCHAR); break; default: break; } - quote = 0; + quote = dollar = false; } - if (quote + squote + dquote != 0) + if (quote || dollar || need_sq || need_dq || need_par_end || + need_cmd_old || need_cmd_new) return (WRDE_SYNTAX); return (0); From owner-svn-src-all@freebsd.org Wed Sep 30 22:21:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB5CA0AAA3; Wed, 30 Sep 2015 22:21:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E6CD1F48; Wed, 30 Sep 2015 22:21:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3E345B922; Wed, 30 Sep 2015 18:21:35 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288424 - head/usr.bin/truss Date: Wed, 30 Sep 2015 12:46:02 -0700 Message-ID: <2136278.DT0mBerccO@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201509301913.t8UJDWL8050052@repo.freebsd.org> References: <201509301913.t8UJDWL8050052@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 30 Sep 2015 18:21:35 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 22:21:37 -0000 On Wednesday, September 30, 2015 07:13:32 PM John Baldwin wrote: > Author: jhb > Date: Wed Sep 30 19:13:32 2015 > New Revision: 288424 > URL: https://svnweb.freebsd.org/changeset/base/288424 > > Log: > Several changes to truss. > .... > > Reviewed by: kib (earlier version) > Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version) > Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc) This was posted to arch@ a while back for testing. mips and sparc64 could certainly use some testing. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Sep 30 23:06:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0939BA0C9E6; Wed, 30 Sep 2015 23:06:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED562105F; Wed, 30 Sep 2015 23:06:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UN6WL5043750; Wed, 30 Sep 2015 23:06:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UN6UwX043736; Wed, 30 Sep 2015 23:06:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509302306.t8UN6UwX043736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 23:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288431 - in head/sys: kern 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.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 23:06:33 -0000 Author: markj Date: Wed Sep 30 23:06:29 2015 New Revision: 288431 URL: https://svnweb.freebsd.org/changeset/base/288431 Log: As a step towards the elimination of PG_CACHED pages, rework the handling of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to the head of the inactive queue instead of being cached. This affects the implementation of POSIX_FADV_NOREUSE as well, since it works by applying POSIX_FADV_DONTNEED to file ranges after they have been read or written. At that point the corresponding buffers may still be dirty, so the previous implementation would coalesce successive ranges and apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the dirty buffers would eventually be cached. To preserve this behaviour in an efficient manner, this change adds a new buf flag, B_NOREUSE, which causes the pages backing a VMIO buf to be placed at the head of the inactive queue when the buf is released. POSIX_FADV_NOREUSE then works by setting this flag in bufs that underlie the specified range. Reviewed by: alc, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3726 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_default.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/sys/buf.h head/sys/sys/file.h head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_bio.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1785,6 +1785,8 @@ brelse(struct buf *bp) bp, bp->b_vp, bp->b_flags); KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), ("brelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp)); + KASSERT((bp->b_flags & B_VMIO) != 0 || (bp->b_flags & B_NOREUSE) == 0, + ("brelse: non-VMIO buffer marked NOREUSE")); if (BUF_LOCKRECURSED(bp)) { /* @@ -1873,8 +1875,10 @@ brelse(struct buf *bp) allocbuf(bp, 0); } - if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0) { + if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0 || + (bp->b_flags & (B_DELWRI | B_NOREUSE)) == B_NOREUSE) { allocbuf(bp, 0); + bp->b_flags &= ~B_NOREUSE; if (bp->b_vp != NULL) brelvp(bp); } @@ -1969,6 +1973,10 @@ bqrelse(struct buf *bp) if ((bp->b_flags & B_DELWRI) == 0 && (bp->b_xflags & BX_VNDIRTY)) panic("bqrelse: not dirty"); + if ((bp->b_flags & B_NOREUSE) != 0) { + brelse(bp); + return; + } qindex = QUEUE_CLEAN; } binsfree(bp, qindex); @@ -2079,10 +2087,15 @@ vfs_vmio_unwire(struct buf *bp, vm_page_ freed = false; if (!freed) { /* - * In order to maintain LRU page ordering, put - * the page at the tail of the inactive queue. + * If the page is unlikely to be reused, let the + * VM know. Otherwise, maintain LRU page + * ordering and put the page at the tail of the + * inactive queue. */ - vm_page_deactivate(m); + if ((bp->b_flags & B_NOREUSE) != 0) + vm_page_deactivate_noreuse(m); + else + vm_page_deactivate(m); } } vm_page_unlock(m); @@ -2456,8 +2469,9 @@ getnewbuf_reuse_bp(struct buf *bp, int q * Note: we no longer distinguish between VMIO and non-VMIO * buffers. */ - KASSERT((bp->b_flags & B_DELWRI) == 0, - ("delwri buffer %p found in queue %d", bp, qindex)); + KASSERT((bp->b_flags & (B_DELWRI | B_NOREUSE)) == 0, + ("invalid buffer %p flags %#x found in queue %d", bp, bp->b_flags, + qindex)); /* * When recycling a clean buffer we have to truncate it and Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_default.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1034,9 +1034,12 @@ vop_stdallocate(struct vop_allocate_args int vop_stdadvise(struct vop_advise_args *ap) { + struct buf *bp; + struct buflists *bl; struct vnode *vp; + daddr_t bn, startn, endn; off_t start, end; - int error; + int bsize, error; vp = ap->a_vp; switch (ap->a_advice) { @@ -1049,28 +1052,59 @@ vop_stdadvise(struct vop_advise_args *ap error = 0; break; case POSIX_FADV_DONTNEED: - /* - * Flush any open FS buffers and then remove pages - * from the backing VM object. Using vinvalbuf() here - * is a bit heavy-handed as it flushes all buffers for - * the given vnode, not just the buffers covering the - * requested range. - */ error = 0; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); break; } - vinvalbuf(vp, V_CLEANONLY, 0, 0); + + /* + * Deactivate pages in the specified range from the backing VM + * object. Pages that are resident in the buffer cache will + * remain wired until their corresponding buffers are released + * below. + */ if (vp->v_object != NULL) { start = trunc_page(ap->a_start); end = round_page(ap->a_end); VM_OBJECT_WLOCK(vp->v_object); - vm_object_page_cache(vp->v_object, OFF_TO_IDX(start), + vm_object_page_noreuse(vp->v_object, OFF_TO_IDX(start), OFF_TO_IDX(end)); VM_OBJECT_WUNLOCK(vp->v_object); } + + BO_RLOCK(&vp->v_bufobj); + bsize = vp->v_bufobj.bo_bsize; + startn = ap->a_start / bsize; + if (ap->a_end == OFF_MAX) { + endn = -1; + bl = &vp->v_bufobj.bo_clean.bv_hd; + if (!TAILQ_EMPTY(bl)) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + bl = &vp->v_bufobj.bo_dirty.bv_hd; + if (!TAILQ_EMPTY(bl) && + endn < TAILQ_LAST(bl, buflists)->b_lblkno) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + } else + endn = ap->a_end / bsize; + BO_RUNLOCK(&vp->v_bufobj); + /* + * In the VMIO case, use the B_NOREUSE flag to hint that the + * pages backing each buffer in the range are unlikely to be + * reused. Dirty buffers will have the hint applied once + * they've been written. + */ + for (bn = startn; bn <= endn; bn++) { + bp = getblk(vp, bn, bsize, 0, 0, GB_NOCREAT | + GB_UNMAPPED); + if (bp == NULL) + continue; + bp->b_flags |= B_RELBUF; + if (vp->v_object != NULL) + bp->b_flags |= B_NOREUSE; + brelse(bp); + } VOP_UNLOCK(vp, 0); break; default: Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_syscalls.c Wed Sep 30 23:06:29 2015 (r288431) @@ -4610,8 +4610,6 @@ kern_posix_fadvise(struct thread *td, in new->fa_advice = advice; new->fa_start = offset; new->fa_end = end; - new->fa_prevstart = 0; - new->fa_prevend = 0; fp->f_advice = new; new = fa; } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_vnops.c Wed Sep 30 23:06:29 2015 (r288431) @@ -770,10 +770,9 @@ vn_read(fp, uio, active_cred, flags, td) struct thread *td; { struct vnode *vp; - struct mtx *mtxp; + off_t orig_offset; int error, ioflag; int advice; - off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -797,7 +796,7 @@ vn_read(fp, uio, active_cred, flags, td) /* Disable read-ahead for random I/O. */ break; } - offset = uio->uio_offset; + orig_offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -807,39 +806,14 @@ vn_read(fp, uio, active_cred, flags, td) fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (error == 0 && advice == POSIX_FADV_NOREUSE && - offset != uio->uio_offset) { + orig_offset != uio->uio_offset) /* - * Use POSIX_FADV_DONTNEED to flush clean pages and - * buffers for the backing file after a - * POSIX_FADV_NOREUSE read(2). To optimize the common - * case of using POSIX_FADV_NOREUSE with sequential - * access, track the previous implicit DONTNEED - * request and grow this request to include the - * current read(2) in addition to the previous - * DONTNEED. With purely sequential access this will - * cause the DONTNEED requests to continously grow to - * cover all of the previously read regions of the - * file. This allows filesystem blocks that are - * accessed by multiple calls to read(2) to be flushed - * once the last read(2) finishes. + * Use POSIX_FADV_DONTNEED to flush pages and buffers + * for the backing file after a POSIX_FADV_NOREUSE + * read(2). */ - start = offset; - end = uio->uio_offset - 1; - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { - if (start != 0 && fp->f_advice->fa_prevend + 1 == start) - start = fp->f_advice->fa_prevstart; - else if (fp->f_advice->fa_prevstart != 0 && - fp->f_advice->fa_prevstart == end + 1) - end = fp->f_advice->fa_prevend; - fp->f_advice->fa_prevstart = start; - fp->f_advice->fa_prevend = end; - } - mtx_unlock(mtxp); - error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); - } + error = VOP_ADVISE(vp, orig_offset, uio->uio_offset - 1, + POSIX_FADV_DONTNEED); return (error); } @@ -856,10 +830,9 @@ vn_write(fp, uio, active_cred, flags, td { struct vnode *vp; struct mount *mp; - struct mtx *mtxp; + off_t orig_offset; int error, ioflag, lock_flags; int advice; - off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -902,7 +875,7 @@ vn_write(fp, uio, active_cred, flags, td /* XXX: Is this correct? */ break; } - offset = uio->uio_offset; + orig_offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); @@ -914,55 +887,14 @@ vn_write(fp, uio, active_cred, flags, td if (vp->v_type != VCHR) vn_finished_write(mp); if (error == 0 && advice == POSIX_FADV_NOREUSE && - offset != uio->uio_offset) { + orig_offset != uio->uio_offset) /* - * Use POSIX_FADV_DONTNEED to flush clean pages and - * buffers for the backing file after a - * POSIX_FADV_NOREUSE write(2). To optimize the - * common case of using POSIX_FADV_NOREUSE with - * sequential access, track the previous implicit - * DONTNEED request and grow this request to include - * the current write(2) in addition to the previous - * DONTNEED. With purely sequential access this will - * cause the DONTNEED requests to continously grow to - * cover all of the previously written regions of the - * file. - * - * Note that the blocks just written are almost - * certainly still dirty, so this only works when - * VOP_ADVISE() calls from subsequent writes push out - * the data written by this write(2) once the backing - * buffers are clean. However, as compared to forcing - * IO_DIRECT, this gives much saner behavior. Write - * clustering is still allowed, and clean pages are - * merely moved to the cache page queue rather than - * outright thrown away. This means a subsequent - * read(2) can still avoid hitting the disk if the - * pages have not been reclaimed. - * - * This does make POSIX_FADV_NOREUSE largely useless - * with non-sequential access. However, sequential - * access is the more common use case and the flag is - * merely advisory. + * Use POSIX_FADV_DONTNEED to flush pages and buffers + * for the backing file after a POSIX_FADV_NOREUSE + * write(2). */ - start = offset; - end = uio->uio_offset - 1; - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { - if (start != 0 && fp->f_advice->fa_prevend + 1 == start) - start = fp->f_advice->fa_prevstart; - else if (fp->f_advice->fa_prevstart != 0 && - fp->f_advice->fa_prevstart == end + 1) - end = fp->f_advice->fa_prevend; - fp->f_advice->fa_prevstart = start; - fp->f_advice->fa_prevend = end; - } - mtx_unlock(mtxp); - error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); - } - + error = VOP_ADVISE(vp, orig_offset, uio->uio_offset - 1, + POSIX_FADV_DONTNEED); unlock: return (error); } Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/sys/buf.h Wed Sep 30 23:06:29 2015 (r288431) @@ -204,7 +204,7 @@ struct buf { #define B_PERSISTENT 0x00000100 /* Perm. ref'ed while EXT2FS mounted. */ #define B_DONE 0x00000200 /* I/O completed. */ #define B_EINTR 0x00000400 /* I/O was interrupted */ -#define B_00000800 0x00000800 /* Available flag. */ +#define B_NOREUSE 0x00000800 /* Contents not reused once released. */ #define B_00001000 0x00001000 /* Available flag. */ #define B_INVAL 0x00002000 /* Does not contain valid info. */ #define B_BARRIER 0x00004000 /* Write this and all preceeding first. */ @@ -229,7 +229,7 @@ struct buf { #define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \ "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26dirty\25b20" \ "\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \ - "\15b12\14b11\13eintr\12done\11persist\10delwri" \ + "\15b12\14noreuse\13eintr\12done\11persist\10delwri" \ "\7validsuspwrt\6cache\5deferred\4direct\3async\2needcommit\1age" /* Modified: head/sys/sys/file.h ============================================================================== --- head/sys/sys/file.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/sys/file.h Wed Sep 30 23:06:29 2015 (r288431) @@ -160,8 +160,6 @@ struct fadvise_info { int fa_advice; /* (f) FADV_* type. */ off_t fa_start; /* (f) Region start. */ off_t fa_end; /* (f) Region end. */ - off_t fa_prevstart; /* (f) Previous NOREUSE start. */ - off_t fa_prevend; /* (f) Previous NOREUSE end. */ }; struct file { Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_object.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1963,15 +1963,15 @@ skipmemq: } /* - * vm_object_page_cache: + * vm_object_page_noreuse: * - * For the given object, attempt to move the specified clean - * pages to the cache queue. If a page is wired for any reason, - * then it will not be changed. Pages are specified by the given - * range ["start", "end"). As a special case, if "end" is zero, - * then the range extends from "start" to the end of the object. - * Any mappings to the specified pages are removed before the - * pages are moved to the cache queue. + * For the given object, attempt to move the specified pages to + * the head of the inactive queue. This bypasses regular LRU + * operation and allows the pages to be reused quickly under memory + * pressure. If a page is wired for any reason, then it will not + * be queued. Pages are specified by the range ["start", "end"). + * As a special case, if "end" is zero, then the range extends from + * "start" to the end of the object. * * This operation should only be performed on objects that * contain non-fictitious, managed pages. @@ -1979,14 +1979,14 @@ skipmemq: * The object must be locked. */ void -vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end) +vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) { struct mtx *mtx, *new_mtx; vm_page_t p, next; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & (OBJ_FICTITIOUS | OBJ_UNMANAGED)) == 0, - ("vm_object_page_cache: illegal object %p", object)); + ("vm_object_page_noreuse: illegal object %p", object)); if (object->resident_page_count == 0) return; p = vm_page_find_least(object, start); @@ -2009,7 +2009,7 @@ vm_object_page_cache(vm_object_t object, mtx = new_mtx; mtx_lock(mtx); } - vm_page_try_to_cache(p); + vm_page_deactivate_noreuse(p); } if (mtx != NULL) mtx_unlock(mtx); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_object.h Wed Sep 30 23:06:29 2015 (r288431) @@ -304,10 +304,10 @@ void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); -void vm_object_page_cache(vm_object_t object, vm_pindex_t start, - vm_pindex_t end); boolean_t vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, int flags); +void vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, + vm_pindex_t end); void vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int options); boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_page.c Wed Sep 30 23:06:29 2015 (r288431) @@ -2589,6 +2589,19 @@ vm_page_deactivate(vm_page_t m) } /* + * Move the specified page to the inactive queue with the expectation + * that it is unlikely to be reused. + * + * The page must be locked. + */ +void +vm_page_deactivate_noreuse(vm_page_t m) +{ + + _vm_page_deactivate(m, 1); +} + +/* * vm_page_try_to_cache: * * Returns 0 on failure, 1 on success @@ -2740,8 +2753,7 @@ vm_page_cache(vm_page_t m) /* * vm_page_advise * - * Deactivate or do nothing, as appropriate. This routine is used - * by madvise() and vop_stdadvise(). + * Deactivate or do nothing, as appropriate. * * The object and page must be locked. */ Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_page.h Wed Sep 30 23:06:29 2015 (r288431) @@ -451,6 +451,7 @@ void vm_page_cache_transfer(vm_object_t, int vm_page_try_to_cache (vm_page_t); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); +void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_locked(vm_page_t m); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); From owner-svn-src-all@freebsd.org Wed Sep 30 23:14:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AFD0A0B1EA; Wed, 30 Sep 2015 23:14:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C0D71BD4; Wed, 30 Sep 2015 23:14:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UNEOQi048151; Wed, 30 Sep 2015 23:14:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UNEObc048149; Wed, 30 Sep 2015 23:14:24 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302314.t8UNEObc048149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 23:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288432 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 30 Sep 2015 23:14:24 -0000 Author: bdrewery Date: Wed Sep 30 23:14:23 2015 New Revision: 288432 URL: https://svnweb.freebsd.org/changeset/base/288432 Log: META_MODE: Set HOST_CXX and HOST_CPP and chain them down into CXX/CPP for host builds. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.init.mk head/share/mk/local.meta.sys.mk Modified: head/share/mk/local.init.mk ============================================================================== --- head/share/mk/local.init.mk Wed Sep 30 23:06:29 2015 (r288431) +++ head/share/mk/local.init.mk Wed Sep 30 23:14:23 2015 (r288432) @@ -28,8 +28,12 @@ CXXFLAGS_LAST+= -I/usr/include .if ${.MAKE.DEPENDFILE:E} != "host" UPDATE_DEPENDFILE?= no .endif -HOST_CC?= /usr/bin/cc +HOST_CC?= /usr/bin/cc +CC= ${HOST_CC} +HOST_CXX?= /usr/bin/c++ +CXX= ${HOST_CXX} +HOST_CPP?= /usr/bin/cpp +CPP= ${HOST_CPP} HOST_CFLAGS+= -DHOSTPROG -CC= ${HOST_CC} CFLAGS+= ${HOST_CFLAGS} .endif Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Wed Sep 30 23:06:29 2015 (r288431) +++ head/share/mk/local.meta.sys.mk Wed Sep 30 23:14:23 2015 (r288432) @@ -213,10 +213,13 @@ TOOLSDIR?= ${STAGE_HOST_OBJTOP} PATH:= ${PATH:S,:, ,g:@d@${exists(${TOOLSDIR}$d):?${TOOLSDIR}$d:}@:ts:}:${PATH} .export PATH .if exists(${TOOLSDIR}/usr/bin/cc) -HOST_CC?= ${TOOLSDIR}/usr/bin/cc -CC?= ${TOOLSDIR}/usr/bin/cc -CXX?= ${TOOLSDIR}/usr/bin/c++ -.export HOST_CC CC CXX +HOST_CC?= ${TOOLSDIR}/usr/bin/cc +CC?= ${HOST_CC} +HOST_CXX?= ${TOOLSDIR}/usr/bin/c++ +CXX?= ${HOST_CXX} +HOST_CPP?= ${TOOLSDIR}/usr/bin/cpp +CPP?= ${HOST_CPP} +.export HOST_CC CC HOST_CXX CXX HOST_CPP CPP .endif .endif .endif From owner-svn-src-all@freebsd.org Thu Oct 1 00:34:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15030A0C1DC; Thu, 1 Oct 2015 00:34:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 067081E92; Thu, 1 Oct 2015 00:34:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t910Yd3m080624; Thu, 1 Oct 2015 00:34:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t910Ydp1080621; Thu, 1 Oct 2015 00:34:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510010034.t910Ydp1080621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 00:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288433 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 00:34:40 -0000 Author: gjb Date: Thu Oct 1 00:34:38 2015 New Revision: 288433 URL: https://svnweb.freebsd.org/changeset/base/288433 Log: Fix FAT_SIZE by removing '-b' argument passing, which was a result of my misunderstanding on what Crochet was doing in this case for these boards. Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/BANANAPI.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="CUBIEBOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 From owner-svn-src-all@freebsd.org Thu Oct 1 00:44:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7535A0CA17; Thu, 1 Oct 2015 00:44:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7EFF147C; Thu, 1 Oct 2015 00:44:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t910ijvP084767; Thu, 1 Oct 2015 00:44:45 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t910ijCM084766; Thu, 1 Oct 2015 00:44:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510010044.t910ijCM084766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 1 Oct 2015 00:44: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: r288434 - stable/10/usr.sbin/bhyve 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 00:44:46 -0000 Author: delphij Date: Thu Oct 1 00:44:45 2015 New Revision: 288434 URL: https://svnweb.freebsd.org/changeset/base/288434 Log: MFC r287927: Use strlcpy() instead of strncpy() because subsequent mkstemps expects the string be nul-terminated. Reviewed by: neel Modified: stable/10/usr.sbin/bhyve/acpi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/acpi.c ============================================================================== --- stable/10/usr.sbin/bhyve/acpi.c Thu Oct 1 00:34:38 2015 (r288433) +++ stable/10/usr.sbin/bhyve/acpi.c Thu Oct 1 00:44:45 2015 (r288434) @@ -790,10 +790,10 @@ basl_open(struct basl_fio *bf, int suffi err = 0; if (suffix) { - strncpy(bf->f_name, basl_stemplate, MAXPATHLEN); + strlcpy(bf->f_name, basl_stemplate, MAXPATHLEN); bf->fd = mkstemps(bf->f_name, strlen(BHYVE_ASL_SUFFIX)); } else { - strncpy(bf->f_name, basl_template, MAXPATHLEN); + strlcpy(bf->f_name, basl_template, MAXPATHLEN); bf->fd = mkstemp(bf->f_name); } From owner-svn-src-all@freebsd.org Thu Oct 1 00:47:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EEAFA0CD2C; Thu, 1 Oct 2015 00:47:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FCB8178C; Thu, 1 Oct 2015 00:47:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t910lUnj084937; Thu, 1 Oct 2015 00:47:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t910lUhP084936; Thu, 1 Oct 2015 00:47:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510010047.t910lUhP084936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 00:47: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: r288435 - stable/10/release 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 00:47:31 -0000 Author: gjb Date: Thu Oct 1 00:47:30 2015 New Revision: 288435 URL: https://svnweb.freebsd.org/changeset/base/288435 Log: MFC r288341, r288345, r288347: r288341: Honor VMFORMATS and VMSIZE if set in release.conf. [1] r288345: In followup to r288341, ensure VMFORMATS and VMSIZE are not set to empty values, which would result in nonintuitive build errors. r288347: Append VMFORMATS and VMSIZE to RELEASE_RMAKEFLAGS only if WITH_VMIMAGES is set. PR: 203420 [1] Sponsored by: The FreeBSD Foundation Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Thu Oct 1 00:44:45 2015 (r288434) +++ stable/10/release/release.sh Thu Oct 1 00:47:30 2015 (r288435) @@ -311,6 +311,18 @@ chroot_build_target() { # chroot_build_release(): Invoke the 'make release' target. chroot_build_release() { load_target_env + if [ ! -z "${WITH_VMIMAGES}" ]; then + if [ -z "${VMFORMATS}" ]; then + VMFORMATS="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMFORMATS)" + fi + if [ -z "${VMSIZE}" ]; then + VMSIZE="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMSIZE)" + fi + RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} \ + VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE}" + fi eval chroot ${CHROOTDIR} make -C /usr/src/release \ ${RELEASE_RMAKEFLAGS} release eval chroot ${CHROOTDIR} make -C /usr/src/release \ From owner-svn-src-all@freebsd.org Thu Oct 1 01:50:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30FA5A0C67E; Thu, 1 Oct 2015 01:50:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2D214AE; Thu, 1 Oct 2015 01:50:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t911oLQc010282; Thu, 1 Oct 2015 01:50:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t911oLJ7010279; Thu, 1 Oct 2015 01:50:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510010150.t911oLJ7010279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 01:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288436 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 01:50:22 -0000 Author: gjb Date: Thu Oct 1 01:50:20 2015 New Revision: 288436 URL: https://svnweb.freebsd.org/changeset/base/288436 Log: Partially revert r288433, with a minor change: Spell 'k' correctly. Spotted by: loos (thank you!) Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/BANANAPI.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -23,9 +23,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="CUBIEBOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -22,9 +22,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -23,9 +23,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} From owner-svn-src-all@freebsd.org Thu Oct 1 05:56:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBC40A0E61B; Thu, 1 Oct 2015 05:56:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8CD51D3A; Thu, 1 Oct 2015 05:56:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t915udCp012223; Thu, 1 Oct 2015 05:56:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t915udJs012222; Thu, 1 Oct 2015 05:56:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201510010556.t915udJs012222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 1 Oct 2015 05:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288437 - head/sys/modules/otus 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 05:56:39 -0000 Author: lwhsu (ports committer) Date: Thu Oct 1 05:56:38 2015 New Revision: 288437 URL: https://svnweb.freebsd.org/changeset/base/288437 Log: Fix `make depend` in sys/modules/otus Reviewed by: delphij Approved by: delphij Differential Revision: https://reviews.freebsd.org/D3751 Modified: head/sys/modules/otus/Makefile Modified: head/sys/modules/otus/Makefile ============================================================================== --- head/sys/modules/otus/Makefile Thu Oct 1 01:50:20 2015 (r288436) +++ head/sys/modules/otus/Makefile Thu Oct 1 05:56:38 2015 (r288437) @@ -5,6 +5,6 @@ KMOD = if_otus SRCS = if_otus.c if_otusreg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include From owner-svn-src-all@freebsd.org Thu Oct 1 07:47:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDA53A0D93F; Thu, 1 Oct 2015 07:47:48 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAAAD1F6A; Thu, 1 Oct 2015 07:47:48 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t917lmk5058094; Thu, 1 Oct 2015 07:47:48 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t917ljsr058081; Thu, 1 Oct 2015 07:47:45 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201510010747.t917ljsr058081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Thu, 1 Oct 2015 07:47:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288438 - in vendor/bind9/dist: . bin/check bin/confgen bin/dig bin/dnssec bin/named bin/named/include/named bin/nsupdate bin/rndc bin/tools doc/arm doc/misc lib/bind9 lib/dns lib/dns/i... 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 07:47:49 -0000 Author: erwin Date: Thu Oct 1 07:47:44 2015 New Revision: 288438 URL: https://svnweb.freebsd.org/changeset/base/288438 Log: Vendor import of BIND 9.9.8 Sponsored by: DK Hostmaster A/S Added: vendor/bind9/dist/doc/arm/html-fixup.pl (contents, props changed) Modified: vendor/bind9/dist/CHANGES vendor/bind9/dist/README vendor/bind9/dist/bin/check/check-tool.c vendor/bind9/dist/bin/check/named-checkconf.c vendor/bind9/dist/bin/check/named-checkzone.c vendor/bind9/dist/bin/confgen/keygen.c vendor/bind9/dist/bin/confgen/util.c vendor/bind9/dist/bin/dig/dig.1 vendor/bind9/dist/bin/dig/dig.c vendor/bind9/dist/bin/dig/dig.docbook vendor/bind9/dist/bin/dig/dig.html vendor/bind9/dist/bin/dig/dighost.c vendor/bind9/dist/bin/dig/nslookup.c vendor/bind9/dist/bin/dnssec/dnssec-dsfromkey.8 vendor/bind9/dist/bin/dnssec/dnssec-dsfromkey.c vendor/bind9/dist/bin/dnssec/dnssec-dsfromkey.docbook vendor/bind9/dist/bin/dnssec/dnssec-dsfromkey.html vendor/bind9/dist/bin/dnssec/dnssec-keygen.c vendor/bind9/dist/bin/dnssec/dnssec-revoke.c vendor/bind9/dist/bin/dnssec/dnssec-settime.c vendor/bind9/dist/bin/dnssec/dnssec-signzone.c vendor/bind9/dist/bin/named/client.c vendor/bind9/dist/bin/named/config.c vendor/bind9/dist/bin/named/control.c vendor/bind9/dist/bin/named/include/named/lwdclient.h vendor/bind9/dist/bin/named/include/named/main.h vendor/bind9/dist/bin/named/include/named/server.h vendor/bind9/dist/bin/named/interfacemgr.c vendor/bind9/dist/bin/named/logconf.c vendor/bind9/dist/bin/named/lwdclient.c vendor/bind9/dist/bin/named/lwresd.c vendor/bind9/dist/bin/named/main.c vendor/bind9/dist/bin/named/named.8 vendor/bind9/dist/bin/named/named.docbook vendor/bind9/dist/bin/named/named.html vendor/bind9/dist/bin/named/query.c vendor/bind9/dist/bin/named/server.c vendor/bind9/dist/bin/named/statschannel.c vendor/bind9/dist/bin/named/update.c vendor/bind9/dist/bin/named/xfrout.c vendor/bind9/dist/bin/nsupdate/nsupdate.1 vendor/bind9/dist/bin/nsupdate/nsupdate.c vendor/bind9/dist/bin/nsupdate/nsupdate.docbook vendor/bind9/dist/bin/nsupdate/nsupdate.html vendor/bind9/dist/bin/rndc/rndc.8 vendor/bind9/dist/bin/rndc/rndc.c vendor/bind9/dist/bin/rndc/rndc.docbook vendor/bind9/dist/bin/rndc/rndc.html vendor/bind9/dist/bin/rndc/util.c vendor/bind9/dist/bin/tools/arpaname.c vendor/bind9/dist/bin/tools/isc-hmac-fixup.c vendor/bind9/dist/bin/tools/named-journalprint.c vendor/bind9/dist/config.h.in vendor/bind9/dist/configure.in vendor/bind9/dist/doc/arm/Bv9ARM-book.xml vendor/bind9/dist/doc/arm/Bv9ARM.ch01.html vendor/bind9/dist/doc/arm/Bv9ARM.ch02.html vendor/bind9/dist/doc/arm/Bv9ARM.ch03.html vendor/bind9/dist/doc/arm/Bv9ARM.ch04.html vendor/bind9/dist/doc/arm/Bv9ARM.ch05.html vendor/bind9/dist/doc/arm/Bv9ARM.ch06.html vendor/bind9/dist/doc/arm/Bv9ARM.ch07.html vendor/bind9/dist/doc/arm/Bv9ARM.ch08.html vendor/bind9/dist/doc/arm/Bv9ARM.ch09.html vendor/bind9/dist/doc/arm/Bv9ARM.ch10.html vendor/bind9/dist/doc/arm/Bv9ARM.ch11.html vendor/bind9/dist/doc/arm/Bv9ARM.ch12.html vendor/bind9/dist/doc/arm/Bv9ARM.ch13.html vendor/bind9/dist/doc/arm/Bv9ARM.html vendor/bind9/dist/doc/arm/Bv9ARM.pdf vendor/bind9/dist/doc/arm/Makefile.in vendor/bind9/dist/doc/arm/man.arpaname.html vendor/bind9/dist/doc/arm/man.ddns-confgen.html vendor/bind9/dist/doc/arm/man.dig.html vendor/bind9/dist/doc/arm/man.dnssec-checkds.html vendor/bind9/dist/doc/arm/man.dnssec-coverage.html vendor/bind9/dist/doc/arm/man.dnssec-dsfromkey.html vendor/bind9/dist/doc/arm/man.dnssec-keyfromlabel.html vendor/bind9/dist/doc/arm/man.dnssec-keygen.html vendor/bind9/dist/doc/arm/man.dnssec-revoke.html vendor/bind9/dist/doc/arm/man.dnssec-settime.html vendor/bind9/dist/doc/arm/man.dnssec-signzone.html vendor/bind9/dist/doc/arm/man.dnssec-verify.html vendor/bind9/dist/doc/arm/man.genrandom.html vendor/bind9/dist/doc/arm/man.host.html vendor/bind9/dist/doc/arm/man.isc-hmac-fixup.html vendor/bind9/dist/doc/arm/man.named-checkconf.html vendor/bind9/dist/doc/arm/man.named-checkzone.html vendor/bind9/dist/doc/arm/man.named-journalprint.html vendor/bind9/dist/doc/arm/man.named.html vendor/bind9/dist/doc/arm/man.nsec3hash.html vendor/bind9/dist/doc/arm/man.nsupdate.html vendor/bind9/dist/doc/arm/man.rndc-confgen.html vendor/bind9/dist/doc/arm/man.rndc.conf.html vendor/bind9/dist/doc/arm/man.rndc.html vendor/bind9/dist/doc/arm/notes.html vendor/bind9/dist/doc/arm/notes.pdf vendor/bind9/dist/doc/arm/notes.xml vendor/bind9/dist/doc/misc/rfc-compliance vendor/bind9/dist/isc-config.sh.in vendor/bind9/dist/lib/bind9/api vendor/bind9/dist/lib/bind9/check.c vendor/bind9/dist/lib/dns/adb.c vendor/bind9/dist/lib/dns/api vendor/bind9/dist/lib/dns/cache.c vendor/bind9/dist/lib/dns/callbacks.c vendor/bind9/dist/lib/dns/client.c vendor/bind9/dist/lib/dns/diff.c vendor/bind9/dist/lib/dns/dispatch.c vendor/bind9/dist/lib/dns/dlz.c vendor/bind9/dist/lib/dns/dnssec.c vendor/bind9/dist/lib/dns/dst_api.c vendor/bind9/dist/lib/dns/dst_openssl.h vendor/bind9/dist/lib/dns/dst_parse.c vendor/bind9/dist/lib/dns/gssapi_link.c vendor/bind9/dist/lib/dns/gssapictx.c vendor/bind9/dist/lib/dns/hmac_link.c vendor/bind9/dist/lib/dns/include/dns/adb.h vendor/bind9/dist/lib/dns/include/dns/log.h vendor/bind9/dist/lib/dns/include/dns/message.h vendor/bind9/dist/lib/dns/include/dns/name.h vendor/bind9/dist/lib/dns/include/dns/resolver.h vendor/bind9/dist/lib/dns/include/dns/result.h vendor/bind9/dist/lib/dns/include/dns/rrl.h vendor/bind9/dist/lib/dns/include/dns/stats.h vendor/bind9/dist/lib/dns/include/dns/types.h vendor/bind9/dist/lib/dns/include/dns/update.h vendor/bind9/dist/lib/dns/include/dns/zone.h vendor/bind9/dist/lib/dns/include/dst/dst.h vendor/bind9/dist/lib/dns/journal.c vendor/bind9/dist/lib/dns/keytable.c vendor/bind9/dist/lib/dns/log.c vendor/bind9/dist/lib/dns/master.c vendor/bind9/dist/lib/dns/message.c vendor/bind9/dist/lib/dns/name.c vendor/bind9/dist/lib/dns/ncache.c vendor/bind9/dist/lib/dns/nsec.c vendor/bind9/dist/lib/dns/nsec3.c vendor/bind9/dist/lib/dns/openssl_link.c vendor/bind9/dist/lib/dns/openssldh_link.c vendor/bind9/dist/lib/dns/openssldsa_link.c vendor/bind9/dist/lib/dns/opensslecdsa_link.c vendor/bind9/dist/lib/dns/opensslgost_link.c vendor/bind9/dist/lib/dns/opensslrsa_link.c vendor/bind9/dist/lib/dns/order.c vendor/bind9/dist/lib/dns/private.c vendor/bind9/dist/lib/dns/rbt.c vendor/bind9/dist/lib/dns/rbtdb.c vendor/bind9/dist/lib/dns/rdata.c vendor/bind9/dist/lib/dns/rdata/any_255/tsig_250.c vendor/bind9/dist/lib/dns/rdata/ch_3/a_1.c vendor/bind9/dist/lib/dns/rdata/generic/afsdb_18.c vendor/bind9/dist/lib/dns/rdata/generic/caa_257.c vendor/bind9/dist/lib/dns/rdata/generic/cdnskey_60.c vendor/bind9/dist/lib/dns/rdata/generic/cds_59.c vendor/bind9/dist/lib/dns/rdata/generic/cert_37.c vendor/bind9/dist/lib/dns/rdata/generic/cname_5.c vendor/bind9/dist/lib/dns/rdata/generic/dlv_32769.c vendor/bind9/dist/lib/dns/rdata/generic/dname_39.c vendor/bind9/dist/lib/dns/rdata/generic/dnskey_48.c vendor/bind9/dist/lib/dns/rdata/generic/ds_43.c vendor/bind9/dist/lib/dns/rdata/generic/eui48_108.c vendor/bind9/dist/lib/dns/rdata/generic/eui64_109.c vendor/bind9/dist/lib/dns/rdata/generic/gpos_27.c vendor/bind9/dist/lib/dns/rdata/generic/hinfo_13.c vendor/bind9/dist/lib/dns/rdata/generic/hip_55.c vendor/bind9/dist/lib/dns/rdata/generic/ipseckey_45.c vendor/bind9/dist/lib/dns/rdata/generic/isdn_20.c vendor/bind9/dist/lib/dns/rdata/generic/key_25.c vendor/bind9/dist/lib/dns/rdata/generic/keydata_65533.c vendor/bind9/dist/lib/dns/rdata/generic/l32_105.c vendor/bind9/dist/lib/dns/rdata/generic/l64_106.c vendor/bind9/dist/lib/dns/rdata/generic/loc_29.c vendor/bind9/dist/lib/dns/rdata/generic/lp_107.c vendor/bind9/dist/lib/dns/rdata/generic/mb_7.c vendor/bind9/dist/lib/dns/rdata/generic/md_3.c vendor/bind9/dist/lib/dns/rdata/generic/mf_4.c vendor/bind9/dist/lib/dns/rdata/generic/mg_8.c vendor/bind9/dist/lib/dns/rdata/generic/minfo_14.c vendor/bind9/dist/lib/dns/rdata/generic/mr_9.c vendor/bind9/dist/lib/dns/rdata/generic/mx_15.c vendor/bind9/dist/lib/dns/rdata/generic/naptr_35.c vendor/bind9/dist/lib/dns/rdata/generic/nid_104.c vendor/bind9/dist/lib/dns/rdata/generic/ns_2.c vendor/bind9/dist/lib/dns/rdata/generic/nsec3_50.c vendor/bind9/dist/lib/dns/rdata/generic/nsec3param_51.c vendor/bind9/dist/lib/dns/rdata/generic/nsec_47.c vendor/bind9/dist/lib/dns/rdata/generic/null_10.c vendor/bind9/dist/lib/dns/rdata/generic/nxt_30.c vendor/bind9/dist/lib/dns/rdata/generic/openpgpkey_61.c vendor/bind9/dist/lib/dns/rdata/generic/opt_41.c vendor/bind9/dist/lib/dns/rdata/generic/proforma.c vendor/bind9/dist/lib/dns/rdata/generic/ptr_12.c vendor/bind9/dist/lib/dns/rdata/generic/rp_17.c vendor/bind9/dist/lib/dns/rdata/generic/rrsig_46.c vendor/bind9/dist/lib/dns/rdata/generic/rt_21.c vendor/bind9/dist/lib/dns/rdata/generic/sig_24.c vendor/bind9/dist/lib/dns/rdata/generic/soa_6.c vendor/bind9/dist/lib/dns/rdata/generic/spf_99.c vendor/bind9/dist/lib/dns/rdata/generic/sshfp_44.c vendor/bind9/dist/lib/dns/rdata/generic/tkey_249.c vendor/bind9/dist/lib/dns/rdata/generic/tlsa_52.c vendor/bind9/dist/lib/dns/rdata/generic/txt_16.c vendor/bind9/dist/lib/dns/rdata/generic/unspec_103.c vendor/bind9/dist/lib/dns/rdata/generic/uri_256.c vendor/bind9/dist/lib/dns/rdata/generic/x25_19.c vendor/bind9/dist/lib/dns/rdata/hs_4/a_1.c vendor/bind9/dist/lib/dns/rdata/in_1/a6_38.c vendor/bind9/dist/lib/dns/rdata/in_1/a_1.c vendor/bind9/dist/lib/dns/rdata/in_1/aaaa_28.c vendor/bind9/dist/lib/dns/rdata/in_1/apl_42.c vendor/bind9/dist/lib/dns/rdata/in_1/dhcid_49.c vendor/bind9/dist/lib/dns/rdata/in_1/kx_36.c vendor/bind9/dist/lib/dns/rdata/in_1/nsap-ptr_23.c vendor/bind9/dist/lib/dns/rdata/in_1/nsap_22.c vendor/bind9/dist/lib/dns/rdata/in_1/px_26.c vendor/bind9/dist/lib/dns/rdata/in_1/srv_33.c vendor/bind9/dist/lib/dns/rdata/in_1/wks_11.c vendor/bind9/dist/lib/dns/request.c vendor/bind9/dist/lib/dns/resolver.c vendor/bind9/dist/lib/dns/result.c vendor/bind9/dist/lib/dns/rpz.c vendor/bind9/dist/lib/dns/rrl.c vendor/bind9/dist/lib/dns/sdb.c vendor/bind9/dist/lib/dns/sdlz.c vendor/bind9/dist/lib/dns/spnego.c vendor/bind9/dist/lib/dns/tcpmsg.c vendor/bind9/dist/lib/dns/tkey.c vendor/bind9/dist/lib/dns/tsig.c vendor/bind9/dist/lib/dns/update.c vendor/bind9/dist/lib/dns/view.c vendor/bind9/dist/lib/dns/xfrin.c vendor/bind9/dist/lib/dns/zone.c vendor/bind9/dist/lib/export/isc/unix/include/isc/Makefile.in vendor/bind9/dist/lib/export/samples/nsprobe.c vendor/bind9/dist/lib/export/samples/sample-async.c vendor/bind9/dist/lib/export/samples/sample-gai.c vendor/bind9/dist/lib/export/samples/sample-request.c vendor/bind9/dist/lib/export/samples/sample-update.c vendor/bind9/dist/lib/export/samples/sample.c vendor/bind9/dist/lib/irs/api vendor/bind9/dist/lib/irs/getaddrinfo.c vendor/bind9/dist/lib/isc/api vendor/bind9/dist/lib/isc/assertions.c vendor/bind9/dist/lib/isc/backtrace.c vendor/bind9/dist/lib/isc/commandline.c vendor/bind9/dist/lib/isc/entropy.c vendor/bind9/dist/lib/isc/error.c vendor/bind9/dist/lib/isc/heap.c vendor/bind9/dist/lib/isc/hmacmd5.c vendor/bind9/dist/lib/isc/hmacsha.c vendor/bind9/dist/lib/isc/httpd.c vendor/bind9/dist/lib/isc/include/isc/app.h vendor/bind9/dist/lib/isc/include/isc/mem.h vendor/bind9/dist/lib/isc/include/isc/namespace.h vendor/bind9/dist/lib/isc/include/isc/platform.h.in vendor/bind9/dist/lib/isc/include/isc/print.h vendor/bind9/dist/lib/isc/include/isc/safe.h vendor/bind9/dist/lib/isc/include/isc/util.h vendor/bind9/dist/lib/isc/lex.c vendor/bind9/dist/lib/isc/lib.c vendor/bind9/dist/lib/isc/mem.c vendor/bind9/dist/lib/isc/pool.c vendor/bind9/dist/lib/isc/print.c vendor/bind9/dist/lib/isc/pthreads/mutex.c vendor/bind9/dist/lib/isc/regex.c vendor/bind9/dist/lib/isc/rwlock.c vendor/bind9/dist/lib/isc/safe.c vendor/bind9/dist/lib/isc/socket_api.c vendor/bind9/dist/lib/isc/stats.c vendor/bind9/dist/lib/isc/task.c vendor/bind9/dist/lib/isc/timer.c vendor/bind9/dist/lib/isc/unix/app.c vendor/bind9/dist/lib/isc/unix/file.c vendor/bind9/dist/lib/isc/unix/ifiter_ioctl.c vendor/bind9/dist/lib/isc/unix/ifiter_sysctl.c vendor/bind9/dist/lib/isc/unix/net.c vendor/bind9/dist/lib/isc/unix/socket.c vendor/bind9/dist/lib/isccc/Makefile.in vendor/bind9/dist/lib/isccc/alist.c vendor/bind9/dist/lib/isccc/api vendor/bind9/dist/lib/isccc/cc.c vendor/bind9/dist/lib/isccc/sexpr.c vendor/bind9/dist/lib/isccfg/api vendor/bind9/dist/lib/isccfg/include/isccfg/cfg.h vendor/bind9/dist/lib/isccfg/include/isccfg/grammar.h vendor/bind9/dist/lib/isccfg/namedconf.c vendor/bind9/dist/lib/isccfg/parser.c vendor/bind9/dist/lib/lwres/api vendor/bind9/dist/lib/lwres/herror.c vendor/bind9/dist/lib/lwres/man/lwres.html vendor/bind9/dist/lib/lwres/man/lwres_buffer.html vendor/bind9/dist/lib/lwres/man/lwres_config.html vendor/bind9/dist/lib/lwres/man/lwres_context.html vendor/bind9/dist/lib/lwres/man/lwres_gabn.html vendor/bind9/dist/lib/lwres/man/lwres_gai_strerror.html vendor/bind9/dist/lib/lwres/man/lwres_getaddrinfo.html vendor/bind9/dist/lib/lwres/man/lwres_gethostent.html vendor/bind9/dist/lib/lwres/man/lwres_getipnode.html vendor/bind9/dist/lib/lwres/man/lwres_getnameinfo.html vendor/bind9/dist/lib/lwres/man/lwres_getrrsetbyname.html vendor/bind9/dist/lib/lwres/man/lwres_gnba.html vendor/bind9/dist/lib/lwres/man/lwres_hstrerror.html vendor/bind9/dist/lib/lwres/man/lwres_inetntop.html vendor/bind9/dist/lib/lwres/man/lwres_noop.html vendor/bind9/dist/lib/lwres/man/lwres_packet.html vendor/bind9/dist/lib/lwres/man/lwres_resutil.html vendor/bind9/dist/lib/lwres/print.c vendor/bind9/dist/version Modified: vendor/bind9/dist/CHANGES ============================================================================== --- vendor/bind9/dist/CHANGES Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/CHANGES Thu Oct 1 07:47:44 2015 (r288438) @@ -1,14 +1,318 @@ - --- 9.9.7-P2 released --- + --- 9.9.8 released --- + + --- 9.9.8rc1 released --- + +4193. [bug] Handle broken servers that return BADVERS incorrectly. + [RT #40427] + +4192. [bug] The default rrset-order of random was not always being + applied. [RT #40456] + +4191. [protocol] Accept DNS-SD non LDH PTR records in reverse zones + as per RFC 6763. [RT #37889] + +4190. [protocol] Accept Active Diretory gc._msdcs. name as + valid with check-names. still needs to be + LDH. [RT #40399] + +4189. [cleanup] Don't exit on overly long tokens in named.conf. + [RT #40418] + +4188. [bug] Support HTTP/1.0 client properly on the statistics + channel. [RT #40261] + +4187. [func] When any RR type implementation doesn't + implement totext() for the RDATA's wire + representation and returns ISC_R_NOTIMPLEMENTED, + such RDATA is now printed in unknown + presentation format (RFC 3597). RR types affected + include LOC(29) and APL(42). [RT #40317]. + +4183. [cleanup] Use timing-safe memory comparisons in cryptographic + code. Also, the timing-safe comparison functions have + been renamed to avoid possible confusion with + memcmp(). Thanks to Loganaden Velvindron of + AFRINIC. [RT #40148] + +4182. [cleanup] Use mnemonics for RR class and type comparisons. + [RT #40297] + +4181. [bug] Queued notify messages could be dequeued from the + wrong rate limiter queue. [RT #40350] + +4179. [bug] Fix double frees in getaddrinfo() in libirs. + [RT #40209] + +4178. [bug] Fix assertion failure in parsing UNSPEC(103) RR from + text. [RT #40274] + +4177. [bug] Fix assertion failure in parsing NSAP records from + text. [RT #40285] + +4176. [bug] Address race issues with lwresd. [RT #40284] + +4175. [bug] TKEY with GSS-API keys needed bigger buffers. + [RT #40333] + +4174. [bug] "dnssec-coverage -r" didn't handle time unit + suffixes correctly. [RT #38444] + +4173. [bug] dig +sigchase was not properly matching the trusted + key. [RT #40188] + +4172. [bug] Named / named-checkconf didn't handle a view of CLASS0. + [RT #40265] + +4171. [bug] Fixed incorrect class checks in TSIG RR + implementation. [RT #40287] + +4170. [security] An incorrect boundary check in the OPENPGPKEY + rdatatype could trigger an assertion failure. + (CVE-2015-5986) [RT #40286] + +4169. [test] Added a 'wire_test -d' option to read input as + raw binary data, for use as a fuzzing harness. + [RT #40312] + +4168. [security] A buffer accounting error could trigger an + assertion failure when parsing certain malformed + DNSSEC keys. (CVE-2015-5722) [RT #40212] + + --- 9.9.8b1 released --- 4165. [security] A failure to reset a value to NULL in tkey.c could result in an assertion failure. (CVE-2015-5477) [RT #40046] - --- 9.9.7-P1 released --- +4164. [bug] Don't rename slave files and journals on out of memory. + [RT #40033] + +4163. [bug] Address compiler warnings. [RT #40024] + +4162. [bug] httpdmgr->flags was not being initialized. [RT #40017] + +4159. [cleanup] Alphabetize dig's help output. [RT #39966] + +4158. [protocol] Support the printing of EDNS COOKIE and EXPIRE options. + [RT #39928] + +4154. [bug] A OPT record should be included with the FORMERR + response when there is a malformed EDNS option. + [RT #39647] + +4153. [bug] Check that non significant ECS bits are zero on + receipt. [RT #39647] + +4151. [bug] 'rndc flush' could cause a deadlock. [RT #39835] + +4150. [bug] win32: listen-on-v6 { any; }; was not working. Apply + minimal fix. [RT #39667] + +4149. [bug] Fixed a race condition in the getaddrinfo() + implementation in libirs. [RT #39899] + +4148. [bug] Fix a bug when printing zone names with '/' character + in XML and JSON statistics output. [RT #39873] + +4147. [bug] Filter-aaaa / filter-aaaa-on-v4 / filter-aaaa-on-v6 + was returning referrals rather than nodata responses + when the AAAA records were filtered. [RT #39843] -4138. [bug] An uninitialized value in validator.c could result +4146. [bug] Address reference leak that could prevent a clean + shutdown. [RT #37125] + +4145. [bug] Not all unassociated adb entries where being printed. + [RT #37125] + +4143. [bug] serial-query-rate was not effective for notify. + [RT #39858] + +4142. [bug] rndc addzone with view specified saved NZF config + that could not be read back by named. This has now + been fixed. [RT #39845] + +4138. [security] An uninitialized value in validator.c could result in an assertion failure. (CVE-2015-4620) [RT #39795] +4137. [bug] Make rndc reconfig report configuration errors the + same way rndc reload does. [RT #39635] + +4132. [cleanup] dig: added +rd as a synonym for +recurse, + added +class as an unabbreviated alternative + to +cl. [RT #39686] + +4130. [bug] The compatibility shim for *printf() misprinted some + large numbers. [RT #39586] + +4129. [port] Address API changes in OpenSSL 1.1.0. [RT #39532] + +4128. [bug] Address issues raised by Coverity 7.6. [RT #39537] + +4127. [protocol] CDS and CDNSKEY need to be signed by the key signing + key as per RFC 7344, Section 4.1. [RT #37215] + +4123. [port] Added %z (size_t) format options to the portable + internal printf/sprintf implementation. [RT #39586] + +4118. [bug] Teach isc-config.sh about irs. [RT #39213] + +4117. [protocol] Add EMPTY.AS112.ARPA as per RFC 7534. + +4113. [test] Check for Net::DNS is some system test + prerequisites. [RT #39369] + +4112. [bug] Named failed to load when "root-delegation-only" + was used without a list of domains to exclude. + [RT #39380] + +4111. [doc] Alphabetize rndc man page. [RT #39360] + +4110. [bug] Address memory leaks / null pointer dereferences + on out of memory. [RT #39310] + +4109. [port] linux: support reading the local port range from + net.ipv4.ip_local_port_range. [RT # 39379] + +4107. [bug] Address potential deadlock when updating zone content. + [RT #39269] + +4106. [port] Improve readline support. [RT #38938] + +4105. [port] Misc fixes for Microsoft Visual Studio + 2015 CTP6 in 64 bit mode. [RT #39308] + +4104. [bug] Address uninitialized elements. [RT #39252] + +4102. [bug] Fix a use after free bug introduced in change + #4094. [RT #39281] + +4101. [bug] dig: the +split option didn't work with +short. + [RT #39291] + +4100. [bug] Inherited owernames on the line immediately following + a $INCLUDE were not working. [RT #39268] + +4099. [port] clang: make unknown commandline options hard errors + when determining what options are supported. + [RT #39273] + +4098. [bug] Address use-after-free issue when using a + predecessor key with dnssec-settime. [RT #39272] + +4097. [func] Add additional logging about xfrin transfer status. + [RT #39170] + +4096. [bug] Fix a use after free of query->sendevent. + [RT #39132] + +4094. [bug] A race during shutdown or reconfiguration could + cause an assertion in mem.c. [RT #38979] + +4091. [cleanup] Some cleanups in isc mem code. [RT #38896] + +4090. [bug] Fix a crash while parsing malformed CAA RRs in + presentation format, i.e., from text such as + from master files. Thanks to John Van de + Meulebrouck Brendgard for discovering and + reporting this problem. [RT #39003] + +4089. [bug] Send notifies immediately for slave zones during + startup. [RT #38843] + +4088. [port] Fixed errors when building with libressl. [RT #38899] + +4087. [bug] Fix a crash due to use-after-free due to sequencing + of tasks actions. [RT #38495] + +4085. [bug] ISC_PLATFORM_HAVEXADDQ could be inconsistently set. + [RT #38828] + +4084. [bug] Fix a possible race in updating stats counters. + [RT #38826] + +4082. [bug] Incrementally sign large inline zone deltas. + [RT #37927] + +4081. [cleanup] Use dns_rdatalist_init consistently. [RT #38759] + +4077. [test] Add static-stub regression test for DS NXDOMAIN + return making the static stub disappear. [RT #38564] + +4076. [bug] Named could crash on shutdown with outstanding + reload / reconfig events. [RT #38622] + +4075. [bug] Increase nsupdate's input buffer to accomodate + very large RRs. [RT #38689] + +4074. [cleanup] Cleaned up more warnings from gcc -Wshadow. [RT #38708] + +4073. [cleanup] Add libjson-c version number reporting to + "named -V"; normalize version number formatting. + [RT #38056] + +4072. [func] Add a --enable-querytrace configure switch for + very verbose query trace logging. (This option + has a negative performance impact and should be + used only for debugging.) [RT #37520] + +4070. [bug] Fix a segfault in nslookup in a query such as + "nslookup isc.org AMS.SNS-PB.ISC.ORG -all". + [RT #38548] + +4069. [doc] Reorganize options in the nsupdate man page. + [RT #38515] + +4067. [cleanup] Reduce noise from RRL when query logging is + disabled. [RT #38648] + +4066. [doc] Reorganize options in the dig man page. [RT #38516] + +4064. [contrib] dnssec-keyset.sh: Generates a specified number + of DNSSEC keys with timing set to implement a + pre-publication key rollover strategy. Thanks + to Jeffry A. Spain. [RT #38459] + +4063. [bug] Asynchronous zone loads were not handled + correctly when the zone load was already in + progress; this could trigger a crash in zt.c. + [RT #37573] + +4062. [bug] Fix an out-of-bounds read in RPZ code. If the + read succeeded, it doesn't result in a bug + during operation. If the read failed, named + could segfault. [RT #38559] + +3938. [func] Added quotas to be used in recursive resolvers + that are under high query load for names in zones + whose authoritative servers are nonresponsive or + are experiencing a denial of service attack. + + - "fetches-per-server" limits the number of + simultaneous queries that can be sent to any + single authoritative server. The configured + value is a starting point; it is automatically + adjusted downward if the server is partially or + completely non-responsive. The algorithm used to + adjust the quota can be configured via the + "fetch-quota-params" option. + - "fetches-per-zone" limits the number of + simultaneous queries that can be sent for names + within a single domain. (Note: Unlike + "fetches-per-server", this value is not + self-tuning.) + - New stats counters have been added to count + queries spilled due to these quotas. + + These options are not available by default; + use "configure --enable-fetchlimit" (or + --enable-developer) to include them in the build. + + See the ARM for details of these options. [RT #37125] + +3937. [func] Added some debug logging to better indicate the + conditions causing SERVFAILs when resolving. + [RT #35538] + --- 9.9.7 released --- --- 9.9.7rc2 released --- @@ -16,7 +320,7 @@ 4061. [bug] Handle timeout in legacy system test. [RT #38573] 4060. [bug] dns_rdata_freestruct could be called on a - uninitialised structure when handling a error. + uninitialized structure when handling a error. [RT #38568] 4059. [bug] Addressed valgrind warnings. [RT #38549] Modified: vendor/bind9/dist/README ============================================================================== --- vendor/bind9/dist/README Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/README Thu Oct 1 07:47:44 2015 (r288438) @@ -51,15 +51,35 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes -BIND 9.9.7-P2 +BIND 9.9.8 - BIND 9.9.7-P1 is a security release addressing the flaw - described in CVE-2015-5477. + BIND 9.9.8 is a maintenance release and addresses bugs + found in BIND 9.9.7 and earlier, as well as the security + flaws described in CVE-2015-4620, CVE-2015-5477, + CVE-2015-5722, and CVE-2015-5986. + + It also makes the following new features available via a + compile-time option: + + - New "fetchlimit" quotas are now available for the use of + recursive resolvers that are are under high query load for + domains whose authoritative servers are nonresponsive or are + experiencing a denial of service attack. + + + "fetches-per-server" limits the number of simultaneous queries + that can be sent to any single authoritative server. The + configured value is a starting point; it is automatically + adjusted downward if the server is partially or completely + non-responsive. The algorithm used to adjust the quota can be + configured via the "fetch-quota-params" option. + + "fetches-per-zone" limits the number of simultaneous queries + that can be sent for names within a single domain. (Note: + Unlike "fetches-per-server", this value is not self-tuning.) + + New stats counters have been added to count + queries spilled due to these quotas. -BIND 9.9.7-P1 - - BIND 9.9.7-P1 is a security release addressing the flaw - described in CVE-2015-4620. + NOTE: These options are NOT built in by default; use + "configure --enable-fetchlimit" to enable them. BIND 9.9.7 Modified: vendor/bind9/dist/bin/check/check-tool.c ============================================================================== --- vendor/bind9/dist/bin/check/check-tool.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/check/check-tool.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include Modified: vendor/bind9/dist/bin/check/named-checkconf.c ============================================================================== --- vendor/bind9/dist/bin/check/named-checkconf.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/check/named-checkconf.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include Modified: vendor/bind9/dist/bin/check/named-checkzone.c ============================================================================== --- vendor/bind9/dist/bin/check/named-checkzone.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/check/named-checkzone.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2013, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include Modified: vendor/bind9/dist/bin/confgen/keygen.c ============================================================================== --- vendor/bind9/dist/bin/confgen/keygen.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/confgen/keygen.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -29,6 +29,7 @@ #include #include #include +#include #include #include Modified: vendor/bind9/dist/bin/confgen/util.c ============================================================================== --- vendor/bind9/dist/bin/confgen/util.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/confgen/util.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,6 +25,7 @@ #include #include +#include #include "util.h" Modified: vendor/bind9/dist/bin/dig/dig.1 ============================================================================== --- vendor/bind9/dist/bin/dig/dig.1 Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/dig/dig.1 Thu Oct 1 07:47:44 2015 (r288438) @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004-2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004-2011, 2013-2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -130,77 +130,97 @@ will perform a lookup for an A record. .RE .SH "OPTIONS" .PP -The -\fB\-b\fR -option sets the source IP address of the query to -\fIaddress\fR. This must be a valid address on one of the host's network interfaces or "0.0.0.0" or "::". An optional port may be specified by appending "#" +\-4 +.RS 4 +Use IPv4 only. +.RE .PP -The default query class (IN for internet) is overridden by the -\fB\-c\fR -option. +\-6 +.RS 4 +Use IPv6 only. +.RE +.PP +\-b \fIaddress\fR\fI[#port]\fR +.RS 4 +Set the source IP address of the query. The +\fIaddress\fR +must be a valid address on one of the host's network interfaces, or "0.0.0.0" or "::". An optional port may be specified by appending "#" +.RE +.PP +\-c \fIclass\fR +.RS 4 +Set the query class. The default \fIclass\fR -is any valid class, such as HS for Hesiod records or CH for Chaosnet records. +is IN; other classes are HS for Hesiod records or CH for Chaosnet records. +.RE .PP -The -\fB\-f\fR -option makes -\fBdig \fR -operate in batch mode by reading a list of lookup requests to process from the file -\fIfilename\fR. The file contains a number of queries, one per line. Each entry in the file should be organized in the same way they would be presented as queries to +\-f \fIfile\fR +.RS 4 +Batch mode: +\fBdig\fR +reads a list of lookup requests to process from the given +\fIfile\fR. Each line in the file should be organized in the same way they would be presented as queries to \fBdig\fR using the command\-line interface. +.RE .PP -The -\fB\-m\fR -option enables memory usage debugging. -.PP -If a non\-standard port number is to be queried, the -\fB\-p\fR -option is used. -\fIport#\fR -is the port number that -\fBdig\fR -will send its queries instead of the standard DNS port number 53. This option would be used to test a name server that has been configured to listen for queries on a non\-standard port number. +\-i +.RS 4 +Do reverse IPv6 lookups using the obsolete RFC1886 IP6.INT domain, which is no longer in use. Obsolete bit string label queries (RFC2874) are not attempted. +.RE .PP -The -\fB\-4\fR -option forces -\fBdig\fR -to only use IPv4 query transport. The -\fB\-6\fR -option forces -\fBdig\fR -to only use IPv6 query transport. +\-k \fIkeyfile\fR +.RS 4 +Sign queries using TSIG using a key read from the given file. Key files can be generated using +\fBtsig\-keygen\fR(8). When using TSIG authentication with +\fBdig\fR, the name server that is queried needs to know the key and algorithm that is being used. In BIND, this is done by providing appropriate +\fBkey\fR +and +\fBserver\fR +statements in +\fInamed.conf\fR. +.RE .PP -The -\fB\-t\fR -option sets the query type to -\fItype\fR. It can be any valid query type which is supported in BIND 9. The default query type is "A", unless the +\-m +.RS 4 +Enable memory usage debugging. +.RE +.PP +\-p \fIport\fR +.RS 4 +Send the query to a non\-standard port on the server, instead of the defaut port 53. This option would be used to test a name server that has been configured to listen for queries on a non\-standard port number. +.RE +.PP +\-q \fIname\fR +.RS 4 +The domain name to query. This is useful to distinguish the +\fIname\fR +from other arguments. +.RE +.PP +\-t \fItype\fR +.RS 4 +The resource record type to query. It can be any valid query type which is supported in BIND 9. The default query type is "A", unless the \fB\-x\fR -option is supplied to indicate a reverse lookup. A zone transfer can be requested by specifying a type of AXFR. When an incremental zone transfer (IXFR) is required, +option is supplied to indicate a reverse lookup. A zone transfer can be requested by specifying a type of AXFR. When an incremental zone transfer (IXFR) is required, set the \fItype\fR -is set to +to ixfr=N. The incremental zone transfer will contain the changes made to the zone since the serial number in the zone's SOA record was \fIN\fR. +.RE .PP -The -\fB\-q\fR -option sets the query name to -\fIname\fR. This is useful to distinguish the -\fIname\fR -from other arguments. -.PP -The -\fB\-v\fR -causes -\fBdig\fR -to print the version number and exit. +\-v +.RS 4 +Print the version number and exit. +.RE .PP -Reverse lookups \(em mapping addresses to names \(em are simplified by the -\fB\-x\fR -option. +\-x \fIaddr\fR +.RS 4 +Simplified reverse lookups, for mapping addresses to names. The \fIaddr\fR -is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address. When this option is used, there is no need to provide the +is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address. When the +\fB\-x\fR +is used, there is no need to provide the \fIname\fR, \fIclass\fR and @@ -208,35 +228,41 @@ and arguments. \fBdig\fR automatically performs a lookup for a name like -11.12.13.10.in\-addr.arpa -and sets the query type and class to PTR and IN respectively. By default, IPv6 addresses are looked up using nibble format under the IP6.ARPA domain. To use the older RFC1886 method using the IP6.INT domain specify the +94.2.0.192.in\-addr.arpa +and sets the query type and class to PTR and IN respectively. IPv6 addresses are looked up using nibble format under the IP6.ARPA domain (but see also the \fB\-i\fR -option. Bit string labels (RFC2874) are now experimental and are not attempted. +option). +.RE .PP -To sign the DNS queries sent by -\fBdig\fR -and their responses using transaction signatures (TSIG), specify a TSIG key file using the +\-y \fI[hmac:]\fR\fIkeyname:secret\fR +.RS 4 +Sign queries using TSIG with the given authentication key. +\fIkeyname\fR +is the name of the key, and +\fIsecret\fR +is the base64 encoded shared secret. +\fIhmac\fR +is the name of the key algorithm; valid choices are +hmac\-md5, +hmac\-sha1, +hmac\-sha224, +hmac\-sha256, +hmac\-sha384, or +hmac\-sha512. If +\fIhmac\fR +is not specified, the default is +hmac\-md5. +.sp +NOTE: You should use the \fB\-k\fR -option. You can also specify the TSIG key itself on the command line using the +option and avoid the \fB\-y\fR -option; -\fIhmac\fR -is the type of the TSIG, default HMAC\-MD5, -\fIname\fR -is the name of the TSIG key and -\fIkey\fR -is the actual key. The key is a base\-64 encoded string, typically generated by -\fBdnssec\-keygen\fR(8). Caution should be taken when using the +option, because with \fB\-y\fR -option on multi\-user systems as the key can be visible in the output from +the shared secret is supplied as a command line argument in clear text. This may be visible in the output from \fBps\fR(1) -or in the shell's history file. When using TSIG authentication with -\fBdig\fR, the name server that is queried needs to know the key and algorithm that is being used. In BIND, this is done by providing appropriate -\fBkey\fR -and -\fBserver\fR -statements in -\fInamed.conf\fR. +or in a history file maintained by the user's shell. +.RE .SH "QUERY OPTIONS" .PP \fBdig\fR @@ -245,7 +271,10 @@ provides a number of query options which Each query option is identified by a keyword preceded by a plus sign (+). Some keywords set or reset an option. These may be preceded by the string no to negate the meaning of that keyword. Other keywords assign values to options like the timeout interval. They have the form -\fB+keyword=value\fR. The query options are: +\fB+keyword=value\fR. Keywords may be abbreviated, provided the abbreviation is unambiguous; for example, ++cd +is equivalent to ++cdflag. The query options are: .PP \fB+[no]aaflag\fR .RS 4 @@ -300,7 +329,7 @@ bytes. The maximum and minimum sizes of Set [do not set] the CD (checking disabled) bit in the query. This requests the server to not perform DNSSEC validation of responses. .RE .PP -\fB+[no]cl\fR +\fB+[no]class\fR .RS 4 Display [do not display] the CLASS when printing the record. .RE @@ -421,6 +450,12 @@ Print [do not print] the query as it is Print [do not print] the question section of a query when an answer is returned. The default is to print the question section as a comment. .RE .PP +\fB+[no]rdflag\fR +.RS 4 +A synonym for +\fI+[no]recurse\fR. +.RE +.PP \fB+[no]recurse\fR .RS 4 Toggle the setting of the RD (recursion desired) bit in the query. This bit is set by default, which means @@ -518,6 +553,8 @@ Toggle tracing of the delegation path fr \fBdig\fR makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup. .sp +If @server is also specified, it affects only the initial query for the root zone name servers. +.sp \fB+dnssec\fR is also set when +trace is set to better emulate the default queries from a nameserver. .RE @@ -620,7 +657,7 @@ RFC1035. .PP There are probably too many query options. .SH "COPYRIGHT" -Copyright \(co 2004\-2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004\-2011, 2013\-2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000\-2003 Internet Software Consortium. .br Modified: vendor/bind9/dist/bin/dig/dig.c ============================================================================== --- vendor/bind9/dist/bin/dig/dig.c Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/dig/dig.c Thu Oct 1 07:47:44 2015 (r288438) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -165,71 +165,75 @@ help(void) { " q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n" " (Use ixfr=version for type ixfr)\n" " q-opt is one of:\n" -" -x dot-notation (shortcut for reverse lookups)\n" -" -i (use IP6.INT for IPv6 reverse lookups)\n" -" -f filename (batch mode)\n" +" -4 (use IPv4 query transport only)\n" +" -6 (use IPv6 query transport only)\n" " -b address[#port] (bind to source address/port)\n" +" -c class (specify query class)\n" +" -f filename (batch mode)\n" +" -i (use IP6.INT for IPv6 reverse lookups)\n" +" -k keyfile (specify tsig key file)\n" +" -m (enable memory usage debugging)\n" " -p port (specify port number)\n" " -q name (specify query name)\n" " -t type (specify query type)\n" -" -c class (specify query class)\n" -" -k keyfile (specify tsig key file)\n" +" -x dot-notation (shortcut for reverse lookups)\n" " -y [hmac:]name:key (specify named base64 tsig key)\n" -" -4 (use IPv4 query transport only)\n" -" -6 (use IPv6 query transport only)\n" -" -m (enable memory usage debugging)\n" " d-opt is of the form +keyword[=value], where keyword is:\n" -" +[no]vc (TCP mode)\n" -" +[no]tcp (TCP mode, alternate syntax)\n" -" +time=### (Set query timeout) [5]\n" -" +tries=### (Set number of UDP attempts) [3]\n" -" +retry=### (Set number of UDP retries) [2]\n" -" +domain=### (Set default domainname)\n" -" +bufsize=### (Set EDNS0 Max UDP packet size)\n" -" +ndots=### (Set NDOTS value)\n" -" +[no]edns[=###] (Set EDNS version) [0]\n" -" +[no]search (Set whether to use searchlist)\n" -" +[no]showsearch (Search with intermediate results)\n" -" +[no]defname (Ditto)\n" -" +[no]recurse (Recursive mode)\n" -" +[no]ignore (Don't revert to TCP for TC responses.)" -"\n" -" +[no]fail (Don't try next server on SERVFAIL)\n" -" +[no]besteffort (Try to parse even illegal messages)\n" " +[no]aaonly (Set AA flag in query (+[no]aaflag))\n" -" +[no]adflag (Set AD flag in query)\n" -" +[no]cdflag (Set CD flag in query)\n" +" +[no]additional (Control display of additional section)\n" +" +[no]adflag (Set AD flag in query (default on))\n" +" +[no]all (Set or clear all display flags)\n" +" +[no]answer (Control display of answer section)\n" +" +[no]authority (Control display of authority section)\n" +" +[no]besteffort (Try to parse even illegal messages)\n" +" +bufsize=### (Set EDNS0 Max UDP packet size)\n" +" +[no]cdflag (Set checking disabled flag in query)\n" " +[no]cl (Control display of class in records)\n" " +[no]cmd (Control display of command line)\n" " +[no]comments (Control display of comment lines)\n" +" +[no]defname (Use search list (+[no]search))\n" +" +[no]dnssec (Request DNSSEC records)\n" +" +domain=### (Set default domainname)\n" +" +[no]edns[=###] (Set EDNS version) [0]\n" +" +[no]fail (Don't try next server on SERVFAIL)\n" +" +[no]identify (ID responders in short answers)\n" +" +[no]ignore (Don't revert to TCP for TC responses.)" +"\n" +" +[no]keepopen (Keep the TCP socket open between queries)\n" +" +[no]multiline (Print records in an expanded format)\n" +" +ndots=### (Set search NDOTS value)\n" +" +[no]nsid (Request Name Server ID)\n" +" +[no]nssearch (Search all authoritative nameservers)\n" +" +[no]onesoa (AXFR prints only one soa record)\n" +" +[no]qr (Print question before sending)\n" +" +[no]question (Control display of question section)\n" +" +[no]recurse (Recursive mode)\n" +" +retry=### (Set number of UDP retries) [2]\n" " +[no]rrcomments (Control display of per-record " "comments)\n" -" +[no]question (Control display of question)\n" -" +[no]answer (Control display of answer)\n" -" +[no]authority (Control display of authority)\n" -" +[no]additional (Control display of additional)\n" -" +[no]stats (Control display of statistics)\n" -" +[no]short (Disable everything except short\n" +" +[no]search (Set whether to use searchlist)\n" +" +[no]short (Display nothing except short\n" " form of answer)\n" -" +[no]ttlid (Control display of ttls in records)\n" -" +[no]all (Set or clear all display flags)\n" -" +[no]qr (Print question before sending)\n" -" +[no]nssearch (Search all authoritative nameservers)\n" -" +[no]identify (ID responders in short answers)\n" -" +[no]trace (Trace delegation down from root [+dnssec])\n" -" +[no]dnssec (Request DNSSEC records)\n" -" +[no]nsid (Request Name Server ID)\n" +" +[no]showsearch (Search with intermediate results)\n" #ifdef DIG_SIGCHASE " +[no]sigchase (Chase DNSSEC signatures)\n" -" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n" +#endif +" +[no]split=## (Split hex/base64 fields into chunks)\n" +" +[no]stats (Control display of statistics)\n" +" +[no]tcp (TCP mode (+[no]vc))\n" +" +time=### (Set query timeout) [5]\n" +#ifdef DIG_SIGCHASE #if DIG_SIGCHASE_TD " +[no]topdown (Do DNSSEC validation top down mode)\n" #endif #endif -" +[no]split=## (Split hex/base64 fields into chunks)\n" -" +[no]multiline (Print records in an expanded format)\n" -" +[no]onesoa (AXFR prints only one soa record)\n" -" +[no]keepopen (Keep the TCP socket open between queries)\n" +" +[no]trace (Trace delegation down from root [+dnssec])\n" +" +tries=### (Set number of UDP attempts) [3]\n" +#ifdef DIG_SIGCHASE +" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n" +#endif +" +[no]ttlid (Control display of ttls in records)\n" +" +[no]vc (TCP mode (+[no]tcp))\n" " global d-opts and servers (before host name) affect all queries.\n" " local d-opts and servers (after host name) affect only that lookup.\n" " -h (print help and exit)\n" @@ -306,6 +310,7 @@ say_message(dns_rdata_t *rdata, dig_quer isc_result_t result; isc_uint64_t diff; char store[sizeof("12345678901234567890")]; + unsigned int styleflags = 0; if (query->lookup->trace || query->lookup->ns_search_only) { result = dns_rdatatype_totext(rdata->type, buf); @@ -313,7 +318,11 @@ say_message(dns_rdata_t *rdata, dig_quer return (result); ADD_STRING(buf, " "); } - result = dns_rdata_totext(rdata, NULL, buf); + + if (rrcomments) + styleflags |= DNS_STYLEFLAG_RRCOMMENT; + result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, + splitwidth, " ", buf); if (result == ISC_R_NOSPACE) return (result); check_result(result, "dns_rdata_totext"); @@ -831,8 +840,9 @@ plus_option(char *option, isc_boolean_t goto invalid_option; } break; - case 'l': /* cl */ - FULLCHECK("cl"); + case 'l': /* class */ + /* keep +cl for backwards compatibility */ + FULLCHECK2("cl", "class"); noclass = ISC_TF(!state); break; case 'm': /* cmd */ @@ -984,6 +994,10 @@ plus_option(char *option, isc_boolean_t break; case 'r': switch (cmd[1]) { + case 'd': /* rdflag */ + FULLCHECK("rdflag"); + lookup->recurse = state; + break; case 'e': switch (cmd[2]) { case 'c': /* recurse */ Modified: vendor/bind9/dist/bin/dig/dig.docbook ============================================================================== --- vendor/bind9/dist/bin/dig/dig.docbook Thu Oct 1 05:56:38 2015 (r288437) +++ vendor/bind9/dist/bin/dig/dig.docbook Thu Oct 1 07:47:44 2015 (r288438) @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> - - - - If a non-standard port number is to be queried, the - option is used. port# is - the port number that dig will send its - queries - instead of the standard DNS port number 53. This option would be used - to test a name server that has been configured to listen for queries - on a non-standard port number. - - - - The option forces dig - to only - use IPv4 query transport. The option forces - dig to only use IPv6 query transport. - - - - The option sets the query type to - type. It can be any valid query type - which is - supported in BIND 9. The default query type is "A", unless the - option is supplied to indicate a reverse lookup. - A zone transfer can be requested by specifying a type of AXFR. When - an incremental zone transfer (IXFR) is required, - type is set to ixfr=N. - The incremental zone transfer will contain the changes made to the zone *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 1 07:48:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 424AEA0D9D2; Thu, 1 Oct 2015 07:48:27 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A3B010CD; Thu, 1 Oct 2015 07:48:27 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t917mQpW058162; Thu, 1 Oct 2015 07:48:26 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t917mQLZ058161; Thu, 1 Oct 2015 07:48:26 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201510010748.t917mQLZ058161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Thu, 1 Oct 2015 07:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r288439 - vendor/bind9/9.9.8 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 07:48:27 -0000 Author: erwin Date: Thu Oct 1 07:48:26 2015 New Revision: 288439 URL: https://svnweb.freebsd.org/changeset/base/288439 Log: Tag the 9.9.8 release Sponsored by: DK Hostmaster A/S Added: - copied from r288438, vendor/bind9/dist/ Directory Properties: vendor/bind9/9.9.8/ (props changed) From owner-svn-src-all@freebsd.org Thu Oct 1 09:36:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F5A9A0C1D3; Thu, 1 Oct 2015 09:36:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 405DE1282; Thu, 1 Oct 2015 09:36:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919aJkg003509; Thu, 1 Oct 2015 09:36:19 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919aJ2W003508; Thu, 1 Oct 2015 09:36:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010936.t919aJ2W003508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288440 - head/etc/etc.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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 09:36:19 -0000 Author: andrew Date: Thu Oct 1 09:36:18 2015 New Revision: 288440 URL: https://svnweb.freebsd.org/changeset/base/288440 Log: Update the arm64 ttys file to enable the correct uart based on which device the console is attached to. This makes this file identical to the 32-bit arm version of this file. Obtained from: EuroBSDCon devsummit Sponsored by: ABT Systems Ltd Modified: head/etc/etc.aarch64/ttys Modified: head/etc/etc.aarch64/ttys ============================================================================== --- head/etc/etc.aarch64/ttys Thu Oct 1 07:48:26 2015 (r288439) +++ head/etc/etc.aarch64/ttys Thu Oct 1 09:36:18 2015 (r288440) @@ -29,7 +29,7 @@ # when going to single-user mode. console none unknown off secure # -ttyv0 "/usr/libexec/getty Pc" xterm off secure +ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" xterm off secure ttyv2 "/usr/libexec/getty Pc" xterm off secure @@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm off #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 on secure -ttyu1 "/usr/libexec/getty std.9600" dialup off secure -ttyu2 "/usr/libexec/getty std.9600" dialup off secure -ttyu3 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure From owner-svn-src-all@freebsd.org Thu Oct 1 09:40:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C310A0C69B; Thu, 1 Oct 2015 09:40:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DA9E17DD; Thu, 1 Oct 2015 09:40:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919eYsR004984; Thu, 1 Oct 2015 09:40:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919eYeA004983; Thu, 1 Oct 2015 09:40:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010940.t919eYeA004983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288442 - head/usr.sbin 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 09:40:34 -0000 Author: andrew Date: Thu Oct 1 09:40:33 2015 New Revision: 288442 URL: https://svnweb.freebsd.org/changeset/base/288442 Log: Also build ofwdump on arm64. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Added: head/usr.sbin/Makefile.arm64 (contents, props changed) Added: head/usr.sbin/Makefile.arm64 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/Makefile.arm64 Thu Oct 1 09:40:33 2015 (r288442) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SUBDIR+= ofwdump From owner-svn-src-all@freebsd.org Thu Oct 1 09:44:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 420B6A0C9F6; Thu, 1 Oct 2015 09:44:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 332C71D26; Thu, 1 Oct 2015 09:44:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919iGCg007764; Thu, 1 Oct 2015 09:44:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919iGv3007763; Thu, 1 Oct 2015 09:44:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010944.t919iGv3007763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288443 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 09:44:16 -0000 Author: andrew Date: Thu Oct 1 09:44:15 2015 New Revision: 288443 URL: https://svnweb.freebsd.org/changeset/base/288443 Log: Add the ENTRY/END entries around the exception handlers. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/exception.S Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Thu Oct 1 09:40:33 2015 (r288442) +++ head/sys/arm64/arm64/exception.S Thu Oct 1 09:44:15 2015 (r288443) @@ -131,45 +131,51 @@ __FBSDID("$FreeBSD$"); 2: .endm -handle_el1h_sync: +ENTRY(handle_el1h_sync) save_registers 1 mov x0, sp bl do_el1h_sync restore_registers 1 eret +END(handle_el1h_sync) -handle_el1h_irq: +ENTRY(handle_el1h_irq) save_registers 1 mov x0, sp bl arm_cpu_intr restore_registers 1 eret +END(handle_el1h_irq) -handle_el1h_error: +ENTRY(handle_el1h_error) brk 0xf13 +END(handle_el1h_error) -handle_el0_sync: +ENTRY(handle_el0_sync) save_registers 0 mov x0, sp bl do_el0_sync do_ast restore_registers 0 eret +END(handle_el0_sync) -handle_el0_irq: +ENTRY(handle_el0_irq) save_registers 0 mov x0, sp bl arm_cpu_intr do_ast restore_registers 0 eret +END(handle_el0_irq) -handle_el0_error: +ENTRY(handle_el0_error) save_registers 0 mov x0, sp bl do_el0_error brk 0xf23 1: b 1b +END(handle_el0_error) .macro vempty .align 7 From owner-svn-src-all@freebsd.org Thu Oct 1 09:53:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B82ABA0D59D; Thu, 1 Oct 2015 09:53:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8E7812FF; Thu, 1 Oct 2015 09:53:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919rD2O011762; Thu, 1 Oct 2015 09:53:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919rDXc011761; Thu, 1 Oct 2015 09:53:13 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010953.t919rDXc011761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288444 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 09:53:13 -0000 Author: andrew Date: Thu Oct 1 09:53:12 2015 New Revision: 288444 URL: https://svnweb.freebsd.org/changeset/base/288444 Log: Pass 8 arguments to makecontext on arm64 as this is all we support. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Thu Oct 1 09:44:15 2015 (r288443) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Thu Oct 1 09:53:12 2015 (r288444) @@ -53,6 +53,8 @@ run(int n, ...) va_start(va, n); #if defined(__FreeBSD__) && defined(__amd64__) for (i = 0; i < 5; i++) { +#elif defined(__FreeBSD__) && defined(__aarch64__) + for (i = 0; i < 7; i++) { #else for (i = 0; i < 9; i++) { #endif @@ -116,6 +118,10 @@ ATF_TC_BODY(setcontext_link, tc) /* FreeBSD/amd64 only permits up to 6 arguments. */ makecontext(&uc[i], (void *)run, 6, i, 0, 1, 2, 3, 4); +#elif defined(__FreeBSD__) && defined(__aarch64__) + /* FreeBSD/arm64 only permits up to 8 arguments. */ + makecontext(&uc[i], (void *)run, 8, i, + 0, 1, 2, 3, 4, 5, 6); #else makecontext(&uc[i], (void *)run, 10, i, 0, 1, 2, 3, 4, 5, 6, 7, 8); From owner-svn-src-all@freebsd.org Thu Oct 1 10:43:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BA34A0D7B3; Thu, 1 Oct 2015 10:43:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8FB1B73; Thu, 1 Oct 2015 10:43:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Ahfn3032249; Thu, 1 Oct 2015 10:43:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91AhfvE032248; Thu, 1 Oct 2015 10:43:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510011043.t91AhfvE032248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 10:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288445 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 10:43:41 -0000 Author: andrew Date: Thu Oct 1 10:43:40 2015 New Revision: 288445 URL: https://svnweb.freebsd.org/changeset/base/288445 Log: Use pmap_load more consistently. While here try to only load the data once when we reuse the same data. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Oct 1 09:53:12 2015 (r288444) +++ head/sys/arm64/arm64/pmap.c Thu Oct 1 10:43:40 2015 (r288445) @@ -243,6 +243,16 @@ static void _pmap_unwire_l3(pmap_t pmap, struct spglist *free); static int pmap_unuse_l3(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); +/* + * These load the old table data and store the new value. + * They need to be atomic as the System MMU may write to the table at + * the same time as the CPU. + */ +#define pmap_load_store(table, entry) atomic_swap_64(table, entry) +#define pmap_set(table, mask) atomic_set_64(table, mask) +#define pmap_load_clear(table) atomic_swap_64(table, 0) +#define pmap_load(table) (*table) + /********************/ /* Inline functions */ /********************/ @@ -277,7 +287,7 @@ pmap_l1_to_l2(pd_entry_t *l1, vm_offset_ { pd_entry_t *l2; - l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK); + l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); return (&l2[pmap_l2_index(va)]); } @@ -287,7 +297,7 @@ pmap_l2(pmap_t pmap, vm_offset_t va) pd_entry_t *l1; l1 = pmap_l1(pmap, va); - if ((*l1 & ATTR_DESCR_MASK) != L1_TABLE) + if ((pmap_load(l1) & ATTR_DESCR_MASK) != L1_TABLE) return (NULL); return (pmap_l1_to_l2(l1, va)); @@ -298,7 +308,7 @@ pmap_l2_to_l3(pd_entry_t *l2, vm_offset_ { pt_entry_t *l3; - l3 = (pd_entry_t *)PHYS_TO_DMAP(*l2 & ~ATTR_MASK); + l3 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l2) & ~ATTR_MASK); return (&l3[pmap_l3_index(va)]); } @@ -308,7 +318,7 @@ pmap_l3(pmap_t pmap, vm_offset_t va) pd_entry_t *l2; l2 = pmap_l2(pmap, va); - if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE) + if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE) return (NULL); return (pmap_l2_to_l3(l2, va)); @@ -326,19 +336,19 @@ pmap_get_tables(pmap_t pmap, vm_offset_t l1p = pmap_l1(pmap, va); *l1 = l1p; - if ((*l1p & ATTR_DESCR_MASK) == L1_BLOCK) { + if ((pmap_load(l1p) & ATTR_DESCR_MASK) == L1_BLOCK) { *l2 = NULL; *l3 = NULL; return (true); } - if ((*l1p & ATTR_DESCR_MASK) != L1_TABLE) + if ((pmap_load(l1p) & ATTR_DESCR_MASK) != L1_TABLE) return (false); l2p = pmap_l1_to_l2(l1p, va); *l2 = l2p; - if ((*l2p & ATTR_DESCR_MASK) == L2_BLOCK) { + if ((pmap_load(l2p) & ATTR_DESCR_MASK) == L2_BLOCK) { *l3 = NULL; return (true); } @@ -348,16 +358,6 @@ pmap_get_tables(pmap_t pmap, vm_offset_t return (true); } -/* - * These load the old table data and store the new value. - * They need to be atomic as the System MMU may write to the table at - * the same time as the CPU. - */ -#define pmap_load_store(table, entry) atomic_swap_64(table, entry) -#define pmap_set(table, mask) atomic_set_64(table, mask) -#define pmap_load_clear(table) atomic_swap_64(table, 0) -#define pmap_load(table) (*table) - static __inline int pmap_is_current(pmap_t pmap) { @@ -799,11 +799,11 @@ pmap_extract(pmap_t pmap, vm_offset_t va */ l2p = pmap_l2(pmap, va); if (l2p != NULL) { - l2 = *l2p; + l2 = pmap_load(l2p); if ((l2 & ATTR_DESCR_MASK) == L2_TABLE) { l3p = pmap_l2_to_l3(l2p, va); if (l3p != NULL) { - l3 = *l3p; + l3 = pmap_load(l3p); if ((l3 & ATTR_DESCR_MASK) == L3_PAGE) pa = (l3 & ~ATTR_MASK) | @@ -852,23 +852,25 @@ retry: vm_paddr_t pmap_kextract(vm_offset_t va) { - pd_entry_t *l2; + pd_entry_t *l2p, l2; pt_entry_t *l3; vm_paddr_t pa; if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) { pa = DMAP_TO_PHYS(va); } else { - l2 = pmap_l2(kernel_pmap, va); - if (l2 == NULL) + l2p = pmap_l2(kernel_pmap, va); + if (l2p == NULL) panic("pmap_kextract: No l2"); - if ((*l2 & ATTR_DESCR_MASK) == L2_BLOCK) - return ((*l2 & ~ATTR_MASK) | (va & L2_OFFSET)); + l2 = pmap_load(l2p); + if ((l2 & ATTR_DESCR_MASK) == L2_BLOCK) + return ((l2 & ~ATTR_MASK) | + (va & L2_OFFSET)); - l3 = pmap_l2_to_l3(l2, va); + l3 = pmap_l2_to_l3(l2p, va); if (l3 == NULL) panic("pmap_kextract: No l3..."); - pa = (*l3 & ~ATTR_MASK) | (va & PAGE_MASK); + pa = (pmap_load(l3) & ~ATTR_MASK) | (va & PAGE_MASK); } return (pa); } @@ -1242,11 +1244,11 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t return (NULL); } } else { - pdpg = PHYS_TO_VM_PAGE(*l1 & ~ATTR_MASK); + pdpg = PHYS_TO_VM_PAGE(pmap_load(l1) & ~ATTR_MASK); pdpg->wire_count++; } - l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK); + l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; pmap_load_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); PTE_SYNC(l2); @@ -1738,7 +1740,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva if (l2 == NULL) continue; - l3_paddr = *l2; + l3_paddr = pmap_load(l2); /* * Weed out invalid mappings. @@ -1805,7 +1807,7 @@ pmap_remove_all(vm_page_t m) pv_entry_t pv; pmap_t pmap; pt_entry_t *l3, tl3; - pd_entry_t *l2; + pd_entry_t *l2, tl2; struct spglist free; KASSERT((m->oflags & VPO_UNMANAGED) == 0, @@ -1817,7 +1819,9 @@ pmap_remove_all(vm_page_t m) PMAP_LOCK(pmap); pmap_resident_count_dec(pmap, 1); l2 = pmap_l2(pmap, pv->pv_va); - KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE, + KASSERT(l2 != NULL, ("pmap_remove_all: no l2 table found")); + tl2 = pmap_load(l2); + KASSERT((tl2 & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_remove_all: found a table when expecting " "a block in %p's pv list", m)); l3 = pmap_l2_to_l3(l2, pv->pv_va); @@ -1837,7 +1841,7 @@ pmap_remove_all(vm_page_t m) */ if (pmap_page_dirty(tl3)) vm_page_dirty(m); - pmap_unuse_l3(pmap, pv->pv_va, *l2, &free); + pmap_unuse_l3(pmap, pv->pv_va, tl2, &free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; free_pv_entry(pmap, pv); @@ -1883,7 +1887,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE) + if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE) continue; if (va_next > eva) @@ -2345,7 +2349,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva continue; if ((pmap_load(l3) & ATTR_SW_WIRED) == 0) panic("pmap_unwire: l3 %#jx is missing " - "ATTR_SW_WIRED", (uintmax_t)*l3); + "ATTR_SW_WIRED", (uintmax_t)pmap_load(l3)); /* * PG_W must be cleared atomically. Although the pmap @@ -2836,7 +2840,7 @@ retry_pv_loop: } l3 = pmap_l3(pmap, pv->pv_va); retry: - oldl3 = *l3; + oldl3 = pmap_load(l3); if ((oldl3 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) { if (!atomic_cmpset_long(l3, oldl3, oldl3 | ATTR_AP(ATTR_AP_RO))) @@ -2879,7 +2883,7 @@ pmap_ts_referenced(vm_page_t m) pv_entry_t pv, pvf; pmap_t pmap; struct rwlock *lock; - pd_entry_t *l2; + pd_entry_t *l2p, l2; pt_entry_t *l3; vm_paddr_t pa; int cleared, md_gen, not_cleared; @@ -2912,12 +2916,14 @@ retry: goto retry; } } - l2 = pmap_l2(pmap, pv->pv_va); - KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE, + l2p = pmap_l2(pmap, pv->pv_va); + KASSERT(l2p != NULL, ("pmap_ts_referenced: no l2 table found")); + l2 = pmap_load(l2p); + KASSERT((l2 & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_ts_referenced: found an invalid l2 table")); - l3 = pmap_l2_to_l3(l2, pv->pv_va); + l3 = pmap_l2_to_l3(l2p, pv->pv_va); if ((pmap_load(l3) & ATTR_AF) != 0) { - if (safe_to_clear_referenced(pmap, *l3)) { + if (safe_to_clear_referenced(pmap, pmap_load(l3))) { /* * TODO: We don't handle the access flag * at all. We need to be able to set it in @@ -2931,8 +2937,8 @@ retry: * them is wasted effort. We do the * hard work for unwired pages only. */ - pmap_remove_l3(pmap, l3, pv->pv_va, - *l2, &free, &lock); + pmap_remove_l3(pmap, l3, pv->pv_va, l2, + &free, &lock); pmap_invalidate_page(pmap, pv->pv_va); cleared++; if (pvf == pv) From owner-svn-src-all@freebsd.org Thu Oct 1 10:52:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A02F7A0DDFB; Thu, 1 Oct 2015 10:52:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9012E1041; Thu, 1 Oct 2015 10:52:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91AqSnS036248; Thu, 1 Oct 2015 10:52:28 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91AqR38036244; Thu, 1 Oct 2015 10:52:27 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201510011052.t91AqR38036244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 1 Oct 2015 10:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288446 - in head: sbin/init sys/dev/acpica sys/kern 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 10:52:28 -0000 Author: cperciva Date: Thu Oct 1 10:52:26 2015 New Revision: 288446 URL: https://svnweb.freebsd.org/changeset/base/288446 Log: Disable suspend when we're shutting down. This solves the "tell FreeBSD to shut down; close laptop lid" scenario which otherwise tended to end with a laptop overheating or the battery dying. The implementation uses a new sysctl, kern.suspend_blocked; init(8) sets this while rc.suspend runs, and the ACPI sleep code ignores requests while the sysctl is set. Discussed on: freebsd-acpi (35 emails) MFC after: 1 week Modified: head/sbin/init/init.c head/sys/dev/acpica/acpi.c head/sys/kern/kern_shutdown.c head/sys/sys/systm.h Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sbin/init/init.c Thu Oct 1 10:52:26 2015 (r288446) @@ -1487,6 +1487,15 @@ static state_func_t death(void) { session_t *sp; + int block, blocked; + size_t len; + + /* Temporarily block suspend. */ + len = sizeof(blocked); + block = 1; + if (sysctlbyname("kern.suspend_blocked", &blocked, &len, + &block, sizeof(block)) == -1) + blocked = 0; /* * Also revoke the TTY here. Because runshutdown() may reopen @@ -1503,6 +1512,11 @@ death(void) /* Try to run the rc.shutdown script within a period of time */ runshutdown(); + /* Unblock suspend if we blocked it. */ + if (!blocked) + sysctlbyname("kern.suspend_blocked", NULL, NULL, + &blocked, sizeof(blocked)); + return (state_func_t) death_single; } Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/dev/acpica/acpi.c Thu Oct 1 10:52:26 2015 (r288446) @@ -2574,8 +2574,11 @@ acpi_ReqSleepState(struct acpi_softc *sc if (!acpi_sleep_states[state]) return (EOPNOTSUPP); - /* If a suspend request is already in progress, just return. */ - if (sc->acpi_next_sstate != 0) { + /* + * If a reboot/shutdown/suspend request is already in progress or + * suspend is blocked due to an upcoming shutdown, just return. + */ + if (rebooting || sc->acpi_next_sstate != 0 || suspend_blocked) { return (0); } Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/kern/kern_shutdown.c Thu Oct 1 10:52:26 2015 (r288446) @@ -137,6 +137,10 @@ static int show_busybufs = 1; SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, &show_busybufs, 0, ""); +int suspend_blocked = 0; +SYSCTL_INT(_kern, OID_AUTO, suspend_blocked, CTLFLAG_RW, + &suspend_blocked, 0, "Block suspend due to a pending shutdown"); + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/sys/systm.h Thu Oct 1 10:52:26 2015 (r288446) @@ -46,6 +46,7 @@ #include /* for people using printf mainly */ 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. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ From owner-svn-src-all@freebsd.org Thu Oct 1 12:09:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B76CA0B493; Thu, 1 Oct 2015 12:09:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61C4F1BE8; Thu, 1 Oct 2015 12:09:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91C96Cs065091; Thu, 1 Oct 2015 12:09:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91C95YJ065089; Thu, 1 Oct 2015 12:09:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510011209.t91C95YJ065089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 12:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288447 - in head/sys/arm: broadcom/bcm2835 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 12:09:06 -0000 Author: andrew Date: Thu Oct 1 12:09:05 2015 New Revision: 288447 URL: https://svnweb.freebsd.org/changeset/base/288447 Log: An IPI must be cleared before it is handled otherwise next IPI could be missed. In other words, if a new request for an IPI is sent while the previous request is being handled but the IPI is not cleared yet, the clearing of the previous IPI request also clears the new one and the handling is missed. There are only three MP interrupt controllers in ARM now. Two of them are fixed by this change, the third one is correct, probably only just by accident. The fix is minimalistic as new interrupt framework is awaited. It was debugged on RPi2 where missing IPI handling together with SCHED_ULE led to situation in which tdq_ipipending was not cleared and so IPI_PREEMPT was stopped to be sent. Various odditys were found related to slow system response time like various events timed out, and slow console response. Submitted by: Svatopluk Kraus Reviewed by: loos, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3722 Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c head/sys/arm/mv/mpic.c Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Thu Oct 1 10:52:26 2015 (r288446) +++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Thu Oct 1 12:09:05 2015 (r288447) @@ -182,6 +182,8 @@ pic_ipi_read(int i) if (val == 0) return (0); ipi = ffs(val) - 1; + BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi); + dsb(); return (ipi); } return (0x3ff); @@ -190,12 +192,6 @@ pic_ipi_read(int i) void pic_ipi_clear(int ipi) { - int cpu; - - cpu = PCPU_GET(cpuid); - dsb(); - BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi); - wmb(); } void Modified: head/sys/arm/mv/mpic.c ============================================================================== --- head/sys/arm/mv/mpic.c Thu Oct 1 10:52:26 2015 (r288446) +++ head/sys/arm/mv/mpic.c Thu Oct 1 12:09:05 2015 (r288447) @@ -378,10 +378,14 @@ int pic_ipi_read(int i __unused) { uint32_t val; + int ipi; val = MPIC_CPU_READ(mv_mpic_sc, MPIC_IN_DRBL); - if (val) - return (ffs(val) - 1); + if (val) { + ipi = ffs(val) - 1; + MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, ~(1 << ipi)); + return (ipi); + } return (0x3ff); } @@ -389,10 +393,6 @@ pic_ipi_read(int i __unused) void pic_ipi_clear(int ipi) { - uint32_t val; - - val = ~(1 << ipi); - MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, val); } #endif From owner-svn-src-all@freebsd.org Thu Oct 1 12:15:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9311AA0BAA2; Thu, 1 Oct 2015 12:15:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82F7D112B; Thu, 1 Oct 2015 12:15:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91CFbER069009; Thu, 1 Oct 2015 12:15:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91CFbAN069007; Thu, 1 Oct 2015 12:15:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011215.t91CFbAN069007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 12:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288448 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 12:15:37 -0000 Author: mav Date: Thu Oct 1 12:15:36 2015 New Revision: 288448 URL: https://svnweb.freebsd.org/changeset/base/288448 Log: Unify PR variable names to reduce confusion. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Oct 1 12:09:05 2015 (r288447) +++ head/sys/cam/ctl/ctl.c Thu Oct 1 12:15:36 2015 (r288448) @@ -781,9 +781,9 @@ alloc: msg->hdr.nexus.targ_lun = lun->lun; msg->hdr.nexus.targ_mapped_lun = lun->lun; msg->lun.flags = lun->flags; - msg->lun.pr_generation = lun->PRGeneration; + msg->lun.pr_generation = lun->pr_generation; msg->lun.pr_res_idx = lun->pr_res_idx; - msg->lun.pr_res_type = lun->res_type; + msg->lun.pr_res_type = lun->pr_res_type; msg->lun.pr_key_count = lun->pr_key_count; i = 0; if (lun->lun_devid) { @@ -1085,9 +1085,9 @@ ctl_isc_lun_sync(struct ctl_softc *softc /* If peer is primary and we are not -- use data */ if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && (lun->flags & CTL_LUN_PEER_SC_PRIMARY)) { - lun->PRGeneration = msg->lun.pr_generation; + lun->pr_generation = msg->lun.pr_generation; lun->pr_res_idx = msg->lun.pr_res_idx; - lun->res_type = msg->lun.pr_res_type; + lun->pr_res_type = msg->lun.pr_res_type; lun->pr_key_count = msg->lun.pr_key_count; for (k = 0; k < CTL_MAX_INITIATORS; k++) ctl_clr_prkey(lun, k); @@ -5130,7 +5130,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) residx = ctl_get_initindex(&ctsio->io_hdr.nexus); if (ctl_get_prkey(lun, residx) == 0 || - (lun->pr_res_idx != residx && lun->res_type < 4)) { + (lun->pr_res_idx != residx && lun->pr_res_type < 4)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); @@ -7540,7 +7540,7 @@ retry: goto retry; } - scsi_ulto4b(lun->PRGeneration, res_keys->header.generation); + scsi_ulto4b(lun->pr_generation, res_keys->header.generation); scsi_ulto4b(sizeof(struct scsi_per_res_key) * lun->pr_key_count, res_keys->header.length); @@ -7571,7 +7571,7 @@ retry: res = (struct scsi_per_res_in_rsrv *)ctsio->kern_data_ptr; - scsi_ulto4b(lun->PRGeneration, res->header.generation); + scsi_ulto4b(lun->pr_generation, res->header.generation); if (lun->flags & CTL_LUN_PR_RESERVED) { @@ -7614,7 +7614,7 @@ retry: scsi_u64to8b(ctl_get_prkey(lun, lun->pr_res_idx), res->data.reservation); } - res->data.scopetype = lun->res_type; + res->data.scopetype = lun->pr_res_type; break; } case SPRI_RC: //report capabilities @@ -7659,7 +7659,7 @@ retry: goto retry; } - scsi_ulto4b(lun->PRGeneration, res_status->header.generation); + scsi_ulto4b(lun->pr_generation, res_status->header.generation); res_desc = &res_status->desc[0]; for (i = 0; i < CTL_MAX_INITIATORS; i++) { @@ -7671,7 +7671,7 @@ retry: (lun->pr_res_idx == i || lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { res_desc->flags = SPRI_FULL_R_HOLDER; - res_desc->scopetype = lun->res_type; + res_desc->scopetype = lun->pr_res_type; } scsi_ulto2b(i / CTL_MAX_INIT_PER_PORT, res_desc->rel_trgt_port_id); @@ -7760,11 +7760,11 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } lun->pr_key_count = 1; - lun->res_type = type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); /* send msg to other side */ @@ -7834,7 +7834,7 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); /* send msg to other side */ @@ -7900,19 +7900,19 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_clr_prkey(lun, i); lun->pr_key_count--; ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); - } else if (type != lun->res_type - && (lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type ==SPR_TYPE_EX_AC_RO)){ + } else if (type != lun->pr_res_type && + (lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO)) { ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; else lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -7949,7 +7949,7 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_done((union ctl_io *)ctsio); return (1); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -7993,9 +7993,9 @@ ctl_pro_preempt_other(struct ctl_lun *lu } lun->pr_key_count = 1; - lun->res_type = msg->pr.pr_info.res_type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = msg->pr.pr_info.res_type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = msg->pr.pr_info.residx; } else { for (i = 0; i < CTL_MAX_INITIATORS; i++) { @@ -8017,20 +8017,20 @@ ctl_pro_preempt_other(struct ctl_lun *lu ctl_clr_prkey(lun, i); lun->pr_key_count--; ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); - } else if (msg->pr.pr_info.res_type != lun->res_type - && (lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO)) { + } else if (msg->pr.pr_info.res_type != lun->pr_res_type + && (lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO)) { ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = msg->pr.pr_info.res_type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = msg->pr.pr_info.res_type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = msg->pr.pr_info.residx; else lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; } - lun->PRGeneration++; + lun->pr_generation++; } @@ -8212,9 +8212,9 @@ ctl_persistent_reserve_out(struct ctl_sc lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - if ((lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO) - && lun->pr_key_count) { + if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO) && + lun->pr_key_count) { /* * If the reservation is a registrants * only type we need to generate a UA @@ -8230,15 +8230,15 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_UA_RES_RELEASE); } } - lun->res_type = 0; + lun->pr_res_type = 0; } else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) { if (lun->pr_key_count==0) { lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; } } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8257,7 +8257,7 @@ ctl_persistent_reserve_out(struct ctl_sc if (ctl_get_prkey(lun, residx) == 0) lun->pr_key_count++; ctl_set_prkey(lun, residx, sa_res_key); - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8286,7 +8286,7 @@ ctl_persistent_reserve_out(struct ctl_sc */ if ((lun->pr_res_idx != residx && lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) - || lun->res_type != type) { + || lun->pr_res_type != type) { mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); @@ -8306,7 +8306,7 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; lun->flags |= CTL_LUN_PR_RESERVED; - lun->res_type = type; + lun->pr_res_type = type; mtx_unlock(&lun->lun_lock); @@ -8341,7 +8341,7 @@ ctl_persistent_reserve_out(struct ctl_sc goto done; } - if (lun->res_type != type) { + if (lun->pr_res_type != type) { mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_illegal_pr_release(ctsio); @@ -8352,7 +8352,7 @@ ctl_persistent_reserve_out(struct ctl_sc /* okay to release */ lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - lun->res_type = 0; + lun->pr_res_type = 0; /* * if this isn't an exclusive access @@ -8382,7 +8382,7 @@ ctl_persistent_reserve_out(struct ctl_sc mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; @@ -8392,7 +8392,7 @@ ctl_persistent_reserve_out(struct ctl_sc ctl_clr_prkey(lun, i); ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8459,7 +8459,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->pr_key_count++; ctl_set_prkey(lun, msg->pr.pr_info.residx, scsi_8btou64(msg->pr.pr_info.sa_res_key)); - lun->PRGeneration++; + lun->pr_generation++; break; case CTL_PR_UNREG_KEY: @@ -8472,9 +8472,9 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - if ((lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO) - && lun->pr_key_count) { + if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO) && + lun->pr_key_count) { /* * If the reservation is a registrants * only type we need to generate a UA @@ -8490,20 +8490,20 @@ ctl_hndl_per_res_out_on_other_sc(union c ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = 0; + lun->pr_res_type = 0; } else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) { if (lun->pr_key_count==0) { lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; } } - lun->PRGeneration++; + lun->pr_generation++; break; case CTL_PR_RESERVE: lun->flags |= CTL_LUN_PR_RESERVED; - lun->res_type = msg->pr.pr_info.res_type; + lun->pr_res_type = msg->pr.pr_info.res_type; lun->pr_res_idx = msg->pr.pr_info.residx; break; @@ -8513,8 +8513,8 @@ ctl_hndl_per_res_out_on_other_sc(union c * if this isn't an exclusive access res generate UA for all * other registrants. */ - if (lun->res_type != SPR_TYPE_EX_AC - && lun->res_type != SPR_TYPE_WR_EX) { + if (lun->pr_res_type != SPR_TYPE_EX_AC && + lun->pr_res_type != SPR_TYPE_WR_EX) { for (i = softc->init_min; i < softc->init_max; i++) if (i == residx || ctl_get_prkey(lun, i) == 0) continue; @@ -8523,7 +8523,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - lun->res_type = 0; + lun->pr_res_type = 0; break; case CTL_PR_PREEMPT: @@ -8531,7 +8531,7 @@ ctl_hndl_per_res_out_on_other_sc(union c break; case CTL_PR_CLEAR: lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; @@ -8541,7 +8541,7 @@ ctl_hndl_per_res_out_on_other_sc(union c ctl_clr_prkey(lun, i); ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } - lun->PRGeneration++; + lun->pr_generation++; break; } @@ -11286,9 +11286,9 @@ ctl_scsiio_lun_check(struct ctl_lun *lun (entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_RESV)) { /* No reservation or command is allowed. */; } else if ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_WRESV) && - (lun->res_type == SPR_TYPE_WR_EX || - lun->res_type == SPR_TYPE_WR_EX_RO || - lun->res_type == SPR_TYPE_WR_EX_AR)) { + (lun->pr_res_type == SPR_TYPE_WR_EX || + lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_WR_EX_AR)) { /* The command is allowed for Write Exclusive resv. */; } else { /* @@ -11296,8 +11296,8 @@ ctl_scsiio_lun_check(struct ctl_lun *lun * reservation and this isn't the res holder then set a * conflict. */ - if (ctl_get_prkey(lun, residx) == 0 - || (residx != lun->pr_res_idx && lun->res_type < 4)) { + if (ctl_get_prkey(lun, residx) == 0 || + (residx != lun->pr_res_idx && lun->pr_res_type < 4)) { ctl_set_reservation_conflict(ctsio); retval = 1; goto bailout; Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Thu Oct 1 12:09:05 2015 (r288447) +++ head/sys/cam/ctl/ctl_private.h Thu Oct 1 12:15:36 2015 (r288448) @@ -392,11 +392,11 @@ struct ctl_lun { struct ctl_log_pages log_pages; struct ctl_lun_io_stats stats; uint32_t res_idx; - unsigned int PRGeneration; + uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; int pr_key_count; uint32_t pr_res_idx; - uint8_t res_type; + uint8_t pr_res_type; int prevent_count; uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; uint8_t *write_buffer; From owner-svn-src-all@freebsd.org Thu Oct 1 12:57:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BC8CA0D999; Thu, 1 Oct 2015 12:57:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C5D918BE; Thu, 1 Oct 2015 12:57:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Cvbsx085381; Thu, 1 Oct 2015 12:57:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Cvbvl085380; Thu, 1 Oct 2015 12:57:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011257.t91Cvbvl085380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 12:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288449 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 12:57:38 -0000 Author: mav Date: Thu Oct 1 12:57:37 2015 New Revision: 288449 URL: https://svnweb.freebsd.org/changeset/base/288449 Log: Implement SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Oct 1 12:15:36 2015 (r288448) +++ head/sys/cam/ctl/ctl.c Thu Oct 1 12:57:37 2015 (r288449) @@ -5101,6 +5101,13 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsi ctl_set_reservation_conflict(ctsio); goto bailout; } + + /* SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. */ + if (lun->flags & CTL_LUN_PR_RESERVED) { + ctl_set_success(ctsio); + goto bailout; + } + lun->flags |= CTL_LUN_RESERVED; lun->res_idx = residx; ctl_set_success(ctsio); @@ -7624,7 +7631,8 @@ retry: res_cap = (struct scsi_per_res_cap *)ctsio->kern_data_ptr; scsi_ulto2b(sizeof(*res_cap), res_cap->length); - res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_5; + res_cap->flags1 = SPRI_CRH; + res_cap->flags2 = SPRI_TMV | SPRI_ALLOW_5; type_mask = SPRI_TM_WR_EX_AR | SPRI_TM_EX_AC_RO | SPRI_TM_WR_EX_RO | From owner-svn-src-all@freebsd.org Thu Oct 1 16:30:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39B38A0D5C7; Thu, 1 Oct 2015 16:30:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B1C21EBE; Thu, 1 Oct 2015 16:30:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91GULS4080845; Thu, 1 Oct 2015 16:30:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91GULZw080844; Thu, 1 Oct 2015 16:30:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011630.t91GULZw080844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 16:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288450 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 16:30:21 -0000 Author: mav Date: Thu Oct 1 16:30:20 2015 New Revision: 288450 URL: https://svnweb.freebsd.org/changeset/base/288450 Log: Make zero WUT use WRITE SAME with recently allowed NDOB flag. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 12:57:37 2015 (r288449) +++ head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 16:30:20 2015 (r288450) @@ -1295,7 +1295,6 @@ complete: ctl_free_io(tio->io); free(tio, M_CTL); } - free(list->buf, M_CTL); if (list->abort) { ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); @@ -1311,7 +1310,6 @@ complete: } dstblock = list->lun->be_lun->blocksize; - list->buf = malloc(dstblock, M_CTL, M_WAITOK | M_ZERO); TAILQ_INIT(&run); prun = &run; list->tbdio = 1; @@ -1328,9 +1326,9 @@ complete: TAILQ_INSERT_TAIL(&list->allio, tiow, links); tiow->io = tpcl_alloc_io(); ctl_scsi_write_same(tiow->io, - /*data_ptr*/ list->buf, - /*data_len*/ dstblock, - /*byte2*/ 0, + /*data_ptr*/ NULL, + /*data_len*/ 0, + /*byte2*/ SWS_NDOB, /*lba*/ scsi_8btou64(list->range[r].lba), /*num_blocks*/ len, /*tag_type*/ CTL_TAG_SIMPLE, From owner-svn-src-all@freebsd.org Thu Oct 1 16:34:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 854E1A0D904; Thu, 1 Oct 2015 16:34:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57EE81793; Thu, 1 Oct 2015 16:34:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91GYsAJ085137; Thu, 1 Oct 2015 16:34:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91GYsml085136; Thu, 1 Oct 2015 16:34:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510011634.t91GYsml085136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Oct 2015 16:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288451 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 16:34:54 -0000 Author: markj Date: Thu Oct 1 16:34:53 2015 New Revision: 288451 URL: https://svnweb.freebsd.org/changeset/base/288451 Log: Ensure that vop_stdadvise() does not call getblk() on vnodes that have an empty bufobj. Otherwise, vnodes belonging to filesystems that do not use the buffer cache may trigger assertion failures. Reported by: Fabien Keil Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Oct 1 16:30:20 2015 (r288450) +++ head/sys/kern/vfs_default.c Thu Oct 1 16:34:53 2015 (r288451) @@ -1077,16 +1077,15 @@ vop_stdadvise(struct vop_advise_args *ap BO_RLOCK(&vp->v_bufobj); bsize = vp->v_bufobj.bo_bsize; startn = ap->a_start / bsize; - if (ap->a_end == OFF_MAX) { - endn = -1; - bl = &vp->v_bufobj.bo_clean.bv_hd; - if (!TAILQ_EMPTY(bl)) - endn = TAILQ_LAST(bl, buflists)->b_lblkno; - bl = &vp->v_bufobj.bo_dirty.bv_hd; - if (!TAILQ_EMPTY(bl) && - endn < TAILQ_LAST(bl, buflists)->b_lblkno) - endn = TAILQ_LAST(bl, buflists)->b_lblkno; - } else + endn = -1; + bl = &vp->v_bufobj.bo_clean.bv_hd; + if (!TAILQ_EMPTY(bl)) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + bl = &vp->v_bufobj.bo_dirty.bv_hd; + if (!TAILQ_EMPTY(bl) && + endn < TAILQ_LAST(bl, buflists)->b_lblkno) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + if (ap->a_end != OFF_MAX && endn != -1) endn = ap->a_end / bsize; BO_RUNLOCK(&vp->v_bufobj); /* From owner-svn-src-all@freebsd.org Thu Oct 1 16:40:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFEDEA0DC24; Thu, 1 Oct 2015 16:39:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB7AD1CFB; Thu, 1 Oct 2015 16:39:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EB42FB913; Thu, 1 Oct 2015 12:39:57 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Date: Thu, 01 Oct 2015 09:32:45 -0700 Message-ID: <1837187.vUDrWYExQX@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201509302306.t8UN6UwX043736@repo.freebsd.org> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 12:39:58 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 16:40:00 -0000 On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > Author: markj > Date: Wed Sep 30 23:06:29 2015 > New Revision: 288431 > URL: https://svnweb.freebsd.org/changeset/base/288431 > > Log: > As a step towards the elimination of PG_CACHED pages, rework the handling > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > the head of the inactive queue instead of being cached. > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > read or written. At that point the corresponding buffers may still be > dirty, so the previous implementation would coalesce successive ranges and > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > dirty buffers would eventually be cached. To preserve this behaviour in an > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > the pages backing a VMIO buf to be placed at the head of the inactive queue > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > flag in bufs that underlie the specified range. Putting these pages back on the inactive queue completely defeats the primary purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out of the VM object's tree of pages and into the free pool so that the application can instruct the VM to free memory more efficiently than relying on page daemon. The implementation used cache pages instead of free as a cheap optimization so that if an application did something dumb where it used DONTNEED and then turned around and read the file it would not have to go to disk if the pages had not yet been reused. In practice this didn't work out so well because PG_CACHE pages don't really work well. However, using PG_CACHE was secondary to the primary purpose of explicitly freeing memory that an application knew wasn't going to be reused and avoiding the need for pagedaemon to run at all. I think this should be freeing the pages instead of keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns around and rereads the file, it generally deserves to have to go to disk for it. I'm pretty sure I had mentioned this to Alan before. I believe that the idea is that pagedaemon should be cheap enough that having it run anyway shouldn't be an issue, but I'm a bit skeptical of that. :) Lock contention is always possible and having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with pagedaemon during application page faults (since pagedaemon potentially never has to run). I believe that B_NOREUSE is definitely cleaner, btw. I had wanted to change NOREUSE to work that way but wasn't sure how to do it. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Oct 1 16:59:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C0D4A0DA58; Thu, 1 Oct 2015 16:59:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3D6106C; Thu, 1 Oct 2015 16:59:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Gx816094040; Thu, 1 Oct 2015 16:59:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Gx8SX094039; Thu, 1 Oct 2015 16:59:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011659.t91Gx8SX094039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 16:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288452 - head/sys/dev/drm2/i915 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 16:59:08 -0000 Author: jhb Date: Thu Oct 1 16:59:07 2015 New Revision: 288452 URL: https://svnweb.freebsd.org/changeset/base/288452 Log: Most error cases in i915_gem_do_execbuffer() jump to one of two labels to release resources (such as unholding pages) when errors occur. Some recently added error checks return immediately instead of jumping to a label resulting in leaks. Fix these to jump to a label to do cleanup instead. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3745 Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem_execbuffer.c Thu Oct 1 16:34:53 2015 (r288451) +++ head/sys/dev/drm2/i915/i915_gem_execbuffer.c Thu Oct 1 16:59:07 2015 (r288452) @@ -1151,7 +1151,8 @@ i915_gem_do_execbuffer(struct drm_device if (ctx_id != 0) { DRM_DEBUG("Ring %s doesn't support contexts\n", ring->name); - return -EPERM; + ret = -EPERM; + goto pre_struct_lock_err; } break; case I915_EXEC_BLT: @@ -1159,7 +1160,8 @@ i915_gem_do_execbuffer(struct drm_device if (ctx_id != 0) { DRM_DEBUG("Ring %s doesn't support contexts\n", ring->name); - return -EPERM; + ret = -EPERM; + goto pre_struct_lock_err; } break; default: @@ -1171,7 +1173,8 @@ i915_gem_do_execbuffer(struct drm_device if (!intel_ring_initialized(ring)) { DRM_DEBUG("execbuf with invalid ring: %d\n", (int)(args->flags & I915_EXEC_RING_MASK)); - return -EINVAL; + ret = -EINVAL; + goto pre_struct_lock_err; } mode = args->flags & I915_EXEC_CONSTANTS_MASK; From owner-svn-src-all@freebsd.org Thu Oct 1 17:03:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 247BBA0DCF1; Thu, 1 Oct 2015 17:03:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 034C0146E; Thu, 1 Oct 2015 17:03:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 10CC7B913; Thu, 1 Oct 2015 13:03:12 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288452 - head/sys/dev/drm2/i915 Date: Thu, 01 Oct 2015 10:01:20 -0700 Message-ID: <90323889.l5UMs3tJRz@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201510011659.t91Gx8SX094039@repo.freebsd.org> References: <201510011659.t91Gx8SX094039@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 13:03:12 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 17:03:13 -0000 On Thursday, October 01, 2015 04:59:08 PM John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 16:59:07 2015 > New Revision: 288452 > URL: https://svnweb.freebsd.org/changeset/base/288452 > > Log: > Most error cases in i915_gem_do_execbuffer() jump to one of two labels to > release resources (such as unholding pages) when errors occur. Some > recently added error checks return immediately instead of jumping to a > label resulting in leaks. Fix these to jump to a label to do cleanup > instead. I was getting panics due to the hold count on pages being negative in this function. The hold counts were quiet high and so I believe that the hold count overflowed to zero due to these leaks and triggered the panic. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Oct 1 17:09:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8ED5A0C067; Thu, 1 Oct 2015 17:09:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A779A1ABE; Thu, 1 Oct 2015 17:09:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91H9NqZ098458; Thu, 1 Oct 2015 17:09:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91H9Lbs098447; Thu, 1 Oct 2015 17:09:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011709.t91H9Lbs098447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 17:09:21 +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: r288453 - in stable/10: lib/libutil sys/sys sys/vm usr.bin/vmstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 17:09:23 -0000 Author: jhb Date: Thu Oct 1 17:09:20 2015 New Revision: 288453 URL: https://svnweb.freebsd.org/changeset/base/288453 Log: MFC 283624,283630: Export a list of VM objects in the system via a sysctl. The list can be examined via 'vmstat -o'. It can be used to determine which files are using physical pages of memory and how much each is using. Added: stable/10/lib/libutil/kinfo_getvmobject.3 - copied unchanged from r283624, head/lib/libutil/kinfo_getvmobject.3 stable/10/lib/libutil/kinfo_getvmobject.c - copied unchanged from r283624, head/lib/libutil/kinfo_getvmobject.c Modified: stable/10/lib/libutil/Makefile stable/10/lib/libutil/libutil.h stable/10/sys/sys/user.h stable/10/sys/vm/vm_object.c stable/10/usr.bin/vmstat/vmstat.8 stable/10/usr.bin/vmstat/vmstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/Makefile ============================================================================== --- stable/10/lib/libutil/Makefile Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/lib/libutil/Makefile Thu Oct 1 17:09:20 2015 (r288453) @@ -10,7 +10,8 @@ SHLIB_MAJOR= 9 SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ hexdump.c humanize_number.c kinfo_getfile.c kinfo_getfile.c \ - kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c kld.c \ + kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c \ + kinfo_getvmobject.c kld.c \ login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ pidfile.c property.c pty.c pw_util.c quotafile.c realhostname.c \ @@ -27,7 +28,8 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../li MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ - kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ + kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ + login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ _secure_path.3 trimdomain.3 uucplock.3 pw_util.3 Copied: stable/10/lib/libutil/kinfo_getvmobject.3 (from r283624, head/lib/libutil/kinfo_getvmobject.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libutil/kinfo_getvmobject.3 Thu Oct 1 17:09:20 2015 (r288453, copy of r283624, head/lib/libutil/kinfo_getvmobject.3) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2015 John Baldwin +.\" 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$ +.\" +.Dd May 27, 2015 +.Dt KINFO_GETVMOBJECT 3 +.Os +.Sh NAME +.Nm kinfo_getvmobject +.Nd function for getting system-wide memory information +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In sys/types.h +.In sys/user.h +.In libutil.h +.Ft struct kinfo_vmobject * +.Fn kinfo_getvmobject "int *cntp" +.Sh DESCRIPTION +This function is used to obtain information about the objects using memory +in the system. +.Pp +The +.Ar cntp +argument allows the caller to know how many records are returned. +.Pp +This function is a wrapper around the +.Dq vm.objects +.Xr sysctl 3 +MIB. +While the kernel returns a packed structure, this function expands the +data into a fixed record format. +.Sh RETURN VALUES +On success the +.Fn kinfo_getvmobject +function returns a pointer to an array of +.Vt struct kinfo_vmobject +structures as defined by +.In sys/user.h . +The array is allocated by an internal call to +.Xr malloc 3 +and must be freed by the caller with a call to +.Xr free 3 . +On failure the +.Fn kinfo_getvmobject +function returns +.Dv NULL . +.Sh SEE ALSO +.Xr free 3 , +.Xr kinfo_getvmmap 3 , +.Xr malloc 3 Copied: stable/10/lib/libutil/kinfo_getvmobject.c (from r283624, head/lib/libutil/kinfo_getvmobject.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libutil/kinfo_getvmobject.c Thu Oct 1 17:09:20 2015 (r288453, copy of r283624, head/lib/libutil/kinfo_getvmobject.c) @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2013 Hudson River Trading LLC + * Written by: John H. Baldwin + * 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 "libutil.h" + +struct kinfo_vmobject * +kinfo_getvmobject(int *cntp) +{ + char *buf, *bp, *ep; + struct kinfo_vmobject *kvo, *list, *kp; + size_t len; + int cnt, i; + + buf = NULL; + for (i = 0; i < 3; i++) { + if (sysctlbyname("vm.objects", NULL, &len, NULL, 0) < 0) + return (NULL); + buf = reallocf(buf, len); + if (buf == NULL) + return (NULL); + if (sysctlbyname("vm.objects", buf, &len, NULL, 0) == 0) + goto unpack; + if (errno != ENOMEM) { + free(buf); + return (NULL); + } + } + free(buf); + return (NULL); + +unpack: + /* Count items */ + cnt = 0; + bp = buf; + ep = buf + len; + while (bp < ep) { + kvo = (struct kinfo_vmobject *)(uintptr_t)bp; + bp += kvo->kvo_structsize; + cnt++; + } + + list = calloc(cnt, sizeof(*list)); + if (list == NULL) { + free(buf); + return (NULL); + } + + /* Unpack */ + bp = buf; + kp = list; + while (bp < ep) { + kvo = (struct kinfo_vmobject *)(uintptr_t)bp; + memcpy(kp, kvo, kvo->kvo_structsize); + bp += kvo->kvo_structsize; + kp->kvo_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (list); +} Modified: stable/10/lib/libutil/libutil.h ============================================================================== --- stable/10/lib/libutil/libutil.h Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/lib/libutil/libutil.h Thu Oct 1 17:09:20 2015 (r288453) @@ -102,6 +102,8 @@ struct kinfo_file * kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * kinfo_getvmmap(pid_t _pid, int *_cntp); +struct kinfo_vmobject * + kinfo_getvmobject(int *_cntp); struct kinfo_proc * kinfo_getallproc(int *_cntp); struct kinfo_proc * Modified: stable/10/sys/sys/user.h ============================================================================== --- stable/10/sys/sys/user.h Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/sys/sys/user.h Thu Oct 1 17:09:20 2015 (r288453) @@ -483,6 +483,27 @@ struct kinfo_vmentry { }; /* + * The "vm.objects" sysctl provides a list of all VM objects in the system + * via an array of these entries. + */ +struct kinfo_vmobject { + int kvo_structsize; /* Variable size of record. */ + int kvo_type; /* Object type: KVME_TYPE_*. */ + uint64_t kvo_size; /* Object size in pages. */ + uint64_t kvo_vn_fileid; /* inode number if vnode. */ + uint32_t kvo_vn_fsid; /* dev_t of vnode location. */ + int kvo_ref_count; /* Reference count. */ + int kvo_shadow_count; /* Shadow count. */ + int kvo_memattr; /* Memory attribute. */ + uint64_t kvo_resident; /* Number of resident pages. */ + uint64_t kvo_active; /* Number of active pages. */ + uint64_t kvo_inactive; /* Number of inactive pages. */ + uint64_t _kvo_qspare[8]; + uint32_t _kvo_ispare[8]; + char kvo_path[PATH_MAX]; /* Pathname, if any. */ +}; + +/* * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of * another process as a series of entries. Each stack is represented by a * series of symbol names and offsets as generated by stack_sbuf_print(9). Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/sys/vm/vm_object.c Thu Oct 1 17:09:20 2015 (r288453) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2269,6 +2270,142 @@ next_page: } } +static int +sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) +{ + struct kinfo_vmobject kvo; + char *fullpath, *freepath; + struct vnode *vp; + struct vattr va; + vm_object_t obj; + vm_page_t m; + int count, error; + + if (req->oldptr == NULL) { + /* + * If an old buffer has not been provided, generate an + * estimate of the space needed for a subsequent call. + */ + mtx_lock(&vm_object_list_mtx); + count = 0; + TAILQ_FOREACH(obj, &vm_object_list, object_list) { + if (obj->type == OBJT_DEAD) + continue; + count++; + } + mtx_unlock(&vm_object_list_mtx); + return (SYSCTL_OUT(req, NULL, sizeof(struct kinfo_vmobject) * + count * 11 / 10)); + } + + error = 0; + + /* + * VM objects are type stable and are never removed from the + * list once added. This allows us to safely read obj->object_list + * after reacquiring the VM object lock. + */ + mtx_lock(&vm_object_list_mtx); + TAILQ_FOREACH(obj, &vm_object_list, object_list) { + if (obj->type == OBJT_DEAD) + continue; + VM_OBJECT_RLOCK(obj); + if (obj->type == OBJT_DEAD) { + VM_OBJECT_RUNLOCK(obj); + continue; + } + mtx_unlock(&vm_object_list_mtx); + kvo.kvo_size = ptoa(obj->size); + kvo.kvo_resident = obj->resident_page_count; + kvo.kvo_ref_count = obj->ref_count; + kvo.kvo_shadow_count = obj->shadow_count; + kvo.kvo_memattr = obj->memattr; + kvo.kvo_active = 0; + kvo.kvo_inactive = 0; + TAILQ_FOREACH(m, &obj->memq, listq) { + /* + * A page may belong to the object but be + * dequeued and set to PQ_NONE while the + * object lock is not held. This makes the + * reads of m->queue below racy, and we do not + * count pages set to PQ_NONE. However, this + * sysctl is only meant to give an + * approximation of the system anyway. + */ + if (m->queue == PQ_ACTIVE) + kvo.kvo_active++; + else if (m->queue == PQ_INACTIVE) + kvo.kvo_inactive++; + } + + kvo.kvo_vn_fileid = 0; + kvo.kvo_vn_fsid = 0; + freepath = NULL; + fullpath = ""; + vp = NULL; + switch (obj->type) { + case OBJT_DEFAULT: + kvo.kvo_type = KVME_TYPE_DEFAULT; + break; + case OBJT_VNODE: + kvo.kvo_type = KVME_TYPE_VNODE; + vp = obj->handle; + vref(vp); + break; + case OBJT_SWAP: + kvo.kvo_type = KVME_TYPE_SWAP; + break; + case OBJT_DEVICE: + kvo.kvo_type = KVME_TYPE_DEVICE; + break; + case OBJT_PHYS: + kvo.kvo_type = KVME_TYPE_PHYS; + break; + case OBJT_DEAD: + kvo.kvo_type = KVME_TYPE_DEAD; + break; + case OBJT_SG: + kvo.kvo_type = KVME_TYPE_SG; + break; + case OBJT_MGTDEVICE: + kvo.kvo_type = KVME_TYPE_MGTDEVICE; + break; + default: + kvo.kvo_type = KVME_TYPE_UNKNOWN; + break; + } + VM_OBJECT_RUNLOCK(obj); + if (vp != NULL) { + vn_fullpath(curthread, vp, &fullpath, &freepath); + vn_lock(vp, LK_SHARED | LK_RETRY); + if (VOP_GETATTR(vp, &va, curthread->td_ucred) == 0) { + kvo.kvo_vn_fileid = va.va_fileid; + kvo.kvo_vn_fsid = va.va_fsid; + } + vput(vp); + } + + strlcpy(kvo.kvo_path, fullpath, sizeof(kvo.kvo_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + + /* Pack record size down */ + kvo.kvo_structsize = offsetof(struct kinfo_vmobject, kvo_path) + + strlen(kvo.kvo_path) + 1; + kvo.kvo_structsize = roundup(kvo.kvo_structsize, + sizeof(uint64_t)); + error = SYSCTL_OUT(req, &kvo, kvo.kvo_structsize); + mtx_lock(&vm_object_list_mtx); + if (error) + break; + } + mtx_unlock(&vm_object_list_mtx); + return (error); +} +SYSCTL_PROC(_vm, OID_AUTO, objects, CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_SKIP | + CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_object_list, "S,kinfo_vmobject", + "List of VM objects"); + #include "opt_ddb.h" #ifdef DDB #include Modified: stable/10/usr.bin/vmstat/vmstat.8 ============================================================================== --- stable/10/usr.bin/vmstat/vmstat.8 Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/usr.bin/vmstat/vmstat.8 Thu Oct 1 17:09:20 2015 (r288453) @@ -37,7 +37,7 @@ .Sh SYNOPSIS .Nm .\" .Op Fl fimst -.Op Fl afHhimPsz +.Op Fl afHhimoPsz .Op Fl M Ar core Op Fl N Ar system .Op Fl c Ar count .Op Fl n Ar devs @@ -119,6 +119,9 @@ Report on the usage of kernel dynamic me by type. .It Fl n Change the maximum number of disks to display from the default of 2. +.It Fl o +Display a list of virtual memory objects in the system and the resident +memory used by each object. .It Fl P Report per-cpu system/user/idle cpu statistics. .It Fl p Modified: stable/10/usr.bin/vmstat/vmstat.c ============================================================================== --- stable/10/usr.bin/vmstat/vmstat.c Thu Oct 1 16:59:07 2015 (r288452) +++ stable/10/usr.bin/vmstat/vmstat.c Thu Oct 1 17:09:20 2015 (r288453) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -143,12 +144,14 @@ static kvm_t *kd; #define TIMESTAT 0x10 #define VMSTAT 0x20 #define ZMEMSTAT 0x40 +#define OBJSTAT 0x80 static void cpustats(void); static void pcpustats(int, u_long, int); static void devstats(void); static void doforkst(void); static void dointr(void); +static void doobjstat(void); static void dosum(void); static void dovmstat(unsigned int, int); static void domemstat_malloc(void); @@ -181,7 +184,7 @@ main(int argc, char *argv[]) interval = reps = todo = 0; maxshowdevs = 2; hflag = isatty(1); - while ((c = getopt(argc, argv, "ac:fhHiM:mN:n:Pp:stw:z")) != -1) { + while ((c = getopt(argc, argv, "ac:fhHiM:mN:n:oPp:stw:z")) != -1) { switch (c) { case 'a': aflag++; @@ -220,6 +223,9 @@ main(int argc, char *argv[]) errx(1, "number of devices %d is < 0", maxshowdevs); break; + case 'o': + todo |= OBJSTAT; + break; case 'p': if (devstat_buildmatch(optarg, &matches, &num_matches) != 0) errx(1, "%s", devstat_errbuf); @@ -310,6 +316,8 @@ main(int argc, char *argv[]) domemstat_zone(); if (todo & SUMSTAT) dosum(); + if (todo & OBJSTAT) + doobjstat(); #ifdef notyet if (todo & TIMESTAT) dotimes(); @@ -1299,6 +1307,129 @@ domemstat_zone(void) printf("\n"); } +static void +display_object(struct kinfo_vmobject *kvo) +{ + const char *str; + + printf("%5jd ", (uintmax_t)kvo->kvo_resident); + printf("%5jd ", (uintmax_t)kvo->kvo_active); + printf("%5jd ", (uintmax_t)kvo->kvo_inactive); + printf("%3d ", kvo->kvo_ref_count); + printf("%3d ", kvo->kvo_shadow_count); + switch (kvo->kvo_memattr) { +#ifdef VM_MEMATTR_UNCACHEABLE + case VM_MEMATTR_UNCACHEABLE: + str = "UC"; + break; +#endif +#ifdef VM_MEMATTR_WRITE_COMBINING + case VM_MEMATTR_WRITE_COMBINING: + str = "WC"; + break; +#endif +#ifdef VM_MEMATTR_WRITE_THROUGH + case VM_MEMATTR_WRITE_THROUGH: + str = "WT"; + break; +#endif +#ifdef VM_MEMATTR_WRITE_PROTECTED + case VM_MEMATTR_WRITE_PROTECTED: + str = "WP"; + break; +#endif +#ifdef VM_MEMATTR_WRITE_BACK + case VM_MEMATTR_WRITE_BACK: + str = "WB"; + break; +#endif +#ifdef VM_MEMATTR_WEAK_UNCACHEABLE + case VM_MEMATTR_WEAK_UNCACHEABLE: + str = "UC-"; + break; +#endif +#ifdef VM_MEMATTR_WB_WA + case VM_MEMATTR_WB_WA: + str = "WB"; + break; +#endif +#ifdef VM_MEMATTR_NOCACHE + case VM_MEMATTR_NOCACHE: + str = "NC"; + break; +#endif +#ifdef VM_MEMATTR_DEVICE + case VM_MEMATTR_DEVICE: + str = "DEV"; + break; +#endif +#ifdef VM_MEMATTR_CACHEABLE + case VM_MEMATTR_CACHEABLE: + str = "C"; + break; +#endif +#ifdef VM_MEMATTR_PREFETCHABLE + case VM_MEMATTR_PREFETCHABLE: + str = "PRE"; + break; +#endif + default: + str = "??"; + break; + } + printf("%-3s ", str); + switch (kvo->kvo_type) { + case KVME_TYPE_NONE: + str = "--"; + break; + case KVME_TYPE_DEFAULT: + str = "df"; + break; + case KVME_TYPE_VNODE: + str = "vn"; + break; + case KVME_TYPE_SWAP: + str = "sw"; + break; + case KVME_TYPE_DEVICE: + str = "dv"; + break; + case KVME_TYPE_PHYS: + str = "ph"; + break; + case KVME_TYPE_DEAD: + str = "dd"; + break; + case KVME_TYPE_SG: + str = "sg"; + break; + case KVME_TYPE_UNKNOWN: + default: + str = "??"; + break; + } + printf("%-2s ", str); + printf("%-s\n", kvo->kvo_path); +} + +static void +doobjstat(void) +{ + struct kinfo_vmobject *kvo; + int cnt, i; + + kvo = kinfo_getvmobject(&cnt); + if (kvo == NULL) { + warn("Failed to fetch VM object list"); + return; + } + printf("%5s %5s %5s %3s %3s %3s %2s %s\n", "RES", "ACT", "INACT", + "REF", "SHD", "CM", "TP", "PATH"); + for (i = 0; i < cnt; i++) + display_object(&kvo[i]); + free(kvo); +} + /* * kread reads something from the kernel, given its nlist index. */ @@ -1351,7 +1482,7 @@ static void usage(void) { (void)fprintf(stderr, "%s%s", - "usage: vmstat [-afHhimPsz] [-M core [-N system]] [-c count] [-n devs]\n", + "usage: vmstat [-afHhimoPsz] [-M core [-N system]] [-c count] [-n devs]\n", " [-p type,if,pass] [-w wait] [disks] [wait [count]]\n"); exit(1); } From owner-svn-src-all@freebsd.org Thu Oct 1 17:28:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04D53A0CE38; Thu, 1 Oct 2015 17:28:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7EAB17B8; Thu, 1 Oct 2015 17:28:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91HS7Zr006634; Thu, 1 Oct 2015 17:28:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91HS7fo006633; Thu, 1 Oct 2015 17:28:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011728.t91HS7fo006633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 17:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288454 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 17:28:08 -0000 Author: jhb Date: Thu Oct 1 17:28:07 2015 New Revision: 288454 URL: https://svnweb.freebsd.org/changeset/base/288454 Log: - Remove extra integer argument from truncate() and ftruncate(). This is probably fallout from the removal of the extra padding argument before off_t in 7. However, that padding still exists for 32-bit powerpc, so use QUAD_ALIGN. - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 for 32-bit platforms that add padding to align 64-bit arguments. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:09:20 2015 (r288453) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 17:28:07 2015 (r288454) @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); #include "syscall.h" /* 64-bit alignment on 32-bit platforms. */ -#ifdef __powerpc__ +#if !defined(__LP64__) && defined(__powerpc__) #define QUAD_ALIGN 1 #else #define QUAD_ALIGN 0 @@ -320,10 +320,10 @@ static struct syscall syscalls[] = { .args = { { PipeFds | OUT, 0 } } }, { .name = "pipe2", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Open, 1 } } }, - { .name = "truncate", .ret_type = 1, .nargs = 3, - .args = { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, - { .name = "ftruncate", .ret_type = 1, .nargs = 3, - .args = { { Int | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, + { .name = "truncate", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + { .name = "ftruncate", .ret_type = 1, .nargs = 2, + .args = { { Int | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, { .name = "kill", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, { .name = "munmap", .ret_type = 1, .nargs = 2, From owner-svn-src-all@freebsd.org Thu Oct 1 17:50:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FE55A0DD6A; Thu, 1 Oct 2015 17:50:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 326B015D9; Thu, 1 Oct 2015 17:50:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91HogFD017540; Thu, 1 Oct 2015 17:50:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Hofi5017528; Thu, 1 Oct 2015 17:50:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011750.t91Hofi5017528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 17:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288455 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 17:50:42 -0000 Author: jhb Date: Thu Oct 1 17:50:41 2015 New Revision: 288455 URL: https://svnweb.freebsd.org/changeset/base/288455 Log: The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bit integer. Fix the argument decoding to treat this as a quad instead of an int. This includes using QUAD_ALIGN and QUAD_SLOTS as necessary. To continue printing IDs in decimal, add a new QuadHex argument type that prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments, repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t arguments. This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms. Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Thu Oct 1 17:28:07 2015 (r288454) +++ head/usr.bin/truss/syscall.h Thu Oct 1 17:50:41 2015 (r288455) @@ -42,7 +42,7 @@ enum Argtype { None = 1, Hex, Octal, Int Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, - Sysarch, ExecArgs, ExecEnv, PipeFds }; + Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex }; #define ARG_MASK 0xff #define OUT 0x100 Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:28:07 2015 (r288454) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 17:50:41 2015 (r288455) @@ -106,13 +106,13 @@ static struct syscall syscalls[] = { .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 }, { Int, 3 } } }, { .name = "lseek", .ret_type = 2, .nargs = 3, - .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, + .args = { { Int, 0 }, { QuadHex, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } }, { .name = "linux_lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, { .name = "mmap", .ret_type = 1, .nargs = 6, .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, - { Int, 4 }, { Quad, 5 + QUAD_ALIGN } } }, + { Int, 4 }, { QuadHex, 5 + QUAD_ALIGN } } }, { .name = "linux_mkdir", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Int, 1 } } }, { .name = "mprotect", .ret_type = 1, .nargs = 3, @@ -321,9 +321,9 @@ static struct syscall syscalls[] = { { .name = "pipe2", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Open, 1 } } }, { .name = "truncate", .ret_type = 1, .nargs = 2, - .args = { { Name | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + .args = { { Name | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, { .name = "ftruncate", .ret_type = 1, .nargs = 2, - .args = { { Int | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + .args = { { Int | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, { .name = "kill", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, { .name = "munmap", .ret_type = 1, .nargs = 2, @@ -344,10 +344,15 @@ static struct syscall syscalls[] = { .args = { { Int, 0 }, { ExitStatus | OUT, 1 }, { Waitoptions, 2 }, { Rusage | OUT, 3 } } }, { .name = "wait6", .ret_type = 1, .nargs = 6, - .args = { { Idtype, 0 }, { Int, 1 }, { ExitStatus | OUT, 2 }, - { Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } }, + .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, + { ExitStatus | OUT, 1 + QUAD_ALIGN + QUAD_SLOTS }, + { Waitoptions, 2 + QUAD_ALIGN + QUAD_SLOTS }, + { Rusage | OUT, 3 + QUAD_ALIGN + QUAD_SLOTS }, + { Ptr, 4 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, - .args = { { Idtype, 0 }, { Int, 1 }, { Procctl, 2 }, { Ptr, 3 } } }, + .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, + { Procctl, 1 + QUAD_ALIGN + QUAD_SLOTS }, + { Ptr, 2 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "sysarch", .ret_type = 1, .nargs = 2, .args = { { Sysarch, 0 }, { Ptr, 1 } } }, { .name = "_umtx_op", .ret_type = 1, .nargs = 5, @@ -966,10 +971,14 @@ print_arg(struct syscall_args *sc, unsig } #ifdef __LP64__ case Quad: + fprintf(fp, "%ld", args[sc->offset]); + break; + case QuadHex: fprintf(fp, "0x%lx", args[sc->offset]); break; #else - case Quad: { + case Quad: + case QuadHex: { unsigned long long ll; #if _BYTE_ORDER == _LITTLE_ENDIAN @@ -979,7 +988,10 @@ print_arg(struct syscall_args *sc, unsig ll = (unsigned long long)args[sc->offset] << 32 | args[sc->offset + 1]; #endif - fprintf(fp, "0x%llx", ll); + if ((sc->type & ARG_MASK) == Quad) + fprintf(fp, "%lld", ll); + else + fprintf(fp, "0x%llx", ll); break; } #endif From owner-svn-src-all@freebsd.org Thu Oct 1 18:18:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47F98A0C3B3; Thu, 1 Oct 2015 18:18:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3334C1583; Thu, 1 Oct 2015 18:18:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91IIx75027339; Thu, 1 Oct 2015 18:18:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91IIxZO027338; Thu, 1 Oct 2015 18:18:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011818.t91IIxZO027338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 18:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288456 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 18:18:59 -0000 Author: jhb Date: Thu Oct 1 18:18:58 2015 New Revision: 288456 URL: https://svnweb.freebsd.org/changeset/base/288456 Log: Rather than groveling around in a socket address structure for a socket address's length (and then overriding it if it "looks wrong"), use the next argument to the system call to determine the length. This is more reliable since this is what the kernel depends on anyway and is also simpler. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:50:41 2015 (r288455) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 18:18:58 2015 (r288456) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1288,12 +1289,12 @@ print_arg(struct syscall_args *sc, unsig fputs(xlookup_bits(rfork_flags, args[sc->offset]), fp); break; case Sockaddr: { - struct sockaddr_storage ss; char addr[64]; struct sockaddr_in *lsin; struct sockaddr_in6 *lsin6; struct sockaddr_un *sun; struct sockaddr *sa; + socklen_t len; u_char *q; if (args[sc->offset] == 0) { @@ -1301,70 +1302,71 @@ print_arg(struct syscall_args *sc, unsig break; } - /* yuck: get ss_len */ - if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, - sizeof(ss.ss_len) + sizeof(ss.ss_family)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); - break; - } - /* - * If ss_len is 0, then try to guess from the sockaddr type. - * AF_UNIX may be initialized incorrectly, so always frob - * it by using the "right" size. + * Extract the address length from the next argument. If + * this is an output sockaddr (OUT is set), then the + * next argument is a pointer to a socklen_t. Otherwise + * the next argument contains a socklen_t by value. */ - if (ss.ss_len == 0 || ss.ss_family == AF_UNIX) { - switch (ss.ss_family) { - case AF_INET: - ss.ss_len = sizeof(*lsin); - break; - case AF_INET6: - ss.ss_len = sizeof(*lsin6); - break; - case AF_UNIX: - ss.ss_len = sizeof(*sun); - break; - default: + if (sc->type & OUT) { + if (get_struct(pid, (void *)args[sc->offset + 1], + &len, sizeof(len)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); break; } + } else + len = args[sc->offset + 1]; + + /* If the length is too small, just bail. */ + if (len < sizeof(*sa)) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; } - if (ss.ss_len != 0 && - get_struct(pid, (void *)args[sc->offset], (void *)&ss, - ss.ss_len) == -1) { + + sa = calloc(1, len); + if (get_struct(pid, (void *)args[sc->offset], sa, len) == -1) { + free(sa); fprintf(fp, "0x%lx", args[sc->offset]); break; } - switch (ss.ss_family) { + switch (sa->sa_family) { case AF_INET: - lsin = (struct sockaddr_in *)&ss; + if (len < sizeof(*lsin)) + goto sockaddr_short; + lsin = (struct sockaddr_in *)(void *)sa; inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET %s:%d }", addr, htons(lsin->sin_port)); break; case AF_INET6: - lsin6 = (struct sockaddr_in6 *)&ss; + if (len < sizeof(*lsin6)) + goto sockaddr_short; + lsin6 = (struct sockaddr_in6 *)(void *)sa; inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET6 [%s]:%d }", addr, htons(lsin6->sin6_port)); break; case AF_UNIX: - sun = (struct sockaddr_un *)&ss; - fprintf(fp, "{ AF_UNIX \"%s\" }", sun->sun_path); + sun = (struct sockaddr_un *)sa; + fprintf(fp, "{ AF_UNIX \"%.*s\" }", + (int)(len - offsetof(struct sockaddr_un, sun_path)), + sun->sun_path); break; default: - sa = (struct sockaddr *)&ss; + sockaddr_short: fprintf(fp, "{ sa_len = %d, sa_family = %d, sa_data = {", (int)sa->sa_len, (int)sa->sa_family); for (q = (u_char *)sa->sa_data; - q < (u_char *)sa + sa->sa_len; q++) + q < (u_char *)sa + len; q++) fprintf(fp, "%s 0x%02x", q == (u_char *)sa->sa_data ? "" : ",", *q); fputs(" } }", fp); } + free(sa); break; } case Sigaction: { From owner-svn-src-all@freebsd.org Thu Oct 1 19:07:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05063A0DC14; Thu, 1 Oct 2015 19:07:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EACCF1596; Thu, 1 Oct 2015 19:07:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91J7FAE047803; Thu, 1 Oct 2015 19:07:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91J7Fjt047802; Thu, 1 Oct 2015 19:07:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011907.t91J7Fjt047802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 19:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288458 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 19:07:16 -0000 Author: mav Date: Thu Oct 1 19:07:15 2015 New Revision: 288458 URL: https://svnweb.freebsd.org/changeset/base/288458 Log: More aggressively fill WUT read pipeline. On some tests I've measured 5% copy speedup from this. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 19:02:45 2015 (r288457) +++ head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 19:07:15 2015 (r288458) @@ -1128,7 +1128,7 @@ static int tpc_process_wut(struct tpc_list *list) { struct tpc_io *tio, *tior, *tiow; - struct runl run, *prun; + struct runl run; int drange, srange; off_t doffset, soffset; off_t srclba, dstlba, numbytes, donebytes, roundbytes; @@ -1208,8 +1208,7 @@ tpc_process_wut(struct tpc_list *list) // srclba, dstlba); donebytes = 0; TAILQ_INIT(&run); - prun = &run; - list->tbdio = 1; + list->tbdio = 0; TAILQ_INIT(&list->allio); while (donebytes < numbytes) { roundbytes = numbytes - donebytes; @@ -1262,8 +1261,8 @@ tpc_process_wut(struct tpc_list *list) tiow->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tiow; TAILQ_INSERT_TAIL(&tior->run, tiow, rlinks); - TAILQ_INSERT_TAIL(prun, tior, rlinks); - prun = &tior->run; + TAILQ_INSERT_TAIL(&run, tior, rlinks); + list->tbdio++; donebytes += roundbytes; srclba += roundbytes / srcblock; dstlba += roundbytes / dstblock; From owner-svn-src-all@freebsd.org Thu Oct 1 19:48:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0B43A0D030; Thu, 1 Oct 2015 19:48:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5AD41300; Thu, 1 Oct 2015 19:48:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91JmBZR064804; Thu, 1 Oct 2015 19:48:11 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91JmBmq064801; Thu, 1 Oct 2015 19:48:11 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510011948.t91JmBmq064801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 19:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288459 - head/release/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 19:48:12 -0000 Author: gjb Date: Thu Oct 1 19:48:10 2015 New Revision: 288459 URL: https://svnweb.freebsd.org/changeset/base/288459 Log: Fix the path to the correct u-boot.bin file to write to the disk image, which fixes boot issues. Tested on: BananaPi Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/BANANAPI.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -22,10 +22,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -21,10 +21,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -22,10 +22,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} From owner-svn-src-all@freebsd.org Thu Oct 1 19:51:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C279A0D23F; Thu, 1 Oct 2015 19:51:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AC601768; Thu, 1 Oct 2015 19:51:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DC3E7B918; Thu, 1 Oct 2015 15:51:21 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288454 - head/usr.bin/truss Date: Thu, 01 Oct 2015 11:22:48 -0700 Message-ID: <5360523.S6ag5ugNqo@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201510011728.t91HS7fo006633@repo.freebsd.org> References: <201510011728.t91HS7fo006633@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 15:51:22 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 19:51:23 -0000 On Thursday, October 01, 2015 05:28:07 PM John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 17:28:07 2015 > New Revision: 288454 > URL: https://svnweb.freebsd.org/changeset/base/288454 > > Log: > - Remove extra integer argument from truncate() and ftruncate(). This is > probably fallout from the removal of the extra padding argument before > off_t in 7. However, that padding still exists for 32-bit powerpc, so > use QUAD_ALIGN. > - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 > for 32-bit platforms that add padding to align 64-bit arguments. I'm not sure how the situation is on arm and MIPS, but on powerpc, both the 32-bit and 64-bit platforms define __powerpc__ (unlike amd64 which doesn't define __i386__ for example) making proper #ifdef's for just 32-bit __powerpc__ a bit of a PITA. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Oct 1 20:06:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4315AA0DF4B; Thu, 1 Oct 2015 20:06:07 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F1181121; Thu, 1 Oct 2015 20:06:07 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by igxx6 with SMTP id x6so2888304igx.1; Thu, 01 Oct 2015 13:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7UZMvBd0zj3yPoIwvsLfN5i4MGWkYH+ufJOJTfCqW0I=; b=tP+GfeBgk51P3t4vWq0yq/yj0fxkznTa1jy2Dyr2JDxubr2kdgGzEC0pZKAlah5Iip I3nfAFEtCoT7y0rtPfd0kLYsBekOFbhGkA+njKowMXqvvsQ9AwKuX5selsEglX9e3AKM eq2AQ7PBuaWB6uWu7X6xCWfuFfcns4OWK67c0yfg0mXIY7K+RqCOeCW8MjWuH7JnjLwy SZTYXN8KP/9/joIWVZQLymCVin8pDI6aGy0KaF8plTcMBb5yCH70zcdKcDE/Hvjrb/rJ WaRIhbdehlz/QfqSFg1div09BQ6BVsiX2VRVoNRupw0wiQxJ1Zg2EWoiUfKQQJX6J5NA MNyw== MIME-Version: 1.0 X-Received: by 10.50.78.40 with SMTP id y8mr852559igw.8.1443729966478; Thu, 01 Oct 2015 13:06:06 -0700 (PDT) Received: by 10.36.41.138 with HTTP; Thu, 1 Oct 2015 13:06:06 -0700 (PDT) Received: by 10.36.41.138 with HTTP; Thu, 1 Oct 2015 13:06:06 -0700 (PDT) In-Reply-To: <5360523.S6ag5ugNqo@ralph.baldwin.cx> References: <201510011728.t91HS7fo006633@repo.freebsd.org> <5360523.S6ag5ugNqo@ralph.baldwin.cx> Date: Thu, 1 Oct 2015 15:06:06 -0500 Message-ID: Subject: Re: svn commit: r288454 - head/usr.bin/truss From: Justin Hibbits To: John Baldwin Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 20:06:07 -0000 powerpc64 also defines __powerpc64__ in addition to __powerpc__. This is likely because unlike amd64, the only major difference between 32-bit and 64-bit is the register size, so mips will likely be the same way. -Justin On Oct 1, 2015 2:51 PM, "John Baldwin" wrote: > On Thursday, October 01, 2015 05:28:07 PM John Baldwin wrote: > > Author: jhb > > Date: Thu Oct 1 17:28:07 2015 > > New Revision: 288454 > > URL: https://svnweb.freebsd.org/changeset/base/288454 > > > > Log: > > - Remove extra integer argument from truncate() and ftruncate(). This > is > > probably fallout from the removal of the extra padding argument > before > > off_t in 7. However, that padding still exists for 32-bit powerpc, > so > > use QUAD_ALIGN. > > - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 > > for 32-bit platforms that add padding to align 64-bit arguments. > > I'm not sure how the situation is on arm and MIPS, but on powerpc, both the > 32-bit and 64-bit platforms define __powerpc__ (unlike amd64 which doesn't > define __i386__ for example) making proper #ifdef's for just 32-bit > __powerpc__ a bit of a PITA. > > -- > John Baldwin > > From owner-svn-src-all@freebsd.org Thu Oct 1 20:49:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FA9A0C937; Thu, 1 Oct 2015 20:49:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31A8618CE; Thu, 1 Oct 2015 20:49:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91KnBKD089766; Thu, 1 Oct 2015 20:49:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91KnBcg089765; Thu, 1 Oct 2015 20:49:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012049.t91KnBcg089765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 20:49: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: r288460 - in stable: 10/sys/dev/hwpmc 9/sys/dev/hwpmc 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 20:49:11 -0000 Author: jhb Date: Thu Oct 1 20:49:10 2015 New Revision: 288460 URL: https://svnweb.freebsd.org/changeset/base/288460 Log: MFC 283121: Use the proper mask when reloading sampling PMCs for Core CPUs. Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/10/sys/dev/hwpmc/hwpmc_core.c Thu Oct 1 19:48:10 2015 (r288459) +++ stable/10/sys/dev/hwpmc/hwpmc_core.c Thu Oct 1 20:49:10 2015 (r288460) @@ -2572,7 +2572,7 @@ core_intr(int cpu, struct trapframe *tf) TRAPF_USERMODE(tf)); v = pm->pm_sc.pm_reloadcount; - v = iaf_reload_count_to_perfctr_value(v); + v = iap_reload_count_to_perfctr_value(v); /* * Stop the counter, reload it but only restart it if From owner-svn-src-all@freebsd.org Thu Oct 1 20:49:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7C77A0C93E; Thu, 1 Oct 2015 20:49:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8AC518CF; Thu, 1 Oct 2015 20:49:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91KnBEu089772; Thu, 1 Oct 2015 20:49:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91KnBSJ089771; Thu, 1 Oct 2015 20:49:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012049.t91KnBSJ089771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 20:49:11 +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: r288460 - in stable: 10/sys/dev/hwpmc 9/sys/dev/hwpmc 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 20:49:11 -0000 Author: jhb Date: Thu Oct 1 20:49:10 2015 New Revision: 288460 URL: https://svnweb.freebsd.org/changeset/base/288460 Log: MFC 283121: Use the proper mask when reloading sampling PMCs for Core CPUs. Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/10/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_core.c Thu Oct 1 19:48:10 2015 (r288459) +++ stable/9/sys/dev/hwpmc/hwpmc_core.c Thu Oct 1 20:49:10 2015 (r288460) @@ -2458,7 +2458,7 @@ core_intr(int cpu, struct trapframe *tf) TRAPF_USERMODE(tf)); v = pm->pm_sc.pm_reloadcount; - v = iaf_reload_count_to_perfctr_value(v); + v = iap_reload_count_to_perfctr_value(v); /* * Stop the counter, reload it but only restart it if From owner-svn-src-all@freebsd.org Thu Oct 1 20:54:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74EBCA0CE9F; Thu, 1 Oct 2015 20:54:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 596EE1E9A; Thu, 1 Oct 2015 20:54:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91KsKkf093633; Thu, 1 Oct 2015 20:54:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91KsKtk093632; Thu, 1 Oct 2015 20:54:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012054.t91KsKtk093632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 20:54:20 +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: r288461 - stable/10/sys/x86/acpica 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 20:54:20 -0000 Author: jhb Date: Thu Oct 1 20:54:19 2015 New Revision: 288461 URL: https://svnweb.freebsd.org/changeset/base/288461 Log: MFC 284175: Handle X2APIC entries in the MADT for APICs with an ID < 255. At least one BIOS has been seen to include such entries even though the relevant specs require that X2APIC entries only be used for CPUs with an APIC ID >= 255. This was tested on a system with "plain" local APIC entries in the MADT to ensure no regressions, but it has not yet been tested on a system with X2APIC entries in the MADT. Currently such systems do not boot at all, and with this change they might now boot correctly. Modified: stable/10/sys/x86/acpica/madt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/acpica/madt.c ============================================================================== --- stable/10/sys/x86/acpica/madt.c Thu Oct 1 20:49:10 2015 (r288460) +++ stable/10/sys/x86/acpica/madt.c Thu Oct 1 20:54:19 2015 (r288461) @@ -53,8 +53,8 @@ static struct { } *ioapics; static struct lapic_info { - u_int la_enabled:1; - u_int la_acpi_id:8; + u_int la_enabled; + u_int la_acpi_id; } lapics[MAX_APIC_ID + 1]; static int madt_found_sci_override; @@ -220,34 +220,48 @@ madt_walk_table(acpi_subtable_handler *h } static void +madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags) +{ + struct lapic_info *la; + + /* + * The MADT does not include a BSP flag, so we have to let the + * MP code figure out which CPU is the BSP on its own. + */ + if (bootverbose) + printf("MADT: Found CPU APIC ID %u ACPI ID %u: %s\n", + apic_id, acpi_id, flags & ACPI_MADT_ENABLED ? + "enabled" : "disabled"); + if (!(flags & ACPI_MADT_ENABLED)) + return; + if (apic_id > MAX_APIC_ID) { + printf("MADT: Ignoring local APIC ID %u (too high)\n", + apic_id); + return; + } + + la = &lapics[apic_id]; + KASSERT(la->la_enabled == 0, ("Duplicate local APIC ID %u", apic_id)); + la->la_enabled = 1; + la->la_acpi_id = acpi_id; + lapic_create(apic_id, 0); +} + +static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_MADT_LOCAL_APIC *proc; - struct lapic_info *la; + ACPI_MADT_LOCAL_X2APIC *x2apic; switch (entry->Type) { case ACPI_MADT_TYPE_LOCAL_APIC: - /* - * The MADT does not include a BSP flag, so we have to - * let the MP code figure out which CPU is the BSP on - * its own. - */ proc = (ACPI_MADT_LOCAL_APIC *)entry; - if (bootverbose) - printf("MADT: Found CPU APIC ID %u ACPI ID %u: %s\n", - proc->Id, proc->ProcessorId, - (proc->LapicFlags & ACPI_MADT_ENABLED) ? - "enabled" : "disabled"); - if (!(proc->LapicFlags & ACPI_MADT_ENABLED)) - break; - if (proc->Id > MAX_APIC_ID) - panic("%s: CPU ID %u too high", __func__, proc->Id); - la = &lapics[proc->Id]; - KASSERT(la->la_enabled == 0, - ("Duplicate local APIC ID %u", proc->Id)); - la->la_enabled = 1; - la->la_acpi_id = proc->ProcessorId; - lapic_create(proc->Id, 0); + madt_add_cpu(proc->ProcessorId, proc->Id, proc->LapicFlags); + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + x2apic = (ACPI_MADT_LOCAL_X2APIC *)entry; + madt_add_cpu(x2apic->Uid, x2apic->LocalApicId, + x2apic->LapicFlags); break; } } @@ -503,29 +517,44 @@ madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi * Parse an entry for an NMI routed to a local APIC LVT pin. */ static void -madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi) +madt_handle_local_nmi(u_int acpi_id, UINT8 Lint, UINT16 IntiFlags) { u_int apic_id, pin; - if (nmi->ProcessorId == 0xff) + if (acpi_id == 0xffffffff) apic_id = APIC_ID_ALL; - else if (madt_find_cpu(nmi->ProcessorId, &apic_id) != 0) { + else if (madt_find_cpu(acpi_id, &apic_id) != 0) { if (bootverbose) printf("MADT: Ignoring local NMI routed to " - "ACPI CPU %u\n", nmi->ProcessorId); + "ACPI CPU %u\n", acpi_id); return; } - if (nmi->Lint == 0) + if (Lint == 0) pin = APIC_LVT_LINT0; else pin = APIC_LVT_LINT1; lapic_set_lvt_mode(apic_id, pin, APIC_LVT_DM_NMI); - if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) + if (!(IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) lapic_set_lvt_triggermode(apic_id, pin, - interrupt_trigger(nmi->IntiFlags, 0)); - if (!(nmi->IntiFlags & ACPI_MADT_POLARITY_CONFORMS)) + interrupt_trigger(IntiFlags, 0)); + if (!(IntiFlags & ACPI_MADT_POLARITY_CONFORMS)) lapic_set_lvt_polarity(apic_id, pin, - interrupt_polarity(nmi->IntiFlags, 0)); + interrupt_polarity(IntiFlags, 0)); +} + +static void +madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi) +{ + + madt_handle_local_nmi(nmi->ProcessorId == 0xff ? 0xffffffff : + nmi->ProcessorId, nmi->Lint, nmi->IntiFlags); +} + +static void +madt_parse_local_x2apic_nmi(ACPI_MADT_LOCAL_X2APIC_NMI *nmi) +{ + + madt_handle_local_nmi(nmi->Uid, nmi->Lint, nmi->IntiFlags); } /* @@ -546,6 +575,10 @@ madt_parse_ints(ACPI_SUBTABLE_HEADER *en case ACPI_MADT_TYPE_LOCAL_APIC_NMI: madt_parse_local_nmi((ACPI_MADT_LOCAL_APIC_NMI *)entry); break; + case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: + madt_parse_local_x2apic_nmi( + (ACPI_MADT_LOCAL_X2APIC_NMI *)entry); + break; } } From owner-svn-src-all@freebsd.org Thu Oct 1 21:28:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E53B3A0E863; Thu, 1 Oct 2015 21:28:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1E84105D; Thu, 1 Oct 2015 21:28:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9C7DDB913; Thu, 1 Oct 2015 17:28:57 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r288453 - in stable/10: lib/libutil sys/sys sys/vm usr.bin/vmstat Date: Thu, 01 Oct 2015 14:28:49 -0700 Message-ID: <2096646.C1FjOzzH6L@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201510011709.t91H9Lbs098447@repo.freebsd.org> References: <201510011709.t91H9Lbs098447@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 17:28:57 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:29:00 -0000 On Thursday, October 01, 2015 05:09:21 PM John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 17:09:20 2015 > New Revision: 288453 > URL: https://svnweb.freebsd.org/changeset/base/288453 > > Log: > MFC 283624,283630: > Export a list of VM objects in the system via a sysctl. The list can be > examined via 'vmstat -o'. It can be used to determine which files are > using physical pages of memory and how much each is using. Note that userland sysctls in stable/10 are single-threaded. Thus, other programs that use sysctls will hang while this new sysctl runs. Resolving the pathnames of mapped files can take a while, especially if any NFS files are mapped (on the order of seconds). Programs like top(1), ps(1), fstat(1), vmstat(1), etc. all use sysctls to fetch information, so they will all hang while 'vmstat -o' runs. This does not mean the entire machine has locked up, but it can feel like it. User beware, etc. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Oct 1 21:52:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18452A0DBA4; Thu, 1 Oct 2015 21:52:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03ECE11FA; Thu, 1 Oct 2015 21:52:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LqQB1018711; Thu, 1 Oct 2015 21:52:26 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91LqQbY018709; Thu, 1 Oct 2015 21:52:26 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510012152.t91LqQbY018709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 1 Oct 2015 21:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288462 - in head/targets/pseudo: bootstrap-tools stage 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:52:27 -0000 Author: bdrewery Date: Thu Oct 1 21:52:25 2015 New Revision: 288462 URL: https://svnweb.freebsd.org/changeset/base/288462 Log: Don't create cookie until the command is all finished, it or the commands after may fail. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/bootstrap-tools/Makefile head/targets/pseudo/stage/Makefile Modified: head/targets/pseudo/bootstrap-tools/Makefile ============================================================================== --- head/targets/pseudo/bootstrap-tools/Makefile Thu Oct 1 20:54:19 2015 (r288461) +++ head/targets/pseudo/bootstrap-tools/Makefile Thu Oct 1 21:52:25 2015 (r288462) @@ -43,8 +43,10 @@ BSARGS= DESTDIR= \ legacy: .MAKE .META mkdir -p ${LEGACY_TOOLS} - ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} > $@2 - ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} > $@ + ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} \ + > $@.distrib-dirs_btoolsdir + ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} \ + > $@.distrib-dirs_legacy_tools ${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@ touch $@ Modified: head/targets/pseudo/stage/Makefile ============================================================================== --- head/targets/pseudo/stage/Makefile Thu Oct 1 20:54:19 2015 (r288461) +++ head/targets/pseudo/stage/Makefile Thu Oct 1 21:52:25 2015 (r288462) @@ -8,7 +8,9 @@ all: # we don't need to see it. stage-distrib-dirs: .META mkdir -p ${STAGE_OBJTOP} - ${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS DESTDIR=${STAGE_OBJTOP} > $@ + ${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS \ + DESTDIR=${STAGE_OBJTOP} > $@.distrib_dirs + touch $@ .include From owner-svn-src-all@freebsd.org Thu Oct 1 21:54:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EBCDA0DCEE; Thu, 1 Oct 2015 21:54:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAC3D13AA; Thu, 1 Oct 2015 21:54:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LsiEG018839; Thu, 1 Oct 2015 21:54:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Lsise018837; Thu, 1 Oct 2015 21:54:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012154.t91Lsise018837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 21:54:44 +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: r288463 - in stable: 10/sys/kern 9/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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:54:45 -0000 Author: jhb Date: Thu Oct 1 21:54:43 2015 New Revision: 288463 URL: https://svnweb.freebsd.org/changeset/base/288463 Log: MFC 286256: kgdb uses td_oncpu to determine if a thread is running and should use a pcb from stoppcbs[] rather than the thread's PCB. However, exited threads retained td_oncpu from the last time they ran, and newborn threads had their CPU fields cleared to zero during fork and thread creation since they are in the set of fields zeroed when threads are setup. To fix, explicitly update the CPU fields for exiting threads in sched_throw() to reflect the switch out and reset the CPU fields for new threads in sched_fork_thread() to NOCPU. Modified: stable/10/sys/kern/sched_4bsd.c stable/10/sys/kern/sched_ule.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/kern/sched_4bsd.c stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/10/sys/kern/sched_4bsd.c ============================================================================== --- stable/10/sys/kern/sched_4bsd.c Thu Oct 1 21:52:25 2015 (r288462) +++ stable/10/sys/kern/sched_4bsd.c Thu Oct 1 21:54:43 2015 (r288463) @@ -793,6 +793,8 @@ sched_fork_thread(struct thread *td, str { struct td_sched *ts; + childtd->td_oncpu = NOCPU; + childtd->td_lastcpu = NOCPU; childtd->td_estcpu = td->td_estcpu; childtd->td_lock = &sched_lock; childtd->td_cpuset = cpuset_ref(td->td_cpuset); @@ -1672,6 +1674,8 @@ sched_throw(struct thread *td) } else { lock_profile_release_lock(&sched_lock.lock_object); MPASS(td->td_lock == &sched_lock); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; } mtx_assert(&sched_lock, MA_OWNED); KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); Modified: stable/10/sys/kern/sched_ule.c ============================================================================== --- stable/10/sys/kern/sched_ule.c Thu Oct 1 21:52:25 2015 (r288462) +++ stable/10/sys/kern/sched_ule.c Thu Oct 1 21:54:43 2015 (r288463) @@ -2071,6 +2071,8 @@ sched_fork_thread(struct thread *td, str */ ts = td->td_sched; ts2 = child->td_sched; + child->td_oncpu = NOCPU; + child->td_lastcpu = NOCPU; child->td_lock = TDQ_LOCKPTR(tdq); child->td_cpuset = cpuset_ref(td->td_cpuset); ts2->ts_cpu = ts->ts_cpu; @@ -2694,6 +2696,8 @@ sched_throw(struct thread *td) MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); tdq_load_rem(tdq, td); lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; } KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); newtd = choosethread(); From owner-svn-src-all@freebsd.org Thu Oct 1 21:54:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2402DA0DCF8; Thu, 1 Oct 2015 21:54:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEB5813AB; Thu, 1 Oct 2015 21:54:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LsjJv018846; Thu, 1 Oct 2015 21:54:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91LsjM3018844; Thu, 1 Oct 2015 21:54:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012154.t91LsjM3018844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 21:54:45 +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: r288463 - in stable: 10/sys/kern 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:54:46 -0000 Author: jhb Date: Thu Oct 1 21:54:43 2015 New Revision: 288463 URL: https://svnweb.freebsd.org/changeset/base/288463 Log: MFC 286256: kgdb uses td_oncpu to determine if a thread is running and should use a pcb from stoppcbs[] rather than the thread's PCB. However, exited threads retained td_oncpu from the last time they ran, and newborn threads had their CPU fields cleared to zero during fork and thread creation since they are in the set of fields zeroed when threads are setup. To fix, explicitly update the CPU fields for exiting threads in sched_throw() to reflect the switch out and reset the CPU fields for new threads in sched_fork_thread() to NOCPU. Modified: stable/9/sys/kern/sched_4bsd.c stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/kern/sched_4bsd.c stable/10/sys/kern/sched_ule.c Directory Properties: stable/10/ (props changed) Modified: stable/9/sys/kern/sched_4bsd.c ============================================================================== --- stable/9/sys/kern/sched_4bsd.c Thu Oct 1 21:52:25 2015 (r288462) +++ stable/9/sys/kern/sched_4bsd.c Thu Oct 1 21:54:43 2015 (r288463) @@ -793,6 +793,8 @@ sched_fork_thread(struct thread *td, str { struct td_sched *ts; + childtd->td_oncpu = NOCPU; + childtd->td_lastcpu = NOCPU; childtd->td_estcpu = td->td_estcpu; childtd->td_lock = &sched_lock; childtd->td_cpuset = cpuset_ref(td->td_cpuset); @@ -1671,6 +1673,8 @@ sched_throw(struct thread *td) } else { lock_profile_release_lock(&sched_lock.lock_object); MPASS(td->td_lock == &sched_lock); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; } mtx_assert(&sched_lock, MA_OWNED); KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Thu Oct 1 21:52:25 2015 (r288462) +++ stable/9/sys/kern/sched_ule.c Thu Oct 1 21:54:43 2015 (r288463) @@ -2035,6 +2035,8 @@ sched_fork_thread(struct thread *td, str */ ts = td->td_sched; ts2 = child->td_sched; + child->td_oncpu = NOCPU; + child->td_lastcpu = NOCPU; child->td_lock = TDQ_LOCKPTR(TDQ_SELF()); child->td_cpuset = cpuset_ref(td->td_cpuset); ts2->ts_cpu = ts->ts_cpu; @@ -2656,6 +2658,8 @@ sched_throw(struct thread *td) MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); tdq_load_rem(tdq, td); lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); + td->td_lastcpu = td->td_oncpu; + td->td_oncpu = NOCPU; } KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); newtd = choosethread(); From owner-svn-src-all@freebsd.org Thu Oct 1 21:57:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 706F9A0E006; Thu, 1 Oct 2015 21:57:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60D641886; Thu, 1 Oct 2015 21:57:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LvGKT019036; Thu, 1 Oct 2015 21:57:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91LvGih019035; Thu, 1 Oct 2015 21:57:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012157.t91LvGih019035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 21:57:16 +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: r288464 - in stable: 10/lib/libc/stdio 9/lib/libc/stdio 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:57:16 -0000 Author: jhb Date: Thu Oct 1 21:57:15 2015 New Revision: 288464 URL: https://svnweb.freebsd.org/changeset/base/288464 Log: MFC 286177: Fix a couple of markup typos. Modified: stable/10/lib/libc/stdio/open_memstream.3 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/lib/libc/stdio/open_memstream.3 (contents, props changed) Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/10/lib/libc/stdio/open_memstream.3 ============================================================================== --- stable/10/lib/libc/stdio/open_memstream.3 Thu Oct 1 21:54:43 2015 (r288463) +++ stable/10/lib/libc/stdio/open_memstream.3 Thu Oct 1 21:57:15 2015 (r288464) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2014 +.Dd August 1, 2015 .Dt OPEN_MEMSTREAM 3 .Os .Sh NAME @@ -86,13 +86,13 @@ will contain the start of the memory buf will contain the smaller of the current position and the current buffer length. .Pp After a successful call to -.Xr fflush 3, +.Xr fflush 3 , the pointer referenced by .Fa bufp and the variable referenced by .Fa sizep are only valid until the next write operation or a call to -.Xr fclose 3. +.Xr fclose 3 . .Pp Once a stream is closed, the allocated buffer referenced by From owner-svn-src-all@freebsd.org Thu Oct 1 21:57:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29395A0E019; Thu, 1 Oct 2015 21:57:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19AC61887; Thu, 1 Oct 2015 21:57:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LvGn7019043; Thu, 1 Oct 2015 21:57:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91LvGZe019042; Thu, 1 Oct 2015 21:57:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012157.t91LvGZe019042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 21:57:16 +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: r288464 - in stable: 10/lib/libc/stdio 9/lib/libc/stdio 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 21:57:17 -0000 Author: jhb Date: Thu Oct 1 21:57:15 2015 New Revision: 288464 URL: https://svnweb.freebsd.org/changeset/base/288464 Log: MFC 286177: Fix a couple of markup typos. Modified: stable/9/lib/libc/stdio/open_memstream.3 (contents, props changed) Directory Properties: stable/9/lib/libc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/stdio/open_memstream.3 Directory Properties: stable/10/ (props changed) Modified: stable/9/lib/libc/stdio/open_memstream.3 ============================================================================== --- stable/9/lib/libc/stdio/open_memstream.3 Thu Oct 1 21:54:43 2015 (r288463) +++ stable/9/lib/libc/stdio/open_memstream.3 Thu Oct 1 21:57:15 2015 (r288464) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2014 +.Dd August 1, 2015 .Dt OPEN_MEMSTREAM 3 .Os .Sh NAME @@ -86,13 +86,13 @@ will contain the start of the memory buf will contain the smaller of the current position and the current buffer length. .Pp After a successful call to -.Xr fflush 3, +.Xr fflush 3 , the pointer referenced by .Fa bufp and the variable referenced by .Fa sizep are only valid until the next write operation or a call to -.Xr fclose 3. +.Xr fclose 3 . .Pp Once a stream is closed, the allocated buffer referenced by From owner-svn-src-all@freebsd.org Thu Oct 1 22:08:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E48B8A0E7E1; Thu, 1 Oct 2015 22:08:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4BAA1121; Thu, 1 Oct 2015 22:08:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91M8Hwt023305; Thu, 1 Oct 2015 22:08:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91M8HXl023303; Thu, 1 Oct 2015 22:08:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012208.t91M8HXl023303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 22:08: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: r288465 - stable/10/tests/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 22:08:18 -0000 Author: jhb Date: Thu Oct 1 22:08:16 2015 New Revision: 288465 URL: https://svnweb.freebsd.org/changeset/base/288465 Log: MFC 286369: Convert the map_at_zero test case to ATF. In particular, this will facilitate adding more mmap() tests. Modified: stable/10/tests/sys/vm/Makefile stable/10/tests/sys/vm/mmap_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/vm/Makefile ============================================================================== --- stable/10/tests/sys/vm/Makefile Thu Oct 1 21:57:15 2015 (r288464) +++ stable/10/tests/sys/vm/Makefile Thu Oct 1 22:08:16 2015 (r288465) @@ -2,6 +2,6 @@ TESTSDIR= ${TESTSBASE}/sys/vm -TAP_TESTS_C+= mmap_test +ATF_TESTS_C+= mmap_test .include Modified: stable/10/tests/sys/vm/mmap_test.c ============================================================================== --- stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 21:57:15 2015 (r288464) +++ stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 22:08:16 2015 (r288465) @@ -29,16 +29,14 @@ #include #include #include -#include +#include #include -#include -#include static const struct { void *addr; int ok[2]; /* Depending on security.bsd.map_at_zero {0, !=0}. */ -} tests[] = { +} map_at_zero_tests[] = { { (void *)0, { 0, 1 } }, /* Test sysctl. */ { (void *)1, { 0, 0 } }, { (void *)(PAGE_SIZE - 1), { 0, 0 } }, @@ -52,54 +50,43 @@ static const struct { #define MAP_AT_ZERO "security.bsd.map_at_zero" -int -main(void) +ATF_TC_WITHOUT_HEAD(mmap__map_at_zero); +ATF_TC_BODY(mmap__map_at_zero, tc) { void *p; size_t len; - int i, error, mib[3], map_at_zero; - - error = 0; - - /* Get the current sysctl value of security.bsd.map_at_zero. */ - len = sizeof(mib) / sizeof(*mib); - if (sysctlnametomib(MAP_AT_ZERO, mib, &len) == -1) { - printf("1..0 # SKIP: sysctlnametomib(\"%s\") failed: %s\n", - MAP_AT_ZERO, strerror(errno)); - return (0); - } + unsigned int i; + int map_at_zero; len = sizeof(map_at_zero); - if (sysctl(mib, 3, &map_at_zero, &len, NULL, 0) == -1) { - printf("1..0 # SKIP: sysctl for %s failed: %s\n", MAP_AT_ZERO, + if (sysctlbyname(MAP_AT_ZERO, &map_at_zero, &len, NULL, 0) == -1) { + atf_tc_skip("sysctl for %s failed: %s\n", MAP_AT_ZERO, strerror(errno)); - return (0); + return; } /* Normalize to 0 or 1 for array access. */ map_at_zero = !!map_at_zero; - printf("1..%zu\n", nitems(tests)); - for (i = 0; i < (int)nitems(tests); i++) { - p = mmap((void *)tests[i].addr, PAGE_SIZE, + for (i = 0; i < nitems(map_at_zero_tests); i++) { + p = mmap((void *)map_at_zero_tests[i].addr, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED, -1, 0); if (p == MAP_FAILED) { - if (tests[i].ok[map_at_zero] != 0) - error++; - printf("%sok %d # mmap(%p, ...) failed\n", - tests[i].ok[map_at_zero] == 0 ? "" : "not ", - i + 1, - tests[i].addr); + ATF_CHECK_MSG(map_at_zero_tests[i].ok[map_at_zero] == 0, + "mmap(%p, ...) failed", map_at_zero_tests[i].addr); } else { - if (tests[i].ok[map_at_zero] != 1) - error++; - printf("%sok %d # mmap(%p, ...) succeeded: p=%p\n", - tests[i].ok[map_at_zero] == 1 ? "" : "not ", - i + 1, - tests[i].addr, p); + ATF_CHECK_MSG(map_at_zero_tests[i].ok[map_at_zero] == 1, + "mmap(%p, ...) succeeded: p=%p\n", + map_at_zero_tests[i].addr, p); } } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, mmap__map_at_zero); - return (error != 0); + return (atf_no_error()); } From owner-svn-src-all@freebsd.org Thu Oct 1 22:17:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A8B5A0ECC0; Thu, 1 Oct 2015 22:17:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AEE0177A; Thu, 1 Oct 2015 22:17:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91MHSPh027342; Thu, 1 Oct 2015 22:17:28 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91MHSe1027341; Thu, 1 Oct 2015 22:17:28 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012217.t91MHSe1027341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 22:17:28 +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: r288466 - stable/10/tests/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 22:17:28 -0000 Author: jhb Date: Thu Oct 1 22:17:27 2015 New Revision: 288466 URL: https://svnweb.freebsd.org/changeset/base/288466 Log: MFC 286370: Add various tests to ensure that invalid arguments passed to mmap() trigger failures. Note: most of the tests that should provoke an EINVAL error do not pass on stable/10 as stable/10 does not have the changes that added more strict parameter checking to mmap(). Those changes will not be merged to stable/10, so I have disabled them via #if 0 with a comment explaining why. Modified: stable/10/tests/sys/vm/mmap_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/vm/mmap_test.c ============================================================================== --- stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 22:08:16 2015 (r288465) +++ stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 22:17:27 2015 (r288466) @@ -32,6 +32,10 @@ #include #include +#include +#include +#include +#include static const struct { void *addr; @@ -83,10 +87,86 @@ ATF_TC_BODY(mmap__map_at_zero, tc) } } +static void +checked_mmap(int prot, int flags, int fd, int error, const char *msg) +{ + void *p; + + p = mmap(NULL, getpagesize(), prot, flags, fd, 0); + if (p == MAP_FAILED) { + if (error == 0) + ATF_CHECK_MSG(0, "%s failed with errno %d", msg, + errno); + else + ATF_CHECK_EQ_MSG(error, errno, + "%s failed with wrong errno %d (expected %d)", msg, + errno, error); + } else { + ATF_CHECK_MSG(error == 0, "%s succeeded", msg); + munmap(p, getpagesize()); + } +} + +ATF_TC_WITHOUT_HEAD(mmap__bad_arguments); +ATF_TC_BODY(mmap__bad_arguments, tc) +{ + int fd; + + ATF_REQUIRE((fd = shm_open(SHM_ANON, O_RDWR, 0644)) >= 0); + ATF_REQUIRE(ftruncate(fd, getpagesize()) == 0); + + /* These should work. */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON, -1, 0, + "simple MAP_ANON"); + checked_mmap(PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0, + "simple shm fd shared"); + checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0, + "simple shm fd private"); + +#if 0 + /* + * These tests do not fail without r271635 and followup fixes. + * Those changes will not be merged to stable/10 since they + * are potentially disruptive. + */ + + /* Extra PROT flags. */ + checked_mmap(PROT_READ | PROT_WRITE | 0x100000, MAP_ANON, -1, EINVAL, + "MAP_ANON with extra PROT flags"); + checked_mmap(0xffff, MAP_SHARED, fd, EINVAL, + "shm fd with garbage PROT"); + + /* Undefined flag. */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_RESERVED0080, -1, + EINVAL, "Undefined flag"); + + /* Both MAP_SHARED and MAP_PRIVATE */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | + MAP_SHARED, -1, EINVAL, "MAP_ANON with both SHARED and PRIVATE"); + checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_SHARED, fd, + EINVAL, "shm fd with both SHARED and PRIVATE"); + + /* At least one of MAP_SHARED or MAP_PRIVATE without ANON */ + checked_mmap(PROT_READ | PROT_WRITE, 0, fd, EINVAL, + "shm fd without sharing flag"); +#endif + + /* MAP_ANON with either sharing flag (impacts fork). */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0, + "shared MAP_ANON"); + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0, + "private MAP_ANON"); + + /* MAP_ANON should require an fd of -1. */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, EINVAL, + "MAP_ANON with fd != -1"); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, mmap__map_at_zero); + ATF_TP_ADD_TC(tp, mmap__bad_arguments); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Thu Oct 1 22:19:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9C87A0EDE5; Thu, 1 Oct 2015 22:19:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8EF191C; Thu, 1 Oct 2015 22:19:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91MJgQp027498; Thu, 1 Oct 2015 22:19:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91MJgH4027497; Thu, 1 Oct 2015 22:19:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510012219.t91MJgH4027497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 22:19:42 +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: r288467 - stable/10/tests/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 01 Oct 2015 22:19:42 -0000 Author: jhb Date: Thu Oct 1 22:19:41 2015 New Revision: 288467 URL: https://svnweb.freebsd.org/changeset/base/288467 Log: MFC 287448: Add more mmap tests related to character devices. - Add cdev-related tests for bad args. - Add two simple tests cases for mapping /dev/zero that test for MAP_ANON-like behavior. Modified: stable/10/tests/sys/vm/mmap_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/vm/mmap_test.c ============================================================================== --- stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 22:17:27 2015 (r288466) +++ stable/10/tests/sys/vm/mmap_test.c Thu Oct 1 22:19:41 2015 (r288467) @@ -110,18 +110,26 @@ checked_mmap(int prot, int flags, int fd ATF_TC_WITHOUT_HEAD(mmap__bad_arguments); ATF_TC_BODY(mmap__bad_arguments, tc) { - int fd; + int devstatfd, shmfd, zerofd; - ATF_REQUIRE((fd = shm_open(SHM_ANON, O_RDWR, 0644)) >= 0); - ATF_REQUIRE(ftruncate(fd, getpagesize()) == 0); + ATF_REQUIRE((devstatfd = open("/dev/devstat", O_RDONLY)) >= 0); + ATF_REQUIRE((shmfd = shm_open(SHM_ANON, O_RDWR, 0644)) >= 0); + ATF_REQUIRE(ftruncate(shmfd, getpagesize()) == 0); + ATF_REQUIRE((zerofd = open("/dev/zero", O_RDONLY)) >= 0); /* These should work. */ checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON, -1, 0, "simple MAP_ANON"); - checked_mmap(PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0, + checked_mmap(PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0, "simple shm fd shared"); - checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0, + checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, shmfd, 0, "simple shm fd private"); + checked_mmap(PROT_READ, MAP_SHARED, zerofd, 0, + "simple /dev/zero shared"); + checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, zerofd, 0, + "simple /dev/zero private"); + checked_mmap(PROT_READ, MAP_SHARED, devstatfd, 0, + "simple /dev/devstat shared"); #if 0 /* @@ -133,7 +141,7 @@ ATF_TC_BODY(mmap__bad_arguments, tc) /* Extra PROT flags. */ checked_mmap(PROT_READ | PROT_WRITE | 0x100000, MAP_ANON, -1, EINVAL, "MAP_ANON with extra PROT flags"); - checked_mmap(0xffff, MAP_SHARED, fd, EINVAL, + checked_mmap(0xffff, MAP_SHARED, shmfd, EINVAL, "shm fd with garbage PROT"); /* Undefined flag. */ @@ -143,11 +151,11 @@ ATF_TC_BODY(mmap__bad_arguments, tc) /* Both MAP_SHARED and MAP_PRIVATE */ checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_SHARED, -1, EINVAL, "MAP_ANON with both SHARED and PRIVATE"); - checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_SHARED, fd, + checked_mmap(PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_SHARED, shmfd, EINVAL, "shm fd with both SHARED and PRIVATE"); /* At least one of MAP_SHARED or MAP_PRIVATE without ANON */ - checked_mmap(PROT_READ | PROT_WRITE, 0, fd, EINVAL, + checked_mmap(PROT_READ | PROT_WRITE, 0, shmfd, EINVAL, "shm fd without sharing flag"); #endif @@ -160,6 +168,91 @@ ATF_TC_BODY(mmap__bad_arguments, tc) /* MAP_ANON should require an fd of -1. */ checked_mmap(PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, EINVAL, "MAP_ANON with fd != -1"); + + /* Writable MAP_SHARED should fail on read-only descriptors. */ + checked_mmap(PROT_READ | PROT_WRITE, MAP_SHARED, zerofd, EACCES, + "MAP_SHARED of read-only /dev/zero"); + + /* + * Character devices other than /dev/zero do not support private + * mappings. + */ + checked_mmap(PROT_READ, MAP_PRIVATE, devstatfd, EINVAL, + "MAP_PRIVATE of /dev/devstat"); +} + +ATF_TC_WITHOUT_HEAD(mmap__dev_zero_private); +ATF_TC_BODY(mmap__dev_zero_private, tc) +{ + char *p1, *p2, *p3; + size_t i; + int fd; + + ATF_REQUIRE((fd = open("/dev/zero", O_RDONLY)) >= 0); + + p1 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, + 0); + ATF_REQUIRE(p1 != MAP_FAILED); + + p2 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, + 0); + ATF_REQUIRE(p2 != MAP_FAILED); + + for (i = 0; i < getpagesize(); i++) + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + + ATF_REQUIRE(memcmp(p1, p2, getpagesize()) == 0); + + p1[0] = 1; + + ATF_REQUIRE(p2[0] == 0); + + p2[0] = 2; + + ATF_REQUIRE(p1[0] == 1); + + p3 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, + 0); + ATF_REQUIRE(p3 != MAP_FAILED); + + ATF_REQUIRE(p3[0] == 0); +} + +ATF_TC_WITHOUT_HEAD(mmap__dev_zero_shared); +ATF_TC_BODY(mmap__dev_zero_shared, tc) +{ + char *p1, *p2, *p3; + size_t i; + int fd; + + ATF_REQUIRE((fd = open("/dev/zero", O_RDWR)) >= 0); + + p1 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, + 0); + ATF_REQUIRE(p1 != MAP_FAILED); + + p2 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, + 0); + ATF_REQUIRE(p2 != MAP_FAILED); + + for (i = 0; i < getpagesize(); i++) + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + + ATF_REQUIRE(memcmp(p1, p2, getpagesize()) == 0); + + p1[0] = 1; + + ATF_REQUIRE(p2[0] == 0); + + p2[0] = 2; + + ATF_REQUIRE(p1[0] == 1); + + p3 = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd, + 0); + ATF_REQUIRE(p3 != MAP_FAILED); + + ATF_REQUIRE(p3[0] == 0); } ATF_TP_ADD_TCS(tp) @@ -167,6 +260,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mmap__map_at_zero); ATF_TP_ADD_TC(tp, mmap__bad_arguments); + ATF_TP_ADD_TC(tp, mmap__dev_zero_private); + ATF_TP_ADD_TC(tp, mmap__dev_zero_shared); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Fri Oct 2 02:06:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EF29A0E9F9; Fri, 2 Oct 2015 02:06:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0E80156D; Fri, 2 Oct 2015 02:06:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9226ada021373; Fri, 2 Oct 2015 02:06:36 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9226adI021372; Fri, 2 Oct 2015 02:06:36 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510020206.t9226adI021372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 2 Oct 2015 02:06: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: r288468 - stable/10/release/tools 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 02:06:37 -0000 Author: gjb Date: Fri Oct 2 02:06:36 2015 New Revision: 288468 URL: https://svnweb.freebsd.org/changeset/base/288468 Log: MFC r288370: In vm_copy_base(), turn off SU+J on the resultant filesystem, leaving only SU enabled. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Modified: stable/10/release/tools/vmimage.subr ============================================================================== --- stable/10/release/tools/vmimage.subr Thu Oct 1 22:19:41 2015 (r288467) +++ stable/10/release/tools/vmimage.subr Fri Oct 2 02:06:36 2015 (r288468) @@ -102,7 +102,7 @@ vm_copy_base() { umount_loop /dev/${mdnew} rmdir ${DESTDIR}/new - tunefs -j enable /dev/${mdnew} + tunefs -n enable /dev/${mdnew} mdconfig -d -u ${mdnew} mv ${VMBASE}.tmp ${VMBASE} } From owner-svn-src-all@freebsd.org Fri Oct 2 02:08:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19790A0EBB3; Fri, 2 Oct 2015 02:08:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F27DF1807; Fri, 2 Oct 2015 02:08:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9228gAK021521; Fri, 2 Oct 2015 02:08:42 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9228fLG021511; Fri, 2 Oct 2015 02:08:41 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510020208.t9228fLG021511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 2 Oct 2015 02:08:41 +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: r288469 - stable/10/release/arm 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 02:08:43 -0000 Author: gjb Date: Fri Oct 2 02:08:40 2015 New Revision: 288469 URL: https://svnweb.freebsd.org/changeset/base/288469 Log: MFC r288374: In addition to the ubldr file, also copy ubldr.bin to the MS-DOS partition. This will help with transitioning to a single arm/armv6 userland build which could be used for all FreeBSD/armv6 images without UBLDR_LOADADDR being set for each board (ultimately requiring a separate buildworld for each currently). Sponsored by: The FreeBSD Foundation Modified: stable/10/release/arm/BEAGLEBONE.conf stable/10/release/arm/CUBOX-HUMMINGBOARD.conf stable/10/release/arm/GUMSTIX.conf stable/10/release/arm/PANDABOARD.conf stable/10/release/arm/RPI-B.conf stable/10/release/arm/RPI2.conf stable/10/release/arm/WANDBOARD.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/10/release/arm/BEAGLEBONE.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/BEAGLEBONE.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: stable/10/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- stable/10/release/arm/CUBOX-HUMMINGBOARD.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/CUBOX-HUMMINGBOARD.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -28,6 +28,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: stable/10/release/arm/GUMSTIX.conf ============================================================================== --- stable/10/release/arm/GUMSTIX.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/GUMSTIX.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: stable/10/release/arm/PANDABOARD.conf ============================================================================== --- stable/10/release/arm/PANDABOARD.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/PANDABOARD.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: stable/10/release/arm/RPI-B.conf ============================================================================== --- stable/10/release/arm/RPI-B.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/RPI-B.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -30,6 +30,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi.dtb \ ${FATMOUNT}/rpi.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: stable/10/release/arm/RPI2.conf ============================================================================== --- stable/10/release/arm/RPI2.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/RPI2.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -31,6 +31,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi2.dtb \ ${FATMOUNT}/rpi2.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: stable/10/release/arm/WANDBOARD.conf ============================================================================== --- stable/10/release/arm/WANDBOARD.conf Fri Oct 2 02:06:36 2015 (r288468) +++ stable/10/release/arm/WANDBOARD.conf Fri Oct 2 02:08:40 2015 (r288469) @@ -29,6 +29,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} From owner-svn-src-all@freebsd.org Fri Oct 2 02:09:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2891BA0ECC0; Fri, 2 Oct 2015 02:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19BE419A0; Fri, 2 Oct 2015 02:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9229omC021605; Fri, 2 Oct 2015 02:09:50 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9229oW8021604; Fri, 2 Oct 2015 02:09:50 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510020209.t9229oW8021604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 02:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288470 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 02:09:51 -0000 Author: grehan Date: Fri Oct 2 02:09:50 2015 New Revision: 288470 URL: https://svnweb.freebsd.org/changeset/base/288470 Log: - Increase the max number of indirect descriptors to match the largest that the Windows virtio driver can send down - Always advertize indirect descriptors. The Illumos virtio driver won't attach unless this capability is seen. Reviewed by: neel Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 2 02:08:40 2015 (r288469) +++ head/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 2 02:09:50 2015 (r288470) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #define VTNET_RINGSZ 1024 -#define VTNET_MAXSEGS 32 +#define VTNET_MAXSEGS 256 /* * Host capabilities. Note that we only offer a few of these. @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); #define VTNET_S_HOSTCAPS \ ( VIRTIO_NET_F_MAC | VIRTIO_NET_F_MRG_RXBUF | VIRTIO_NET_F_STATUS | \ - VIRTIO_F_NOTIFY_ON_EMPTY) + VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC) /* * PCI config-space "registers" From owner-svn-src-all@freebsd.org Fri Oct 2 02:21:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7866EA0D628; Fri, 2 Oct 2015 02:21:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C9A710CD; Fri, 2 Oct 2015 02:21:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t922LctT028843; Fri, 2 Oct 2015 02:21:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t922LbZe028840; Fri, 2 Oct 2015 02:21:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510020221.t922LbZe028840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 02:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288471 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 02:21:38 -0000 Author: adrian Date: Fri Oct 2 02:21:36 2015 New Revision: 288471 URL: https://svnweb.freebsd.org/changeset/base/288471 Log: Fix neeed -> neeeded. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3595 Modified: head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 02:21:36 2015 (r288471) @@ -168,7 +168,7 @@ ccmp_encap(struct ieee80211_key *k, stru ivp[7] = k->wk_keytsc >> 40; /* PN5 */ /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && !ccmp_encrypt(k, m, hdrlen)) Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 02:21:36 2015 (r288471) @@ -195,7 +195,7 @@ tkip_encap(struct ieee80211_key *k, stru ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) { if (!tkip_encrypt(ctx, k, m, hdrlen)) Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 02:21:36 2015 (r288471) @@ -184,7 +184,7 @@ wep_encap(struct ieee80211_key *k, struc ivp[3] = keyid; /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && !wep_encrypt(k, m, hdrlen)) From owner-svn-src-all@freebsd.org Fri Oct 2 04:58:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 299FAA0D3B9; Fri, 2 Oct 2015 04:58:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F00B71EE0; Fri, 2 Oct 2015 04:58:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by padhy16 with SMTP id hy16so96204880pad.1; Thu, 01 Oct 2015 21:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=YTu/N4+VKVRj8rcbIp1zVbauLSdAjYLZsZ//cihdu5k=; b=grBCA5Z92oiGU36iSKLKze4WPj8nzWiIL7Ib7c31AdGF34TaUMnAwNyXLtOSsQV541 iZLR4zA+ZfeUd9ln4fKYF8c1mJXg9D6an+Ex8v8w37P4Qb1qG185tDlCqaIobx4Mbq17 2iMCvZadAe/Qa/lMzGZKrAPWHbuppeIt+YU0EkswMMP5S8kbOdy7gDIpHrp8jCCDwe3i d+Own/j3PTZsb5QBe+2sW4SX5Q1z7JxR0LkIwys3j4eG4ok4PaL2u7ntPg7Ez8ddA4B7 Fkz0e7PbigSfGNsC69EjBJhXhiJI2Lf+XEa0OLkrajkRF/WlohEdT7n+arN/AFYU2S+R Tg+g== X-Received: by 10.68.238.130 with SMTP id vk2mr17416552pbc.114.1443761927572; Thu, 01 Oct 2015 21:58:47 -0700 (PDT) Received: from raichu ([104.232.114.184]) by smtp.gmail.com with ESMTPSA id ey3sm9804472pbd.28.2015.10.01.21.58.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 21:58:46 -0700 (PDT) Sender: Mark Johnston Date: Thu, 1 Oct 2015 21:58:43 -0700 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Message-ID: <20151002045842.GA18421@raichu> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1837187.vUDrWYExQX@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 04:58:48 -0000 On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > Author: markj > > Date: Wed Sep 30 23:06:29 2015 > > New Revision: 288431 > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > Log: > > As a step towards the elimination of PG_CACHED pages, rework the handling > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > the head of the inactive queue instead of being cached. > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > read or written. At that point the corresponding buffers may still be > > dirty, so the previous implementation would coalesce successive ranges and > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > dirty buffers would eventually be cached. To preserve this behaviour in an > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > flag in bufs that underlie the specified range. > > Putting these pages back on the inactive queue completely defeats the primary > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > of the VM object's tree of pages and into the free pool so that the application > can instruct the VM to free memory more efficiently than relying on page daemon. > > The implementation used cache pages instead of free as a cheap optimization so > that if an application did something dumb where it used DONTNEED and then turned > around and read the file it would not have to go to disk if the pages had not > yet been reused. In practice this didn't work out so well because PG_CACHE pages > don't really work well. > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > memory that an application knew wasn't going to be reused and avoiding the need > for pagedaemon to run at all. I think this should be freeing the pages instead of > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > around and rereads the file, it generally deserves to have to go to disk for it. A problem with this is that one application's DONTNEED or NOREUSE hint would cause every application reading or writing that file to go to disk, but posix_fadvise(2) is explicitly intended for applications that wish to provide hints about their own access patterns. I realize that it's typically used with application-private files, but that's not a requirement of the interface. Deactivating (or caching) the backing pages generally avoids this problem. > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > pagedaemon during application page faults (since pagedaemon potentially never has > to run). That's true, but the page queue locking (and the pagedaemon's manipulation of the page queue locks) has also become more fine-grained since posix_fadvise(2) was added. In particular, from some reading of sys/vm in stable/8, inactive queue scans used to be performed with the global page queue lock held; it was only dropped to launder dirty pages. Now, the page queue lock is split into separate locks for the active and inactive page queues, and the pagedaemon drops the inactive queue lock for each page in all but a few exceptional cases. Does the optimization of freeing or caching DONTNEED pages buy us all that much now? Some synthetic testing in which an application writes out many large (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows no significant difference in runtime if the buffer pages are deactivated vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE identically to B_DIRECT.) Unsurprisingly, I see very little lock contention in the latter case, but in the former, most of the lock contention is short (i.e. the mutex is acquired while spinning), and a large majority of the contention is on the free page queue mutex. If lock contention there is a concern, wouldn't it be better to try and address that directly rather than by bypassing the pagedaemon? > > I believe that B_NOREUSE is definitely cleaner, btw. I had wanted to change > NOREUSE to work that way but wasn't sure how to do it. > > -- > John Baldwin From owner-svn-src-all@freebsd.org Fri Oct 2 05:04:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2849DA0D859; Fri, 2 Oct 2015 05:04:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1904E12AB; Fri, 2 Oct 2015 05:04:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9254HRD095141; Fri, 2 Oct 2015 05:04:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9254H2i095140; Fri, 2 Oct 2015 05:04:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510020504.t9254H2i095140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 05:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r288472 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 05:04:18 -0000 Author: kib Date: Fri Oct 2 05:04:17 2015 New Revision: 288472 URL: https://svnweb.freebsd.org/changeset/base/288472 Log: Free Jason. Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Fri Oct 2 02:21:36 2015 (r288471) +++ svnadmin/conf/mentors Fri Oct 2 05:04:17 2015 (r288472) @@ -19,7 +19,6 @@ carl jimharris cherry gibbs eri gnn Co-mentor: thompsa erj gnn Co-mentor: jfv -jah kib jceel wkoszek Co-mentor: cognet jkh rwatson jonathan rwatson From owner-svn-src-all@freebsd.org Fri Oct 2 05:27:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C310A0D361; Fri, 2 Oct 2015 05:27:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C3D71FF0; Fri, 2 Oct 2015 05:27:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t925RDol003516; Fri, 2 Oct 2015 05:27:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t925RDgQ003515; Fri, 2 Oct 2015 05:27:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510020527.t925RDgQ003515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 05:27: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: r288473 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 05:27:13 -0000 Author: kib Date: Fri Oct 2 05:27:12 2015 New Revision: 288473 URL: https://svnweb.freebsd.org/changeset/base/288473 Log: MFC r288216: Use per-cpu values for base and last in tc_cpu_ticks(). Modified: stable/10/sys/kern/kern_tc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_tc.c ============================================================================== --- stable/10/sys/kern/kern_tc.c Fri Oct 2 05:04:17 2015 (r288472) +++ stable/10/sys/kern/kern_tc.c Fri Oct 2 05:27:12 2015 (r288473) @@ -1888,20 +1888,27 @@ SYSINIT(timecounter, SI_SUB_CLOCKS, SI_O static int cpu_tick_variable; static uint64_t cpu_tick_frequency; +static DPCPU_DEFINE(uint64_t, tc_cpu_ticks_base); +static DPCPU_DEFINE(unsigned, tc_cpu_ticks_last); + static uint64_t tc_cpu_ticks(void) { - static uint64_t base; - static unsigned last; - unsigned u; struct timecounter *tc; + uint64_t res, *base; + unsigned u, *last; + critical_enter(); + base = DPCPU_PTR(tc_cpu_ticks_base); + last = DPCPU_PTR(tc_cpu_ticks_last); tc = timehands->th_counter; u = tc->tc_get_timecount(tc) & tc->tc_counter_mask; - if (u < last) - base += (uint64_t)tc->tc_counter_mask + 1; - last = u; - return (u + base); + if (u < *last) + *base += (uint64_t)tc->tc_counter_mask + 1; + *last = u; + res = u + *base; + critical_exit(); + return (res); } void From owner-svn-src-all@freebsd.org Fri Oct 2 06:24:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76469A0D620; Fri, 2 Oct 2015 06:24:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7D11AA4; Fri, 2 Oct 2015 06:24:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t926OAJM027679; Fri, 2 Oct 2015 06:24:10 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t926OAKl027678; Fri, 2 Oct 2015 06:24:10 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510020624.t926OAKl027678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 06:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288475 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 06:24:10 -0000 Author: bdrewery Date: Fri Oct 2 06:24:09 2015 New Revision: 288475 URL: https://svnweb.freebsd.org/changeset/base/288475 Log: META_MODE: Fix stage_links not running in the right order without -j. This fixes staging errors for non-parallel builds that have LINKS. Creating hardlinks must always happen after the actual files are installed. The staging code was protected by an .ORDER statement that only affected parallel -j builds but not non-parallel builds. Fix this by making the real stage_links.SET (stage_links.links, stage_links.mlinks, etc) targets depend on the main targets for all of the other possible staging needs. For example, stage_links.links will depend on stage_as and stage_files, which have their own dependencies to stage_as.prog or stage_files.prog or stage_files.SET, which is enough to satistfy the ordering. Also remove the requirement that symlinks be created last, as they can safely be made without the source being present unlike hardlinks. This also fixes symlinks to come before hardlinks as it is possible, in theory, to hardlink a symlink. This is not actually supported here though. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/meta.stage.mk Modified: head/share/mk/meta.stage.mk ============================================================================== --- head/share/mk/meta.stage.mk Fri Oct 2 05:30:46 2015 (r288474) +++ head/share/mk/meta.stage.mk Fri Oct 2 06:24:09 2015 (r288475) @@ -237,10 +237,11 @@ stage_as.$s: .dirdep CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes # stage_*links usually needs to follow any others. -.for t in ${STAGE_TARGETS:N*links:O:u} -.ORDER: $t stage_links -.ORDER: $t stage_symlinks +.if !empty(STAGE_SETS) && !empty(STAGE_TARGETS:Nstage_links) +.for s in ${STAGE_SETS:O:u} +stage_links.$s: ${STAGE_TARGETS:Nstage_links:O:u} .endfor +.endif # make sure this exists staging: From owner-svn-src-all@freebsd.org Fri Oct 2 07:00:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44656A0CF51; Fri, 2 Oct 2015 07:00:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 179331254; Fri, 2 Oct 2015 07:00:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9270htd044476; Fri, 2 Oct 2015 07:00:43 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9270hW3044475; Fri, 2 Oct 2015 07:00:43 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510020700.t9270hW3044475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 07:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288477 - head/sbin/ipf/ipftest 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 07:00:44 -0000 Author: bdrewery Date: Fri Oct 2 07:00:43 2015 New Revision: 288477 URL: https://svnweb.freebsd.org/changeset/base/288477 Log: META_MODE: For some reason meta mode cannot generate the intermediate tab.c files. Split up all of the targets to be more clear on how they are generated to fix the problem. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/ipf/ipftest/Makefile Modified: head/sbin/ipf/ipftest/Makefile ============================================================================== --- head/sbin/ipf/ipftest/Makefile Fri Oct 2 06:34:34 2015 (r288476) +++ head/sbin/ipf/ipftest/Makefile Fri Oct 2 07:00:43 2015 (r288477) @@ -32,15 +32,19 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h CLEANFILES+= ippool_y.c ippool_l.c CLEANFILES+= ippool.tab.c ippool.tab.h -ipnat_y.c: ipnat_y.y +ipnat.tab.c ipnat.tab.h: ipnat_y.y ${YACC} -b ipnat -d ${.ALLSRC} + +ipnat_y.c: ipnat.tab.c sed -e 's/yy/ipnat_yy/g' \ -e 's/y.tab.c/ipnat_y.c/' \ -e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \ ipnat.tab.c > ${.TARGET} + +ipnat_y.h: ipnat.tab.h sed -e 's/yy/ipnat_yy/g' \ -e 's/y.tab.h/ipnat_y.h/' \ - ipnat.tab.h > ${.TARGET:.c=.h} + ipnat.tab.h > ${.TARGET} ipnat_y.h: ipnat_y.c @@ -54,13 +58,17 @@ ipnat_l.h: lexer.h sed -e 's/yy/ipnat_yy/g' \ ${.ALLSRC} > ${.TARGET} -ippool_y.c: ippool_y.y +ippool.tab.c ippool.tab.h: ippool_y.y ${YACC} -b ippool -d ${.ALLSRC} + +ippool_y.c: ippool.tab.c sed -e 's/yy/ippool_yy/g' \ -e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \ ippool.tab.c > ${.TARGET} + +ippool_y.h: ippool.tab.h sed -e 's/yy/ippool_yy/g' \ - ippool.tab.h > ${.TARGET:.c=.h} + ippool.tab.h > ${.TARGET} ippool_y.h: ippool_y.c @@ -74,13 +82,17 @@ ippool_l.h: lexer.h sed -e 's/yy/ippool_yy/g' \ ${.ALLSRC} > ${.TARGET} -ipf_y.c: ipf_y.y +ipf.tab.c ipf.tab.h: ipf_y.y ${YACC} -b ipf -d ${.ALLSRC} + +ipf_y.c: ipf.tab.c sed -e 's/yy/ipf_yy/g' \ -e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \ ipf.tab.c > ${.TARGET} + +ipf_y.h: ipf.tab.h sed -e 's/yy/ipf_yy/g' \ - ipf.tab.h > ${.TARGET:.c=.h} + ipf.tab.h > ${.TARGET} ipf_y.h: ipf_y.c From owner-svn-src-all@freebsd.org Fri Oct 2 08:58:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88EBFA0E97C; Fri, 2 Oct 2015 08:58:51 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 774E01168; Fri, 2 Oct 2015 08:58:51 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t928wpBB091772; Fri, 2 Oct 2015 08:58:51 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t928wpt6091771; Fri, 2 Oct 2015 08:58:51 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201510020858.t928wpt6091771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 2 Oct 2015 08:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288482 - head/usr.sbin/rpc.yppasswdd 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 08:58:51 -0000 Author: araujo Date: Fri Oct 2 08:58:50 2015 New Revision: 288482 URL: https://svnweb.freebsd.org/changeset/base/288482 Log: The rpc.yppasswdd has an option to not allow shell changes (-s), but is always passed a shell by the remote yppasswd. If an NIS client overrides the shell provided by the ypserv, then yppasswd (pam_unix, actually, afaict) will pass this new shell to the yppasswdd. If this shell has been set on the client to a shell which is invalid on the server, a user will never be able to change their password on the client. PR: 67142 Submitted by: russell@rucus.ru.ac.za Approved by: bapt (mentor) Sponsored by: EuroBSDCon Sweden. Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c ============================================================================== --- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Fri Oct 2 08:33:06 2015 (r288481) +++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Fri Oct 2 08:58:50 2015 (r288482) @@ -212,12 +212,12 @@ validate(struct passwd *opw, struct x_pa * Don't allow the user to shoot himself in the foot, * even on purpose. */ - if (!ok_shell(npw->pw_shell)) { + if (!no_chsh && !ok_shell(npw->pw_shell)) { yp_error("%s is not a valid shell", npw->pw_shell); return(1); } - if (validchars(npw->pw_shell)) { + if (!no_chsh && validchars(npw->pw_shell)) { yp_error("specified shell contains invalid characters"); return(1); } From owner-svn-src-all@freebsd.org Fri Oct 2 09:23:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA70DA0DEC3; Fri, 2 Oct 2015 09:23:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8CD91152; Fri, 2 Oct 2015 09:23:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t929NFAY004064; Fri, 2 Oct 2015 09:23:15 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t929NFKK004063; Fri, 2 Oct 2015 09:23:15 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201510020923.t929NFKK004063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Fri, 2 Oct 2015 09:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288484 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 09:23:15 -0000 Author: phk Date: Fri Oct 2 09:23:14 2015 New Revision: 288484 URL: https://svnweb.freebsd.org/changeset/base/288484 Log: Fail the sbuf if vsnprintf(3) fails. Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Oct 2 09:03:28 2015 (r288483) +++ head/sys/kern/subr_sbuf.c Fri Oct 2 09:23:14 2015 (r288484) @@ -623,6 +623,10 @@ sbuf_vprintf(struct sbuf *s, const char va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, fmt, ap_copy); + if (len < 0) { + s->s_error = errno; + return (-1); + } va_end(ap_copy); if (SBUF_FREESPACE(s) >= len) From owner-svn-src-all@freebsd.org Fri Oct 2 10:08:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B52FA0E21A; Fri, 2 Oct 2015 10:08:13 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6615187D; Fri, 2 Oct 2015 10:08:12 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92A8CX6020647; Fri, 2 Oct 2015 10:08:12 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92A8CnP020645; Fri, 2 Oct 2015 10:08:12 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201510021008.t92A8CnP020645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 2 Oct 2015 10:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288485 - in head: . games usr.bin usr.bin/caesar usr.bin/factor usr.bin/fortune usr.bin/grdc usr.bin/morse usr.bin/number usr.bin/pom usr.bin/primes usr.bin/random 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 10:08:13 -0000 Author: cperciva Date: Fri Oct 2 10:08:11 2015 New Revision: 288485 URL: https://svnweb.freebsd.org/changeset/base/288485 Log: Final step of eliminating the "games" distribution: Merge src/games (or what's left of it, at least) into src/usr.bin. This change will not be MFCed. Discussed at: EuroBSDCon 2014 Committed from: EuroBSDCon 2015 Added: head/usr.bin/caesar/ - copied from r288479, head/games/caesar/ head/usr.bin/factor/ - copied from r288479, head/games/factor/ head/usr.bin/fortune/ - copied from r288479, head/games/fortune/ head/usr.bin/grdc/ - copied from r288479, head/games/grdc/ head/usr.bin/morse/ - copied from r288479, head/games/morse/ head/usr.bin/number/ - copied from r288479, head/games/number/ head/usr.bin/pom/ - copied from r288479, head/games/pom/ head/usr.bin/primes/ - copied from r288479, head/games/primes/ head/usr.bin/random/ - copied from r288479, head/games/random/ Deleted: head/games/ Modified: head/Makefile.inc1 head/usr.bin/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Oct 2 09:23:14 2015 (r288484) +++ head/Makefile.inc1 Fri Oct 2 10:08:11 2015 (r288485) @@ -61,9 +61,6 @@ SUBDIR= ${SUBDIR_OVERRIDE} .else SUBDIR= lib libexec SUBDIR+=bin -.if ${MK_GAMES} != "no" -SUBDIR+=games -.endif .if ${MK_CDDL} != "no" SUBDIR+=cddl .endif @@ -1285,7 +1282,7 @@ legacy: _bt= _bootstrap-tools .if ${MK_GAMES} != "no" -_strfile= games/fortune/strfile +_strfile= usr.bin/fortune/strfile .endif .if ${MK_GCC} != "no" && ${MK_CXX} != "no" Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Fri Oct 2 09:23:14 2015 (r288484) +++ head/usr.bin/Makefile Fri Oct 2 10:08:11 2015 (r288485) @@ -230,6 +230,18 @@ SUBDIR+= finger SUBDIR+= ftp .endif +.if ${MK_GAMES} != "no" +SUBDIR+= caesar +SUBDIR+= factor +SUBDIR+= fortune +SUBDIR+= grdc +SUBDIR+= morse +SUBDIR+= number +SUBDIR+= pom +SUBDIR+= primes +SUBDIR+= random +.endif + .if ${MK_GPL_DTC} != "yes" SUBDIR+= dtc .endif From owner-svn-src-all@freebsd.org Fri Oct 2 11:16:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07134A0E5C7; Fri, 2 Oct 2015 11:16:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED70F1352; Fri, 2 Oct 2015 11:16:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BGlMT049187; Fri, 2 Oct 2015 11:16:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BGlbE049185; Fri, 2 Oct 2015 11:16:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021116.t92BGlbE049185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 11:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288486 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 11:16:48 -0000 Author: mav Date: Fri Oct 2 11:16:46 2015 New Revision: 288486 URL: https://svnweb.freebsd.org/changeset/base/288486 Log: Set default block size for CD to expected 2048 bytes. Modified: head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Fri Oct 2 10:08:11 2015 (r288485) +++ head/usr.sbin/ctld/ctld.c Fri Oct 2 11:16:46 2015 (r288486) @@ -1661,7 +1661,10 @@ conf_verify_lun(struct lun *lun) } } if (lun->l_blocksize == 0) { - lun_set_blocksize(lun, DEFAULT_BLOCKSIZE); + if (lun->l_device_type == 5) + lun_set_blocksize(lun, DEFAULT_CD_BLOCKSIZE); + else + lun_set_blocksize(lun, DEFAULT_BLOCKSIZE); } else if (lun->l_blocksize < 0) { log_warnx("invalid blocksize for lun \"%s\"; " "must be larger than 0", lun->l_name); Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Fri Oct 2 10:08:11 2015 (r288485) +++ head/usr.sbin/ctld/ctld.h Fri Oct 2 11:16:46 2015 (r288486) @@ -43,6 +43,7 @@ #define DEFAULT_CONFIG_PATH "/etc/ctl.conf" #define DEFAULT_PIDFILE "/var/run/ctld.pid" #define DEFAULT_BLOCKSIZE 512 +#define DEFAULT_CD_BLOCKSIZE 2048 #define MAX_LUNS 1024 #define MAX_NAME_LEN 223 From owner-svn-src-all@freebsd.org Fri Oct 2 11:17:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61C19A0E63E; Fri, 2 Oct 2015 11:17:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5322C1599; Fri, 2 Oct 2015 11:17:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BHHVH049255; Fri, 2 Oct 2015 11:17:17 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BHGAT049252; Fri, 2 Oct 2015 11:17:16 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201510021117.t92BHGAT049252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 2 Oct 2015 11:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288487 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 11:17:17 -0000 Author: ed Date: Fri Oct 2 11:17:15 2015 New Revision: 288487 URL: https://svnweb.freebsd.org/changeset/base/288487 Log: Make truss print CloudABI system call names. This change adds the bits that are necessary to fetch system call arguments and return values from trapframes for CloudABI. This allows us to properly print system calls with the right name. We need to make sure that we properly convert error numbers when system calls fail. We still need to improve truss to pretty-print some of the system calls that have flags. Added: head/usr.bin/truss/amd64-cloudabi64.c (contents, props changed) head/usr.bin/truss/amd64cloudabi64.conf (contents, props changed) Modified: head/usr.bin/truss/Makefile Modified: head/usr.bin/truss/Makefile ============================================================================== --- head/usr.bin/truss/Makefile Fri Oct 2 11:16:46 2015 (r288486) +++ head/usr.bin/truss/Makefile Fri Oct 2 11:17:15 2015 (r288487) @@ -58,6 +58,16 @@ fbsd32-syscalls.master: ${.CURDIR}/../.. freebsd32_syscalls.h: fbsd32-syscalls.master /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \ ${.CURDIR}/fbsd32.conf + +SRCS+= amd64-cloudabi64.c cloudabi64_syscalls.h +CLEANFILES+=amd64cloudabi64-syscalls.master cloudabi64_syscalls.h + +amd64cloudabi64-syscalls.master: ${.CURDIR}/../../sys/compat/cloudabi64/syscalls.master + cat ${.ALLSRC} > ${.TARGET} + +cloudabi64_syscalls.h: amd64cloudabi64-syscalls.master + /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \ + ${.CURDIR}/amd64cloudabi64.conf .endif .if ${MACHINE_ARCH} == "powerpc64" Added: head/usr.bin/truss/amd64-cloudabi64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/amd64-cloudabi64.c Fri Oct 2 11:17:15 2015 (r288487) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include +#include + +#include "cloudabi64_syscalls.h" +#include "truss.h" + +static int +amd64_cloudabi64_fetch_args(struct trussinfo *trussinfo, unsigned int narg) +{ + struct current_syscall *cs; + struct reg regs; + lwpid_t tid; + + tid = trussinfo->curthread->tid; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) == -1) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + cs = &trussinfo->curthread->cs; + if (narg >= 1) + cs->args[0] = regs.r_rdi; + if (narg >= 2) + cs->args[1] = regs.r_rsi; + if (narg >= 3) + cs->args[2] = regs.r_rdx; + if (narg >= 4) + cs->args[3] = regs.r_rcx; + if (narg >= 5) + cs->args[4] = regs.r_r8; + if (narg >= 6) + cs->args[5] = regs.r_r9; + return (0); +} + +static const int cloudabi_errno_table[] = { + 0, E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EAFNOSUPPORT, + EAGAIN, EALREADY, EBADF, EBADMSG, EBUSY, ECANCELED, ECHILD, + ECONNABORTED, ECONNREFUSED, ECONNRESET, EDEADLK, EDESTADDRREQ, + EDOM, EDQUOT, EEXIST, EFAULT, EFBIG, EHOSTUNREACH, EIDRM, + EILSEQ, EINPROGRESS, EINTR, EINVAL, EIO, EISCONN, EISDIR, ELOOP, + EMFILE, EMLINK, EMSGSIZE, EMULTIHOP, ENAMETOOLONG, ENETDOWN, + ENETRESET, ENETUNREACH, ENFILE, ENOBUFS, ENODEV, ENOENT, + ENOEXEC, ENOLCK, ENOLINK, ENOMEM, ENOMSG, ENOPROTOOPT, ENOSPC, + ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE, ENOTSOCK, + ENOTSUP, ENOTTY, ENXIO, EOVERFLOW, EOWNERDEAD, EPERM, EPIPE, + EPROTO, EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, + ESRCH, ESTALE, ETIMEDOUT, ETXTBSY, EXDEV, ENOTCAPABLE, +}; + +static int +amd64_cloudabi64_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) == -1) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + retval[0] = regs.r_rax; + retval[1] = regs.r_rdx; + *errorp = (regs.r_rflags & PSL_C) != 0; + if (*errorp && *retval >= 0 && *retval < nitems(cloudabi_errno_table)) + *retval = cloudabi_errno_table[*retval]; + return (0); +} + +static struct procabi amd64_cloudabi64 = { + "CloudABI ELF64", + cloudabi64_syscallnames, + nitems(cloudabi64_syscallnames), + amd64_cloudabi64_fetch_args, + amd64_cloudabi64_fetch_retval +}; + +PROCABI(amd64_cloudabi64); Added: head/usr.bin/truss/amd64cloudabi64.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/amd64cloudabi64.conf Fri Oct 2 11:17:15 2015 (r288487) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +sysnames="cloudabi64_syscalls.h" +sysproto="/dev/null" +sysproto_h="/dev/null" +syshdr="/dev/null" +sysmk="/dev/null" +syssw="/dev/null" +syshide="/dev/null" +syscallprefix="SYS_" +switchname="sysent" +namesname="cloudabi64_syscallnames" +systrace="/dev/null" From owner-svn-src-all@freebsd.org Fri Oct 2 11:27:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20674A0EFBF; Fri, 2 Oct 2015 11:27:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 124B71055; Fri, 2 Oct 2015 11:27:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BRYgS053404; Fri, 2 Oct 2015 11:27:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BRYEB053403; Fri, 2 Oct 2015 11:27:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021127.t92BRYEB053403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 11:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288488 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 11:27:35 -0000 Author: mav Date: Fri Oct 2 11:27:34 2015 New Revision: 288488 URL: https://svnweb.freebsd.org/changeset/base/288488 Log: Document CD block size of 2048. Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Fri Oct 2 11:17:15 2015 (r288487) +++ head/usr.sbin/ctld/ctl.conf.5 Fri Oct 2 11:27:34 2015 (r288488) @@ -387,7 +387,7 @@ testing. The default backend is block. .It Ic blocksize Ar size The blocksize visible to the initiator. -The default blocksize is 512. +The default blocksize is 512 for disks, and 2048 for CD/DVDs. .It Ic ctl-lun Ar lun_id Global numeric identifier to use for a given LUN inside CTL. By default CTL allocates those IDs dynamically, but explicit specification From owner-svn-src-all@freebsd.org Fri Oct 2 12:50:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66C8BA0CA0B; Fri, 2 Oct 2015 12:50:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58D891DA7; Fri, 2 Oct 2015 12:50:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92CoD7T086741; Fri, 2 Oct 2015 12:50:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92CoDCw086740; Fri, 2 Oct 2015 12:50:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021250.t92CoDCw086740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 12:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r288489 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 12:50:13 -0000 Author: kib Date: Fri Oct 2 12:50:12 2015 New Revision: 288489 URL: https://svnweb.freebsd.org/changeset/base/288489 Log: Free Eric. Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Fri Oct 2 11:27:34 2015 (r288488) +++ svnadmin/conf/mentors Fri Oct 2 12:50:12 2015 (r288489) @@ -31,7 +31,6 @@ peterj jhb Co-mentor: grog slm ken Co-mentor: scottl, ambrisko snb dwmalone torek rpaulo -vangyzen kib venkat delphij Co-mentor: luigi, jhb versus gavin Co-mentor: fjoe whu royger Co-mentor: gibbs From owner-svn-src-all@freebsd.org Fri Oct 2 13:16:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13DB9A0DBE7; Fri, 2 Oct 2015 13:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 054D71AFB; Fri, 2 Oct 2015 13:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DG6BB098750; Fri, 2 Oct 2015 13:16:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DG6gF098749; Fri, 2 Oct 2015 13:16:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201510021316.t92DG6gF098749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 2 Oct 2015 13:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288490 - head/usr.sbin/kldxref 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 13:16:07 -0000 Author: emaste Date: Fri Oct 2 13:16:06 2015 New Revision: 288490 URL: https://svnweb.freebsd.org/changeset/base/288490 Log: Add debug file extension to kldxref(8) after r288176 After r288176 kernel debug files have the extension .debug. They also moved to /usr/lib/debug/boot/kernel by default so in the normal case kldxref does not encounter them. A src.conf(5) setting may be used to continue installing them in /boot/kernel though, so have kldxref skip .debug files in addition to .symbols files. Reported by: fabient Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/kldxref/kldxref.c Modified: head/usr.sbin/kldxref/kldxref.c ============================================================================== --- head/usr.sbin/kldxref/kldxref.c Fri Oct 2 12:50:12 2015 (r288489) +++ head/usr.sbin/kldxref/kldxref.c Fri Oct 2 13:16:06 2015 (r288490) @@ -360,9 +360,12 @@ main(int argc, char *argv[]) fwrite(&ival, sizeof(ival), 1, fxref); reccnt = 0; } - /* skip non-files or .symbols entries */ + /* skip non-files and separate debug files */ if (p->fts_info != FTS_F) continue; + if (p->fts_namelen >= 6 && + strcmp(p->fts_name + p->fts_namelen - 6, ".debug") == 0) + continue; if (p->fts_namelen >= 8 && strcmp(p->fts_name + p->fts_namelen - 8, ".symbols") == 0) continue; From owner-svn-src-all@freebsd.org Fri Oct 2 13:21:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6371CA0E006; Fri, 2 Oct 2015 13:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54EFE1ECC; Fri, 2 Oct 2015 13:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DLA1u002728; Fri, 2 Oct 2015 13:21:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DL9nr002723; Fri, 2 Oct 2015 13:21:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021321.t92DL9nr002723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288491 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 13:21:10 -0000 Author: kib Date: Fri Oct 2 13:21:08 2015 New Revision: 288491 URL: https://svnweb.freebsd.org/changeset/base/288491 Log: FreeBSD does not support SMP on ARMv5. Since processor is always self-consistent, there is no need in anything but compiler barrier in the implementation of atomic_thread_fence_*() on ARMv5. Split implementation of fences for ARMv4/5 and ARMv6; the former use compiler barriers, the later also perform hardware barriers. An issue which is fixed by the change is the faults from the CP15 coprocessor accesses in the user mode. This was uncovered by the pthread_once() changes in r287556. Reported by: Mattia Rossi Discussed with: alc, cognet, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/arm/include/atomic-v4.h head/sys/arm/include/atomic-v6.h head/sys/arm/include/atomic.h Modified: head/sys/arm/include/atomic-v4.h ============================================================================== --- head/sys/arm/include/atomic-v4.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic-v4.h Fri Oct 2 13:21:08 2015 (r288491) @@ -439,4 +439,37 @@ atomic_subtract_long(volatile u_long *p, atomic_subtract_32((volatile uint32_t *)p, v); } +/* + * ARMv5 does not support SMP. For both kernel and user modes, only a + * compiler barrier is needed for fences, since CPU is always + * self-consistent. + */ +static __inline void +atomic_thread_fence_acq(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_rel(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_acq_rel(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_seq_cst(void) +{ + + __compiler_membar(); +} + #endif /* _MACHINE_ATOMIC_H_ */ Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic-v6.h Fri Oct 2 13:21:08 2015 (r288491) @@ -596,4 +596,32 @@ atomic_store_rel_long(volatile u_long *p #undef ATOMIC_ACQ_REL #undef ATOMIC_ACQ_REL_LONG +static __inline void +atomic_thread_fence_acq(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_rel(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_acq_rel(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_seq_cst(void) +{ + + dmb(); +} + #endif /* _MACHINE_ATOMIC_V6_H_ */ Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic.h Fri Oct 2 13:21:08 2015 (r288491) @@ -82,34 +82,6 @@ atomic_store_long(volatile u_long *dst, *dst = src; } -static __inline void -atomic_thread_fence_acq(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_rel(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_acq_rel(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_seq_cst(void) -{ - - dmb(); -} - #define atomic_clear_ptr atomic_clear_32 #define atomic_set_ptr atomic_set_32 #define atomic_cmpset_ptr atomic_cmpset_32 From owner-svn-src-all@freebsd.org Fri Oct 2 13:26:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CCB1A0E30D; Fri, 2 Oct 2015 13:26:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E7EB11B0; Fri, 2 Oct 2015 13:26:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DQ0CX002989; Fri, 2 Oct 2015 13:26:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DQ0Ds002986; Fri, 2 Oct 2015 13:26:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021326.t92DQ0Ds002986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288492 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 13:26:00 -0000 Author: kib Date: Fri Oct 2 13:25:59 2015 New Revision: 288492 URL: https://svnweb.freebsd.org/changeset/base/288492 Log: Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct implementation of IEEE 754 arithmetic depends on denormals operating correctly. Both perl test suite and paranoia tripped over the setting. Reported by: Stefan Parvu Discussed with: andrew Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/arm/arm/machdep.c head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_vfpcpu = -1; - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; } Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); pcb2->pcb_vfpcpu = -1; - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; tf = td2->td_frame; tf->tf_spsr &= ~PSR_C; From owner-svn-src-all@freebsd.org Fri Oct 2 13:30:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66750A0E676; Fri, 2 Oct 2015 13:30:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C0C15DD; Fri, 2 Oct 2015 13:30:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DUvIQ005685; Fri, 2 Oct 2015 13:30:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DUuOi005683; Fri, 2 Oct 2015 13:30:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021330.t92DUuOi005683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288493 - in head/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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 13:30:57 -0000 Author: kib Date: Fri Oct 2 13:30:56 2015 New Revision: 288493 URL: https://svnweb.freebsd.org/changeset/base/288493 Log: Add aarch64 support to truss(1). Reviewed by: jhb Discussed with: emaste (license) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3750 Added: head/usr.bin/truss/aarch64-fbsd.c (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Fri Oct 2 13:25:59 2015 (r288492) +++ head/usr.bin/Makefile Fri Oct 2 13:30:56 2015 (r288493) @@ -266,10 +266,8 @@ SUBDIR+= iscsictl .if ${MK_KDUMP} != "no" SUBDIR+= kdump -.if ${MACHINE_ARCH} != "aarch64" # ARM64TODO truss does not build SUBDIR+= truss .endif -.endif .if ${MK_KERBEROS_SUPPORT} != "no" SUBDIR+= compile_et Added: head/usr.bin/truss/aarch64-fbsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/aarch64-fbsd.c Fri Oct 2 13:30:56 2015 (r288493) @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2015 The FreeBSD Foundation + * + * Portions of this software were developed 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: + * 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/arm64-specific system call handling. */ + +#include +#include + +#include +#include +#include + +#include + +#include "truss.h" + +extern const char *syscallnames[]; /* silence compiler */ +#include "syscalls.h" + +static int +aarch64_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.x[8]; + if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) { + reg = 1; + syscall_num = regs.x[0]; + } else { + reg = 0; + } + + for (i = 0; i < narg && reg < 8; i++, reg++) + cs->args[i] = regs.x[reg]; + return (0); +} + +static int +aarch64_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.x[0]; + retval[1] = regs.x[1]; + *errorp = !!(regs.spsr & PSR_C); + return (0); +} + +static struct procabi aarch64_fbsd = { + "FreeBSD ELF64", + syscallnames, + nitems(syscallnames), + aarch64_fetch_args, + aarch64_fetch_retval +}; + +PROCABI(aarch64_fbsd); From owner-svn-src-all@freebsd.org Fri Oct 2 13:48:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D057A0D226; Fri, 2 Oct 2015 13:48:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5E4E10E7; Fri, 2 Oct 2015 13:48:32 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DmWOt011528; Fri, 2 Oct 2015 13:48:32 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DmWrS011527; Fri, 2 Oct 2015 13:48:32 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021348.t92DmWrS011527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 13:48:32 +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: r288494 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 13:48:33 -0000 Author: vangyzen Date: Fri Oct 2 13:48:32 2015 New Revision: 288494 URL: https://svnweb.freebsd.org/changeset/base/288494 Log: MFC r280792 Clean up some cosmetic nits in kern_umtx.c, found during recent work in this area and by the Clang static analyzer. Remove some dead assignments. Fix a typo in a panic string. Use umtx_pi_disown() instead of duplicate code. Use an existing variable instead of curthread. Approved by: kib (mentor until recently) Sponsored by: Dell Inc. Modified: stable/10/sys/kern/kern_umtx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_umtx.c ============================================================================== --- stable/10/sys/kern/kern_umtx.c Fri Oct 2 13:30:56 2015 (r288493) +++ stable/10/sys/kern/kern_umtx.c Fri Oct 2 13:48:32 2015 (r288494) @@ -1273,7 +1273,7 @@ kern_umtx_wake(struct thread *td, void * is_private ? THREAD_SHARE : AUTO_SHARE, &key)) != 0) return (ret); umtxq_lock(&key); - ret = umtxq_signal(&key, n_wake); + umtxq_signal(&key, n_wake); umtxq_unlock(&key); umtx_key_release(&key); return (0); @@ -1805,7 +1805,7 @@ umtx_pi_setowner(struct umtx_pi *pi, str uq_owner = owner->td_umtxq; mtx_assert(&umtx_lock, MA_OWNED); if (pi->pi_owner != NULL) - panic("pi_ower != NULL"); + panic("pi_owner != NULL"); pi->pi_owner = owner; TAILQ_INSERT_TAIL(&uq_owner->uq_pi_contested, pi, pi_link); } @@ -1829,9 +1829,8 @@ umtx_pi_disown(struct umtx_pi *pi) static int umtx_pi_claim(struct umtx_pi *pi, struct thread *owner) { - struct umtx_q *uq, *uq_owner; + struct umtx_q *uq; - uq_owner = owner->td_umtxq; mtx_lock(&umtx_lock); if (pi->pi_owner == owner) { mtx_unlock(&umtx_lock); @@ -1977,11 +1976,8 @@ umtx_pi_unref(struct umtx_pi *pi) KASSERT(pi->pi_refcount > 0, ("invalid reference count")); if (--pi->pi_refcount == 0) { mtx_lock(&umtx_lock); - if (pi->pi_owner != NULL) { - TAILQ_REMOVE(&pi->pi_owner->td_umtxq->uq_pi_contested, - pi, pi_link); - pi->pi_owner = NULL; - } + if (pi->pi_owner != NULL) + umtx_pi_disown(pi); KASSERT(TAILQ_EMPTY(&pi->pi_blocked), ("blocked queue not empty")); mtx_unlock(&umtx_lock); @@ -2241,7 +2237,7 @@ do_unlock_pi(struct thread *td, struct u mtx_lock(&umtx_lock); pi = uq_first->uq_pi_blocked; KASSERT(pi != NULL, ("pi == NULL?")); - if (pi->pi_owner != curthread) { + if (pi->pi_owner != td) { mtx_unlock(&umtx_lock); umtxq_unbusy(&key); umtxq_unlock(&key); @@ -2249,7 +2245,7 @@ do_unlock_pi(struct thread *td, struct u /* userland messed the mutex */ return (EPERM); } - uq_me = curthread->td_umtxq; + uq_me = td->td_umtxq; umtx_pi_disown(pi); /* get highest priority thread which is still sleeping. */ uq_first = TAILQ_FIRST(&pi->pi_blocked); @@ -2265,9 +2261,9 @@ do_unlock_pi(struct thread *td, struct u pri = UPRI(uq_first2->uq_thread); } } - thread_lock(curthread); - sched_lend_user_prio(curthread, pri); - thread_unlock(curthread); + thread_lock(td); + sched_lend_user_prio(td, pri); + thread_unlock(td); mtx_unlock(&umtx_lock); if (uq_first) umtxq_signal_thread(uq_first); From owner-svn-src-all@freebsd.org Fri Oct 2 14:11:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69BD1A0E5FC; Fri, 2 Oct 2015 14:11:45 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 412B610E1; Fri, 2 Oct 2015 14:11:45 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92EBjgp023612; Fri, 2 Oct 2015 14:11:45 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92EBiJf023608; Fri, 2 Oct 2015 14:11:44 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021411.t92EBiJf023608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 14:11:44 +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: r288495 - stable/10/usr.sbin/pmcstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:11:45 -0000 Author: vangyzen Date: Fri Oct 2 14:11:44 2015 New Revision: 288495 URL: https://svnweb.freebsd.org/changeset/base/288495 Log: MFC r280793 pmcstat.8: fix -a flag description; improve -m flag to match The -a flag reads a file saved by -O, not -o. The -m flag requires the -R flag. Copy that paragraph from -a. Sponsored by: Dell Inc. Modified: stable/10/usr.sbin/pmcstat/pmcstat.8 stable/10/usr.sbin/pmcstat/pmcstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- stable/10/usr.sbin/pmcstat/pmcstat.8 Fri Oct 2 13:48:32 2015 (r288494) +++ stable/10/usr.sbin/pmcstat/pmcstat.8 Fri Oct 2 14:11:44 2015 (r288495) @@ -236,7 +236,7 @@ This option requires the .Fl R option to read in samples that were previously collected and saved with the -.Fl o +.Fl O option. .It Fl c Ar cpu-spec Set the cpus for subsequent system mode PMCs specified on the @@ -302,6 +302,12 @@ is a this information is sent to the output file specified by the .Fl o option. +This option requires the +.Fl R +option to read in samples that were previously collected and +saved with the +.Fl O +option. .It Fl n Ar rate Set the default sampling rate for subsequent sampling mode PMCs specified on the command line. Modified: stable/10/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/10/usr.sbin/pmcstat/pmcstat.c Fri Oct 2 13:48:32 2015 (r288494) +++ stable/10/usr.sbin/pmcstat/pmcstat.c Fri Oct 2 14:11:44 2015 (r288495) @@ -938,7 +938,7 @@ main(int argc, char **argv) errx(EX_USAGE, "ERROR: options -T and -l are mutually " "exclusive."); - /* -m option is allowed with -R only. */ + /* -a and -m require -R */ if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL) errx(EX_USAGE, "ERROR: option %s requires an input file", args.pa_plugin == PMCSTAT_PL_ANNOTATE ? "-m" : "-a"); From owner-svn-src-all@freebsd.org Fri Oct 2 14:16:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1171DA0EA49; Fri, 2 Oct 2015 14:16:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0169714A5; Fri, 2 Oct 2015 14:16:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92EGc0Y023842; Fri, 2 Oct 2015 14:16:38 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92EGc3V023840; Fri, 2 Oct 2015 14:16:38 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021416.t92EGc3V023840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 14:16:38 +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: r288496 - stable/9/usr.sbin/pmcstat 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:16:39 -0000 Author: vangyzen Date: Fri Oct 2 14:16:37 2015 New Revision: 288496 URL: https://svnweb.freebsd.org/changeset/base/288496 Log: MFC r280793 pmcstat.8: The -m flag requires the -R flag. Approved by: kib (mentor until recently) Sponsored by: Dell Inc. Modified: stable/9/usr.sbin/pmcstat/pmcstat.8 stable/9/usr.sbin/pmcstat/pmcstat.c Directory Properties: stable/9/usr.sbin/pmcstat/ (props changed) Modified: stable/9/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat.8 Fri Oct 2 14:11:44 2015 (r288495) +++ stable/9/usr.sbin/pmcstat/pmcstat.8 Fri Oct 2 14:16:37 2015 (r288496) @@ -279,6 +279,12 @@ is a this information is sent to the output file specified by the .Fl o option. +This option requires the +.Fl R +option to read in samples that were previously collected and +saved with the +.Fl O +option. .It Fl n Ar rate Set the default sampling rate for subsequent sampling mode PMCs specified on the command line. Modified: stable/9/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat.c Fri Oct 2 14:11:44 2015 (r288495) +++ stable/9/usr.sbin/pmcstat/pmcstat.c Fri Oct 2 14:16:37 2015 (r288496) @@ -935,7 +935,7 @@ main(int argc, char **argv) errx(EX_USAGE, "ERROR: options -T and -l are mutually " "exclusive."); - /* -m option is allowed with -R only. */ + /* -m requires -R */ if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL) errx(EX_USAGE, "ERROR: option -m requires an input file"); From owner-svn-src-all@freebsd.org Fri Oct 2 14:21:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5603AA0EE01; Fri, 2 Oct 2015 14:21:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4647D1902; Fri, 2 Oct 2015 14:21:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92EL8S1026501; Fri, 2 Oct 2015 14:21:08 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92EL7Gc026499; Fri, 2 Oct 2015 14:21:07 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021421.t92EL7Gc026499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 14:21: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: r288497 - in stable/10: share/man/man9 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:21:08 -0000 Author: vangyzen Date: Fri Oct 2 14:21:07 2015 New Revision: 288497 URL: https://svnweb.freebsd.org/changeset/base/288497 Log: MFC r281785 Always send log(9) messages to the message buffer. It is truer to the semantics of logging for messages to *always* go to the message buffer, where they can eventually be collected and, in fact, be put into a log file. This restores the behavior prior to r70239, which seems to have changed it inadvertently. Submitted by: Eric Badger Obtained from: Dell Inc. Modified: stable/10/share/man/man9/printf.9 stable/10/sys/kern/subr_prf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/printf.9 ============================================================================== --- stable/10/share/man/man9/printf.9 Fri Oct 2 14:16:37 2015 (r288496) +++ stable/10/share/man/man9/printf.9 Fri Oct 2 14:21:07 2015 (r288497) @@ -67,7 +67,8 @@ The .Fn log function sends the message to the kernel logging facility, using the log level as indicated by -.Fa pri . +.Fa pri , +and to the console if no process is yet reading the log. .Pp Each of these related functions use the .Fa fmt Modified: stable/10/sys/kern/subr_prf.c ============================================================================== --- stable/10/sys/kern/subr_prf.c Fri Oct 2 14:16:37 2015 (r288496) +++ stable/10/sys/kern/subr_prf.c Fri Oct 2 14:21:07 2015 (r288497) @@ -305,7 +305,7 @@ log(int level, const char *fmt, ...) va_list ap; va_start(ap, fmt); - (void)_vprintf(level, log_open ? TOLOG : TOCONS, fmt, ap); + (void)_vprintf(level, log_open ? TOLOG : TOCONS | TOLOG, fmt, ap); va_end(ap); msgbuftrigger = 1; From owner-svn-src-all@freebsd.org Fri Oct 2 14:24:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CA7EA0D03A; Fri, 2 Oct 2015 14:24:40 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D1DC1C78; Fri, 2 Oct 2015 14:24:40 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92EOdbG027976; Fri, 2 Oct 2015 14:24:39 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92EOdxp027975; Fri, 2 Oct 2015 14:24:39 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021424.t92EOdxp027975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 14:24: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: r288498 - stable/10/sbin/dmesg 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:24:40 -0000 Author: vangyzen Date: Fri Oct 2 14:24:39 2015 New Revision: 288498 URL: https://svnweb.freebsd.org/changeset/base/288498 Log: MFC r281787 dmesg: accommodate message buffer growth between the sysctl calls Allocate 12.5% extra space to avoid ENOMEM when the message buffer is growing steadily. Reported by: Steve Wahl (and tested) Sponsored by: Dell Inc. Modified: stable/10/sbin/dmesg/dmesg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/dmesg/dmesg.c ============================================================================== --- stable/10/sbin/dmesg/dmesg.c Fri Oct 2 14:21:07 2015 (r288497) +++ stable/10/sbin/dmesg/dmesg.c Fri Oct 2 14:24:39 2015 (r288498) @@ -116,6 +116,9 @@ main(int argc, char *argv[]) */ if (sysctlbyname("kern.msgbuf", NULL, &buflen, NULL, 0) == -1) err(1, "sysctl kern.msgbuf"); + /* Allocate extra room for growth between the sysctl calls. */ + buflen += buflen/8; + /* Allocate more than sysctl sees, for room to append \n\0. */ if ((bp = malloc(buflen + 2)) == NULL) errx(1, "malloc failed"); if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == -1) From owner-svn-src-all@freebsd.org Fri Oct 2 14:26:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 023DCA0D22D for ; Fri, 2 Oct 2015 14:26:14 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE2541F0F for ; Fri, 2 Oct 2015 14:26:13 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Fri, 2 Oct 2015 14:26:53 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t92EQAJg020591; Fri, 2 Oct 2015 08:26:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1443795970.66572.68.camel@freebsd.org> Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Ian Lepore To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 08:26:10 -0600 In-Reply-To: <201510021326.t92DQ0Ds002986@repo.freebsd.org> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:26:14 -0000 On Fri, 2015-10-02 at 13:26 +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Oct 2 13:25:59 2015 > New Revision: 288492 > URL: https://svnweb.freebsd.org/changeset/base/288492 > > Log: > Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct > implementation of IEEE 754 arithmetic depends on denormals operating > correctly. Both perl test suite and paranoia tripped over the > setting. > > Reported by: Stefan Parvu > Discussed with: andrew > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/arm/arm/machdep.c > head/sys/arm/arm/vm_machdep.c > > Modified: head/sys/arm/arm/machdep.c > ============================================================================== > --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) > (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; > thread0.td_pcb->pcb_flags = 0; > thread0.td_pcb->pcb_vfpcpu = -1; > - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; > thread0.td_frame = &proc0_tf; > pcpup->pc_curpcb = thread0.td_pcb; > } > > Modified: head/sys/arm/arm/vm_machdep.c > ============================================================================== > --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re > pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); > > pcb2->pcb_vfpcpu = -1; > - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; > > tf = td2->td_frame; > tf->tf_spsr &= ~PSR_C; > Some arm documentation refers to the need for "support code" when the flush-to-zero option is disabled on VFPv2 hardware (which for us would be just the RPi I think). Do we have that support code? What happens if it's missing? I can't actually find any info on exactly what that support code is supposed to do. For all I know, we have the required code in libm. Or maybe what's needed is exception-handling code in the kernel. I can't find any info on what they mean by "support code" in this context. I don't think this is an issue for VFPv3 and later hardware. I've looked in a few of the TRMs for different cortex-a series processors and they say the hardware handles all combinations of rounding and flush to zero without support software. But we should probably be on the lookout for reports of misbehaving apps on RPi after this change, just in case this setting has been protecting us from our ignorance there. -- Ian From owner-svn-src-all@freebsd.org Fri Oct 2 14:36:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C7F7A0D9E1; Fri, 2 Oct 2015 14:36:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0051155B; Fri, 2 Oct 2015 14:36:43 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92EahEl032467; Fri, 2 Oct 2015 14:36:43 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92EafPt032456; Fri, 2 Oct 2015 14:36:41 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021436.t92EafPt032456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 14:36:41 +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: r288499 - in stable/10/sys: compat/linprocfs dev/hwpmc fs/procfs kern vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 14:36:44 -0000 Author: vangyzen Date: Fri Oct 2 14:36:41 2015 New Revision: 288499 URL: https://svnweb.freebsd.org/changeset/base/288499 Log: MFC r283924 Provide vnode in memory map info for files on tmpfs When providing memory map information to userland, populate the vnode pointer for tmpfs files. Set the memory mapping to appear as a vnode type, to match FreeBSD 9 behavior. This fixes the use of tmpfs files with the dtrace pid provider, procstat -v, procfs, linprocfs, pmc (pmcstat), and ptrace (PT_VM_ENTRY). Submitted by: Eric Badger (initial revision) Obtained from: Dell Inc. PR: 198431 Modified: stable/10/sys/compat/linprocfs/linprocfs.c stable/10/sys/dev/hwpmc/hwpmc_mod.c stable/10/sys/fs/procfs/procfs_map.c stable/10/sys/kern/kern_proc.c stable/10/sys/kern/sys_process.c stable/10/sys/vm/vm_object.c stable/10/sys/vm/vm_object.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/10/sys/compat/linprocfs/linprocfs.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/compat/linprocfs/linprocfs.c Fri Oct 2 14:36:41 2015 (r288499) @@ -1042,20 +1042,16 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) ino = 0; if (lobj) { off = IDX_TO_OFF(lobj->size); - if (lobj->type == OBJT_VNODE) { - vp = lobj->handle; - if (vp) - vref(vp); - } - else - vp = NULL; + vp = vm_object_vnode(lobj); + if (vp != NULL) + vref(vp); if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); flags = obj->flags; ref_count = obj->ref_count; shadow_count = obj->shadow_count; VM_OBJECT_RUNLOCK(obj); - if (vp) { + if (vp != NULL) { vn_fullpath(td, vp, &name, &freename); vn_lock(vp, LK_SHARED | LK_RETRY); VOP_GETATTR(vp, &vat, td->td_ucred); Modified: stable/10/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/10/sys/dev/hwpmc/hwpmc_mod.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/dev/hwpmc/hwpmc_mod.c Fri Oct 2 14:36:41 2015 (r288499) @@ -1660,7 +1660,8 @@ pmc_log_process_mappings(struct pmc_owne continue; } - if (lobj->type != OBJT_VNODE || lobj->handle == NULL) { + vp = vm_object_vnode(lobj); + if (vp == NULL) { if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); VM_OBJECT_RUNLOCK(obj); @@ -1672,7 +1673,7 @@ pmc_log_process_mappings(struct pmc_owne * vnode, so we don't emit redundant MAP-IN * directives. */ - if (entry->start == last_end && lobj->handle == last_vp) { + if (entry->start == last_end && vp == last_vp) { last_end = entry->end; if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); @@ -1695,7 +1696,6 @@ pmc_log_process_mappings(struct pmc_owne last_timestamp = map->timestamp; vm_map_unlock_read(map); - vp = lobj->handle; vref(vp); if (lobj != obj) VM_OBJECT_RUNLOCK(lobj); Modified: stable/10/sys/fs/procfs/procfs_map.c ============================================================================== --- stable/10/sys/fs/procfs/procfs_map.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/fs/procfs/procfs_map.c Fri Oct 2 14:36:41 2015 (r288499) @@ -159,11 +159,11 @@ procfs_doprocmap(PFS_FILL_ARGS) freepath = NULL; fullpath = "-"; if (lobj) { + vp = NULL; switch (lobj->type) { default: case OBJT_DEFAULT: type = "default"; - vp = NULL; break; case OBJT_VNODE: type = "vnode"; @@ -171,13 +171,19 @@ procfs_doprocmap(PFS_FILL_ARGS) vref(vp); break; case OBJT_SWAP: - type = "swap"; - vp = NULL; + if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { + type = "vnode"; + if ((lobj->flags & OBJ_TMPFS) != 0) { + vp = lobj->un_pager.swp.swp_tmpfs; + vref(vp); + } + } else { + type = "swap"; + } break; case OBJT_SG: case OBJT_DEVICE: type = "device"; - vp = NULL; break; } if (lobj != obj) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/kern/kern_proc.c Fri Oct 2 14:36:41 2015 (r288499) @@ -2074,7 +2074,15 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A vref(vp); break; case OBJT_SWAP: - kve->kve_type = KVME_TYPE_SWAP; + if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { + kve->kve_type = KVME_TYPE_VNODE; + if ((lobj->flags & OBJ_TMPFS) != 0) { + vp = lobj->un_pager.swp.swp_tmpfs; + vref(vp); + } + } else { + kve->kve_type = KVME_TYPE_SWAP; + } break; case OBJT_DEVICE: kve->kve_type = KVME_TYPE_DEVICE; @@ -2300,7 +2308,15 @@ kern_proc_vmmap_out(struct proc *p, stru vref(vp); break; case OBJT_SWAP: - kve->kve_type = KVME_TYPE_SWAP; + if ((lobj->flags & OBJ_TMPFS_NODE) != 0) { + kve->kve_type = KVME_TYPE_VNODE; + if ((lobj->flags & OBJ_TMPFS) != 0) { + vp = lobj->un_pager.swp.swp_tmpfs; + vref(vp); + } + } else { + kve->kve_type = KVME_TYPE_SWAP; + } break; case OBJT_DEVICE: kve->kve_type = KVME_TYPE_DEVICE; Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/kern/sys_process.c Fri Oct 2 14:36:41 2015 (r288499) @@ -402,7 +402,7 @@ ptrace_vm_entry(struct thread *td, struc lobj = tobj; pve->pve_offset += tobj->backing_object_offset; } - vp = (lobj->type == OBJT_VNODE) ? lobj->handle : NULL; + vp = vm_object_vnode(lobj); if (vp != NULL) vref(vp); if (lobj != obj) Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/vm/vm_object.c Fri Oct 2 14:36:41 2015 (r288499) @@ -2270,6 +2270,18 @@ next_page: } } +struct vnode * +vm_object_vnode(vm_object_t object) +{ + + VM_OBJECT_ASSERT_LOCKED(object); + if (object->type == OBJT_VNODE) + return (object->handle); + if (object->type == OBJT_SWAP && (object->flags & OBJ_TMPFS) != 0) + return (object->un_pager.swp.swp_tmpfs); + return (NULL); +} + static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { Modified: stable/10/sys/vm/vm_object.h ============================================================================== --- stable/10/sys/vm/vm_object.h Fri Oct 2 14:24:39 2015 (r288498) +++ stable/10/sys/vm/vm_object.h Fri Oct 2 14:36:41 2015 (r288499) @@ -297,6 +297,7 @@ boolean_t vm_object_sync(vm_object_t, vm boolean_t); void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t length, uint8_t queue); +struct vnode *vm_object_vnode(vm_object_t object); #endif /* _KERNEL */ #endif /* _VM_OBJECT_ */ From owner-svn-src-all@freebsd.org Fri Oct 2 15:07:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74EF1A0EDB8; Fri, 2 Oct 2015 15:07:03 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64C3F17B4; Fri, 2 Oct 2015 15:07:03 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92F73Nx044989; Fri, 2 Oct 2015 15:07:03 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92F730p044988; Fri, 2 Oct 2015 15:07:03 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201510021507.t92F730p044988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 2 Oct 2015 15:07:03 +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: r288500 - stable/9/sbin/dmesg 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:07:03 -0000 Author: vangyzen Date: Fri Oct 2 15:07:02 2015 New Revision: 288500 URL: https://svnweb.freebsd.org/changeset/base/288500 Log: MFC r281787 dmesg: accommodate message buffer growth between the sysctl calls Allocate 12.5% extra space to avoid ENOMEM when the message buffer is growing steadily. Reported by: Steve Wahl (and tested) Approved by: kib (mentor until recently) Obtained from: Dell Inc. Modified: stable/9/sbin/dmesg/dmesg.c Directory Properties: stable/9/sbin/dmesg/ (props changed) Modified: stable/9/sbin/dmesg/dmesg.c ============================================================================== --- stable/9/sbin/dmesg/dmesg.c Fri Oct 2 14:36:41 2015 (r288499) +++ stable/9/sbin/dmesg/dmesg.c Fri Oct 2 15:07:02 2015 (r288500) @@ -112,6 +112,9 @@ main(int argc, char *argv[]) */ if (sysctlbyname("kern.msgbuf", NULL, &buflen, NULL, 0) == -1) err(1, "sysctl kern.msgbuf"); + /* Allocate extra room for growth between the sysctl calls. */ + buflen += buflen/8; + /* Allocate more than sysctl sees, for room to append \n\0. */ if ((bp = malloc(buflen + 2)) == NULL) errx(1, "malloc failed"); if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == -1) From owner-svn-src-all@freebsd.org Fri Oct 2 15:21:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42917A0D9B8; Fri, 2 Oct 2015 15:21:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1007119F; Fri, 2 Oct 2015 15:21:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t92FKxr9062418 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 2 Oct 2015 18:20:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t92FKxr9062418 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t92FKx2o062417; Fri, 2 Oct 2015 18:20:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 2 Oct 2015 18:20:59 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151002152059.GY11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443795970.66572.68.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:21:05 -0000 On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > Some arm documentation refers to the need for "support code" when the > flush-to-zero option is disabled on VFPv2 hardware (which for us would > be just the RPi I think). Do we have that support code? What happens > if it's missing? I can't actually find any info on exactly what that > support code is supposed to do. For all I know, we have the required > code in libm. Or maybe what's needed is exception-handling code in the > kernel. I can't find any info on what they mean by "support code" in > this context. The fpscr register is user-modifiable, so whatever happens after the change, could as well happen before it. I saw the references to the support code in e.g. ARM v7-A A2.7.5 Flush-to-zero. But I was sure that the text refers to the modes when e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, fault handler must do something to allow the computation to proceed. > > I don't think this is an issue for VFPv3 and later hardware. I've > looked in a few of the TRMs for different cortex-a series processors and > they say the hardware handles all combinations of rounding and flush to > zero without support software. But we should probably be on the lookout > for reports of misbehaving apps on RPi after this change, just in case > this setting has been protecting us from our ignorance there. I did found the reference to the support code in the VFP11 TRM, which in turns point to http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html Does FreeBSD enable and handle this variant of coprocessor ? If yes, then indeed I would need to not enable FZ on the affected hardware. From owner-svn-src-all@freebsd.org Fri Oct 2 15:22:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86129A0DA85; Fri, 2 Oct 2015 15:22:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CDE314C2; Fri, 2 Oct 2015 15:22:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FM1SO053436; Fri, 2 Oct 2015 15:22:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FM1rt053435; Fri, 2 Oct 2015 15:22:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021522.t92FM1rt053435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288501 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:22:01 -0000 Author: adrian Date: Fri Oct 2 15:22:00 2015 New Revision: 288501 URL: https://svnweb.freebsd.org/changeset/base/288501 Log: rum(4): reduce code duplication. Tested: rum0: on usbus0 rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3606 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:07:02 2015 (r288500) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:22:00 2015 (r288501) @@ -199,6 +199,7 @@ static void rum_set_chan(struct rum_sof struct ieee80211_channel *); static void rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); +static void rum_abort_tsf_sync(struct rum_softc *); static void rum_update_slot(struct rum_softc *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -687,7 +688,6 @@ rum_newstate(struct ieee80211vap *vap, e const struct ieee80211_txparam *tp; enum ieee80211_state ostate; struct ieee80211_node *ni; - uint32_t tmp; ostate = vap->iv_state; DPRINTF("%s -> %s\n", @@ -700,11 +700,9 @@ rum_newstate(struct ieee80211vap *vap, e switch (nstate) { case IEEE80211_S_INIT: - if (ostate == IEEE80211_S_RUN) { - /* abort TSF synchronization */ - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); - } + if (ostate == IEEE80211_S_RUN) + rum_abort_tsf_sync(sc); + break; case IEEE80211_S_RUN: @@ -1731,6 +1729,15 @@ rum_enable_tsf(struct rum_softc *sc) } static void +rum_abort_tsf_sync(struct rum_softc *sc) +{ + uint32_t tmp; + + tmp = rum_read(sc, RT2573_TXRX_CSR9); + rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); +} + +static void rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -2217,12 +2224,9 @@ static void rum_scan_start(struct ieee80211com *ic) { struct rum_softc *sc = ic->ic_softc; - uint32_t tmp; RUM_LOCK(sc); - /* abort TSF synchronization */ - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); + rum_abort_tsf_sync(sc); rum_set_bssid(sc, ieee80211broadcastaddr); RUM_UNLOCK(sc); From owner-svn-src-all@freebsd.org Fri Oct 2 15:26:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7078A0DD51; Fri, 2 Oct 2015 15:26:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AC44184C; Fri, 2 Oct 2015 15:26:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FQYlP053675; Fri, 2 Oct 2015 15:26:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FQYgm053674; Fri, 2 Oct 2015 15:26:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021526.t92FQYgm053674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288502 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:26:34 -0000 Author: adrian Date: Fri Oct 2 15:26:33 2015 New Revision: 288502 URL: https://svnweb.freebsd.org/changeset/base/288502 Log: rum(4): move common part of rum_bbp_write() and rum_bbp_read() into rum_bbp_busy(). Submitted by: Differential Revision: https://reviews.freebsd.org/D3608 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:22:00 2015 (r288501) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:26:33 2015 (r288502) @@ -186,6 +186,7 @@ static void rum_read_multi(struct rum_s static usb_error_t rum_write(struct rum_softc *, uint16_t, uint32_t); static usb_error_t rum_write_multi(struct rum_softc *, uint16_t, void *, size_t); +static int rum_bbp_busy(struct rum_softc *); static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t); static uint8_t rum_bbp_read(struct rum_softc *, uint8_t); static void rum_rf_write(struct rum_softc *, uint8_t, uint32_t); @@ -1410,21 +1411,31 @@ rum_write_multi(struct rum_softc *sc, ui return (USB_ERR_NORMAL_COMPLETION); } -static void -rum_bbp_write(struct rum_softc *sc, uint8_t reg, uint8_t val) +static int +rum_bbp_busy(struct rum_softc *sc) { - uint32_t tmp; int ntries; - DPRINTFN(2, "reg=0x%08x\n", reg); - for (ntries = 0; ntries < 100; ntries++) { if (!(rum_read(sc, RT2573_PHY_CSR3) & RT2573_BBP_BUSY)) break; if (rum_pause(sc, hz / 100)) break; } - if (ntries == 100) { + if (ntries == 100) + return (ETIMEDOUT); + + return (0); +} + +static void +rum_bbp_write(struct rum_softc *sc, uint8_t reg, uint8_t val) +{ + uint32_t tmp; + + DPRINTFN(2, "reg=0x%08x\n", reg); + + if (rum_bbp_busy(sc) != 0) { device_printf(sc->sc_dev, "could not write to BBP\n"); return; } @@ -1441,13 +1452,7 @@ rum_bbp_read(struct rum_softc *sc, uint8 DPRINTFN(2, "reg=0x%08x\n", reg); - for (ntries = 0; ntries < 100; ntries++) { - if (!(rum_read(sc, RT2573_PHY_CSR3) & RT2573_BBP_BUSY)) - break; - if (rum_pause(sc, hz / 100)) - break; - } - if (ntries == 100) { + if (rum_bbp_busy(sc) != 0) { device_printf(sc->sc_dev, "could not read BBP\n"); return 0; } From owner-svn-src-all@freebsd.org Fri Oct 2 15:28:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52D0AA0DEE6; Fri, 2 Oct 2015 15:28:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42CB21A21; Fri, 2 Oct 2015 15:28:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FSjj4053805; Fri, 2 Oct 2015 15:28:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FSjFc053804; Fri, 2 Oct 2015 15:28:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021528.t92FSjFc053804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288503 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:28:45 -0000 Author: adrian Date: Fri Oct 2 15:28:44 2015 New Revision: 288503 URL: https://svnweb.freebsd.org/changeset/base/288503 Log: rum(4): create few wrappers. Tested: rum0: on usbus0 rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3609 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:26:33 2015 (r288502) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:28:44 2015 (r288503) @@ -186,6 +186,10 @@ static void rum_read_multi(struct rum_s static usb_error_t rum_write(struct rum_softc *, uint16_t, uint32_t); static usb_error_t rum_write_multi(struct rum_softc *, uint16_t, void *, size_t); +static usb_error_t rum_setbits(struct rum_softc *, uint16_t, uint32_t); +static usb_error_t rum_clrbits(struct rum_softc *, uint16_t, uint32_t); +static usb_error_t rum_modbits(struct rum_softc *, uint16_t, uint32_t, + uint32_t); static int rum_bbp_busy(struct rum_softc *); static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t); static uint8_t rum_bbp_read(struct rum_softc *, uint8_t); @@ -1411,6 +1415,24 @@ rum_write_multi(struct rum_softc *sc, ui return (USB_ERR_NORMAL_COMPLETION); } +static usb_error_t +rum_setbits(struct rum_softc *sc, uint16_t reg, uint32_t mask) +{ + return (rum_write(sc, reg, rum_read(sc, reg) | mask)); +} + +static usb_error_t +rum_clrbits(struct rum_softc *sc, uint16_t reg, uint32_t mask) +{ + return (rum_write(sc, reg, rum_read(sc, reg) & ~mask)); +} + +static usb_error_t +rum_modbits(struct rum_softc *sc, uint16_t reg, uint32_t set, uint32_t unset) +{ + return (rum_write(sc, reg, (rum_read(sc, reg) & ~unset) | set)); +} + static int rum_bbp_busy(struct rum_softc *sc) { @@ -1528,31 +1550,25 @@ static void rum_enable_mrr(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR4); - - tmp &= ~RT2573_MRR_CCK_FALLBACK; - if (!IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) - tmp |= RT2573_MRR_CCK_FALLBACK; - tmp |= RT2573_MRR_ENABLED; - rum_write(sc, RT2573_TXRX_CSR4, tmp); + if (!IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) { + rum_setbits(sc, RT2573_TXRX_CSR4, + RT2573_MRR_ENABLED | RT2573_MRR_CCK_FALLBACK); + } else { + rum_modbits(sc, RT2573_TXRX_CSR4, + RT2573_MRR_ENABLED, RT2573_MRR_CCK_FALLBACK); + } } static void rum_set_txpreamble(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR4); - tmp &= ~RT2573_SHORT_PREAMBLE; if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) - tmp |= RT2573_SHORT_PREAMBLE; - - rum_write(sc, RT2573_TXRX_CSR4, tmp); + rum_setbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_PREAMBLE); + else + rum_clrbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_PREAMBLE); } static void @@ -1581,7 +1597,6 @@ static void rum_select_band(struct rum_softc *sc, struct ieee80211_channel *c) { uint8_t bbp17, bbp35, bbp96, bbp97, bbp98, bbp104; - uint32_t tmp; /* update all BBP registers that depend on the band */ bbp17 = 0x20; bbp96 = 0x48; bbp104 = 0x2c; @@ -1611,13 +1626,13 @@ rum_select_band(struct rum_softc *sc, st rum_bbp_write(sc, 97, bbp97); rum_bbp_write(sc, 98, bbp98); - tmp = rum_read(sc, RT2573_PHY_CSR0); - tmp &= ~(RT2573_PA_PE_2GHZ | RT2573_PA_PE_5GHZ); - if (IEEE80211_IS_CHAN_2GHZ(c)) - tmp |= RT2573_PA_PE_2GHZ; - else - tmp |= RT2573_PA_PE_5GHZ; - rum_write(sc, RT2573_PHY_CSR0, tmp); + if (IEEE80211_IS_CHAN_2GHZ(c)) { + rum_modbits(sc, RT2573_PHY_CSR0, RT2573_PA_PE_2GHZ, + RT2573_PA_PE_5GHZ); + } else { + rum_modbits(sc, RT2573_PHY_CSR0, RT2573_PA_PE_5GHZ, + RT2573_PA_PE_2GHZ); + } } static void @@ -1728,18 +1743,14 @@ rum_enable_tsf_sync(struct rum_softc *sc static void rum_enable_tsf(struct rum_softc *sc) { - rum_write(sc, RT2573_TXRX_CSR9, - (rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000) | - RT2573_TSF_TICKING | RT2573_TSF_MODE(2)); + rum_modbits(sc, RT2573_TXRX_CSR9, + RT2573_TSF_TICKING | RT2573_TSF_MODE(2), 0x00ffffff); } static void rum_abort_tsf_sync(struct rum_softc *sc) { - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); + rum_clrbits(sc, RT2573_TXRX_CSR9, 0x00ffffff); } static void @@ -1747,13 +1758,10 @@ rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; - uint32_t tmp; slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; - tmp = rum_read(sc, RT2573_MAC_CSR9); - tmp = (tmp & ~0xff) | slottime; - rum_write(sc, RT2573_MAC_CSR9, tmp); + rum_modbits(sc, RT2573_MAC_CSR9, slottime, 0xff); DPRINTF("setting slot time to %uus\n", slottime); } @@ -1785,17 +1793,14 @@ rum_set_macaddr(struct rum_softc *sc, co static void rum_setpromisc(struct rum_softc *sc) { - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR0); - - tmp &= ~RT2573_DROP_NOT_TO_ME; - if (sc->sc_ic.ic_promisc == 0) - tmp |= RT2573_DROP_NOT_TO_ME; + struct ieee80211com *ic = &sc->sc_ic; - rum_write(sc, RT2573_TXRX_CSR0, tmp); + if (ic->ic_promisc == 0) + rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DROP_NOT_TO_ME); + else + rum_clrbits(sc, RT2573_TXRX_CSR0, RT2573_DROP_NOT_TO_ME); - DPRINTF("%s promiscuous mode\n", sc->sc_ic.ic_promisc > 0 ? + DPRINTF("%s promiscuous mode\n", ic->ic_promisc > 0 ? "entering" : "leaving"); } @@ -2033,7 +2038,6 @@ fail: rum_stop(sc); static void rum_stop(struct rum_softc *sc) { - uint32_t tmp; RUM_LOCK_ASSERT(sc, MA_OWNED); @@ -2052,8 +2056,7 @@ rum_stop(struct rum_softc *sc) rum_unsetup_tx_list(sc); /* disable Rx */ - tmp = rum_read(sc, RT2573_TXRX_CSR0); - rum_write(sc, RT2573_TXRX_CSR0, tmp | RT2573_DISABLE_RX); + rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DISABLE_RX); /* reset ASIC */ rum_write(sc, RT2573_MAC_CSR1, 3); From owner-svn-src-all@freebsd.org Fri Oct 2 15:30:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE062A0E15B; Fri, 2 Oct 2015 15:30:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 767E91D6A; Fri, 2 Oct 2015 15:30:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FUcsL053952; Fri, 2 Oct 2015 15:30:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FUbEh053950; Fri, 2 Oct 2015 15:30:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021530.t92FUbEh053950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288504 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 15:30:38 -0000 Author: adrian Date: Fri Oct 2 15:30:37 2015 New Revision: 288504 URL: https://svnweb.freebsd.org/changeset/base/288504 Log: rum(4): sync rum_enable_tsf(_sync) with run(4). Submitted by: Differential Revision: https://reviews.freebsd.org/D3611 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:28:44 2015 (r288503) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:30:37 2015 (r288504) @@ -1730,12 +1730,35 @@ rum_enable_tsf_sync(struct rum_softc *sc /* set beacon interval (in 1/16ms unit) */ tmp |= vap->iv_bss->ni_intval * 16; + tmp |= RT2573_TSF_TIMER_EN | RT2573_TBTT_TIMER_EN; - tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT; - if (vap->iv_opmode == IEEE80211_M_STA) - tmp |= RT2573_TSF_MODE(1); - else - tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON; + switch (vap->iv_opmode) { + case IEEE80211_M_STA: + /* + * Local TSF is always updated with remote TSF on beacon + * reception. + */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_STA); + break; + case IEEE80211_M_IBSS: + /* + * Local TSF is updated with remote TSF on beacon reception + * only if the remote TSF is greater than local TSF. + */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_IBSS); + tmp |= RT2573_BCN_TX_EN; + break; + case IEEE80211_M_HOSTAP: + /* SYNC with nobody */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_HOSTAP); + tmp |= RT2573_BCN_TX_EN; + break; + default: + device_printf(sc->sc_dev, + "Enabling TSF failed. undefined opmode %d\n", + vap->iv_opmode); + return; + } rum_write(sc, RT2573_TXRX_CSR9, tmp); } @@ -1743,8 +1766,8 @@ rum_enable_tsf_sync(struct rum_softc *sc static void rum_enable_tsf(struct rum_softc *sc) { - rum_modbits(sc, RT2573_TXRX_CSR9, - RT2573_TSF_TICKING | RT2573_TSF_MODE(2), 0x00ffffff); + rum_modbits(sc, RT2573_TXRX_CSR9, RT2573_TSF_TIMER_EN | + RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_DIS), 0x00ffffff); } static void Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Fri Oct 2 15:28:44 2015 (r288503) +++ head/sys/dev/usb/wlan/if_rumreg.h Fri Oct 2 15:30:37 2015 (r288504) @@ -124,11 +124,14 @@ #define RT2573_MRR_CCK_FALLBACK (1 << 22) /* possible flags for register TXRX_CSR9 */ -#define RT2573_TSF_TICKING (1 << 16) -#define RT2573_TSF_MODE(x) (((x) & 0x3) << 17) -/* TBTT stands for Target Beacon Transmission Time */ -#define RT2573_ENABLE_TBTT (1 << 19) -#define RT2573_GENERATE_BEACON (1 << 20) +#define RT2573_TSF_TIMER_EN (1 << 16) +#define RT2573_TSF_SYNC_MODE(x) (((x) & 0x3) << 17) +#define RT2573_TSF_SYNC_MODE_DIS 0 +#define RT2573_TSF_SYNC_MODE_STA 1 +#define RT2573_TSF_SYNC_MODE_IBSS 2 +#define RT2573_TSF_SYNC_MODE_HOSTAP 3 +#define RT2573_TBTT_TIMER_EN (1 << 19) +#define RT2573_BCN_TX_EN (1 << 20) /* possible flags for register PHY_CSR0 */ #define RT2573_PA_PE_2GHZ (1 << 16) From owner-svn-src-all@freebsd.org Fri Oct 2 16:17:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BBFFA0DED1; Fri, 2 Oct 2015 16:17:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 236C51616; Fri, 2 Oct 2015 16:17:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 329A1B96C; Fri, 2 Oct 2015 12:17:16 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Date: Fri, 02 Oct 2015 08:59:33 -0700 Message-ID: <4276391.z2UvhhORjP@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20151002045842.GA18421@raichu> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Oct 2015 12:17:16 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:17:17 -0000 On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: > On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > > Author: markj > > > Date: Wed Sep 30 23:06:29 2015 > > > New Revision: 288431 > > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > > > Log: > > > As a step towards the elimination of PG_CACHED pages, rework the handling > > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > > the head of the inactive queue instead of being cached. > > > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > > read or written. At that point the corresponding buffers may still be > > > dirty, so the previous implementation would coalesce successive ranges and > > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > > dirty buffers would eventually be cached. To preserve this behaviour in an > > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > > flag in bufs that underlie the specified range. > > > > Putting these pages back on the inactive queue completely defeats the primary > > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > > of the VM object's tree of pages and into the free pool so that the application > > can instruct the VM to free memory more efficiently than relying on page daemon. > > > > The implementation used cache pages instead of free as a cheap optimization so > > that if an application did something dumb where it used DONTNEED and then turned > > around and read the file it would not have to go to disk if the pages had not > > yet been reused. In practice this didn't work out so well because PG_CACHE pages > > don't really work well. > > > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > > memory that an application knew wasn't going to be reused and avoiding the need > > for pagedaemon to run at all. I think this should be freeing the pages instead of > > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > > around and rereads the file, it generally deserves to have to go to disk for it. > > A problem with this is that one application's DONTNEED or NOREUSE hint > would cause every application reading or writing that file to go to > disk, but posix_fadvise(2) is explicitly intended for applications that > wish to provide hints about their own access patterns. I realize that > it's typically used with application-private files, but that's not a > requirement of the interface. Deactivating (or caching) the backing > pages generally avoids this problem. I think it is not unreasonble to expect that fadvise() incurs system-wide affects. A properly implemented WILLNEED that does read-ahead cannot work without incurring system-wide effects. I had always assumed that fadvise() operated on a file, not a given process' view of a file (unlike, say, madvise which only operates on mappings and only indirectly affects file-backed data). > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > > pagedaemon during application page faults (since pagedaemon potentially never has > > to run). > > That's true, but the page queue locking (and the pagedaemon's > manipulation of the page queue locks) has also become more fine-grained > since posix_fadvise(2) was added. In particular, from some reading of > sys/vm in stable/8, inactive queue scans used to be performed with the > global page queue lock held; it was only dropped to launder dirty pages. > Now, the page queue lock is split into separate locks for the active and > inactive page queues, and the pagedaemon drops the inactive queue lock > for each page in all but a few exceptional cases. Does the optimization > of freeing or caching DONTNEED pages buy us all that much now? > > Some synthetic testing in which an application writes out many large > (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows > no significant difference in runtime if the buffer pages are deactivated > vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE > identically to B_DIRECT.) Unsurprisingly, I see very little lock > contention in the latter case, but in the former, most of the lock > contention is short (i.e. the mutex is acquired while spinning), and > a large majority of the contention is on the free page queue mutex. If > lock contention there is a concern, wouldn't it be better to try and > address that directly rather than by bypassing the pagedaemon? The lock contention was related to one process faulting in a new page due to a malloc() while pagedaemon ran. Also, it wasn't a steady type of contention that would show up in an average. Instead, it was the outliers (which in the case on 8.x were on the order of 2 seconds) that were problematic. I used a hack to log "long" wait times for specific processes to both debug this and evaluate the solution. I have a test program laying around from when I last tested this. I'll see what I can reproduce (before it required a machine with at least 24GB of RAM to reproduce). The only foolproof way to reduce contention to zero is to eliminate one of the contending threads. :) I do think there are situations where an application may be more informed about the optimal memory pattern for its workload than what the VM system can infer from heuristics. Currently there is no other way to flush a file's contents from RAM. If we had things like DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a sliding scale, but at the moment the policy isn't that fine-grained. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Oct 2 16:21:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3A48A0E2A2; Fri, 2 Oct 2015 16:21:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9327C1C34; Fri, 2 Oct 2015 16:21:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GLF3e076655; Fri, 2 Oct 2015 16:21:15 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GLF8t076654; Fri, 2 Oct 2015 16:21:15 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021621.t92GLF8t076654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 16:21:15 +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: r288505 - stable/10/usr.sbin/etcupdate 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:21:15 -0000 Author: bdrewery Date: Fri Oct 2 16:21:14 2015 New Revision: 288505 URL: https://svnweb.freebsd.org/changeset/base/288505 Log: MFC r288380: Document the post-merge actions of calling tzsetup(8) and services_mkdb(8) added in r259134. Modified: stable/10/usr.sbin/etcupdate/etcupdate.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- stable/10/usr.sbin/etcupdate/etcupdate.8 Fri Oct 2 15:30:37 2015 (r288504) +++ stable/10/usr.sbin/etcupdate/etcupdate.8 Fri Oct 2 16:21:14 2015 (r288505) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd September 29, 2015 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -233,6 +233,16 @@ is changed, is invoked if .Pa /etc/mail/aliases is changed, +.Xr services_mkdb 8 +is invoked if +.Pa /etc/services +is changed, +.Xr tzsetup 8 +is invoked if +.Pa /etc/localtime +is changed and if +.Fa /var/db/zoneinfo +exists, and .Pa /etc/rc.d/motd is invoked if @@ -843,7 +853,9 @@ but it has been removed in the destinati .Xr make 1 , .Xr newaliases 1 , .Xr sh 1 , -.Xr pwd_mkdb 8 +.Xr pwd_mkdb 8 , +.Xr services_mkdb 8 , +.Xr tzsetup 8 .Sh HISTORY The .Nm From owner-svn-src-all@freebsd.org Fri Oct 2 16:21:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49324A0E2DB; Fri, 2 Oct 2015 16:21:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 391711D86; Fri, 2 Oct 2015 16:21:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GLQ8W076706; Fri, 2 Oct 2015 16:21:26 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GLQE1076705; Fri, 2 Oct 2015 16:21:26 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021621.t92GLQE1076705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 16:21:26 +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: r288506 - stable/9/usr.sbin/etcupdate 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:21:26 -0000 Author: bdrewery Date: Fri Oct 2 16:21:25 2015 New Revision: 288506 URL: https://svnweb.freebsd.org/changeset/base/288506 Log: MFC r288380: Document the post-merge actions of calling tzsetup(8) and services_mkdb(8) added in r259134. Modified: stable/9/usr.sbin/etcupdate/etcupdate.8 Directory Properties: stable/9/usr.sbin/etcupdate/ (props changed) Modified: stable/9/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- stable/9/usr.sbin/etcupdate/etcupdate.8 Fri Oct 2 16:21:14 2015 (r288505) +++ stable/9/usr.sbin/etcupdate/etcupdate.8 Fri Oct 2 16:21:25 2015 (r288506) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd September 29, 2015 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -233,6 +233,16 @@ is changed, is invoked if .Pa /etc/mail/aliases is changed, +.Xr services_mkdb 8 +is invoked if +.Pa /etc/services +is changed, +.Xr tzsetup 8 +is invoked if +.Pa /etc/localtime +is changed and if +.Fa /var/db/zoneinfo +exists, and .Pa /etc/rc.d/motd is invoked if @@ -843,7 +853,9 @@ but it has been removed in the destinati .Xr make 1 , .Xr newaliases 1 , .Xr sh 1 , -.Xr pwd_mkdb 8 +.Xr pwd_mkdb 8 , +.Xr services_mkdb 8 , +.Xr tzsetup 8 .Sh HISTORY The .Nm From owner-svn-src-all@freebsd.org Fri Oct 2 16:22:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B4F4A0E3F0; Fri, 2 Oct 2015 16:22:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AFBD1014; Fri, 2 Oct 2015 16:22:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GMMsj077973; Fri, 2 Oct 2015 16:22:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GMMnU077972; Fri, 2 Oct 2015 16:22:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021622.t92GMMnU077972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 16:22:22 +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: r288507 - stable/10/usr.sbin/mergemaster 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:22:22 -0000 Author: bdrewery Date: Fri Oct 2 16:22:21 2015 New Revision: 288507 URL: https://svnweb.freebsd.org/changeset/base/288507 Log: MFC r288381: All supported releases have the -m support from r186678, so remove the mention of it and reword this a bit to remove 'you'. Modified: stable/10/usr.sbin/mergemaster/mergemaster.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/10/usr.sbin/mergemaster/mergemaster.8 Fri Oct 2 16:21:25 2015 (r288506) +++ stable/10/usr.sbin/mergemaster/mergemaster.8 Fri Oct 2 16:22:21 2015 (r288507) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2011 +.Dd September 29, 2015 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -257,14 +257,13 @@ Specify the path to the directory where .Xr make 1 . (In other words, where your sources are, but -s was already taken.) -In previous versions of +In older versions of .Nm -you needed to specify the path all the way to -.Pa src/etc . -Starting with r186678 you only need to specify the path to -.Pa src . +the path to +.Pa src/etc +was required. .Nm -will convert the path for you if you use the old method. +will convert the path if this older method is used. .It Fl t Ar /path/to/temp/root Create the temporary root environment in .Pa /path/to/temp/root From owner-svn-src-all@freebsd.org Fri Oct 2 16:22:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A373A0E417; Fri, 2 Oct 2015 16:22:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59EB4101A; Fri, 2 Oct 2015 16:22:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GMPeu078017; Fri, 2 Oct 2015 16:22:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GMPoR078016; Fri, 2 Oct 2015 16:22:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021622.t92GMPoR078016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 16:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r288508 - stable/9/usr.sbin/mergemaster 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:22:25 -0000 Author: bdrewery Date: Fri Oct 2 16:22:24 2015 New Revision: 288508 URL: https://svnweb.freebsd.org/changeset/base/288508 Log: MFC r288381: All supported releases have the -m support from r186678, so remove the mention of it and reword this a bit to remove 'you'. Modified: stable/9/usr.sbin/mergemaster/mergemaster.8 Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/9/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.8 Fri Oct 2 16:22:21 2015 (r288507) +++ stable/9/usr.sbin/mergemaster/mergemaster.8 Fri Oct 2 16:22:24 2015 (r288508) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2011 +.Dd September 29, 2015 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -257,14 +257,13 @@ Specify the path to the directory where .Xr make 1 . (In other words, where your sources are, but -s was already taken.) -In previous versions of +In older versions of .Nm -you needed to specify the path all the way to -.Pa src/etc . -Starting with r186678 you only need to specify the path to -.Pa src . +the path to +.Pa src/etc +was required. .Nm -will convert the path for you if you use the old method. +will convert the path if this older method is used. .It Fl t Ar /path/to/temp/root Create the temporary root environment in .Pa /path/to/temp/root From owner-svn-src-all@freebsd.org Fri Oct 2 16:27:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2511A0E7A8 for ; Fri, 2 Oct 2015 16:27:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C177615D5 for ; Fri, 2 Oct 2015 16:27:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Fri, 2 Oct 2015 16:28:39 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t92GRuLr020777; Fri, 2 Oct 2015 10:27:56 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1443803276.66572.72.camel@freebsd.org> Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Ian Lepore To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 10:27:56 -0600 In-Reply-To: <20151002152059.GY11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:27:59 -0000 On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > Some arm documentation refers to the need for "support code" when the > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > be just the RPi I think). Do we have that support code? What happens > > if it's missing? I can't actually find any info on exactly what that > > support code is supposed to do. For all I know, we have the required > > code in libm. Or maybe what's needed is exception-handling code in the > > kernel. I can't find any info on what they mean by "support code" in > > this context. > The fpscr register is user-modifiable, so whatever happens after the > change, could as well happen before it. > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > Flush-to-zero. But I was sure that the text refers to the modes when > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > fault handler must do something to allow the computation to proceed. > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > looked in a few of the TRMs for different cortex-a series processors and > > they say the hardware handles all combinations of rounding and flush to > > zero without support software. But we should probably be on the lookout > > for reports of misbehaving apps on RPi after this change, just in case > > this setting has been protecting us from our ignorance there. > > I did found the reference to the support code in the VFP11 TRM, which in > turns point to > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > indeed I would need to not enable FZ on the affected hardware. > That link opened a reference to a cortex-a57 chip for me. I've had problems trying to share links to arm's documentation site, something about the way that navbar stuff works makes pasting links not-work. We support one arm11/VFPv2 chipset, the one used on RPi. It's the only actual armv6 chip we support, all the other stuff supported by the arch we call armv6 is really armv7. The TRM for the arm1176JZF-S core used on RPi is the one that mentions needing support code. -- Ian From owner-svn-src-all@freebsd.org Fri Oct 2 16:30:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8F79A0E9D2; Fri, 2 Oct 2015 16:30:54 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8DD71A2C; Fri, 2 Oct 2015 16:30:54 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GUsGB079033; Fri, 2 Oct 2015 16:30:54 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GUsin079032; Fri, 2 Oct 2015 16:30:54 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201510021630.t92GUsin079032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 2 Oct 2015 16:30:54 +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: r288509 - stable/10/sys/netinet 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:30:55 -0000 Author: hiren Date: Fri Oct 2 16:30:54 2015 New Revision: 288509 URL: https://svnweb.freebsd.org/changeset/base/288509 Log: MFC r287830 Remove unnecessary tcp state transition call. Modified: stable/10/sys/netinet/tcp_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/10/sys/netinet/tcp_usrreq.c Fri Oct 2 16:22:24 2015 (r288508) +++ stable/10/sys/netinet/tcp_usrreq.c Fri Oct 2 16:30:54 2015 (r288509) @@ -1746,9 +1746,9 @@ tcp_usrclosed(struct tcpcb *tp) #ifdef TCP_OFFLOAD tcp_offload_listen_stop(tp); #endif + tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ case TCPS_CLOSED: - tcp_state_change(tp, TCPS_CLOSED); tp = tcp_close(tp); /* * tcp_close() should never return NULL here as the socket is From owner-svn-src-all@freebsd.org Fri Oct 2 16:33:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFE1EA0EBDD; Fri, 2 Oct 2015 16:33:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CC201CFE; Fri, 2 Oct 2015 16:33:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbni9 with SMTP id ni9so20087091igb.0; Fri, 02 Oct 2015 09:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KvW7vBCRCdXgAm1mqloHmqF4Fhx5taqEZoZIJahXO94=; b=0a+pCOH/S4XgEVQi8tK5wqJx6A23vOH5BDy9TKKYxiupqZ762R+eZ7NBMw8zur87NR kFIC8GTI4TtFEdv4XQEGF4oqsTgZjYKF440TMqYnZJuRziFk0ih4RXRiHBbIOZpGK+rC TRSDlv+csm9lV7KlZfrq+LMqzCQlQM0YHSJSeL7s4kqK3IiASqk/j1cmpOjmz+h9EKL2 MCXtKD/KVLjhikigNk6GHsIBFoEsStKFxDo1aen0YYaoJgMAPm8OILSL8RTOiMF5U06q 7vpzlh21gJn5UKnIbI6L1s2dROyo8UXUKmThzkTcez32KtSuDkLJB9Qee9sIPhT1aWjo TikQ== MIME-Version: 1.0 X-Received: by 10.50.64.243 with SMTP id r19mr5028113igs.22.1443803620079; Fri, 02 Oct 2015 09:33:40 -0700 (PDT) Received: by 10.36.46.15 with HTTP; Fri, 2 Oct 2015 09:33:40 -0700 (PDT) In-Reply-To: <201510021326.t92DQ0Ds002986@repo.freebsd.org> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> Date: Fri, 2 Oct 2015 09:33:40 -0700 Message-ID: Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Adrian Chadd To: Konstantin Belousov 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:33:40 -0000 Hi, When you run this stuff on ARM (and MIPS, too) - would you please report in the commit message(s) which platforms you ran it on? I'd hate to see this break an existing platform that it mostly works on just to fix it on a platform it doesn't. -a On 2 October 2015 at 06:26, Konstantin Belousov wrote: > Author: kib > Date: Fri Oct 2 13:25:59 2015 > New Revision: 288492 > URL: https://svnweb.freebsd.org/changeset/base/288492 > > Log: > Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct > implementation of IEEE 754 arithmetic depends on denormals operating > correctly. Both perl test suite and paranoia tripped over the > setting. > > Reported by: Stefan Parvu > Discussed with: andrew > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/arm/arm/machdep.c > head/sys/arm/arm/vm_machdep.c > > Modified: head/sys/arm/arm/machdep.c > ============================================================================== > --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) > (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; > thread0.td_pcb->pcb_flags = 0; > thread0.td_pcb->pcb_vfpcpu = -1; > - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; > thread0.td_frame = &proc0_tf; > pcpup->pc_curpcb = thread0.td_pcb; > } > > Modified: head/sys/arm/arm/vm_machdep.c > ============================================================================== > --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re > pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); > > pcb2->pcb_vfpcpu = -1; > - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; > > tf = td2->td_frame; > tf->tf_spsr &= ~PSR_C; > From owner-svn-src-all@freebsd.org Fri Oct 2 16:35:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6C32A0ED0F; Fri, 2 Oct 2015 16:35:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D73581EB1; Fri, 2 Oct 2015 16:35:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GZfn6082398; Fri, 2 Oct 2015 16:35:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GZf6j082397; Fri, 2 Oct 2015 16:35:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510021635.t92GZf6j082397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 2 Oct 2015 16:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288510 - head/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:35:42 -0000 Author: delphij Date: Fri Oct 2 16:35:41 2015 New Revision: 288510 URL: https://svnweb.freebsd.org/changeset/base/288510 Log: Fix a regression with SA-15:24 patch that prevented NIS from working. Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- head/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:30:54 2015 (r288509) +++ head/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:35:41 2015 (r288510) @@ -1052,12 +1052,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } From owner-svn-src-all@freebsd.org Fri Oct 2 16:36:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8E76A0ED9D; Fri, 2 Oct 2015 16:36:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B88D6100B; Fri, 2 Oct 2015 16:36:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GaHw1082522; Fri, 2 Oct 2015 16:36:17 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GaHDG082521; Fri, 2 Oct 2015 16:36:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510021636.t92GaHDG082521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 2 Oct 2015 16:36: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: r288511 - in stable: 10/usr.sbin/rpcbind 9/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:36:17 -0000 Author: delphij Date: Fri Oct 2 16:36:16 2015 New Revision: 288511 URL: https://svnweb.freebsd.org/changeset/base/288511 Log: Fix a regression with SA-15:24 patch that prevented NIS from working. Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Changes in other areas also in this revision: Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:35:41 2015 (r288510) +++ stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:36:16 2015 (r288511) @@ -1053,12 +1053,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } From owner-svn-src-all@freebsd.org Fri Oct 2 16:36:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29A76A0ED99; Fri, 2 Oct 2015 16:36:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19242100A; Fri, 2 Oct 2015 16:36:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GaGUw082515; Fri, 2 Oct 2015 16:36:16 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GaGQM082514; Fri, 2 Oct 2015 16:36:16 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510021636.t92GaGQM082514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 2 Oct 2015 16:36:16 +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: r288511 - in stable: 10/usr.sbin/rpcbind 9/usr.sbin/rpcbind 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:36:17 -0000 Author: delphij Date: Fri Oct 2 16:36:16 2015 New Revision: 288511 URL: https://svnweb.freebsd.org/changeset/base/288511 Log: Fix a regression with SA-15:24 patch that prevented NIS from working. Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Changes in other areas also in this revision: Modified: stable/10/usr.sbin/rpcbind/rpcb_svc_com.c Modified: stable/9/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:35:41 2015 (r288510) +++ stable/9/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:36:16 2015 (r288511) @@ -1053,12 +1053,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } From owner-svn-src-all@freebsd.org Fri Oct 2 16:37:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86674A0EEB1; Fri, 2 Oct 2015 16:37:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74CA712C3; Fri, 2 Oct 2015 16:37:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92Gb93T082680; Fri, 2 Oct 2015 16:37:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92Gb6Wg082669; Fri, 2 Oct 2015 16:37:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510021637.t92Gb6Wg082669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 2 Oct 2015 16:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r288512 - in releng: 10.1 10.1/sys/conf 10.1/usr.sbin/rpcbind 10.2 10.2/sys/conf 10.2/usr.sbin/rpcbind 9.3 9.3/sys/conf 9.3/usr.sbin/rpcbind X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 16:37:09 -0000 Author: delphij Date: Fri Oct 2 16:37:06 2015 New Revision: 288512 URL: https://svnweb.freebsd.org/changeset/base/288512 Log: Fix a regression with SA-15:24 patch that prevented NIS from working. Approved by: so Modified: releng/10.1/UPDATING releng/10.1/sys/conf/newvers.sh releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c releng/10.2/UPDATING releng/10.2/sys/conf/newvers.sh releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c releng/9.3/UPDATING releng/9.3/sys/conf/newvers.sh releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.1/UPDATING Fri Oct 2 16:37:06 2015 (r288512) @@ -16,6 +16,9 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20151002: p22 FreeBSD-SA-15:24.rpcbind [revised] + Revised patch to address a regression that prevents NIS from working. + 20150929: p21 FreeBSD-SA-15:24.rpcbind Fix rpcbind(8) remote denial of service. [SA-15:24] Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.1/sys/conf/newvers.sh Fri Oct 2 16:37:06 2015 (r288512) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RELEASE-p21" +BRANCH="RELEASE-p22" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.1/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:37:06 2015 (r288512) @@ -1053,12 +1053,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } Modified: releng/10.2/UPDATING ============================================================================== --- releng/10.2/UPDATING Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.2/UPDATING Fri Oct 2 16:37:06 2015 (r288512) @@ -16,6 +16,9 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20151002: p5 FreeBSD-SA-15:24.rpcbind [revised] + Revised patch to address a regression that prevents NIS from working. + 20150929: p4 FreeBSD-SA-15:24.rpcbind Fix rpcbind(8) remote denial of service. [SA-15:24] Modified: releng/10.2/sys/conf/newvers.sh ============================================================================== --- releng/10.2/sys/conf/newvers.sh Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.2/sys/conf/newvers.sh Fri Oct 2 16:37:06 2015 (r288512) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.2" -BRANCH="RELEASE-p4" +BRANCH="RELEASE-p5" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:36:16 2015 (r288511) +++ releng/10.2/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:37:06 2015 (r288512) @@ -1053,12 +1053,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } Modified: releng/9.3/UPDATING ============================================================================== --- releng/9.3/UPDATING Fri Oct 2 16:36:16 2015 (r288511) +++ releng/9.3/UPDATING Fri Oct 2 16:37:06 2015 (r288512) @@ -11,6 +11,9 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20151002: p28 FreeBSD-SA-15:24.rpcbind [revised] + Revised patch to address a regression that prevents NIS from working. + 20150929: p27 FreeBSD-SA-15:24.rpcbind Fix rpcbind(8) remote denial of service. [SA-15:24] Modified: releng/9.3/sys/conf/newvers.sh ============================================================================== --- releng/9.3/sys/conf/newvers.sh Fri Oct 2 16:36:16 2015 (r288511) +++ releng/9.3/sys/conf/newvers.sh Fri Oct 2 16:37:06 2015 (r288512) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.3" -BRANCH="RELEASE-p27" +BRANCH="RELEASE-p28" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:36:16 2015 (r288511) +++ releng/9.3/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:37:06 2015 (r288512) @@ -1053,12 +1053,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } From owner-svn-src-all@freebsd.org Fri Oct 2 17:51:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DA2EA0E0CB; Fri, 2 Oct 2015 17:51:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AF0B1D37; Fri, 2 Oct 2015 17:51:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92HpmZH020719; Fri, 2 Oct 2015 17:51:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92Hpm9I020718; Fri, 2 Oct 2015 17:51:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021751.t92Hpm9I020718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288513 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 17:51:48 -0000 Author: bdrewery Date: Fri Oct 2 17:51:47 2015 New Revision: 288513 URL: https://svnweb.freebsd.org/changeset/base/288513 Log: /usr/src/games was removed in r288485. Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Fri Oct 2 16:37:06 2015 (r288512) +++ head/share/man/man7/hier.7 Fri Oct 2 17:51:47 2015 (r288513) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 14, 2015 +.Dd October 2, 2015 .Dt HIER 7 .Os .Sh NAME @@ -685,9 +685,6 @@ source code for contributed cryptography .It Pa etc/ source code for files in .Pa /etc -.It Pa games/ -source code for files in -.Pa /usr/games .It Pa gnu/ Utilities covered by the GNU General Public License .It Pa include/ From owner-svn-src-all@freebsd.org Fri Oct 2 17:54:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D55AA0E2D4; Fri, 2 Oct 2015 17:54:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D58C1F55; Fri, 2 Oct 2015 17:54:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92Hs6At020960; Fri, 2 Oct 2015 17:54:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92Hs6GH020959; Fri, 2 Oct 2015 17:54:06 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021754.t92Hs6GH020959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288514 - head/targets/pseudo/userland/games 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 17:54:06 -0000 Author: bdrewery Date: Fri Oct 2 17:54:05 2015 New Revision: 288514 URL: https://svnweb.freebsd.org/changeset/base/288514 Log: Remove defunct games removed in r279150. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/userland/games/Makefile.depend Modified: head/targets/pseudo/userland/games/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:51:47 2015 (r288513) +++ head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:54:05 2015 (r288514) @@ -3,7 +3,6 @@ # This file is not autogenerated - take care! DIRDEPS = \ - games/bcd \ games/caesar \ games/factor \ games/fortune/fortune \ @@ -14,7 +13,6 @@ DIRDEPS = \ games/morse \ games/number \ games/pom \ - games/ppt \ games/primes \ games/random \ From owner-svn-src-all@freebsd.org Fri Oct 2 17:58:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E827A0E6D8; Fri, 2 Oct 2015 17:58:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E75D11E8; Fri, 2 Oct 2015 17:58:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92HwHXd021186; Fri, 2 Oct 2015 17:58:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92HwHhA021185; Fri, 2 Oct 2015 17:58:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021758.t92HwHhA021185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288515 - head/targets/pseudo/userland/games 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 17:58:17 -0000 Author: bdrewery Date: Fri Oct 2 17:58:16 2015 New Revision: 288515 URL: https://svnweb.freebsd.org/changeset/base/288515 Log: All the games moved to usr.bin/ in r288485. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/userland/games/Makefile.depend Modified: head/targets/pseudo/userland/games/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:54:05 2015 (r288514) +++ head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:58:16 2015 (r288515) @@ -3,18 +3,18 @@ # This file is not autogenerated - take care! DIRDEPS = \ - games/caesar \ - games/factor \ - games/fortune/fortune \ - games/fortune/strfile \ - games/fortune/datfiles \ - games/fortune/unstr \ - games/grdc \ - games/morse \ - games/number \ - games/pom \ - games/primes \ - games/random \ + usr.bin/caesar \ + usr.bin/factor \ + usr.bin/fortune/fortune \ + usr.bin/fortune/strfile \ + usr.bin/fortune/datfiles \ + usr.bin/fortune/unstr \ + usr.bin/grdc \ + usr.bin/morse \ + usr.bin/number \ + usr.bin/pom \ + usr.bin/primes \ + usr.bin/random \ .include From owner-svn-src-all@freebsd.org Fri Oct 2 18:04:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE1F5A0EC51; Fri, 2 Oct 2015 18:04:43 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89DD6184D; Fri, 2 Oct 2015 18:04:43 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVL00ARJU7SRI00@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 18:04:43 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020227 Message-id: <1443809080.13078.13.camel@me.com> Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Rui Paulo To: Adrian Chadd , Warner Losh Cc: John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 02 Oct 2015 11:04:40 -0700 In-reply-to: References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 18:04:43 -0000 On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: > ... I'm confused about the "load it by hand" stuff in net80211. Why > don't we just do the kldload at that point? > I was talking about ieee80211_load_module. net80211 module auto loading doesn't work probably because kern_kldload() can't be called from certain contexts. -- Rui Paulo From owner-svn-src-all@freebsd.org Fri Oct 2 18:55:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFE94A0D1AA; Fri, 2 Oct 2015 18:55:01 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8ED44104D; Fri, 2 Oct 2015 18:55:01 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVL00GF3TRHHX30@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 17:54:55 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=2.57571741713036e-14 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020225 Message-id: <1443808493.13078.11.camel@me.com> Subject: Re: svn commit: r288362 - head/sys/cddl/dev/sdt From: Rui Paulo To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 10:54:53 -0700 In-reply-to: <201509291158.t8TBwLd1052484@repo.freebsd.org> References: <201509291158.t8TBwLd1052484@repo.freebsd.org> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 18:55:01 -0000 On Tue, 2015-09-29 at 11:58 +0000, Andriy Gapon wrote: > Author: avg > Date: Tue Sep 29 11:58:21 2015 > New Revision: 288362 > URL: https://svnweb.freebsd.org/changeset/base/288362 > > Log: > sdt: start checking version field when parsing probe definitions > > This is an extra safety measure. > > MFC after: 21 days > > Modified: > head/sys/cddl/dev/sdt/sdt.c > > Modified: head/sys/cddl/dev/sdt/sdt.c > ===================================================================== > ========= > --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 > (r288361) > +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 > (r288362) > @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe > char *to; > size_t len; > > + if (probe->version != (int)sizeof(*probe)) { > + printf("ignoring probe %p, version %u expected > %u\n", > + probe, probe->version, (int)sizeof(*probe)); > + return; > + } > + > Not picking on your change, but this version management sounds like a bad idea to me... -- Rui Paulo From owner-svn-src-all@freebsd.org Fri Oct 2 19:10:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC7B8A0DF45; Fri, 2 Oct 2015 19:10:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22f.google.com (mail-ig0-x22f.google.com [IPv6:2607:f8b0:4001:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6BBB1A2A; Fri, 2 Oct 2015 19:10:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igcpb10 with SMTP id pb10so25598787igc.1; Fri, 02 Oct 2015 12:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5sQI3ICgIkxbxfiKHKRFfjvGA0yuj2QtMm9dFVFrmEc=; b=ASm7D8UugUEQfe7IQtKmpT2rbzmeP4wH6eeGMwS/QR5f/goLz4MDyBUueCz+VfQxRO y/JaFWh2vpKDbHEGq98811QsvmOqe9nJUrV0Y4XuheByL8Yz+/zFT9gbnlGmoAL6L05/ XX0bnj5hfyXeo4slectXmwPcvGK4TTVodGnf1pg47lNKOqTjNVGwAkjKtHOGcwieYyHi IRXI79bhJ+Pmx+hb67Sfw42RENcQ/QEDB7gdcr3xT0nFTRbXGuUvPm2F3M+wMFebLSBA e4Xk1BogVu9Isv2R7jnrmcWLmgrkmndy40ODliJ6D9PQXwUZhTvYTEFiEJPyJJCrirtW Ji1g== MIME-Version: 1.0 X-Received: by 10.50.61.243 with SMTP id t19mr627699igr.22.1443813052055; Fri, 02 Oct 2015 12:10:52 -0700 (PDT) Received: by 10.36.46.15 with HTTP; Fri, 2 Oct 2015 12:10:51 -0700 (PDT) In-Reply-To: <1443809080.13078.13.camel@me.com> References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> <1443809080.13078.13.camel@me.com> Date: Fri, 2 Oct 2015 12:10:51 -0700 Message-ID: Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Adrian Chadd To: Rui Paulo Cc: Warner Losh , John Baldwin , 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 19:10:53 -0000 On 2 October 2015 at 11:04, Rui Paulo wrote: > On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: >> ... I'm confused about the "load it by hand" stuff in net80211. Why >> don't we just do the kldload at that point? >> > > I was talking about ieee80211_load_module. net80211 module auto > loading doesn't work probably because kern_kldload() can't be called > from certain contexts. hm, can we do it from a taskqueue? -a From owner-svn-src-all@freebsd.org Fri Oct 2 19:41:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9F74A0D547; Fri, 2 Oct 2015 19:41:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9AB11CC7; Fri, 2 Oct 2015 19:41:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92Jfl7B068152; Fri, 2 Oct 2015 19:41:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92JflSf068151; Fri, 2 Oct 2015 19:41:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021941.t92JflSf068151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 19:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288516 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 19:41:48 -0000 Author: mav Date: Fri Oct 2 19:41:47 2015 New Revision: 288516 URL: https://svnweb.freebsd.org/changeset/base/288516 Log: MFC r269117: Make sysctls under vfs.zfs.zfetch writeable. I don't see any reason for them to be read-only, while tuning them without reboot is much more convenient for experiments. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Oct 2 17:58:16 2015 (r288515) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Oct 2 19:41:47 2015 (r288516) @@ -59,13 +59,13 @@ TUNABLE_INT("vfs.zfs.zfetch.max_streams" SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_streams, CTLFLAG_RW, &zfetch_max_streams, 0, "Max # of streams per zfetch"); TUNABLE_INT("vfs.zfs.zfetch.min_sec_reap", &zfetch_min_sec_reap); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RDTUN, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RWTUN, &zfetch_min_sec_reap, 0, "Min time before stream reclaim"); TUNABLE_INT("vfs.zfs.zfetch.block_cap", &zfetch_block_cap); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RDTUN, +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RWTUN, &zfetch_block_cap, 0, "Max number of blocks to fetch at a time"); TUNABLE_QUAD("vfs.zfs.zfetch.array_rd_sz", &zfetch_array_rd_sz); -SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RDTUN, +SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RWTUN, &zfetch_array_rd_sz, 0, "Number of bytes in a array_read at which we stop prefetching"); From owner-svn-src-all@freebsd.org Fri Oct 2 19:47:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1339AA0DC74; Fri, 2 Oct 2015 19:47:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id EA8F811EA; Fri, 2 Oct 2015 19:47:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA14952; Fri, 02 Oct 2015 22:47:29 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Zi6Ij-0000IG-4p; Fri, 02 Oct 2015 22:47:29 +0300 Subject: Re: svn commit: r288362 - head/sys/cddl/dev/sdt To: Rui Paulo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201509291158.t8TBwLd1052484@repo.freebsd.org> <1443808493.13078.11.camel@me.com> From: Andriy Gapon Message-ID: <560EDEF6.8050009@FreeBSD.org> Date: Fri, 2 Oct 2015 22:45:58 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443808493.13078.11.camel@me.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 19:47:34 -0000 On 02/10/2015 20:54, Rui Paulo wrote: > On Tue, 2015-09-29 at 11:58 +0000, Andriy Gapon wrote: >> Author: avg >> Date: Tue Sep 29 11:58:21 2015 >> New Revision: 288362 >> URL: https://svnweb.freebsd.org/changeset/base/288362 >> >> Log: >> sdt: start checking version field when parsing probe definitions >> >> This is an extra safety measure. >> >> MFC after: 21 days >> >> Modified: >> head/sys/cddl/dev/sdt/sdt.c >> >> Modified: head/sys/cddl/dev/sdt/sdt.c >> ===================================================================== >> ========= >> --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 >> (r288361) >> +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 >> (r288362) >> @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe >> char *to; >> size_t len; >> >> + if (probe->version != (int)sizeof(*probe)) { >> + printf("ignoring probe %p, version %u expected >> %u\n", >> + probe, probe->version, (int)sizeof(*probe)); >> + return; >> + } >> + >> > > Not picking on your change, but this version management sounds like a > bad idea to me... > It's certainly not very robust, but I think that it's better than nothing. Having proper SDT binary layout versions would be better, of course. -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Oct 2 19:59:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11806A0E6C6; Fri, 2 Oct 2015 19:59:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA90519E8; Fri, 2 Oct 2015 19:59:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92JxhMK072614; Fri, 2 Oct 2015 19:59:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92JxhtE072613; Fri, 2 Oct 2015 19:59:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021959.t92JxhtE072613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 19:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288517 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 19:59:44 -0000 Author: mav Date: Fri Oct 2 19:59:43 2015 New Revision: 288517 URL: https://svnweb.freebsd.org/changeset/base/288517 Log: MFC r275780 (by delphij): Add a loader tunable, vfs.zfs.arc_meta_min, which controls how much metadata ZFS should keep in ARC at minimum. In arc_evict(), when doing recycle, take more factors into account by applying the following policy: 1. If no evictable data, evict metadata; 2. If no evictable metadata, evict data; 3. If we hit arc_meta_limit, evict metadata; 4. If we haven't hit arc_meta_min, evict data; 5* (Illumos only, not present in new FreeBSD code, yet) evict the oldest cached element from data and metadata. (FreeBSD) evict the data type specified by caller, which is the existing behavior. Note that because of our splitted locks (implemented in r205231 to improve scalability by reducing lock contention), implementing the fifth Illumos behavior will not be cheap, so for now just implement the 1-4 and fall back to current behavior for 5. Illumos issue: 5368 ARC should cache more metadata Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 19:41:47 2015 (r288516) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 19:59:43 2015 (r288517) @@ -197,6 +197,7 @@ static boolean_t arc_warm; uint64_t zfs_arc_max; uint64_t zfs_arc_min; uint64_t zfs_arc_meta_limit = 0; +uint64_t zfs_arc_meta_min = 0; int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; @@ -220,6 +221,7 @@ SYSINIT(arc_free_target_init, SI_SUB_KTH TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max); TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min); TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit); +TUNABLE_QUAD("vfs.zfs.arc_meta_min", &zfs_arc_meta_min); TUNABLE_QUAD("vfs.zfs.arc_average_blocksize", &zfs_arc_average_blocksize); TUNABLE_INT("vfs.zfs.arc_shrink_shift", &zfs_arc_shrink_shift); SYSCTL_DECL(_vfs_zfs); @@ -429,6 +431,7 @@ typedef struct arc_stats { kstat_named_t arcstat_meta_used; kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; + kstat_named_t arcstat_meta_min; } arc_stats_t; static arc_stats_t arc_stats = { @@ -509,7 +512,8 @@ static arc_stats_t arc_stats = { { "duplicate_reads", KSTAT_DATA_UINT64 }, { "arc_meta_used", KSTAT_DATA_UINT64 }, { "arc_meta_limit", KSTAT_DATA_UINT64 }, - { "arc_meta_max", KSTAT_DATA_UINT64 } + { "arc_meta_max", KSTAT_DATA_UINT64 }, + { "arc_meta_min", KSTAT_DATA_UINT64 } }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -572,6 +576,7 @@ static arc_state_t *arc_l2c_only; #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ #define arc_meta_limit ARCSTAT(arcstat_meta_limit) /* max size for metadata */ +#define arc_meta_min ARCSTAT(arcstat_meta_min) /* min size for metadata */ #define arc_meta_used ARCSTAT(arcstat_meta_used) /* size of metadata */ #define arc_meta_max ARCSTAT(arcstat_meta_max) /* max size of metadata */ @@ -2041,6 +2046,49 @@ arc_evict(arc_state_t *state, uint64_t s evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; + /* + * Decide which "type" (data vs metadata) to recycle from. + * + * If we are over the metadata limit, recycle from metadata. + * If we are under the metadata minimum, recycle from data. + * Otherwise, recycle from whichever type has the oldest (least + * recently accessed) header. This is not yet implemented. + */ + if (recycle) { + arc_buf_contents_t realtype; + if (state->arcs_lsize[ARC_BUFC_DATA] == 0) { + realtype = ARC_BUFC_METADATA; + } else if (state->arcs_lsize[ARC_BUFC_METADATA] == 0) { + realtype = ARC_BUFC_DATA; + } else if (arc_meta_used >= arc_meta_limit) { + realtype = ARC_BUFC_METADATA; + } else if (arc_meta_used <= arc_meta_min) { + realtype = ARC_BUFC_DATA; + } else { +#ifdef illumos + if (data_hdr->b_arc_access < + metadata_hdr->b_arc_access) { + realtype = ARC_BUFC_DATA; + } else { + realtype = ARC_BUFC_METADATA; + } +#else + /* TODO */ + realtype = type; +#endif + } + if (realtype != type) { + /* + * If we want to evict from a different list, + * we can not recycle, because DATA vs METADATA + * buffers are segregated into different kmem + * caches (and vmem arenas). + */ + type = realtype; + recycle = B_FALSE; + } + } + if (type == ARC_BUFC_METADATA) { offset = 0; list_count = ARC_BUFC_NUMMETADATALISTS; @@ -4194,6 +4242,12 @@ arc_init(void) if (arc_c_min < arc_meta_limit / 2 && zfs_arc_min == 0) arc_c_min = arc_meta_limit / 2; + if (zfs_arc_meta_min > 0) { + arc_meta_min = zfs_arc_meta_min; + } else { + arc_meta_min = arc_c_min / 2; + } + if (zfs_arc_grow_retry > 0) arc_grow_retry = zfs_arc_grow_retry; From owner-svn-src-all@freebsd.org Fri Oct 2 20:03:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FC62A0EABA; Fri, 2 Oct 2015 20:03:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F6AD1E0B; Fri, 2 Oct 2015 20:03:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92K3rCT076490; Fri, 2 Oct 2015 20:03:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92K3r6a076489; Fri, 2 Oct 2015 20:03:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510022003.t92K3r6a076489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 20:03: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: r288518 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 20:03:53 -0000 Author: mav Date: Fri Oct 2 20:03:52 2015 New Revision: 288518 URL: https://svnweb.freebsd.org/changeset/base/288518 Log: MFC r277452 (by will): Fix arc__shrink DTrace probe's to_free argument. Remove the unnecessary #ifdef _KERNEL, which did not differ in the true or false cases. Actually set the value of to_free before using it. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 19:59:43 2015 (r288517) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 20:03:52 2015 (r288518) @@ -2543,13 +2543,9 @@ arc_shrink(void) if (arc_c > arc_c_min) { uint64_t to_free; + to_free = arc_c >> arc_shrink_shift; DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, arc_c_min, uint64_t, arc_p, uint64_t, to_free); -#ifdef _KERNEL - to_free = arc_c >> arc_shrink_shift; -#else - to_free = arc_c >> arc_shrink_shift; -#endif if (arc_c > arc_c_min + to_free) atomic_add_64(&arc_c, -to_free); else From owner-svn-src-all@freebsd.org Fri Oct 2 20:07:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 254ECA0ED0F; Fri, 2 Oct 2015 20:07:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1523D1FD0; Fri, 2 Oct 2015 20:07:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92K73Ln076683; Fri, 2 Oct 2015 20:07:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92K73QQ076682; Fri, 2 Oct 2015 20:07:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510022007.t92K73QQ076682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 20:07:03 +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: r288519 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 20:07:04 -0000 Author: mav Date: Fri Oct 2 20:07:03 2015 New Revision: 288519 URL: https://svnweb.freebsd.org/changeset/base/288519 Log: MFC r277826 (by delphij): Diff reduction with upstream. The actual change was merged in r272483 already. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 20:03:52 2015 (r288518) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Oct 2 20:07:03 2015 (r288519) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. From owner-svn-src-all@freebsd.org Fri Oct 2 20:09:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98E1BA0EE59; Fri, 2 Oct 2015 20:09:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88A7B113E; Fri, 2 Oct 2015 20:09:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92K9HMF076825; Fri, 2 Oct 2015 20:09:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92K9Hjl076824; Fri, 2 Oct 2015 20:09:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510022009.t92K9Hjl076824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 20:09: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: r288520 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 20:09:17 -0000 Author: mav Date: Fri Oct 2 20:09:16 2015 New Revision: 288520 URL: https://svnweb.freebsd.org/changeset/base/288520 Log: MFC r279996 (by smh): Allow zvol_geom_worker to process BIO_DELETE's If zvol_geom_start is called with a BIO_DELETE from a thread which can sleep it queues it for later processing by the zvol_geom_worker. The zvol_geom_worker didn't have a delete case so would simply loose the bio hence preventing the original caller from every completing. In addition an other unknown types would suffer the same fate. Allow zvol_geom_worker to process BIO_DELETE's via zvol_strategy and return unsupported for all unknown bio types. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Oct 2 20:07:03 2015 (r288519) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Oct 2 20:09:16 2015 (r288520) @@ -2776,8 +2776,12 @@ zvol_geom_worker(void *arg) break; case BIO_READ: case BIO_WRITE: + case BIO_DELETE: zvol_strategy(bp); break; + default: + g_io_deliver(bp, EOPNOTSUPP); + break; } } } From owner-svn-src-all@freebsd.org Fri Oct 2 20:13:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCA44A0E23D; Fri, 2 Oct 2015 20:13:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA80117A3; Fri, 2 Oct 2015 20:13:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92KDvbH080814; Fri, 2 Oct 2015 20:13:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92KDvt5080813; Fri, 2 Oct 2015 20:13:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510022013.t92KDvt5080813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 20:13: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: r288521 - stable/10/sys/cddl/contrib/opensolaris/uts/common/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 20:13:57 -0000 Author: mav Date: Fri Oct 2 20:13:56 2015 New Revision: 288521 URL: https://svnweb.freebsd.org/changeset/base/288521 Log: MFC r284591 (by avg): illums compat: use flsl/flsll for highbit/highbit64 Do that only when when fast inline versions are available. At the moment that can be the case only in the kernel and not for all platforms. The original code uses the binary search and that's kept as a fallback. This is a micro optimization. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Oct 2 20:09:16 2015 (r288520) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Oct 2 20:13:56 2015 (r288521) @@ -32,6 +32,9 @@ #include #include +#if defined(__FreeBSD__) && defined(_KERNEL) +#include +#endif #ifdef __cplusplus extern "C" { @@ -382,6 +385,9 @@ extern unsigned char bcd_to_byte[256]; static __inline int highbit(ulong_t i) { +#if defined(__FreeBSD__) && defined(_KERNEL) && defined(HAVE_INLINE_FLSL) + return (flsl(i)); +#else register int h = 1; if (i == 0) @@ -407,6 +413,7 @@ highbit(ulong_t i) h += 1; } return (h); +#endif } /* @@ -416,6 +423,9 @@ highbit(ulong_t i) static __inline int highbit64(uint64_t i) { +#if defined(__FreeBSD__) && defined(_KERNEL) && defined(HAVE_INLINE_FLSLL) + return (flsll(i)); +#else int h = 1; if (i == 0) @@ -439,6 +449,7 @@ highbit64(uint64_t i) h += 1; } return (h); +#endif } #ifdef __cplusplus From owner-svn-src-all@freebsd.org Fri Oct 2 21:06:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC692A0EBE3; Fri, 2 Oct 2015 21:06:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 568B914D2; Fri, 2 Oct 2015 21:06:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA15900; Sat, 03 Oct 2015 00:06:04 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Zi7Wl-0000My-OS; Sat, 03 Oct 2015 00:06:03 +0300 Subject: Re: svn commit: r288521 - stable/10/sys/cddl/contrib/opensolaris/uts/common/sys To: Alexander Motin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org References: <201510022013.t92KDvt5080813@repo.freebsd.org> From: Andriy Gapon Message-ID: <560EF182.60501@FreeBSD.org> Date: Sat, 3 Oct 2015 00:05:06 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <201510022013.t92KDvt5080813@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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 21:06:15 -0000 On 02/10/2015 23:13, Alexander Motin wrote: > MFC r284591 (by avg): illums compat: use flsl/flsll for highbit/highbit64 Thank you! -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Oct 2 21:09:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A4A3A0EE8C; Fri, 2 Oct 2015 21:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE1DB1930; Fri, 2 Oct 2015 21:09:50 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92L9oHq001575; Fri, 2 Oct 2015 21:09:50 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92L9nvM001571; Fri, 2 Oct 2015 21:09:49 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510022109.t92L9nvM001571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 21:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288522 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 21:09:51 -0000 Author: grehan Date: Fri Oct 2 21:09:49 2015 New Revision: 288522 URL: https://svnweb.freebsd.org/changeset/base/288522 Log: Simple sysctl-like firmware query interface. Similar in operation to the qemu one, and uses the same i/o ports but with different messaging. Requires the 'bootrom' option to be enabled. This is used by UEFI (and potentially other BIOSs/firmware) to request information from bhyve. Currently, only the number of vCPUs is made available, with more to follow. A very large thankyou to Ben Perrault who helped out testing an earlier version of this, and bhyve/Windows in general. Reviewed by: tychon Discussed with: neel Sponsored by: Nahanni Systems Added: head/usr.sbin/bhyve/fwctl.c (contents, props changed) head/usr.sbin/bhyve/fwctl.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Fri Oct 2 20:13:56 2015 (r288521) +++ head/usr.sbin/bhyve/Makefile Fri Oct 2 21:09:49 2015 (r288522) @@ -16,6 +16,7 @@ SRCS= \ bootrom.c \ consport.c \ dbgport.c \ + fwctl.c \ inout.c \ ioapic.c \ mem.c \ Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Fri Oct 2 20:13:56 2015 (r288521) +++ head/usr.sbin/bhyve/bhyverun.c Fri Oct 2 21:09:49 2015 (r288522) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "inout.h" #include "dbgport.h" +#include "fwctl.h" #include "ioapic.h" #include "mem.h" #include "mevent.h" @@ -950,6 +951,9 @@ main(int argc, char *argv[]) assert(error == 0); } + if (lpc_bootrom()) + fwctl_init(); + /* * Change the proc title to include the VM name. */ Added: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/fwctl.c Fri Oct 2 21:09:49 2015 (r288522) @@ -0,0 +1,549 @@ +/*- + * Copyright (c) 2015 Peter Grehan + * 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 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$ + */ + +/* + * Guest firmware interface. Uses i/o ports x510/x511 as Qemu does, + * but with a request/response messaging protocol. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "bhyverun.h" +#include "inout.h" +#include "fwctl.h" + +/* + * Messaging protocol base operations + */ +#define OP_NULL 1 +#define OP_ECHO 2 +#define OP_GET 3 +#define OP_GET_LEN 4 +#define OP_SET 5 +#define OP_MAX OP_SET + +/* I/O ports */ +#define FWCTL_OUT 0x510 +#define FWCTL_IN 0x511 + +/* + * Back-end state-machine + */ +enum state { + DORMANT, + IDENT_WAIT, + IDENT_SEND, + REQ, + RESP +} be_state = DORMANT; + +static uint8_t sig[] = { 'B', 'H', 'Y', 'V' }; +static u_int ident_idx; + +struct op_info { + int op; + int (*op_start)(int len); + void (*op_data)(uint32_t data, int len); + int (*op_result)(struct iovec **data); + void (*op_done)(struct iovec *data); +}; +static struct op_info *ops[OP_MAX+1]; + +/* Return 0-padded uint32_t */ +static uint32_t +fwctl_send_rest(uint32_t *data, size_t len) +{ + union { + uint8_t c[4]; + uint32_t w; + } u; + uint8_t *cdata; + int i; + + cdata = (uint8_t *) data; + u.w = 0; + + for (i = 0, u.w = 0; i < len; i++) + u.c[i] = *cdata++; + + return (u.w); +} + +/* + * error op dummy proto - drop all data sent and return an error +*/ +static int errop_code; + +static void +errop_set(int err) +{ + + errop_code = err; +} + +static int +errop_start(int len) +{ + errop_code = ENOENT; + + /* accept any length */ + return (errop_code); +} + +static void +errop_data(uint32_t data, int len) +{ + + /* ignore */ +} + +static int +errop_result(struct iovec **data) +{ + + /* no data to send back; always successful */ + *data = NULL; + return (errop_code); +} + +static void +errop_done(struct iovec *data) +{ + + /* assert data is NULL */ +} + +static struct op_info errop_info = { + .op_start = errop_start, + .op_data = errop_data, + .op_result = errop_result, + .op_done = errop_done +}; + +/* OID search */ +SET_DECLARE(ctl_set, struct ctl); + +CTL_NODE("hw.ncpu", &guest_ncpus, sizeof(guest_ncpus)); + +static struct ctl * +ctl_locate(const char *str, int maxlen) +{ + struct ctl *cp, **cpp; + + SET_FOREACH(cpp, ctl_set) { + cp = *cpp; + if (!strncmp(str, cp->c_oid, maxlen)) + return (cp); + } + + return (NULL); +} + +/* uefi-sysctl get-len */ +#define FGET_STRSZ 80 +static struct iovec fget_biov[2]; +static char fget_str[FGET_STRSZ]; +static struct { + size_t f_sz; + uint32_t f_data[1024]; +} fget_buf; +static int fget_cnt; +static size_t fget_size; + +static int +fget_start(int len) +{ + + if (len > FGET_STRSZ) + return(E2BIG); + + fget_cnt = 0; + + return (0); +} + +static void +fget_data(uint32_t data, int len) +{ + + *((uint32_t *) &fget_str[fget_cnt]) = data; + fget_cnt += sizeof(uint32_t); +} + +static int +fget_result(struct iovec **data, int val) +{ + struct ctl *cp; + int err; + + err = 0; + + /* Locate the OID */ + cp = ctl_locate(fget_str, fget_cnt); + if (cp == NULL) { + *data = NULL; + err = ENOENT; + } else { + if (val) { + /* For now, copy the len/data into a buffer */ + memset(&fget_buf, 0, sizeof(fget_buf)); + fget_buf.f_sz = cp->c_len; + memcpy(fget_buf.f_data, cp->c_data, cp->c_len); + fget_biov[0].iov_base = (char *)&fget_buf; + fget_biov[0].iov_len = sizeof(fget_buf.f_sz) + + cp->c_len; + } else { + fget_size = cp->c_len; + fget_biov[0].iov_base = (char *)&fget_size; + fget_biov[0].iov_len = sizeof(fget_size); + } + + fget_biov[1].iov_base = NULL; + fget_biov[1].iov_len = 0; + *data = fget_biov; + } + + return (err); +} + +static void +fget_done(struct iovec *data) +{ + + /* nothing needs to be freed */ +} + +static int +fget_len_result(struct iovec **data) +{ + return (fget_result(data, 0)); +} + +static int +fget_val_result(struct iovec **data) +{ + return (fget_result(data, 1)); +} + +static struct op_info fgetlen_info = { + .op_start = fget_start, + .op_data = fget_data, + .op_result = fget_len_result, + .op_done = fget_done +}; + +static struct op_info fgetval_info = { + .op_start = fget_start, + .op_data = fget_data, + .op_result = fget_val_result, + .op_done = fget_done +}; + +static struct req_info { + int req_error; + u_int req_count; + uint32_t req_size; + uint32_t req_type; + uint32_t req_txid; + struct op_info *req_op; + int resp_error; + int resp_count; + int resp_size; + int resp_off; + struct iovec *resp_biov; +} rinfo; + +static void +fwctl_response_done(void) +{ + + (*rinfo.req_op->op_done)(rinfo.resp_biov); + + /* reinit the req data struct */ + memset(&rinfo, 0, sizeof(rinfo)); +} + +static void +fwctl_request_done(void) +{ + + rinfo.resp_error = (*rinfo.req_op->op_result)(&rinfo.resp_biov); + + /* XXX only a single vector supported at the moment */ + rinfo.resp_off = 0; + if (rinfo.resp_biov == NULL) { + rinfo.resp_size = 0; + } else { + rinfo.resp_size = rinfo.resp_biov[0].iov_len; + } +} + +static int +fwctl_request_start(void) +{ + int err; + + /* Data size doesn't include header */ + rinfo.req_size -= 12; + + rinfo.req_op = &errop_info; + if (rinfo.req_type <= OP_MAX && ops[rinfo.req_type] != NULL) + rinfo.req_op = ops[rinfo.req_type]; + + err = (*rinfo.req_op->op_start)(rinfo.req_size); + + if (err) { + errop_set(err); + rinfo.req_op = &errop_info; + } + + /* Catch case of zero-length message here */ + if (rinfo.req_size == 0) { + fwctl_request_done(); + return (1); + } + + return (0); +} + +static int +fwctl_request_data(uint32_t value) +{ + int remlen; + + /* Make sure remaining size is >= 0 */ + rinfo.req_size -= sizeof(uint32_t); + remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0; + + (*rinfo.req_op->op_data)(value, remlen); + + if (rinfo.req_size < sizeof(uint32_t)) { + fwctl_request_done(); + return (1); + } + + return (0); +} + +static int +fwctl_request(uint32_t value) +{ + + int ret; + + ret = 0; + + switch (rinfo.req_count) { + case 0: + /* Verify size */ + if (value < 12) { + printf("msg size error"); + exit(1); + } + rinfo.req_size = value; + rinfo.req_count = 1; + break; + case 1: + rinfo.req_type = value; + rinfo.req_count++; + break; + case 2: + rinfo.req_txid = value; + rinfo.req_count++; + ret = fwctl_request_start(); + break; + default: + ret = fwctl_request_data(value); + break; + } + + return (ret); +} + +static int +fwctl_response(uint32_t *retval) +{ + uint32_t *dp; + int remlen; + + switch(rinfo.resp_count) { + case 0: + /* 4 x u32 header len + data */ + *retval = 4*sizeof(uint32_t) + + roundup(rinfo.resp_size, sizeof(uint32_t)); + rinfo.resp_count++; + break; + case 1: + *retval = rinfo.req_type; + rinfo.resp_count++; + break; + case 2: + *retval = rinfo.req_txid; + rinfo.resp_count++; + break; + case 3: + *retval = rinfo.resp_error; + rinfo.resp_count++; + break; + default: + remlen = rinfo.resp_size - rinfo.resp_off; + dp = (uint32_t *) + ((uint8_t *)rinfo.resp_biov->iov_base + rinfo.resp_off); + if (remlen >= sizeof(uint32_t)) { + *retval = *dp; + } else if (remlen > 0) { + *retval = fwctl_send_rest(dp, remlen); + } + rinfo.resp_off += sizeof(uint32_t); + break; + } + + if (rinfo.resp_count > 3 && + rinfo.resp_size - rinfo.resp_off <= 0) { + fwctl_response_done(); + return (1); + } + + return (0); +} + + +/* + * i/o port handling. + */ +static uint8_t +fwctl_inb(void) +{ + uint8_t retval; + + retval = 0xff; + + switch (be_state) { + case IDENT_SEND: + retval = sig[ident_idx++]; + if (ident_idx >= sizeof(sig)) + be_state = REQ; + break; + default: + break; + } + + return (retval); +} + +static void +fwctl_outw(uint16_t val) +{ + switch (be_state) { + case IDENT_WAIT: + if (val == 0) { + be_state = IDENT_SEND; + ident_idx = 0; + } + break; + default: + /* ignore */ + break; + } +} + +static uint32_t +fwctl_inl(void) +{ + uint32_t retval; + + switch (be_state) { + case RESP: + if (fwctl_response(&retval)) + be_state = REQ; + break; + default: + retval = 0xffffffff; + break; + } + + return (retval); +} + +static void +fwctl_outl(uint32_t val) +{ + + switch (be_state) { + case REQ: + if (fwctl_request(val)) + be_state = RESP; + default: + break; + } + +} + +static int +fwctl_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, void *arg) +{ + + if (in) { + if (bytes == 1) + *eax = fwctl_inb(); + else if (bytes == 4) + *eax = fwctl_inl(); + else + *eax = 0xffff; + } else { + if (bytes == 2) + fwctl_outw(*eax); + else if (bytes == 4) + fwctl_outl(*eax); + } + + return (0); +} +INOUT_PORT(fwctl_wreg, FWCTL_OUT, IOPORT_F_INOUT, fwctl_handler); +INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_OUT, fwctl_handler); + +void +fwctl_init(void) +{ + + ops[OP_GET_LEN] = &fgetlen_info; + ops[OP_GET] = &fgetval_info; + + be_state = IDENT_WAIT; +} Added: head/usr.sbin/bhyve/fwctl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/fwctl.h Fri Oct 2 21:09:49 2015 (r288522) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2015 Peter Grehan + * 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 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 _FWCTL_H_ +#define _FWCTL_H_ + +#include + +/* + * Linker set api for export of information to guest firmware via + * a sysctl-like OID interface + */ +struct ctl { + const char *c_oid; + const void *c_data; + const int c_len; +}; + +#define CTL_NODE(oid, data, len) \ + static struct ctl __CONCAT(__ctl, __LINE__) = { \ + oid, \ + (data), \ + (len), \ + }; \ + DATA_SET(ctl_set, __CONCAT(__ctl, __LINE__)) + +void fwctl_init(void); + +#endif /* _FWCTL_H_ */ From owner-svn-src-all@freebsd.org Fri Oct 2 21:25:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56302A0EB21; Fri, 2 Oct 2015 21:25:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439E01245; Fri, 2 Oct 2015 21:25:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92LPpDO009625; Fri, 2 Oct 2015 21:25:51 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92LPnbR009619; Fri, 2 Oct 2015 21:25:49 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510022125.t92LPnbR009619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 21:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288523 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 21:25:51 -0000 Author: adrian Date: Fri Oct 2 21:25:48 2015 New Revision: 288523 URL: https://svnweb.freebsd.org/changeset/base/288523 Log: net80211: separate ieee80211_crypto_get_keyid() from ieee80211_crypto_encap() Tested: * rum(4), STA mode * rsu(4), STA mode * urtwn(4), STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3637 Modified: head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_none.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto.c Fri Oct 2 21:25:48 2015 (r288523) @@ -521,6 +521,16 @@ ieee80211_crypto_setkey(struct ieee80211 return dev_key_set(vap, key); } +uint8_t +ieee80211_crypto_get_keyid(struct ieee80211vap *vap, struct ieee80211_key *k) +{ + if (k >= &vap->iv_nw_keys[0] && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]) + return (k - vap->iv_nw_keys); + else + return (0); +} + /* * Add privacy headers appropriate for the specified key. */ @@ -531,7 +541,6 @@ ieee80211_crypto_encap(struct ieee80211_ struct ieee80211_key *k; struct ieee80211_frame *wh; const struct ieee80211_cipher *cip; - uint8_t keyid; /* * Multicast traffic always uses the multicast key. @@ -550,14 +559,12 @@ ieee80211_crypto_encap(struct ieee80211_ vap->iv_stats.is_tx_nodefkey++; return NULL; } - keyid = vap->iv_def_txkey; k = &vap->iv_nw_keys[vap->iv_def_txkey]; - } else { - keyid = 0; + } else k = &ni->ni_ucastkey; - } + cip = k->wk_cipher; - return (cip->ic_encap(k, m, keyid<<6) ? k : NULL); + return (cip->ic_encap(k, m) ? k : NULL); } /* Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto.h Fri Oct 2 21:25:48 2015 (r288523) @@ -178,8 +178,7 @@ struct ieee80211_cipher { void* (*ic_attach)(struct ieee80211vap *, struct ieee80211_key *); void (*ic_detach)(struct ieee80211_key *); int (*ic_setkey)(struct ieee80211_key *); - int (*ic_encap)(struct ieee80211_key *, struct mbuf *, - uint8_t keyid); + int (*ic_encap)(struct ieee80211_key *, struct mbuf *); int (*ic_decap)(struct ieee80211_key *, struct mbuf *, int); int (*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); int (*ic_demic)(struct ieee80211_key *, struct mbuf *, int); @@ -193,6 +192,8 @@ void ieee80211_crypto_register(const str void ieee80211_crypto_unregister(const struct ieee80211_cipher *); int ieee80211_crypto_available(u_int cipher); +uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, + struct ieee80211_key *k); struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *); struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 21:25:48 2015 (r288523) @@ -63,7 +63,7 @@ struct ccmp_ctx { static void *ccmp_attach(struct ieee80211vap *, struct ieee80211_key *); static void ccmp_detach(struct ieee80211_key *); static int ccmp_setkey(struct ieee80211_key *); -static int ccmp_encap(struct ieee80211_key *k, struct mbuf *, uint8_t keyid); +static int ccmp_encap(struct ieee80211_key *, struct mbuf *); static int ccmp_decap(struct ieee80211_key *, struct mbuf *, int); static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int); static int ccmp_demic(struct ieee80211_key *, struct mbuf *, int); @@ -138,11 +138,13 @@ ccmp_setkey(struct ieee80211_key *k) * Add privacy headers appropriate for the specified key. */ static int -ccmp_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +ccmp_encap(struct ieee80211_key *k, struct mbuf *m) { struct ccmp_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->cc_ic; + struct ieee80211vap *vap = ctx->cc_vap; uint8_t *ivp; + uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -157,6 +159,8 @@ ccmp_encap(struct ieee80211_key *k, stru ovbcopy(ivp + ccmp.ic_header, ivp, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + k->wk_keytsc++; /* XXX wrap at 48 bits */ ivp[0] = k->wk_keytsc >> 0; /* PN0 */ ivp[1] = k->wk_keytsc >> 8; /* PN1 */ Modified: head/sys/net80211/ieee80211_crypto_none.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_none.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_none.c Fri Oct 2 21:25:48 2015 (r288523) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); static void *none_attach(struct ieee80211vap *, struct ieee80211_key *); static void none_detach(struct ieee80211_key *); static int none_setkey(struct ieee80211_key *); -static int none_encap(struct ieee80211_key *, struct mbuf *, uint8_t); +static int none_encap(struct ieee80211_key *, struct mbuf *); static int none_decap(struct ieee80211_key *, struct mbuf *, int); static int none_enmic(struct ieee80211_key *, struct mbuf *, int); static int none_demic(struct ieee80211_key *, struct mbuf *, int); @@ -88,19 +88,22 @@ none_setkey(struct ieee80211_key *k) } static int -none_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +none_encap(struct ieee80211_key *k, struct mbuf *m) { struct ieee80211vap *vap = k->wk_private; #ifdef IEEE80211_DEBUG struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); #endif + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k); /* * The specified key is not setup; this can * happen, at least, when changing keys. */ IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr1, - "key id %u is not set (encap)", keyid>>6); + "key id %u is not set (encap)", keyid); vap->iv_stats.is_tx_badcipher++; return 0; } Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 21:25:48 2015 (r288523) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); static void *tkip_attach(struct ieee80211vap *, struct ieee80211_key *); static void tkip_detach(struct ieee80211_key *); static int tkip_setkey(struct ieee80211_key *); -static int tkip_encap(struct ieee80211_key *, struct mbuf *m, uint8_t keyid); +static int tkip_encap(struct ieee80211_key *, struct mbuf *); static int tkip_enmic(struct ieee80211_key *, struct mbuf *, int); static int tkip_decap(struct ieee80211_key *, struct mbuf *, int); static int tkip_demic(struct ieee80211_key *, struct mbuf *, int); @@ -152,12 +152,13 @@ tkip_setkey(struct ieee80211_key *k) * Add privacy headers and do any s/w encryption required. */ static int -tkip_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +tkip_encap(struct ieee80211_key *k, struct mbuf *m) { struct tkip_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211com *ic = vap->iv_ic; uint8_t *ivp; + uint8_t keyid; int hdrlen; /* @@ -185,6 +186,8 @@ tkip_encap(struct ieee80211_key *k, stru memmove(ivp, ivp + tkip.ic_header, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 21:25:48 2015 (r288523) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); static void *wep_attach(struct ieee80211vap *, struct ieee80211_key *); static void wep_detach(struct ieee80211_key *); static int wep_setkey(struct ieee80211_key *); -static int wep_encap(struct ieee80211_key *, struct mbuf *, uint8_t keyid); +static int wep_encap(struct ieee80211_key *, struct mbuf *); static int wep_decap(struct ieee80211_key *, struct mbuf *, int hdrlen); static int wep_enmic(struct ieee80211_key *, struct mbuf *, int); static int wep_demic(struct ieee80211_key *, struct mbuf *, int); @@ -121,12 +121,14 @@ wep_setkey(struct ieee80211_key *k) * Add privacy headers appropriate for the specified key. */ static int -wep_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +wep_encap(struct ieee80211_key *k, struct mbuf *m) { struct wep_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->wc_vap; struct ieee80211com *ic = ctx->wc_ic; uint32_t iv; uint8_t *ivp; + uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -141,6 +143,8 @@ wep_encap(struct ieee80211_key *k, struc ovbcopy(ivp + wep.ic_header, ivp, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + /* * XXX * IV must not duplicate during the lifetime of the key. From owner-svn-src-all@freebsd.org Fri Oct 2 21:43:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A7FAA0DE23; Fri, 2 Oct 2015 21:43:56 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E17D0118C; Fri, 2 Oct 2015 21:43:55 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita.hsd1.ca.comcast.net (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVM005OA4D34W10@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 21:43:54 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=5.55111512312578e-17 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020274 Message-id: <1443822231.6210.1.camel@me.com> Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Rui Paulo To: Adrian Chadd Cc: Warner Losh , John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 02 Oct 2015 14:43:51 -0700 In-reply-to: References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> <1443809080.13078.13.camel@me.com> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 21:43:56 -0000 On Fri, 2015-10-02 at 12:10 -0700, Adrian Chadd wrote: > On 2 October 2015 at 11:04, Rui Paulo wrote: > > On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: > > > ... I'm confused about the "load it by hand" stuff in net80211. > > > Why > > > don't we just do the kldload at that point? > > > > > > > I was talking about ieee80211_load_module. net80211 module auto > > loading doesn't work probably because kern_kldload() can't be > > called > > from certain contexts. > > hm, can we do it from a taskqueue? > Sure, but I suspect the caller might not want to sleep waiting for the taskqueue to terminate. I really haven't looked into it, sorry... It might be a better idea to check if the driver does software and/or hardware crypto and load the appropriate modules at that time. Then check which ratesel module should be used and load that as well. The list continues :-) -- Rui Paulo From owner-svn-src-all@freebsd.org Fri Oct 2 22:03:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9747BA0EF1D; Fri, 2 Oct 2015 22:03:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBCF10FE; Fri, 2 Oct 2015 22:03:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by qkbi190 with SMTP id i190so28539308qkb.1; Fri, 02 Oct 2015 15:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=gXtCJItkCVtZD4rweN72big2DC5728OWMoPGt+u54KA=; b=Nl6r6rijMFhm98AIItT8F7r6ejp2gTz0HGWoIFtpRFg0WnxDDH7UveoRrRl0wh4q9m aEb3PA16X15oJrAjHucKvh0j0DoYf3UQVDb1uRethFyIdvKZAKB6fUEnIz1/fs4ku2vq yLI3PtTIifZs5npiBczhfuTz7rIO62d5bmItsVDLDPZITkMcPaWN82l6gIII2dCaahNH 0Tjik6KIxcNksLTnh5XjU0Xyo7clXVRpVgDCKfm1/QW8cJq4bcA4HeKQctun8nFX/T0n epNsWrYIK7OHlkZf6lueq5S6570A1dDKdkM6iqOIAKe8sCgRO6PgoHBXLExK0N4pTMcn /y1Q== X-Received: by 10.55.49.75 with SMTP id x72mr23436605qkx.45.1443823392098; Fri, 02 Oct 2015 15:03:12 -0700 (PDT) Received: from muskytusk ([104.236.250.12]) by smtp.gmail.com with ESMTPSA id y12sm5519665qgd.20.2015.10.02.15.03.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 15:03:11 -0700 (PDT) Sender: Mark Johnston Date: Fri, 2 Oct 2015 22:02:34 +0000 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Message-ID: <20151002220234.GA58210@muskytusk> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> <4276391.z2UvhhORjP@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <4276391.z2UvhhORjP@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 22:03:13 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 02, 2015 at 08:59:33AM -0700, John Baldwin wrote: > On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: > > On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > > > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > > > Author: markj > > > > Date: Wed Sep 30 23:06:29 2015 > > > > New Revision: 288431 > > > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > > > > > Log: > > > > As a step towards the elimination of PG_CACHED pages, rework the handling > > > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > > > the head of the inactive queue instead of being cached. > > > > > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > > > read or written. At that point the corresponding buffers may still be > > > > dirty, so the previous implementation would coalesce successive ranges and > > > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > > > dirty buffers would eventually be cached. To preserve this behaviour in an > > > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > > > flag in bufs that underlie the specified range. > > > > > > Putting these pages back on the inactive queue completely defeats the primary > > > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > > > of the VM object's tree of pages and into the free pool so that the application > > > can instruct the VM to free memory more efficiently than relying on page daemon. > > > > > > The implementation used cache pages instead of free as a cheap optimization so > > > that if an application did something dumb where it used DONTNEED and then turned > > > around and read the file it would not have to go to disk if the pages had not > > > yet been reused. In practice this didn't work out so well because PG_CACHE pages > > > don't really work well. > > > > > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > > > memory that an application knew wasn't going to be reused and avoiding the need > > > for pagedaemon to run at all. I think this should be freeing the pages instead of > > > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > > > around and rereads the file, it generally deserves to have to go to disk for it. > > > > A problem with this is that one application's DONTNEED or NOREUSE hint > > would cause every application reading or writing that file to go to > > disk, but posix_fadvise(2) is explicitly intended for applications that > > wish to provide hints about their own access patterns. I realize that > > it's typically used with application-private files, but that's not a > > requirement of the interface. Deactivating (or caching) the backing > > pages generally avoids this problem. > > I think it is not unreasonble to expect that fadvise() incurs system-wide > affects. A properly implemented WILLNEED that does read-ahead cannot work > without incurring system-wide effects. I had always assumed that fadvise() > operated on a file, not a given process' view of a file (unlike, say, > madvise which only operates on mappings and only indirectly affects > file-backed data). Well, that's even true of read(): two processes reading the same file may affect each other if one primes the buffer cache with blocks as the second process is reading them. DONTNEED and NOREUSE would specifically pessimize all processes using the file if they were to cause backing pages to be freed, though. > > > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > > > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > > > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > > > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > > > pagedaemon during application page faults (since pagedaemon potentially never has > > > to run). > > > > That's true, but the page queue locking (and the pagedaemon's > > manipulation of the page queue locks) has also become more fine-grained > > since posix_fadvise(2) was added. In particular, from some reading of > > sys/vm in stable/8, inactive queue scans used to be performed with the > > global page queue lock held; it was only dropped to launder dirty pages. > > Now, the page queue lock is split into separate locks for the active and > > inactive page queues, and the pagedaemon drops the inactive queue lock > > for each page in all but a few exceptional cases. Does the optimization > > of freeing or caching DONTNEED pages buy us all that much now? > > > > Some synthetic testing in which an application writes out many large > > (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows > > no significant difference in runtime if the buffer pages are deactivated > > vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE > > identically to B_DIRECT.) Unsurprisingly, I see very little lock > > contention in the latter case, but in the former, most of the lock > > contention is short (i.e. the mutex is acquired while spinning), and > > a large majority of the contention is on the free page queue mutex. If > > lock contention there is a concern, wouldn't it be better to try and > > address that directly rather than by bypassing the pagedaemon? > > The lock contention was related to one process faulting in a new page due to > a malloc() while pagedaemon ran. Also, it wasn't a steady type of contention > that would show up in an average. Instead, it was the outliers (which in the > case on 8.x were on the order of 2 seconds) that were problematic. I used a > hack to log "long" wait times for specific processes to both debug this and > evaluate the solution. I have a test program laying around from when I last > tested this. I'll see what I can reproduce (before it required a machine > with at least 24GB of RAM to reproduce). Thanks! FWIW, I found the attached patch convenient for testing and benchmarking fadvise; it adds iadvice and oadvice parameters to dd(1). > > The only foolproof way to reduce contention to zero is to eliminate one of > the contending threads. :) I do think there are situations where an > application may be more informed about the optimal memory pattern for its > workload than what the VM system can infer from heuristics. Currently there > is no other way to flush a file's contents from RAM. If we had things like > DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a sliding > scale, but at the moment the policy isn't that fine-grained. Sure. I guess I'm just making the conservative argument that a "seatbelts-off" implementation isn't obviously the right choice for a default. This is something that could be controlled with a sysctl or a richer set of hints. --EVF5PPMfhYS0aIcm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ddadv.diff" diff --git a/bin/dd/args.c b/bin/dd/args.c index 2f197f8..6220115 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -39,10 +39,11 @@ static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #include __FBSDID("$FreeBSD$"); -#include +#include #include #include +#include #include #include #include @@ -54,14 +55,17 @@ __FBSDID("$FreeBSD$"); static int c_arg(const void *, const void *); static int c_conv(const void *, const void *); +static void f_advice(const char *, IO *); static void f_bs(char *); static void f_cbs(char *); static void f_conv(char *); static void f_count(char *); static void f_files(char *); static void f_fillchar(char *); +static void f_iadvice(char *); static void f_ibs(char *); static void f_if(char *); +static void f_oadvice(char *); static void f_obs(char *); static void f_of(char *); static void f_seek(char *); @@ -81,9 +85,11 @@ static const struct arg { { "count", f_count, C_COUNT, C_COUNT }, { "files", f_files, C_FILES, C_FILES }, { "fillchar", f_fillchar, C_FILL, C_FILL }, + { "iadvice", f_iadvice, C_IADV, C_IADV }, { "ibs", f_ibs, C_IBS, C_BS|C_IBS }, { "if", f_if, C_IF, C_IF }, { "iseek", f_skip, C_SKIP, C_SKIP }, + { "oadvice", f_oadvice, C_OADV, C_OADV }, { "obs", f_obs, C_OBS, C_BS|C_OBS }, { "of", f_of, C_OF, C_OF }, { "oseek", f_seek, C_SEEK, C_SEEK }, @@ -104,6 +110,7 @@ jcl(char **argv) char *arg; in.dbsz = out.dbsz = 512; + in.advice = out.advice = POSIX_FADV_NORMAL; while ((oper = *++argv) != NULL) { if ((oper = strdup(oper)) == NULL) @@ -306,6 +313,48 @@ f_status(char *arg) errx(1, "unknown status %s", arg); } +static const struct { + const char *name; + int advice; + int flags; +} pieces[] = { + { "noreuse", POSIX_FADV_NOREUSE, ADVBEFORE }, + { "normal", POSIX_FADV_NORMAL, ADVBEFORE }, + { "random", POSIX_FADV_RANDOM, ADVBEFORE }, + { "sequential", POSIX_FADV_SEQUENTIAL, ADVBEFORE }, + { "willneed", POSIX_FADV_WILLNEED, ADVBEFORE }, + { "dontneed", POSIX_FADV_DONTNEED, ADVAFTER }, +}; + +static void +f_advice(const char *arg, IO *io) +{ + u_long i; + + for (i = 0; i < nitems(pieces); i++) + if (strcmp(arg, pieces[i].name) == 0) + break; + if (i == nitems(pieces)) + errx(1, "'%s' isn't real advice", arg); + + io->advice = pieces[i].advice; + io->flags |= pieces[i].flags; +} + +static void +f_iadvice(char *arg) +{ + + f_advice(arg, &in); +} + +static void +f_oadvice(char *arg) +{ + + f_advice(arg, &out); +} + static const struct conv { const char *name; u_int set, noset; diff --git a/bin/dd/dd.1 b/bin/dd/dd.1 index 0908642..9b6a824 100644 --- a/bin/dd/dd.1 +++ b/bin/dd/dd.1 @@ -94,6 +94,16 @@ modes, fill with the specified .Tn ASCII character, rather than using a space or .Dv NUL . +.It Cm iadvice Ns = Ns Ar value +Use +.Xr posix_fadvise 2 +to provide the specified hint about the input file over its entire range. +This is useful for benchmarking. +Valid values are formed by removing the +.Ql POSIX_FADV_ +prefix of +.Xr posix_fadvise 2 +arguments and converting the result to lower-case. .It Cm ibs Ns = Ns Ar n Set the input block size to .Ar n @@ -108,6 +118,10 @@ Seek on the input file blocks. This is synonymous with .Cm skip Ns = Ns Ar n . +.It Cm oadvice Ns = Ns Ar value +The equivalent of +.Cm iadvice +for the output file. .It Cm obs Ns = Ns Ar n Set the output block size to .Ar n diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 8ae11a7..7c78295 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -243,6 +243,13 @@ setup(void) ctab = casetab; } + if ((in.flags & ADVBEFORE) && + posix_fadvise(in.fd, 0, 0, in.advice) != 0) + err(1, "posix_fadvise"); + if ((out.flags & ADVBEFORE) && + posix_fadvise(out.fd, 0, 0, out.advice) != 0) + err(1, "posix_fadvise"); + if (clock_gettime(CLOCK_MONOTONIC, &st.start)) err(1, "clock_gettime"); } @@ -409,6 +416,12 @@ dd_close(void) } if (out.dbcnt || pending) dd_out(1); + if ((in.flags & ADVAFTER) && + posix_fadvise(in.fd, 0, 0, in.advice) != 0) + err(1, "posix_fadvise"); + if ((out.flags & ADVAFTER) && + posix_fadvise(out.fd, 0, 0, out.advice) != 0) + err(1, "posix_fadvise"); } void diff --git a/bin/dd/dd.h b/bin/dd/dd.h index a8b45e5..9627f52 100644 --- a/bin/dd/dd.h +++ b/bin/dd/dd.h @@ -49,9 +49,12 @@ typedef struct { #define ISSEEK 0x08 /* valid to seek on */ #define NOREAD 0x10 /* not readable */ #define ISTRUNC 0x20 /* valid to ftruncate() */ +#define ADVBEFORE 0x40 /* apply advice before I/O */ +#define ADVAFTER 0x80 /* apply advice after I/O */ u_int flags; const char *name; /* name */ + int advice; /* posix_fadvise(2) advice */ int fd; /* file descriptor */ off_t offset; /* # of blocks to skip */ } IO; @@ -98,5 +101,7 @@ typedef struct { #define C_STATUS 0x08000000 #define C_NOXFER 0x10000000 #define C_NOINFO 0x20000000 +#define C_IADV 0x40000000 +#define C_OADV 0x80000000 #define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET) --EVF5PPMfhYS0aIcm-- From owner-svn-src-all@freebsd.org Fri Oct 2 22:05:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADCE2A0E09E; Fri, 2 Oct 2015 22:05:52 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F1CA12A7; Fri, 2 Oct 2015 22:05:52 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92M5q5c025876; Fri, 2 Oct 2015 22:05:52 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92M5qOV025875; Fri, 2 Oct 2015 22:05:52 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510022205.t92M5qOV025875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 22:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288524 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 22:05:52 -0000 Author: grehan Date: Fri Oct 2 22:05:51 2015 New Revision: 288524 URL: https://svnweb.freebsd.org/changeset/base/288524 Log: Fix post-test typo that snuck in. Modified: head/usr.sbin/bhyve/fwctl.c Modified: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- head/usr.sbin/bhyve/fwctl.c Fri Oct 2 21:25:48 2015 (r288523) +++ head/usr.sbin/bhyve/fwctl.c Fri Oct 2 22:05:51 2015 (r288524) @@ -536,7 +536,7 @@ fwctl_handler(struct vmctx *ctx, int vcp return (0); } INOUT_PORT(fwctl_wreg, FWCTL_OUT, IOPORT_F_INOUT, fwctl_handler); -INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_OUT, fwctl_handler); +INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_IN, fwctl_handler); void fwctl_init(void) From owner-svn-src-all@freebsd.org Fri Oct 2 23:50:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9391CA0D6B7; Fri, 2 Oct 2015 23:50:45 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D1F21C40; Fri, 2 Oct 2015 23:50:44 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.15.0.59/8.15.0.59) with SMTP id t92NnjnB012271; Fri, 2 Oct 2015 18:50:37 -0500 Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by pp1.rice.edu with ESMTP id 1x9wyjg9rh-1; Fri, 02 Oct 2015 18:50:37 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from [10.87.76.177] (unknown [10.87.76.177]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 458054C01B1; Fri, 2 Oct 2015 18:50:37 -0500 (CDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r288431 - in head/sys: kern sys vm From: Alan Cox In-Reply-To: <4276391.z2UvhhORjP@ralph.baldwin.cx> Date: Fri, 2 Oct 2015 18:50:36 -0500 Cc: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> <4276391.z2UvhhORjP@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.9 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1510020307 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 02 Oct 2015 23:50:45 -0000 On Oct 2, 2015, at 10:59 AM, John Baldwin wrote: > On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: >> On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: >>> On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: >>>> Author: markj >>>> Date: Wed Sep 30 23:06:29 2015 >>>> New Revision: 288431 >>>> URL: https://svnweb.freebsd.org/changeset/base/288431 >>>>=20 >>>> Log: >>>> As a step towards the elimination of PG_CACHED pages, rework the = handling >>>> of POSIX_FADV_DONTNEED so that it causes the backing pages to be = moved to >>>> the head of the inactive queue instead of being cached. >>>>=20 >>>> This affects the implementation of POSIX_FADV_NOREUSE as well, = since it >>>> works by applying POSIX_FADV_DONTNEED to file ranges after they = have been >>>> read or written. At that point the corresponding buffers may = still be >>>> dirty, so the previous implementation would coalesce successive = ranges and >>>> apply POSIX_FADV_DONTNEED to the result, ensuring that pages = backing the >>>> dirty buffers would eventually be cached. To preserve this = behaviour in an >>>> efficient manner, this change adds a new buf flag, B_NOREUSE, = which causes >>>> the pages backing a VMIO buf to be placed at the head of the = inactive queue >>>> when the buf is released. POSIX_FADV_NOREUSE then works by = setting this >>>> flag in bufs that underlie the specified range. >>>=20 >>> Putting these pages back on the inactive queue completely defeats = the primary >>> purpose of DONTNEED and NOREUSE. The primary purpose is to move the = pages out >>> of the VM object's tree of pages and into the free pool so that the = application >>> can instruct the VM to free memory more efficiently than relying on = page daemon. >>>=20 >>> The implementation used cache pages instead of free as a cheap = optimization so >>> that if an application did something dumb where it used DONTNEED and = then turned >>> around and read the file it would not have to go to disk if the = pages had not >>> yet been reused. In practice this didn't work out so well because = PG_CACHE pages >>> don't really work well. >>>=20 >>> However, using PG_CACHE was secondary to the primary purpose of = explicitly freeing >>> memory that an application knew wasn't going to be reused and = avoiding the need >>> for pagedaemon to run at all. I think this should be freeing the = pages instead of >>> keeping them inactive. If an application uses DONTNEED or NOREUSE = and then turns >>> around and rereads the file, it generally deserves to have to go to = disk for it. >>=20 >> A problem with this is that one application's DONTNEED or NOREUSE = hint >> would cause every application reading or writing that file to go to >> disk, but posix_fadvise(2) is explicitly intended for applications = that >> wish to provide hints about their own access patterns. I realize that >> it's typically used with application-private files, but that's not a >> requirement of the interface. Deactivating (or caching) the backing >> pages generally avoids this problem. >=20 > I think it is not unreasonble to expect that fadvise() incurs = system-wide > affects. A properly implemented WILLNEED that does read-ahead cannot = work > without incurring system-wide effects. I had always assumed that = fadvise() > operated on a file, not a given process' view of a file (unlike, say, > madvise which only operates on mappings and only indirectly affects > file-backed data). >=20 Can you elaborate on what you mean by =93I had always assumed that = fadvise() operated on a file, =85=94? Under the previous implementation, if you did an fadvise(DONTNEED) on a = file, in order to cache the file=92s pages, those pages first had to be = unmapped from any address space. (You can find this unmapping performed = by vm_page_try_to_cache().) In other words, there was never any code = that said, =93Is this a mapped page, and if it is, don=92t cache it = because we=92re actually performing an fadvise().=94 So, to pick an = extreme example, if you did an fadvise(=93libc.so=94, DONTNEED), unless = some process had libc.so wired, then every single mapping to every = single page of libc.so was going to be destroyed and the pages moved to = the cache. However, because we moved the pages to the cache (rather = than freeing them), and libc.so is frequently accessed, a subsequent = instruction fetch would have faulted and been able to reactivate the = cached page, avoiding an I/O operation. In other words, that we were = caching the pages targeted by fadvise() rather than simply freeing them = mattered in cases where the pages were in use/accessed by multiple = processes. >>> I'm pretty sure I had mentioned this to Alan before. I believe that = the idea is >>> that pagedaemon should be cheap enough that having it run anyway = shouldn't be an >>> issue, but I'm a bit skeptical of that. :) Lock contention is = always possible and >>> having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock = contention with >>> pagedaemon during application page faults (since pagedaemon = potentially never has >>> to run). >>=20 >> That's true, but the page queue locking (and the pagedaemon's >> manipulation of the page queue locks) has also become more = fine-grained >> since posix_fadvise(2) was added. In particular, from some reading of >> sys/vm in stable/8, inactive queue scans used to be performed with = the >> global page queue lock held; it was only dropped to launder dirty = pages. >> Now, the page queue lock is split into separate locks for the active = and >> inactive page queues, and the pagedaemon drops the inactive queue = lock >> for each page in all but a few exceptional cases. Does the = optimization >> of freeing or caching DONTNEED pages buy us all that much now? >>=20 >> Some synthetic testing in which an application writes out many large >> (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one = shows >> no significant difference in runtime if the buffer pages are = deactivated >> vs. freed. (My test just modifies vfs_vmio_unwire() to treat = B_NOREUSE >> identically to B_DIRECT.) Unsurprisingly, I see very little lock >> contention in the latter case, but in the former, most of the lock >> contention is short (i.e. the mutex is acquired while spinning), and >> a large majority of the contention is on the free page queue mutex. = If >> lock contention there is a concern, wouldn't it be better to try and >> address that directly rather than by bypassing the pagedaemon? >=20 > The lock contention was related to one process faulting in a new page = due to > a malloc() while pagedaemon ran. Also, it wasn't a steady type of = contention > that would show up in an average. Instead, it was the outliers (which = in the > case on 8.x were on the order of 2 seconds) that were problematic. I = used a > hack to log "long" wait times for specific processes to both debug = this and > evaluate the solution. I have a test program laying around from when = I last > tested this. I'll see what I can reproduce (before it required a = machine > with at least 24GB of RAM to reproduce). >=20 > The only foolproof way to reduce contention to zero is to eliminate = one of > the contending threads. :) I do think there are situations where an > application may be more informed about the optimal memory pattern for = its > workload than what the VM system can infer from heuristics. Currently = there > is no other way to flush a file's contents from RAM. If we had things = like > DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a = sliding > scale, but at the moment the policy isn't that fine-grained. >=20 > --=20 > John Baldwin >=20 >=20 From owner-svn-src-all@freebsd.org Sat Oct 3 00:03:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95DFCA0E4B4; Sat, 3 Oct 2015 00:03:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B2A11608; Sat, 3 Oct 2015 00:03:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93038Y1074838; Sat, 3 Oct 2015 00:03:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93038q9074837; Sat, 3 Oct 2015 00:03:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030003.t93038q9074837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288525 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 00:03:08 -0000 Author: adrian Date: Sat Oct 3 00:03:07 2015 New Revision: 288525 URL: https://svnweb.freebsd.org/changeset/base/288525 Log: net80211: get rid of tx_phase1_done flag (ieee80211_crypto_tkip.c). Submitted by: Differential Revision: https://reviews.freebsd.org/D3596 Modified: head/sys/net80211/ieee80211_crypto_tkip.c Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 22:05:51 2015 (r288524) +++ head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:03:07 2015 (r288525) @@ -84,7 +84,6 @@ struct tkip_ctx { struct ieee80211vap *tc_vap; /* for diagnostics+statistics */ u16 tx_ttak[5]; - int tx_phase1_done; u8 tx_rc4key[16]; /* XXX for test module; make locals? */ u16 rx_ttak[5]; @@ -143,7 +142,6 @@ tkip_setkey(struct ieee80211_key *k) __func__, k->wk_keylen, 128/NBBY); return 0; } - k->wk_keytsc = 1; /* TSC starts at 1 */ ctx->rx_phase1_done = 0; return 1; } @@ -188,6 +186,7 @@ tkip_encap(struct ieee80211_key *k, stru keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + k->wk_keytsc++; ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ @@ -200,12 +199,9 @@ tkip_encap(struct ieee80211_key *k, stru /* * Finally, do software encrypt if needed. */ - if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) { - if (!tkip_encrypt(ctx, k, m, hdrlen)) - return 0; - /* NB: tkip_encrypt handles wk_keytsc */ - } else - k->wk_keytsc++; + if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && + !tkip_encrypt(ctx, k, m, hdrlen)) + return 0; return 1; } @@ -934,10 +930,9 @@ tkip_encrypt(struct tkip_ctx *ctx, struc ctx->tc_vap->iv_stats.is_crypto_tkip++; wh = mtod(m, struct ieee80211_frame *); - if (!ctx->tx_phase1_done) { + if ((u16)(key->wk_keytsc) == 0 || key->wk_keytsc == 1) { tkip_mixing_phase1(ctx->tx_ttak, key->wk_key, wh->i_addr2, (u32)(key->wk_keytsc >> 16)); - ctx->tx_phase1_done = 1; } tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak, (u16) key->wk_keytsc); @@ -948,9 +943,6 @@ tkip_encrypt(struct tkip_ctx *ctx, struc icv); (void) m_append(m, IEEE80211_WEP_CRCLEN, icv); /* XXX check return */ - key->wk_keytsc++; - if ((u16)(key->wk_keytsc) == 0) - ctx->tx_phase1_done = 0; return 1; } From owner-svn-src-all@freebsd.org Sat Oct 3 00:50:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10320A0E956; Sat, 3 Oct 2015 00:50:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98441D50; Sat, 3 Oct 2015 00:50:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t930oFol093573; Sat, 3 Oct 2015 00:50:15 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t930oElb093568; Sat, 3 Oct 2015 00:50:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030050.t930oElb093568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288526 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 00:50:16 -0000 Author: adrian Date: Sat Oct 3 00:50:13 2015 New Revision: 288526 URL: https://svnweb.freebsd.org/changeset/base/288526 Log: net80211: add new method for ieee80211_cipher (ic_setiv). This can be used to update IV state for the caller without adding information to the mbuf. Some hardware (eg rum) apparently requires bits of this. Submitted by: Differential Revision: https://reviews.freebsd.org/D3638 Modified: head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_none.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:50:13 2015 (r288526) @@ -178,6 +178,7 @@ struct ieee80211_cipher { void* (*ic_attach)(struct ieee80211vap *, struct ieee80211_key *); void (*ic_detach)(struct ieee80211_key *); int (*ic_setkey)(struct ieee80211_key *); + void (*ic_setiv)(struct ieee80211_key *, uint8_t *); int (*ic_encap)(struct ieee80211_key *, struct mbuf *); int (*ic_decap)(struct ieee80211_key *, struct mbuf *, int); int (*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Sat Oct 3 00:50:13 2015 (r288526) @@ -63,6 +63,7 @@ struct ccmp_ctx { static void *ccmp_attach(struct ieee80211vap *, struct ieee80211_key *); static void ccmp_detach(struct ieee80211_key *); static int ccmp_setkey(struct ieee80211_key *); +static void ccmp_setiv(struct ieee80211_key *, uint8_t *); static int ccmp_encap(struct ieee80211_key *, struct mbuf *); static int ccmp_decap(struct ieee80211_key *, struct mbuf *, int); static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int); @@ -78,6 +79,7 @@ static const struct ieee80211_cipher ccm .ic_attach = ccmp_attach, .ic_detach = ccmp_detach, .ic_setkey = ccmp_setkey, + .ic_setiv = ccmp_setiv, .ic_encap = ccmp_encap, .ic_decap = ccmp_decap, .ic_enmic = ccmp_enmic, @@ -134,6 +136,26 @@ ccmp_setkey(struct ieee80211_key *k) return 1; } +static void +ccmp_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ + struct ccmp_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->cc_vap; + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + + k->wk_keytsc++; + ivp[0] = k->wk_keytsc >> 0; /* PN0 */ + ivp[1] = k->wk_keytsc >> 8; /* PN1 */ + ivp[2] = 0; /* Reserved */ + ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ + ivp[4] = k->wk_keytsc >> 16; /* PN2 */ + ivp[5] = k->wk_keytsc >> 24; /* PN3 */ + ivp[6] = k->wk_keytsc >> 32; /* PN4 */ + ivp[7] = k->wk_keytsc >> 40; /* PN5 */ +} + /* * Add privacy headers appropriate for the specified key. */ @@ -142,9 +164,7 @@ ccmp_encap(struct ieee80211_key *k, stru { struct ccmp_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->cc_ic; - struct ieee80211vap *vap = ctx->cc_vap; uint8_t *ivp; - uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -159,17 +179,7 @@ ccmp_encap(struct ieee80211_key *k, stru ovbcopy(ivp + ccmp.ic_header, ivp, hdrlen); ivp += hdrlen; - keyid = ieee80211_crypto_get_keyid(vap, k) << 6; - - k->wk_keytsc++; /* XXX wrap at 48 bits */ - ivp[0] = k->wk_keytsc >> 0; /* PN0 */ - ivp[1] = k->wk_keytsc >> 8; /* PN1 */ - ivp[2] = 0; /* Reserved */ - ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ - ivp[4] = k->wk_keytsc >> 16; /* PN2 */ - ivp[5] = k->wk_keytsc >> 24; /* PN3 */ - ivp[6] = k->wk_keytsc >> 32; /* PN4 */ - ivp[7] = k->wk_keytsc >> 40; /* PN5 */ + ccmp_setiv(k, ivp); /* * Finally, do software encrypt if needed. Modified: head/sys/net80211/ieee80211_crypto_none.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_none.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_none.c Sat Oct 3 00:50:13 2015 (r288526) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); static void *none_attach(struct ieee80211vap *, struct ieee80211_key *); static void none_detach(struct ieee80211_key *); static int none_setkey(struct ieee80211_key *); +static void none_setiv(struct ieee80211_key *, uint8_t *); static int none_encap(struct ieee80211_key *, struct mbuf *); static int none_decap(struct ieee80211_key *, struct mbuf *, int); static int none_enmic(struct ieee80211_key *, struct mbuf *, int); @@ -62,6 +63,7 @@ const struct ieee80211_cipher ieee80211_ .ic_attach = none_attach, .ic_detach = none_detach, .ic_setkey = none_setkey, + .ic_setiv = none_setiv, .ic_encap = none_encap, .ic_decap = none_decap, .ic_enmic = none_enmic, @@ -87,6 +89,11 @@ none_setkey(struct ieee80211_key *k) return 1; } +static void +none_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ +} + static int none_encap(struct ieee80211_key *k, struct mbuf *m) { Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:50:13 2015 (r288526) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); static void *tkip_attach(struct ieee80211vap *, struct ieee80211_key *); static void tkip_detach(struct ieee80211_key *); static int tkip_setkey(struct ieee80211_key *); +static void tkip_setiv(struct ieee80211_key *, uint8_t *); static int tkip_encap(struct ieee80211_key *, struct mbuf *); static int tkip_enmic(struct ieee80211_key *, struct mbuf *, int); static int tkip_decap(struct ieee80211_key *, struct mbuf *, int); @@ -69,6 +70,7 @@ static const struct ieee80211_cipher tki .ic_attach = tkip_attach, .ic_detach = tkip_detach, .ic_setkey = tkip_setkey, + .ic_setiv = tkip_setiv, .ic_encap = tkip_encap, .ic_decap = tkip_decap, .ic_enmic = tkip_enmic, @@ -146,6 +148,26 @@ tkip_setkey(struct ieee80211_key *k) return 1; } +static void +tkip_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ + struct tkip_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->tc_vap; + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + + k->wk_keytsc++; + ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ + ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ + ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ + ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ + ivp[4] = k->wk_keytsc >> 16; /* TSC2 */ + ivp[5] = k->wk_keytsc >> 24; /* TSC3 */ + ivp[6] = k->wk_keytsc >> 32; /* TSC4 */ + ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ +} + /* * Add privacy headers and do any s/w encryption required. */ @@ -156,7 +178,6 @@ tkip_encap(struct ieee80211_key *k, stru struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211com *ic = vap->iv_ic; uint8_t *ivp; - uint8_t keyid; int hdrlen; /* @@ -184,17 +205,7 @@ tkip_encap(struct ieee80211_key *k, stru memmove(ivp, ivp + tkip.ic_header, hdrlen); ivp += hdrlen; - keyid = ieee80211_crypto_get_keyid(vap, k) << 6; - - k->wk_keytsc++; - ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ - ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ - ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ - ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ - ivp[4] = k->wk_keytsc >> 16; /* TSC2 */ - ivp[5] = k->wk_keytsc >> 24; /* TSC3 */ - ivp[6] = k->wk_keytsc >> 32; /* TSC4 */ - ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ + tkip_setiv(k, ivp); /* * Finally, do software encrypt if needed. Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_wep.c Sat Oct 3 00:50:13 2015 (r288526) @@ -50,8 +50,9 @@ __FBSDID("$FreeBSD$"); static void *wep_attach(struct ieee80211vap *, struct ieee80211_key *); static void wep_detach(struct ieee80211_key *); static int wep_setkey(struct ieee80211_key *); +static void wep_setiv(struct ieee80211_key *, uint8_t *); static int wep_encap(struct ieee80211_key *, struct mbuf *); -static int wep_decap(struct ieee80211_key *, struct mbuf *, int hdrlen); +static int wep_decap(struct ieee80211_key *, struct mbuf *, int); static int wep_enmic(struct ieee80211_key *, struct mbuf *, int); static int wep_demic(struct ieee80211_key *, struct mbuf *, int); @@ -64,6 +65,7 @@ static const struct ieee80211_cipher wep .ic_attach = wep_attach, .ic_detach = wep_detach, .ic_setkey = wep_setkey, + .ic_setiv = wep_setiv, .ic_encap = wep_encap, .ic_decap = wep_decap, .ic_enmic = wep_enmic, @@ -117,31 +119,13 @@ wep_setkey(struct ieee80211_key *k) return k->wk_keylen >= 40/NBBY; } -/* - * Add privacy headers appropriate for the specified key. - */ -static int -wep_encap(struct ieee80211_key *k, struct mbuf *m) +static void +wep_setiv(struct ieee80211_key *k, uint8_t *ivp) { struct wep_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->wc_vap; - struct ieee80211com *ic = ctx->wc_ic; uint32_t iv; - uint8_t *ivp; uint8_t keyid; - int hdrlen; - - hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); - - /* - * Copy down 802.11 header and add the IV + KeyID. - */ - M_PREPEND(m, wep.ic_header, M_NOWAIT); - if (m == NULL) - return 0; - ivp = mtod(m, uint8_t *); - ovbcopy(ivp + wep.ic_header, ivp, hdrlen); - ivp += hdrlen; keyid = ieee80211_crypto_get_keyid(vap, k) << 6; @@ -186,6 +170,32 @@ wep_encap(struct ieee80211_key *k, struc ivp[0] = iv >> 16; #endif ivp[3] = keyid; +} + +/* + * Add privacy headers appropriate for the specified key. + */ +static int +wep_encap(struct ieee80211_key *k, struct mbuf *m) +{ + struct wep_ctx *ctx = k->wk_private; + struct ieee80211com *ic = ctx->wc_ic; + uint8_t *ivp; + int hdrlen; + + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); + + /* + * Copy down 802.11 header and add the IV + KeyID. + */ + M_PREPEND(m, wep.ic_header, M_NOWAIT); + if (m == NULL) + return 0; + ivp = mtod(m, uint8_t *); + ovbcopy(ivp + wep.ic_header, ivp, hdrlen); + ivp += hdrlen; + + wep_setiv(k, ivp); /* * Finally, do software encrypt if needed. From owner-svn-src-all@freebsd.org Sat Oct 3 00:57:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F41B1A0EF61; Sat, 3 Oct 2015 00:57:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C89F211D7; Sat, 3 Oct 2015 00:57:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t930vYok095568; Sat, 3 Oct 2015 00:57:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t930vYjn095566; Sat, 3 Oct 2015 00:57:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030057.t930vYjn095566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288527 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 00:57:35 -0000 Author: adrian Date: Sat Oct 3 00:57:33 2015 New Revision: 288527 URL: https://svnweb.freebsd.org/changeset/base/288527 Log: net80211: add a possibility to retrieve current TX key without encapsulation. Submitted by: Differential Revision: https://reviews.freebsd.org/D3639 Modified: head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Sat Oct 3 00:50:13 2015 (r288526) +++ head/sys/net80211/ieee80211_crypto.c Sat Oct 3 00:57:33 2015 (r288527) @@ -531,16 +531,11 @@ ieee80211_crypto_get_keyid(struct ieee80 return (0); } -/* - * Add privacy headers appropriate for the specified key. - */ struct ieee80211_key * -ieee80211_crypto_encap(struct ieee80211_node *ni, struct mbuf *m) +ieee80211_crypto_get_txkey(struct ieee80211_node *ni, struct mbuf *m) { struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211_key *k; struct ieee80211_frame *wh; - const struct ieee80211_cipher *cip; /* * Multicast traffic always uses the multicast key. @@ -559,12 +554,27 @@ ieee80211_crypto_encap(struct ieee80211_ vap->iv_stats.is_tx_nodefkey++; return NULL; } - k = &vap->iv_nw_keys[vap->iv_def_txkey]; - } else - k = &ni->ni_ucastkey; + return &vap->iv_nw_keys[vap->iv_def_txkey]; + } - cip = k->wk_cipher; - return (cip->ic_encap(k, m) ? k : NULL); + return &ni->ni_ucastkey; +} + +/* + * Add privacy headers appropriate for the specified key. + */ +struct ieee80211_key * +ieee80211_crypto_encap(struct ieee80211_node *ni, struct mbuf *m) +{ + struct ieee80211_key *k; + const struct ieee80211_cipher *cip; + + if ((k = ieee80211_crypto_get_txkey(ni, m)) != NULL) { + cip = k->wk_cipher; + return (cip->ic_encap(k, m) ? k : NULL); + } + + return NULL; } /* Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:50:13 2015 (r288526) +++ head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:57:33 2015 (r288527) @@ -195,6 +195,8 @@ int ieee80211_crypto_available(u_int cip uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, struct ieee80211_key *k); +struct ieee80211_key *ieee80211_crypto_get_txkey(struct ieee80211_node *, + struct mbuf *); struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *); struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, From owner-svn-src-all@freebsd.org Sat Oct 3 03:12:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3CD9A0FBFD; Sat, 3 Oct 2015 03:12:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E46201929; Sat, 3 Oct 2015 03:12:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t933Cvm6053978; Sat, 3 Oct 2015 03:12:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t933Cvch053977; Sat, 3 Oct 2015 03:12:57 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201510030312.t933Cvch053977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 3 Oct 2015 03:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288528 - head/sbin/ipfw 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 03:12:58 -0000 Author: ae Date: Sat Oct 3 03:12:57 2015 New Revision: 288528 URL: https://svnweb.freebsd.org/changeset/base/288528 Log: Fix possible segmentation fault. PR: 203494 MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Oct 3 00:57:33 2015 (r288527) +++ head/sbin/ipfw/ipfw2.c Sat Oct 3 03:12:57 2015 (r288528) @@ -3625,7 +3625,7 @@ compile_rule(char *av[], uint32_t *rbuf, action->opcode = O_NAT; action->len = F_INSN_SIZE(ipfw_insn_nat); CHECK_ACTLEN; - if (_substrcmp(*av, "global") == 0) { + if (*av != NULL && _substrcmp(*av, "global") == 0) { action->arg1 = 0; av++; break; From owner-svn-src-all@freebsd.org Sat Oct 3 03:57:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B852BA0ECDB; Sat, 3 Oct 2015 03:57:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A86481B91; Sat, 3 Oct 2015 03:57:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t933vxNq070213; Sat, 3 Oct 2015 03:57:59 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t933vxMc070212; Sat, 3 Oct 2015 03:57:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201510030357.t933vxMc070212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 3 Oct 2015 03:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288529 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 03:57:59 -0000 Author: ae Date: Sat Oct 3 03:57:58 2015 New Revision: 288529 URL: https://svnweb.freebsd.org/changeset/base/288529 Log: Always detach encap handler when reconfiguring tunnel. Reported by: hrs MFC after: 1 week Modified: head/sys/net/if_gre.c Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Oct 3 03:12:57 2015 (r288528) +++ head/sys/net/if_gre.c Sat Oct 3 03:57:58 2015 (r288529) @@ -623,7 +623,7 @@ gre_set_tunnel(struct ifnet *ifp, struct default: return (EAFNOSUPPORT); } - if (sc->gre_family != src->sa_family) + if (sc->gre_family != 0) gre_detach(sc); GRE_WLOCK(sc); if (sc->gre_family != 0) From owner-svn-src-all@freebsd.org Sat Oct 3 05:42:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A177A0F343; Sat, 3 Oct 2015 05:42:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A34A1E40; Sat, 3 Oct 2015 05:42:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935gQjt019287; Sat, 3 Oct 2015 05:42:26 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935gQhE019286; Sat, 3 Oct 2015 05:42:26 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201510030542.t935gQhE019286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 3 Oct 2015 05:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288530 - head/sys/netpfil/ipfw 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 05:42:26 -0000 Author: melifaro Date: Sat Oct 3 05:42:25 2015 New Revision: 288530 URL: https://svnweb.freebsd.org/changeset/base/288530 Log: Bump number of prefixes in O_IP_ from 15 to 31 (max possible). PR: 203459 Submitted by: groos at xiplink.com MFC after: 2 weeks Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Oct 3 03:57:58 2015 (r288529) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Oct 3 05:42:25 2015 (r288530) @@ -1531,7 +1531,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int case O_IP_SRC_MASK: case O_IP_DST_MASK: /* only odd command lengths */ - if ( !(cmdlen & 1) || cmdlen > 31) + if ((cmdlen & 1) == 0) goto bad_size; break; From owner-svn-src-all@freebsd.org Sat Oct 3 05:44:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 596E4A0F478; Sat, 3 Oct 2015 05:44:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 496511FF5; Sat, 3 Oct 2015 05:44:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935i6Df019428; Sat, 3 Oct 2015 05:44:06 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935i5YN019425; Sat, 3 Oct 2015 05:44:05 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030544.t935i5YN019425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288531 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 05:44:06 -0000 Author: adrian Date: Sat Oct 3 05:44:05 2015 New Revision: 288531 URL: https://svnweb.freebsd.org/changeset/base/288531 Log: rum(4): some non-functional changes / cleanup * Remove unused sc_txtap_len/sc_rxtap_len fields. * Remove unused ackrate variable. * Remove unneded warning in rum_update_mcast(). * Use nitems(). * Replace some hardcoded values for RT2573_MAC_CSR1 register. * Remove second argument for RUM_LOCK_ASSERT() - it is always the same. Submitted by: Differential Revision: https://reviews.freebsd.org/D3605 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:42:25 2015 (r288530) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:44:05 2015 (r288531) @@ -86,8 +86,6 @@ SYSCTL_INT(_hw_usb_rum, OID_AUTO, debug, "Debug level"); #endif -#define N(a) ((int)(sizeof (a) / sizeof ((a)[0]))) - static const STRUCT_USB_HOST_ID rum_devs[] = { #define RUM_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } RUM_DEV(ABOCOM, HWU54DM), @@ -532,6 +530,7 @@ static int rum_detach(device_t self) { struct rum_softc *sc = device_get_softc(self); + struct ieee80211com *ic = &sc->sc_ic; /* Prevent further ioctls */ RUM_LOCK(sc); @@ -546,8 +545,8 @@ rum_detach(device_t self) rum_unsetup_tx_list(sc); RUM_UNLOCK(sc); - if (sc->sc_ic.ic_softc == sc) - ieee80211_ifdetach(&sc->sc_ic); + if (ic->ic_softc == sc) + ieee80211_ifdetach(ic); mbufq_drain(&sc->sc_snd); mtx_destroy(&sc->sc_mtx); return (0); @@ -1025,10 +1024,10 @@ rum_sendprot(struct rum_softc *sc, const struct ieee80211_frame *wh; struct rum_tx_data *data; struct mbuf *mprot; - int protrate, ackrate, pktlen, flags, isshort; + int protrate, pktlen, flags, isshort; uint16_t dur; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); KASSERT(prot == IEEE80211_PROT_RTSCTS || prot == IEEE80211_PROT_CTSONLY, ("protection %d", prot)); @@ -1036,7 +1035,6 @@ rum_sendprot(struct rum_softc *sc, pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN; protrate = ieee80211_ctl_rate(ic->ic_rt, rate); - ackrate = ieee80211_ack_rate(ic->ic_rt, rate); isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0; dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) @@ -1081,7 +1079,7 @@ rum_tx_mgt(struct rum_softc *sc, struct uint32_t flags = 0; uint16_t dur; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); @@ -1137,7 +1135,7 @@ rum_tx_raw(struct rum_softc *sc, struct uint32_t flags; int rate, error; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); KASSERT(params != NULL, ("no raw xmit params")); rate = params->ibp_rate0; @@ -1193,7 +1191,7 @@ rum_tx_data(struct rum_softc *sc, struct uint16_t dur; int error, rate; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); @@ -1289,7 +1287,7 @@ rum_start(struct rum_softc *sc) struct ieee80211_node *ni; struct mbuf *m; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); if (!sc->sc_running) return; @@ -1844,12 +1842,7 @@ rum_update_promisc(struct ieee80211com * static void rum_update_mcast(struct ieee80211com *ic) { - static int warning_printed; - - if (warning_printed == 0) { - ic_printf(ic, "need to implement %s\n", __func__); - warning_printed = 1; - } + /* Ignore. */ } static const char * @@ -1966,7 +1959,7 @@ rum_bbp_init(struct rum_softc *sc) } /* initialize BBP registers to default values */ - for (i = 0; i < N(rum_def_bbp); i++) + for (i = 0; i < nitems(rum_def_bbp); i++) rum_bbp_write(sc, rum_def_bbp[i].reg, rum_def_bbp[i].val); /* write vendor-specific BBP values (from EEPROM) */ @@ -1988,16 +1981,16 @@ rum_init(struct rum_softc *sc) usb_error_t error; int i, ntries; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); rum_stop(sc); /* initialize MAC registers to default values */ - for (i = 0; i < N(rum_def_mac); i++) + for (i = 0; i < nitems(rum_def_mac); i++) rum_write(sc, rum_def_mac[i].reg, rum_def_mac[i].val); /* set host ready */ - rum_write(sc, RT2573_MAC_CSR1, 3); + rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); /* wait for BBP/RF to wakeup */ @@ -2028,7 +2021,7 @@ rum_init(struct rum_softc *sc) rum_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr); /* initialize ASIC */ - rum_write(sc, RT2573_MAC_CSR1, 4); + rum_write(sc, RT2573_MAC_CSR1, RT2573_HOST_READY); /* * Allocate Tx and Rx xfer queues. @@ -2062,7 +2055,7 @@ static void rum_stop(struct rum_softc *sc) { - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); sc->sc_running = 0; @@ -2082,7 +2075,7 @@ rum_stop(struct rum_softc *sc) rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DISABLE_RX); /* reset ASIC */ - rum_write(sc, RT2573_MAC_CSR1, 3); + rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:42:25 2015 (r288530) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:44:05 2015 (r288531) @@ -90,7 +90,7 @@ struct rum_softc { device_t sc_dev; struct usb_device *sc_udev; - struct usb_xfer *sc_xfer[RUM_N_TRANSFER]; + struct usb_xfer *sc_xfer[RUM_N_TRANSFER]; uint8_t rf_rev; uint8_t rffreq; @@ -125,12 +125,9 @@ struct rum_softc { uint8_t bbp17; struct rum_rx_radiotap_header sc_rxtap; - int sc_rxtap_len; - struct rum_tx_radiotap_header sc_txtap; - int sc_txtap_len; }; #define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) #define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) -#define RUM_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t) +#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) From owner-svn-src-all@freebsd.org Sat Oct 3 05:46:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ABA5A0F675; Sat, 3 Oct 2015 05:46:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E47E11FD; Sat, 3 Oct 2015 05:46:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935kaqc019640; Sat, 3 Oct 2015 05:46:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935kao5019638; Sat, 3 Oct 2015 05:46:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030546.t935kao5019638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288532 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 05:46:36 -0000 Author: adrian Date: Sat Oct 3 05:46:35 2015 New Revision: 288532 URL: https://svnweb.freebsd.org/changeset/base/288532 Log: rum(4): add command queue for running sleepable tasks in non-sleepable contexts Tested: * Tested on WUSB54GC, STA mode. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3629 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:44:05 2015 (r288531) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:46:35 2015 (r288532) @@ -158,6 +158,9 @@ static struct ieee80211vap *rum_vap_crea int, const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void rum_vap_delete(struct ieee80211vap *); +static void rum_cmdq_cb(void *, int); +static int rum_cmd_sleepable(struct rum_softc *, const void *, + size_t, uint8_t, uint8_t, CMD_FUNC_PROTO); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); static void rum_unsetup_tx_list(struct rum_softc *); @@ -438,8 +441,8 @@ rum_attach(device_t self) sc->sc_udev = uaa->device; sc->sc_dev = self; - mtx_init(&sc->sc_mtx, device_get_nameunit(self), - MTX_NETWORK_LOCK, MTX_DEF); + RUM_LOCK_INIT(sc); + RUM_CMDQ_LOCK_INIT(sc); mbufq_init(&sc->sc_snd, ifqmaxlen); iface_index = RT2573_IFACE_INDEX; @@ -516,6 +519,8 @@ rum_attach(device_t self) &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), RT2573_RX_RADIOTAP_PRESENT); + TASK_INIT(&sc->cmdq_task, 0, rum_cmdq_cb, sc); + if (bootverbose) ieee80211_announce(ic); @@ -545,10 +550,15 @@ rum_detach(device_t self) rum_unsetup_tx_list(sc); RUM_UNLOCK(sc); - if (ic->ic_softc == sc) + if (ic->ic_softc == sc) { + ieee80211_draintask(ic, &sc->cmdq_task); ieee80211_ifdetach(ic); + } + mbufq_drain(&sc->sc_snd); - mtx_destroy(&sc->sc_mtx); + RUM_CMDQ_LOCK_DESTROY(sc); + RUM_LOCK_DESTROY(sc); + return (0); } @@ -625,6 +635,57 @@ rum_vap_delete(struct ieee80211vap *vap) } static void +rum_cmdq_cb(void *arg, int pending) +{ + struct rum_softc *sc = arg; + struct rum_cmdq *rc; + + RUM_CMDQ_LOCK(sc); + while (sc->cmdq[sc->cmdq_first].func != NULL) { + rc = &sc->cmdq[sc->cmdq_first]; + RUM_CMDQ_UNLOCK(sc); + + RUM_LOCK(sc); + rc->func(sc, &rc->data, rc->rn_id, rc->rvp_id); + RUM_UNLOCK(sc); + + RUM_CMDQ_LOCK(sc); + memset(rc, 0, sizeof (*rc)); + sc->cmdq_first = (sc->cmdq_first + 1) % RUM_CMDQ_SIZE; + } + RUM_CMDQ_UNLOCK(sc); +} + +static int +rum_cmd_sleepable(struct rum_softc *sc, const void *ptr, size_t len, + uint8_t rn_id, uint8_t rvp_id, CMD_FUNC_PROTO) +{ + struct ieee80211com *ic = &sc->sc_ic; + + KASSERT(len <= sizeof(union sec_param), ("buffer overflow")); + + RUM_CMDQ_LOCK(sc); + if (sc->cmdq[sc->cmdq_last].func != NULL) { + device_printf(sc->sc_dev, "%s: cmdq overflow\n", __func__); + RUM_CMDQ_UNLOCK(sc); + + return EAGAIN; + } + + if (ptr != NULL) + memcpy(&sc->cmdq[sc->cmdq_last].data, ptr, len); + sc->cmdq[sc->cmdq_last].rn_id = rn_id; + sc->cmdq[sc->cmdq_last].rvp_id = rvp_id; + sc->cmdq[sc->cmdq_last].func = func; + sc->cmdq_last = (sc->cmdq_last + 1) % RUM_CMDQ_SIZE; + RUM_CMDQ_UNLOCK(sc); + + ieee80211_runtask(ic, &sc->cmdq_task); + + return 0; +} + +static void rum_tx_free(struct rum_tx_data *data, int txerr) { struct rum_softc *sc = data->sc; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:44:05 2015 (r288531) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:46:35 2015 (r288532) @@ -67,6 +67,25 @@ struct rum_tx_data { }; typedef STAILQ_HEAD(, rum_tx_data) rum_txdhead; +union sec_param { + struct ieee80211_key key; + uint8_t macaddr[IEEE80211_ADDR_LEN]; + struct ieee80211vap *vap; +}; +#define CMD_FUNC_PROTO void (*func)(struct rum_softc *, \ + union sec_param *, uint8_t, \ + uint8_t) + +struct rum_cmdq { + union sec_param data; + + uint8_t rn_id; + uint8_t rvp_id; + + CMD_FUNC_PROTO; +}; +#define RUM_CMDQ_SIZE 16 + struct rum_vap { struct ieee80211vap vap; struct ieee80211_beacon_offsets bo; @@ -103,6 +122,12 @@ struct rum_softc { struct mtx sc_mtx; + struct rum_cmdq cmdq[RUM_CMDQ_SIZE]; + struct mtx cmdq_mtx; + struct task cmdq_task; + uint8_t cmdq_first; + uint8_t cmdq_last; + uint32_t sta[6]; uint32_t rf_regs[4]; uint8_t txpow[44]; @@ -128,6 +153,16 @@ struct rum_softc { struct rum_tx_radiotap_header sc_txtap; }; -#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) -#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define RUM_LOCK_INIT(sc) \ + mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \ + MTX_NETWORK_LOCK, MTX_DEF); +#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) +#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) +#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define RUM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) + +#define RUM_CMDQ_LOCK_INIT(sc) \ + mtx_init(&(sc)->cmdq_mtx, "cmdq lock", NULL, MTX_DEF) +#define RUM_CMDQ_LOCK(sc) mtx_lock(&(sc)->cmdq_mtx) +#define RUM_CMDQ_UNLOCK(sc) mtx_unlock(&(sc)->cmdq_mtx) +#define RUM_CMDQ_LOCK_DESTROY(sc) mtx_destroy(&(sc)->cmdq_mtx) From owner-svn-src-all@freebsd.org Sat Oct 3 05:55:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CE0A0FB51; Sat, 3 Oct 2015 05:55:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 820301831; Sat, 3 Oct 2015 05:55:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935tHNB023706; Sat, 3 Oct 2015 05:55:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935tH1O023705; Sat, 3 Oct 2015 05:55:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030555.t935tH1O023705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288533 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 05:55:17 -0000 Author: adrian Date: Sat Oct 3 05:55:16 2015 New Revision: 288533 URL: https://svnweb.freebsd.org/changeset/base/288533 Log: ural(4): reduce copy-paste in ural_newstate(). Submitted by: Differential Revision: https://reviews.freebsd.org/D3656 Modified: head/sys/dev/usb/wlan/if_ural.c Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 05:46:35 2015 (r288532) +++ head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 05:55:16 2015 (r288533) @@ -698,12 +698,9 @@ ural_newstate(struct ieee80211vap *vap, ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { - if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); - } + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + goto fail; + ural_update_slot(sc); ural_set_txpreamble(sc); ural_set_basicrates(sc, ic->ic_bsschan); @@ -717,19 +714,13 @@ ural_newstate(struct ieee80211vap *vap, if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + goto fail; } ieee80211_ref_node(ni); if (ural_tx_bcn(sc, m, ni) != 0) { device_printf(sc->sc_dev, "could not send beacon\n"); - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + goto fail; } } @@ -755,6 +746,12 @@ ural_newstate(struct ieee80211vap *vap, RAL_UNLOCK(sc); IEEE80211_LOCK(ic); return (uvp->newstate(vap, nstate, arg)); + +fail: + RAL_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return (-1); } From owner-svn-src-all@freebsd.org Sat Oct 3 06:07:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8BF6A0D073; Sat, 3 Oct 2015 06:07:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C93001C9D; Sat, 3 Oct 2015 06:07:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93672QE027851; Sat, 3 Oct 2015 06:07:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93672ft027850; Sat, 3 Oct 2015 06:07:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030607.t93672ft027850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 06:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288534 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 06:07:02 -0000 Author: adrian Date: Sat Oct 3 06:07:01 2015 New Revision: 288534 URL: https://svnweb.freebsd.org/changeset/base/288534 Log: urtwn(4): fix sequence numbering for QoS frames Tested: * urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3684 Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Sat Oct 3 05:55:16 2015 (r288533) +++ head/sys/dev/usb/wlan/if_urtwn.c Sat Oct 3 06:07:01 2015 (r288534) @@ -1775,7 +1775,7 @@ urtwn_tx_start(struct urtwn_softc *sc, s struct r92c_tx_desc *txd; uint8_t raid, type; uint16_t sum; - int i, hasqos, xferlen; + int i, xferlen; struct usb_xfer *urtwn_pipes[4] = { sc->sc_xfer[URTWN_BULK_TX_BE], sc->sc_xfer[URTWN_BULK_TX_BK], @@ -1816,8 +1816,6 @@ urtwn_tx_start(struct urtwn_softc *sc, s break; } - hasqos = 0; - /* Fill Tx descriptor. */ txd = (struct r92c_tx_desc *)data->buf; memset(txd, 0, sizeof(*txd)); @@ -1873,7 +1871,7 @@ urtwn_tx_start(struct urtwn_softc *sc, s /* Set sequence number (already little endian). */ txd->txdseq |= *(uint16_t *)wh->i_seq; - if (!hasqos) { + if (!IEEE80211_QOS_HAS_SEQ(wh)) { /* Use HW sequence numbering for non-QoS frames. */ txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ); txd->txdseq |= htole16(0x8000); From owner-svn-src-all@freebsd.org Sat Oct 3 06:35:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5539EA0EBB2; Sat, 3 Oct 2015 06:35:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 456361AAE; Sat, 3 Oct 2015 06:35:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t936ZI6A040142; Sat, 3 Oct 2015 06:35:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t936ZHbs040140; Sat, 3 Oct 2015 06:35:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030635.t936ZHbs040140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 06:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288535 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 06:35:18 -0000 Author: adrian Date: Sat Oct 3 06:35:17 2015 New Revision: 288535 URL: https://svnweb.freebsd.org/changeset/base/288535 Log: Remove beacon offsets usage from if_rum. Differential Revision: https://reviews.freebsd.org/D3658 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 06:07:01 2015 (r288534) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 06:35:17 2015 (r288535) @@ -2187,7 +2187,7 @@ rum_prepare_beacon(struct rum_softc *sc, if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) return; - m0 = ieee80211_beacon_alloc(vap->iv_bss, &RUM_VAP(vap)->bo); + m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); if (m0 == NULL) return; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 06:07:01 2015 (r288534) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 06:35:17 2015 (r288535) @@ -88,7 +88,6 @@ struct rum_cmdq { struct rum_vap { struct ieee80211vap vap; - struct ieee80211_beacon_offsets bo; struct usb_callout ratectl_ch; struct task ratectl_task; From owner-svn-src-all@freebsd.org Sat Oct 3 07:03:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E342EA0FD69; Sat, 3 Oct 2015 07:03:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6A118D5; Sat, 3 Oct 2015 07:03:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t9372u6R091217 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 3 Oct 2015 10:02:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t9372u6R091217 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t9372uPg091216; Sat, 3 Oct 2015 10:02:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Oct 2015 10:02:56 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, gjb@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151003070256.GD11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> <1443803276.66572.72.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443803276.66572.72.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:03:03 -0000 On Fri, Oct 02, 2015 at 10:27:56AM -0600, Ian Lepore wrote: > On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > > Some arm documentation refers to the need for "support code" when the > > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > > be just the RPi I think). Do we have that support code? What happens > > > if it's missing? I can't actually find any info on exactly what that > > > support code is supposed to do. For all I know, we have the required > > > code in libm. Or maybe what's needed is exception-handling code in the > > > kernel. I can't find any info on what they mean by "support code" in > > > this context. > > The fpscr register is user-modifiable, so whatever happens after the > > change, could as well happen before it. > > > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > > Flush-to-zero. But I was sure that the text refers to the modes when > > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > > fault handler must do something to allow the computation to proceed. > > > > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > > looked in a few of the TRMs for different cortex-a series processors and > > > they say the hardware handles all combinations of rounding and flush to > > > zero without support software. But we should probably be on the lookout > > > for reports of misbehaving apps on RPi after this change, just in case > > > this setting has been protecting us from our ignorance there. > > > > I did found the reference to the support code in the VFP11 TRM, which in > > turns point to > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > > indeed I would need to not enable FZ on the affected hardware. > > > > That link opened a reference to a cortex-a57 chip for me. I've had > problems trying to share links to arm's documentation site, something > about the way that navbar stuff works makes pasting links not-work. I tried to reference App Notes and tutorials -> All Application Notes -> AN098 - VFP Support Code > > We support one arm11/VFPv2 chipset, the one used on RPi. It's the only > actual armv6 chip we support, all the other stuff supported by the arch > we call armv6 is really armv7. The TRM for the arm1176JZF-S core used > on RPi is the one that mentions needing support code. Yes, testing on original RPi, done by Glen, demostrates it. The test program I used is at https://www.kib.kiev.ua/kib/perl_opbasic_arith_175.c https://www.kib.kiev.ua/kib/perl_opbasic_arith_175 is the compiled binary with -mfloat-abi=softfp Also the following untested on RPi patch should fix this. I verified that it still starts with FZ bit cleared, on VFP v3 (RPi 2): https://www.kib.kiev.ua/kib/rpi-fz.1.patch From owner-svn-src-all@freebsd.org Sat Oct 3 07:17:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37075A0D7E4; Sat, 3 Oct 2015 07:17:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 273581DE7; Sat, 3 Oct 2015 07:17:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937Hk6q057960; Sat, 3 Oct 2015 07:17:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937HkMu057959; Sat, 3 Oct 2015 07:17:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030717.t937HkMu057959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:17: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: r288536 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:17:46 -0000 Author: mav Date: Sat Oct 3 07:17:45 2015 New Revision: 288536 URL: https://svnweb.freebsd.org/changeset/base/288536 Log: MFC r281109: Add DTrace probe to the new ARC reclaim cause added in r281026. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 06:35:17 2015 (r288535) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:17:45 2015 (r288536) @@ -2674,8 +2674,12 @@ arc_reclaim_needed(void) * Above limits know nothing about real level of KVA fragmentation. * Start aggressive reclamation if too little sequential KVA left. */ - if (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) + if (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) { + DTRACE_PROBE2(arc__reclaim_maxfree, uint64_t, + vmem_size(heap_arena, VMEM_MAXFREE), + uint64_t, zfs_max_recordsize); return (1); + } #else /* _KERNEL */ if (spa_get_random(100) == 0) From owner-svn-src-all@freebsd.org Sat Oct 3 07:19:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E5CAA0D901; Sat, 3 Oct 2015 07:19:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34BB41F38; Sat, 3 Oct 2015 07:19:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937JD6O058174; Sat, 3 Oct 2015 07:19:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937JD0R058173; Sat, 3 Oct 2015 07:19:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030719.t937JD0R058173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:19: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: r288537 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:19:13 -0000 Author: mav Date: Sat Oct 3 07:19:12 2015 New Revision: 288537 URL: https://svnweb.freebsd.org/changeset/base/288537 Log: MFC r286539: 5562 ZFS sa_handle's violate kmem invariants, debug kernels panic on boot Reviewed by: Matthew Ahrens Reviewed by: Robert Mustacchi Reviewed by: George Wilson Reviewed by: Rich Lowe Approved by: Dan McDonald Author: Justin T. Gibbs illumos/illumos-gate@0fda3cc5c1c5a1d9bdea6d52637bef6e781549c9 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Sat Oct 3 07:17:45 2015 (r288536) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Sat Oct 3 07:19:12 2015 (r288537) @@ -210,12 +210,6 @@ sa_cache_constructor(void *buf, void *un { sa_handle_t *hdl = buf; - hdl->sa_bonus_tab = NULL; - hdl->sa_spill_tab = NULL; - hdl->sa_os = NULL; - hdl->sa_userp = NULL; - hdl->sa_bonus = NULL; - hdl->sa_spill = NULL; mutex_init(&hdl->sa_lock, NULL, MUTEX_DEFAULT, NULL); return (0); } @@ -1350,14 +1344,11 @@ sa_handle_destroy(sa_handle_t *hdl) (void) dmu_buf_update_user((dmu_buf_t *)hdl->sa_bonus, hdl, NULL, NULL); - if (hdl->sa_bonus_tab) { + if (hdl->sa_bonus_tab) sa_idx_tab_rele(hdl->sa_os, hdl->sa_bonus_tab); - hdl->sa_bonus_tab = NULL; - } - if (hdl->sa_spill_tab) { + + if (hdl->sa_spill_tab) sa_idx_tab_rele(hdl->sa_os, hdl->sa_spill_tab); - hdl->sa_spill_tab = NULL; - } dmu_buf_rele(hdl->sa_bonus, NULL); @@ -1392,6 +1383,8 @@ sa_handle_get_from_db(objset_t *os, dmu_ handle->sa_bonus = db; handle->sa_os = os; handle->sa_spill = NULL; + handle->sa_bonus_tab = NULL; + handle->sa_spill_tab = NULL; error = sa_build_index(handle, SA_BONUS); newhandle = (hdl_type == SA_HDL_SHARED) ? From owner-svn-src-all@freebsd.org Sat Oct 3 07:20:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 396B3A0DA1A; Sat, 3 Oct 2015 07:20:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B19910E8; Sat, 3 Oct 2015 07:20:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937KSDF058397; Sat, 3 Oct 2015 07:20:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937KRkN058388; Sat, 3 Oct 2015 07:20:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030720.t937KRkN058388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:20: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: r288538 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:20:29 -0000 Author: mav Date: Sat Oct 3 07:20:26 2015 New Revision: 288538 URL: https://svnweb.freebsd.org/changeset/base/288538 Log: MFC r286541: 5531 NULL pointer dereference in dsl_prop_get_ds() Reviewed by: Matthew Ahrens Reviewed by: Dan McDonald Reviewed by: George Wilson Reviewed by: Bayard Bell Approved by: Robert Mustacchi Author: Justin T. Gibbs illumos/illumos-gate@e57a022b8f718889ffa92adbde47a8f08abcdb25 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:20:26 2015 (r288538) @@ -118,11 +118,9 @@ dbuf_hash(void *os, uint64_t obj, uint8_ (dbuf)->db_blkid == (blkid)) dmu_buf_impl_t * -dbuf_find(dnode_t *dn, uint8_t level, uint64_t blkid) +dbuf_find(objset_t *os, uint64_t obj, uint8_t level, uint64_t blkid) { dbuf_hash_table_t *h = &dbuf_hash_table; - objset_t *os = dn->dn_objset; - uint64_t obj = dn->dn_object; uint64_t hv = DBUF_HASH(os, obj, level, blkid); uint64_t idx = hv & h->hash_table_mask; dmu_buf_impl_t *db; @@ -142,6 +140,24 @@ dbuf_find(dnode_t *dn, uint8_t level, ui return (NULL); } +static dmu_buf_impl_t * +dbuf_find_bonus(objset_t *os, uint64_t object) +{ + dnode_t *dn; + dmu_buf_impl_t *db = NULL; + + if (dnode_hold(os, object, FTAG, &dn) == 0) { + rw_enter(&dn->dn_struct_rwlock, RW_READER); + if (dn->dn_bonus != NULL) { + db = dn->dn_bonus; + mutex_enter(&db->db_mtx); + } + rw_exit(&dn->dn_struct_rwlock); + dnode_rele(dn, FTAG); + } + return (db); +} + /* * Insert an entry into the hash table. If there is already an element * equal to elem in the hash table, then the already existing element @@ -1852,7 +1868,7 @@ dbuf_prefetch(dnode_t *dn, uint64_t blki return; /* dbuf_find() returns with db_mtx held */ - if (db = dbuf_find(dn, 0, blkid)) { + if (db = dbuf_find(dn->dn_objset, dn->dn_object, 0, blkid)) { /* * This dbuf is already in the cache. We assume that * it is already CACHED, or else about to be either @@ -1899,7 +1915,7 @@ dbuf_hold_impl(dnode_t *dn, uint8_t leve *dbp = NULL; top: /* dbuf_find() returns with db_mtx held */ - db = dbuf_find(dn, level, blkid); + db = dbuf_find(dn->dn_objset, dn->dn_object, level, blkid); if (db == NULL) { blkptr_t *bp = NULL; @@ -2035,6 +2051,30 @@ dbuf_add_ref(dmu_buf_impl_t *db, void *t ASSERT(holds > 1); } +#pragma weak dmu_buf_try_add_ref = dbuf_try_add_ref +boolean_t +dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid, + void *tag) +{ + dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; + dmu_buf_impl_t *found_db; + boolean_t result = B_FALSE; + + if (db->db_blkid == DMU_BONUS_BLKID) + found_db = dbuf_find_bonus(os, obj); + else + found_db = dbuf_find(os, obj, 0, blkid); + + if (found_db != NULL) { + if (db == found_db && dbuf_refcount(db) > db->db_dirtycnt) { + (void) refcount_add(&db->db_holds, tag); + result = B_TRUE; + } + mutex_exit(&db->db_mtx); + } + return (result); +} + /* * If you call dbuf_rele() you had better not be referencing the dnode handle * unless you have some other direct or indirect hold on the dnode. (An indirect Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:20:26 2015 (r288538) @@ -76,7 +76,8 @@ dnode_increase_indirection(dnode_t *dn, /* set dbuf's parent pointers to new indirect buf */ for (i = 0; i < nblkptr; i++) { - dmu_buf_impl_t *child = dbuf_find(dn, old_toplvl, i); + dmu_buf_impl_t *child = + dbuf_find(dn->dn_objset, dn->dn_object, old_toplvl, i); if (child == NULL) continue; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:20:26 2015 (r288538) @@ -369,6 +369,13 @@ dsl_dataset_snap_remove(dsl_dataset_t *d return (err); } +boolean_t +dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, void *tag) +{ + return (dmu_buf_try_add_ref(ds->ds_dbuf, dp->dp_meta_objset, + ds->ds_object, DMU_BONUS_BLKID, tag)); +} + int dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag, dsl_dataset_t **dsp) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Sat Oct 3 07:20:26 2015 (r288538) @@ -442,9 +442,31 @@ dsl_prop_notify_all_cb(dsl_pool_t *dp, d cbr = list_next(&dd->dd_prop_cbs, cbr)) { uint64_t value; + /* + * Callback entries do not have holds on their datasets + * so that datasets with registered callbacks are still + * eligible for eviction. Unlike operations on callbacks + * for a single dataset, we are performing a recursive + * descent of related datasets and the calling context + * for this iteration only has a dataset hold on the root. + * Without a hold, the callback's pointer to the dataset + * could be invalidated by eviction at any time. + * + * Use dsl_dataset_try_add_ref() to verify that the + * dataset has not begun eviction processing and to + * prevent eviction from occurring for the duration + * of the callback. If the hold attempt fails, this + * object is already being evicted and the callback can + * be safely ignored. + */ + if (!dsl_dataset_try_add_ref(dp, cbr->cbr_ds, FTAG)) + continue; + if (dsl_prop_get_ds(cbr->cbr_ds, cbr->cbr_propname, sizeof (value), 1, &value, NULL) == 0) cbr->cbr_func(cbr->cbr_arg, value); + + dsl_dataset_rele(cbr->cbr_ds, FTAG); } mutex_exit(&dd->dd_lock); @@ -497,19 +519,28 @@ dsl_prop_changed_notify(dsl_pool_t *dp, mutex_enter(&dd->dd_lock); for (cbr = list_head(&dd->dd_prop_cbs); cbr; cbr = list_next(&dd->dd_prop_cbs, cbr)) { - uint64_t propobj = dsl_dataset_phys(cbr->cbr_ds)->ds_props_obj; + uint64_t propobj; - if (strcmp(cbr->cbr_propname, propname) != 0) + /* + * cbr->cbf_ds may be invalidated due to eviction, + * requiring the use of dsl_dataset_try_add_ref(). + * See comment block in dsl_prop_notify_all_cb() + * for details. + */ + if (strcmp(cbr->cbr_propname, propname) != 0 || + !dsl_dataset_try_add_ref(dp, cbr->cbr_ds, FTAG)) continue; + propobj = dsl_dataset_phys(cbr->cbr_ds)->ds_props_obj; + /* - * If the property is set on this ds, then it is not - * inherited here; don't call the callback. + * If the property is not set on this ds, then it is + * inherited here; call the callback. */ - if (propobj && 0 == zap_contains(mos, propobj, propname)) - continue; + if (propobj == 0 || zap_contains(mos, propobj, propname) != 0) + cbr->cbr_func(cbr->cbr_arg, value); - cbr->cbr_func(cbr->cbr_arg, value); + dsl_dataset_rele(cbr->cbr_ds, FTAG); } mutex_exit(&dd->dd_lock); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Sat Oct 3 07:20:26 2015 (r288538) @@ -264,12 +264,15 @@ int dbuf_hold_impl(struct dnode *dn, uin void dbuf_prefetch(struct dnode *dn, uint64_t blkid, zio_priority_t prio); void dbuf_add_ref(dmu_buf_impl_t *db, void *tag); +boolean_t dbuf_try_add_ref(dmu_buf_t *db, objset_t *os, uint64_t obj, + uint64_t blkid, void *tag); uint64_t dbuf_refcount(dmu_buf_impl_t *db); void dbuf_rele(dmu_buf_impl_t *db, void *tag); void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag); -dmu_buf_impl_t *dbuf_find(struct dnode *dn, uint8_t level, uint64_t blkid); +dmu_buf_impl_t *dbuf_find(struct objset *os, uint64_t object, uint8_t level, + uint64_t blkid); int dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags); void dmu_buf_will_not_fill(dmu_buf_t *db, dmu_tx_t *tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 07:20:26 2015 (r288538) @@ -462,7 +462,23 @@ int dmu_spill_hold_existing(dmu_buf_t *b */ int dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset, void *tag, dmu_buf_t **, int flags); + +/* + * Add a reference to a dmu buffer that has already been held via + * dmu_buf_hold() in the current context. + */ void dmu_buf_add_ref(dmu_buf_t *db, void* tag); + +/* + * Attempt to add a reference to a dmu buffer that is in an unknown state, + * using a pointer that may have been invalidated by eviction processing. + * The request will succeed if the passed in dbuf still represents the + * same os/object/blkid, is ineligible for eviction, and has at least + * one hold by a user other than the syncer. + */ +boolean_t dmu_buf_try_add_ref(dmu_buf_t *, objset_t *os, uint64_t object, + uint64_t blkid, void *tag); + void dmu_buf_rele(dmu_buf_t *db, void *tag); uint64_t dmu_buf_refcount(dmu_buf_t *db); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 07:19:12 2015 (r288537) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 07:20:26 2015 (r288538) @@ -208,6 +208,8 @@ dsl_dataset_is_snapshot(dsl_dataset_t *d int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag, dsl_dataset_t **dsp); +boolean_t dsl_dataset_try_add_ref(struct dsl_pool *dp, dsl_dataset_t *ds, + void *tag); int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj, void *tag, dsl_dataset_t **); void dsl_dataset_rele(dsl_dataset_t *ds, void *tag); From owner-svn-src-all@freebsd.org Sat Oct 3 07:21:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D761A0DC5B; Sat, 3 Oct 2015 07:21:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DC0612FB; Sat, 3 Oct 2015 07:21:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937LS03059560; Sat, 3 Oct 2015 07:21:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937LSgw059559; Sat, 3 Oct 2015 07:21:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030721.t937LSgw059559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:21:28 +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: r288539 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:21:28 -0000 Author: mav Date: Sat Oct 3 07:21:27 2015 New Revision: 288539 URL: https://svnweb.freebsd.org/changeset/base/288539 Log: MFC r286543: 5592 NULL pointer dereference in dsl_prop_notify_all_cb() Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Will Andrews Approved by: Robert Mustacchi illumos/illumos-gate@9d47dec0481d8cd53b2c1053c96bfa3f78357d6a Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:20:26 2015 (r288538) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:21:27 2015 (r288539) @@ -372,8 +372,19 @@ dsl_dataset_snap_remove(dsl_dataset_t *d boolean_t dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, void *tag) { - return (dmu_buf_try_add_ref(ds->ds_dbuf, dp->dp_meta_objset, - ds->ds_object, DMU_BONUS_BLKID, tag)); + dmu_buf_t *dbuf = ds->ds_dbuf; + boolean_t result = B_FALSE; + + if (dbuf != NULL && dmu_buf_try_add_ref(dbuf, dp->dp_meta_objset, + ds->ds_object, DMU_BONUS_BLKID, tag)) { + + if (ds == dmu_buf_get_user(dbuf)) + result = B_TRUE; + else + dmu_buf_rele(dbuf, tag); + } + + return (result); } int From owner-svn-src-all@freebsd.org Sat Oct 3 07:22:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5F7BA0DD74; Sat, 3 Oct 2015 07:22:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B79C17E9; Sat, 3 Oct 2015 07:22:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937MQC7062388; Sat, 3 Oct 2015 07:22:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937MPDo062384; Sat, 3 Oct 2015 07:22:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030722.t937MPDo062384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:22: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: r288541 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:22:26 -0000 Author: mav Date: Sat Oct 3 07:22:24 2015 New Revision: 288541 URL: https://svnweb.freebsd.org/changeset/base/288541 Log: MFC r286545: 5630 stale bonus buffer in recycled dnode_t leads to data corruption Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Will Andrews Approved by: Robert Mustacchi Author: Justin T. Gibbs Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:22:07 2015 (r288540) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:22:24 2015 (r288541) @@ -2128,21 +2128,60 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, if (holds == 0) { if (db->db_blkid == DMU_BONUS_BLKID) { - mutex_exit(&db->db_mtx); + dnode_t *dn; /* - * If the dnode moves here, we cannot cross this barrier - * until the move completes. + * If the dnode moves here, we cannot cross this + * barrier until the move completes. */ DB_DNODE_ENTER(db); - atomic_dec_32(&DB_DNODE(db)->dn_dbufs_count); + + dn = DB_DNODE(db); + atomic_dec_32(&dn->dn_dbufs_count); + + /* + * Decrementing the dbuf count means that the bonus + * buffer's dnode hold is no longer discounted in + * dnode_move(). The dnode cannot move until after + * the dnode_rele_and_unlock() below. + */ DB_DNODE_EXIT(db); + /* - * The bonus buffer's dnode hold is no longer discounted - * in dnode_move(). The dnode cannot move until after - * the dnode_rele(). + * Do not reference db after its lock is dropped. + * Another thread may evict it. */ - dnode_rele(DB_DNODE(db), db); + mutex_exit(&db->db_mtx); + + /* + * If the dnode has been freed, evict the bonus + * buffer immediately. The data in the bonus + * buffer is no longer relevant and this prevents + * a stale bonus buffer from being associated + * with this dnode_t should the dnode_t be reused + * prior to being destroyed. + */ + mutex_enter(&dn->dn_mtx); + if (dn->dn_type == DMU_OT_NONE || + dn->dn_free_txg != 0) { + /* + * Drop dn_mtx. It is a leaf lock and + * cannot be held when dnode_evict_bonus() + * acquires other locks in order to + * perform the eviction. + * + * Freed dnodes cannot be reused until the + * last hold is released. Since this bonus + * buffer has a hold, the dnode will remain + * in the free state, even without dn_mtx + * held, until the dnode_rele_and_unlock() + * below. + */ + mutex_exit(&dn->dn_mtx); + dnode_evict_bonus(dn); + mutex_enter(&dn->dn_mtx); + } + dnode_rele_and_unlock(dn, db); } else if (db->db_buf == NULL) { /* * This is a special case: we never associated this Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Oct 3 07:22:07 2015 (r288540) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Oct 3 07:22:24 2015 (r288541) @@ -1205,12 +1205,18 @@ dnode_add_ref(dnode_t *dn, void *tag) void dnode_rele(dnode_t *dn, void *tag) { + mutex_enter(&dn->dn_mtx); + dnode_rele_and_unlock(dn, tag); +} + +void +dnode_rele_and_unlock(dnode_t *dn, void *tag) +{ uint64_t refs; /* Get while the hold prevents the dnode from moving. */ dmu_buf_impl_t *db = dn->dn_dbuf; dnode_handle_t *dnh = dn->dn_handle; - mutex_enter(&dn->dn_mtx); refs = refcount_remove(&dn->dn_holds, tag); mutex_exit(&dn->dn_mtx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:22:07 2015 (r288540) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:22:24 2015 (r288541) @@ -441,6 +441,12 @@ dnode_evict_dbufs(dnode_t *dn) ASSERT(pass < 100); /* sanity check */ } while (progress); + dnode_evict_bonus(dn); +} + +void +dnode_evict_bonus(dnode_t *dn) +{ rw_enter(&dn->dn_struct_rwlock, RW_WRITER); if (dn->dn_bonus && refcount_is_zero(&dn->dn_bonus->db_holds)) { mutex_enter(&dn->dn_bonus->db_mtx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Sat Oct 3 07:22:07 2015 (r288540) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Sat Oct 3 07:22:24 2015 (r288541) @@ -279,6 +279,7 @@ int dnode_hold_impl(struct objset *dd, u void *ref, dnode_t **dnp); boolean_t dnode_add_ref(dnode_t *dn, void *ref); void dnode_rele(dnode_t *dn, void *ref); +void dnode_rele_and_unlock(dnode_t *dn, void *tag); void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx); void dnode_sync(dnode_t *dn, dmu_tx_t *tx); void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, @@ -300,6 +301,7 @@ void dnode_fini(void); int dnode_next_offset(dnode_t *dn, int flags, uint64_t *off, int minlvl, uint64_t blkfill, uint64_t txg); void dnode_evict_dbufs(dnode_t *dn); +void dnode_evict_bonus(dnode_t *dn); #ifdef ZFS_DEBUG From owner-svn-src-all@freebsd.org Sat Oct 3 07:23:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A8C7A0DEDE; Sat, 3 Oct 2015 07:23:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E31361958; Sat, 3 Oct 2015 07:23:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937NLfM062545; Sat, 3 Oct 2015 07:23:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937NKPu062539; Sat, 3 Oct 2015 07:23:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030723.t937NKPu062539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:23:20 +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: r288542 - in stable/10: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:23:22 -0000 Author: mav Date: Sat Oct 3 07:23:19 2015 New Revision: 288542 URL: https://svnweb.freebsd.org/changeset/base/288542 Log: MFC r286547: 5661 ZFS: "compression = on" should use lz4 if feature is enabled Reviewed by: Matthew Ahrens Reviewed by: Josef 'Jeff' Sipek Reviewed by: Xin LI Approved by: Robert Mustacchi Author: Justin T. Gibbs illumos/illumos-gate@db1741f555ec79def5e9846e6bfd132248514ffe Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 07:22:24 2015 (r288541) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 07:23:19 2015 (r288542) @@ -939,7 +939,23 @@ Disabling checksums is .Em NOT a recommended practice. .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle | Cm lz4 -Controls the compression algorithm used for this dataset. The +Controls the compression algorithm used for this dataset. +Setting compression to +.Cm on +indicates that the current default compression algorithm should be used. +The default balances compression and decompression speed, with compression +ratio and is expected to work well on a wide variety of workloads. +Unlike all other settings for this property, on does not select a fixed +compression type. +As new compression algorithms are added to ZFS and enabled on a pool, the +default compression algorithm may change. +The current default compression algorthm is either +.Cm lzjb +or, if the +.Sy lz4_compress +feature is enabled, +.Cm lz4 . +The .Cm lzjb compression algorithm is optimized for performance while providing decent data compression. Setting compression to Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:22:24 2015 (r288541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:23:19 2015 (r288542) @@ -1785,19 +1785,15 @@ dmu_write_policy(objset_t *os, dnode_t * * 3. all other level 0 blocks */ if (ismd) { - /* - * XXX -- we should design a compression algorithm - * that specializes in arrays of bps. - */ - boolean_t lz4_ac = spa_feature_is_active(os->os_spa, - SPA_FEATURE_LZ4_COMPRESS); - if (zfs_mdcomp_disable) { compress = ZIO_COMPRESS_EMPTY; - } else if (lz4_ac) { - compress = ZIO_COMPRESS_LZ4; } else { - compress = ZIO_COMPRESS_LZJB; + /* + * XXX -- we should design a compression algorithm + * that specializes in arrays of bps. + */ + compress = zio_compress_select(os->os_spa, + ZIO_COMPRESS_ON, ZIO_COMPRESS_ON); } /* @@ -1830,7 +1826,8 @@ dmu_write_policy(objset_t *os, dnode_t * compress = ZIO_COMPRESS_OFF; checksum = ZIO_CHECKSUM_NOPARITY; } else { - compress = zio_compress_select(dn->dn_compress, compress); + compress = zio_compress_select(os->os_spa, dn->dn_compress, + compress); checksum = (dedup_checksum == ZIO_CHECKSUM_OFF) ? zio_checksum_select(dn->dn_checksum, checksum) : Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:22:24 2015 (r288541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:23:19 2015 (r288542) @@ -151,7 +151,8 @@ compression_changed_cb(void *arg, uint64 */ ASSERT(newval != ZIO_COMPRESS_INHERIT); - os->os_compress = zio_compress_select(newval, ZIO_COMPRESS_ON_VALUE); + os->os_compress = zio_compress_select(os->os_spa, newval, + ZIO_COMPRESS_ON); } static void @@ -408,7 +409,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat } else { /* It's the meta-objset. */ os->os_checksum = ZIO_CHECKSUM_FLETCHER_4; - os->os_compress = ZIO_COMPRESS_LZJB; + os->os_compress = ZIO_COMPRESS_ON; os->os_copies = spa_max_replication(spa); os->os_dedup_checksum = ZIO_CHECKSUM_OFF; os->os_dedup_verify = B_FALSE; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:22:24 2015 (r288541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:23:19 2015 (r288542) @@ -125,15 +125,19 @@ enum zio_compress { */ #define ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4 -/* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */ -#define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB -#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF +/* + * The meaning of "compress = on" selected by the compression features enabled + * on a given pool. + */ +#define ZIO_COMPRESS_LEGACY_ON_VALUE ZIO_COMPRESS_LZJB +#define ZIO_COMPRESS_LZ4_ON_VALUE ZIO_COMPRESS_LZ4 + +#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF #define BOOTFS_COMPRESS_VALID(compress) \ ((compress) == ZIO_COMPRESS_LZJB || \ (compress) == ZIO_COMPRESS_LZ4 || \ - ((compress) == ZIO_COMPRESS_ON && \ - ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \ + (compress) == ZIO_COMPRESS_ON || \ (compress) == ZIO_COMPRESS_OFF) #define ZIO_FAILURE_MODE_WAIT 0 @@ -581,8 +585,8 @@ extern enum zio_checksum zio_checksum_se enum zio_checksum parent); extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa, enum zio_checksum child, enum zio_checksum parent); -extern enum zio_compress zio_compress_select(enum zio_compress child, - enum zio_compress parent); +extern enum zio_compress zio_compress_select(spa_t *spa, + enum zio_compress child, enum zio_compress parent); extern void zio_suspend(spa_t *spa, zio_t *zio); extern int zio_resume(spa_t *spa); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sat Oct 3 07:22:24 2015 (r288541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sat Oct 3 07:23:19 2015 (r288542) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -81,19 +82,27 @@ zio_compress_info_t zio_compress_table[Z }; enum zio_compress -zio_compress_select(enum zio_compress child, enum zio_compress parent) +zio_compress_select(spa_t *spa, enum zio_compress child, + enum zio_compress parent) { + enum zio_compress result; + ASSERT(child < ZIO_COMPRESS_FUNCTIONS); ASSERT(parent < ZIO_COMPRESS_FUNCTIONS); - ASSERT(parent != ZIO_COMPRESS_INHERIT && parent != ZIO_COMPRESS_ON); - - if (child == ZIO_COMPRESS_INHERIT) - return (parent); + ASSERT(parent != ZIO_COMPRESS_INHERIT); - if (child == ZIO_COMPRESS_ON) - return (ZIO_COMPRESS_ON_VALUE); + result = child; + if (result == ZIO_COMPRESS_INHERIT) + result = parent; + + if (result == ZIO_COMPRESS_ON) { + if (spa_feature_is_active(spa, SPA_FEATURE_LZ4_COMPRESS)) + result = ZIO_COMPRESS_LZ4_ON_VALUE; + else + result = ZIO_COMPRESS_LEGACY_ON_VALUE; + } - return (child); + return (result); } size_t From owner-svn-src-all@freebsd.org Sat Oct 3 07:24:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59E6AA0DFA2; Sat, 3 Oct 2015 07:24:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A22B1AD0; Sat, 3 Oct 2015 07:24:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937ODLS062697; Sat, 3 Oct 2015 07:24:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937ODFQ062696; Sat, 3 Oct 2015 07:24:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030724.t937ODFQ062696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:24: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: r288543 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:24:13 -0000 Author: mav Date: Sat Oct 3 07:24:12 2015 New Revision: 288543 URL: https://svnweb.freebsd.org/changeset/base/288543 Log: MFC r286549: 5693 ztest fails in dbuf_verify: buf[i] == 0, due to dedup and bp_override Reviewed by: George Wilson Reviewed by: Christopher Siden Reviewed by: Bayard Bell Approved by: Dan McDonald Author: Matthew Ahrens illumos/illumos-gate@7f7ace370074e350853da254c65688fd43ddc695 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Oct 3 07:23:19 2015 (r288542) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Oct 3 07:24:12 2015 (r288543) @@ -1216,8 +1216,6 @@ zio_write_bp_init(zio_t *zio) zio->io_pipeline |= ZIO_STAGE_DDT_WRITE; return (ZIO_PIPELINE_CONTINUE); } - zio->io_bp_override = NULL; - BP_ZERO(bp); } if (!BP_IS_HOLE(bp) && bp->blk_birth == zio->io_txg) { From owner-svn-src-all@freebsd.org Sat Oct 3 07:25:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05644A0E077; Sat, 3 Oct 2015 07:25:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE0C31C36; Sat, 3 Oct 2015 07:25:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937P59s062852; Sat, 3 Oct 2015 07:25:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937P5cu062851; Sat, 3 Oct 2015 07:25:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030725.t937P5cu062851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:25:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288544 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:25:06 -0000 Author: mav Date: Sat Oct 3 07:25:05 2015 New Revision: 288544 URL: https://svnweb.freebsd.org/changeset/base/288544 Log: MFC r286551: 5694 traverse_prefetcher does not prefetch enough Reviewed by: Matthew Ahrens Reviewed by: Alex Reece Reviewed by: Christopher Siden Reviewed by: Josef 'Jeff' Sipek Reviewed by: Bayard Bell Approved by: Garrett D'Amore Author: George Wilson illumos/illumos-gate@34d7ce052c4565b078f73b95ccbd49274e98edaa Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Sat Oct 3 07:24:12 2015 (r288543) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Sat Oct 3 07:25:05 2015 (r288544) @@ -39,13 +39,12 @@ #include #include -int zfs_pd_blks_max = 100; +int32_t zfs_pd_bytes_max = 50 * 1024 * 1024; /* 50MB */ typedef struct prefetch_data { kmutex_t pd_mtx; kcondvar_t pd_cv; - int pd_blks_max; - int pd_blks_fetched; + int32_t pd_bytes_fetched; int pd_flags; boolean_t pd_cancel; boolean_t pd_exited; @@ -250,11 +249,12 @@ traverse_visitbp(traverse_data_t *td, co } if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) { + uint64_t size = BP_GET_LSIZE(bp); mutex_enter(&pd->pd_mtx); - ASSERT(pd->pd_blks_fetched >= 0); - while (pd->pd_blks_fetched == 0 && !pd->pd_exited) + ASSERT(pd->pd_bytes_fetched >= 0); + while (pd->pd_bytes_fetched < size && !pd->pd_exited) cv_wait(&pd->pd_cv, &pd->pd_mtx); - pd->pd_blks_fetched--; + pd->pd_bytes_fetched -= size; cv_broadcast(&pd->pd_cv); mutex_exit(&pd->pd_mtx); } @@ -447,7 +447,7 @@ traverse_prefetcher(spa_t *spa, zilog_t prefetch_data_t *pfd = arg; arc_flags_t aflags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH; - ASSERT(pfd->pd_blks_fetched >= 0); + ASSERT(pfd->pd_bytes_fetched >= 0); if (pfd->pd_cancel) return (SET_ERROR(EINTR)); @@ -455,9 +455,9 @@ traverse_prefetcher(spa_t *spa, zilog_t return (0); mutex_enter(&pfd->pd_mtx); - while (!pfd->pd_cancel && pfd->pd_blks_fetched >= pfd->pd_blks_max) + while (!pfd->pd_cancel && pfd->pd_bytes_fetched >= zfs_pd_bytes_max) cv_wait(&pfd->pd_cv, &pfd->pd_mtx); - pfd->pd_blks_fetched++; + pfd->pd_bytes_fetched += BP_GET_LSIZE(bp); cv_broadcast(&pfd->pd_cv); mutex_exit(&pfd->pd_mtx); @@ -529,7 +529,6 @@ traverse_impl(spa_t *spa, dsl_dataset_t td.td_hole_birth_enabled_txg = 0; } - pd.pd_blks_max = zfs_pd_blks_max; pd.pd_flags = flags; mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL); From owner-svn-src-all@freebsd.org Sat Oct 3 07:26:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D37FA0E179; Sat, 3 Oct 2015 07:26:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D6211DA6; Sat, 3 Oct 2015 07:26:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937Q0ec063010; Sat, 3 Oct 2015 07:26:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937Q0Di063009; Sat, 3 Oct 2015 07:26:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030726.t937Q0Di063009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:26:00 +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: r288545 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:26:00 -0000 Author: mav Date: Sat Oct 3 07:25:59 2015 New Revision: 288545 URL: https://svnweb.freebsd.org/changeset/base/288545 Log: MFC r286554: 5769 Cast 'zfs bad bloc' to ULL for x86 Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Richard PALO Approved by: Dan McDonald illumos/illumos-gate@8c76e0763bcf0029556e106377da859f6492a7ee Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:25:05 2015 (r288544) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:25:59 2015 (r288545) @@ -532,7 +532,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, co for (ptr = abuf->b_data; (char *)ptr < (char *)abuf->b_data + blksz; ptr++) - *ptr = 0x2f5baddb10c; + *ptr = 0x2f5baddb10cULL; } else { return (SET_ERROR(EIO)); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:26:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4B9BA0E244; Sat, 3 Oct 2015 07:26:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B50351EEA; Sat, 3 Oct 2015 07:26:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937QnCG063152; Sat, 3 Oct 2015 07:26:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937QnfM063150; Sat, 3 Oct 2015 07:26:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030726.t937QnfM063150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:26: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: r288546 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:26:49 -0000 Author: mav Date: Sat Oct 3 07:26:48 2015 New Revision: 288546 URL: https://svnweb.freebsd.org/changeset/base/288546 Log: MFC r286556: Avoid 128K kmem allocations in mzap_upgrade() Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Reviewed by: George Wilson Reviewed by: Steven Hartland Approved by: Rich Lowe illumos/illumos-gate@be3e2ab906b80af79c7b22885f279e45ad8fb995 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Sat Oct 3 07:25:59 2015 (r288545) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Sat Oct 3 07:26:48 2015 (r288546) @@ -547,7 +547,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, ASSERT(RW_WRITE_HELD(&zap->zap_rwlock)); sz = zap->zap_dbuf->db_size; - mzp = kmem_alloc(sz, KM_SLEEP); + mzp = zio_buf_alloc(sz); bcopy(zap->zap_dbuf->db_data, mzp, sz); nchunks = zap->zap_m.zap_num_chunks; @@ -555,7 +555,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, err = dmu_object_set_blocksize(zap->zap_objset, zap->zap_object, 1ULL << fzap_default_block_shift, 0, tx); if (err) { - kmem_free(mzp, sz); + zio_buf_free(mzp, sz); return (err); } } @@ -581,7 +581,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, if (err) break; } - kmem_free(mzp, sz); + zio_buf_free(mzp, sz); *zapp = zap; return (err); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:27:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 147DBA0E395; Sat, 3 Oct 2015 07:27:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03FF01059; Sat, 3 Oct 2015 07:27:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937RwxI063345; Sat, 3 Oct 2015 07:27:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937RwuT063343; Sat, 3 Oct 2015 07:27:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030727.t937RwuT063343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:27: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: r288547 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:27:59 -0000 Author: mav Date: Sat Oct 3 07:27:58 2015 New Revision: 288547 URL: https://svnweb.freebsd.org/changeset/base/288547 Log: MFC r286570: 5408 managing ZFS cache devices requires lots of RAM Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Don Brady Reviewed by: Josef 'Jeff' Sipek Approved by: Garrett D'Amore Author: Chris Williamson illumos/illumos-gate@89c86e32293a30cdd7af530c38b2073fee01411c Currently, every buffer cached in the L2ARC is accompanied by a 240-byte header in memory, leading to very high memory consumption when using very large cache devices. These changes significantly reduce this overhead. Currently: L1-only header = 176 bytes L1 + L2 or L2-only header = 176 bytes + 32 byte checksum + 32 byte l2hdr = 240 bytes Memory-optimized: L1-only header = 176 bytes L1 + L2 header = 176 bytes + 32 byte checksum = 208 bytes L2-only header = 96 bytes + 32 byte checksum = 128 bytes So overall: Trunk Optimized +-----------------+ L1-only | 176 B | 176 B | (same) +-----------------+ L1 & L2 | 240 B | 208 B | (saved 32 bytes) +-----------------+ L2-only | 240 B | 128 B | (saved 116 bytes) +-----------------+ For an average blocksize of 8KB, this means that for the L2ARC, the ratio of metadata to data has gone down from about 2.92% to 1.56%. For a 'storage optimized' EC2 instance with 1600GB of SSD and 60GB of RAM, this means that we expect a completely full L2ARC to use (1600 GB * 0.0156) / 60GB = 41% of the available memory, down from 78%. Relnotes: yes Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:26:48 2015 (r288546) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:27:58 2015 (r288547) @@ -111,7 +111,7 @@ * Note that the majority of the performance stats are manipulated * with atomic operations. * - * The L2ARC uses the l2arc_buflist_mtx global mutex for the following: + * The L2ARC uses the l2ad_mtx on each vdev for the following: * * - L2ARC buflist creation * - L2ARC buflist eviction @@ -402,6 +402,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_writes_hdr_miss; kstat_named_t arcstat_l2_evict_lock_retry; kstat_named_t arcstat_l2_evict_reading; + kstat_named_t arcstat_l2_evict_l1cached; kstat_named_t arcstat_l2_free_on_write; kstat_named_t arcstat_l2_cdata_free_on_write; kstat_named_t arcstat_l2_abort_lowmem; @@ -484,6 +485,7 @@ static arc_stats_t arc_stats = { { "l2_writes_hdr_miss", KSTAT_DATA_UINT64 }, { "l2_evict_lock_retry", KSTAT_DATA_UINT64 }, { "l2_evict_reading", KSTAT_DATA_UINT64 }, + { "l2_evict_l1cached", KSTAT_DATA_UINT64 }, { "l2_free_on_write", KSTAT_DATA_UINT64 }, { "l2_cdata_free_on_write", KSTAT_DATA_UINT64 }, { "l2_abort_lowmem", KSTAT_DATA_UINT64 }, @@ -588,8 +590,6 @@ static int arc_no_grow; /* Don't try to static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; -typedef struct l2arc_buf_hdr l2arc_buf_hdr_t; - typedef struct arc_callback arc_callback_t; struct arc_callback { @@ -610,29 +610,53 @@ struct arc_write_callback { arc_buf_t *awcb_buf; }; -struct arc_buf_hdr { - /* protected by hash lock */ - dva_t b_dva; - uint64_t b_birth; - uint64_t b_cksum0; - +/* + * ARC buffers are separated into multiple structs as a memory saving measure: + * - Common fields struct, always defined, and embedded within it: + * - L2-only fields, always allocated but undefined when not in L2ARC + * - L1-only fields, only allocated when in L1ARC + * + * Buffer in L1 Buffer only in L2 + * +------------------------+ +------------------------+ + * | arc_buf_hdr_t | | arc_buf_hdr_t | + * | | | | + * | | | | + * | | | | + * +------------------------+ +------------------------+ + * | l2arc_buf_hdr_t | | l2arc_buf_hdr_t | + * | (undefined if L1-only) | | | + * +------------------------+ +------------------------+ + * | l1arc_buf_hdr_t | + * | | + * | | + * | | + * | | + * +------------------------+ + * + * Because it's possible for the L2ARC to become extremely large, we can wind + * up eating a lot of memory in L2ARC buffer headers, so the size of a header + * is minimized by only allocating the fields necessary for an L1-cached buffer + * when a header is actually in the L1 cache. The sub-headers (l1arc_buf_hdr and + * l2arc_buf_hdr) are embedded rather than allocated separately to save a couple + * words in pointers. arc_hdr_realloc() is used to switch a header between + * these two allocation states. + */ +typedef struct l1arc_buf_hdr { kmutex_t b_freeze_lock; - zio_cksum_t *b_freeze_cksum; +#ifdef ZFS_DEBUG + /* + * used for debugging wtih kmem_flags - by allocating and freeing + * b_thawed when the buffer is thawed, we get a record of the stack + * trace that thawed it. + */ void *b_thawed; +#endif - arc_buf_hdr_t *b_hash_next; arc_buf_t *b_buf; - arc_flags_t b_flags; uint32_t b_datacnt; - - arc_callback_t *b_acb; + /* for waiting on writes to complete */ kcondvar_t b_cv; - /* immutable */ - arc_buf_contents_t b_type; - uint64_t b_size; - uint64_t b_spa; - /* protected by arc state mutex */ arc_state_t *b_state; list_node_t b_arc_node; @@ -643,8 +667,46 @@ struct arc_buf_hdr { /* self protecting */ refcount_t b_refcnt; - l2arc_buf_hdr_t *b_l2hdr; + arc_callback_t *b_acb; + /* temporary buffer holder for in-flight compressed data */ + void *b_tmp_cdata; +} l1arc_buf_hdr_t; + +typedef struct l2arc_dev l2arc_dev_t; + +typedef struct l2arc_buf_hdr { + /* protected by arc_buf_hdr mutex */ + l2arc_dev_t *b_dev; /* L2ARC device */ + uint64_t b_daddr; /* disk address, offset byte */ + /* real alloc'd buffer size depending on b_compress applied */ + int32_t b_asize; + list_node_t b_l2node; +} l2arc_buf_hdr_t; + +struct arc_buf_hdr { + /* protected by hash lock */ + dva_t b_dva; + uint64_t b_birth; + /* + * Even though this checksum is only set/verified when a buffer is in + * the L1 cache, it needs to be in the set of common fields because it + * must be preserved from the time before a buffer is written out to + * L2ARC until after it is read back in. + */ + zio_cksum_t *b_freeze_cksum; + + arc_buf_hdr_t *b_hash_next; + arc_flags_t b_flags; + + /* immutable */ + int32_t b_size; + uint64_t b_spa; + + /* L2ARC fields. Undefined when not in L2ARC. */ + l2arc_buf_hdr_t b_l2hdr; + /* L1ARC fields. Undefined when in l2arc_only state */ + l1arc_buf_hdr_t b_l1hdr; }; #ifdef _KERNEL @@ -681,22 +743,38 @@ static arc_buf_hdr_t arc_eviction_hdr; #define HDR_PREFETCH(hdr) ((hdr)->b_flags & ARC_FLAG_PREFETCH) #define HDR_FREED_IN_READ(hdr) ((hdr)->b_flags & ARC_FLAG_FREED_IN_READ) #define HDR_BUF_AVAILABLE(hdr) ((hdr)->b_flags & ARC_FLAG_BUF_AVAILABLE) -#define HDR_FREE_IN_PROGRESS(hdr) \ - ((hdr)->b_flags & ARC_FLAG_FREE_IN_PROGRESS) + #define HDR_L2CACHE(hdr) ((hdr)->b_flags & ARC_FLAG_L2CACHE) +#define HDR_L2COMPRESS(hdr) ((hdr)->b_flags & ARC_FLAG_L2COMPRESS) #define HDR_L2_READING(hdr) \ - ((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS && \ - (hdr)->b_l2hdr != NULL) + (((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS) && \ + ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR)) #define HDR_L2_WRITING(hdr) ((hdr)->b_flags & ARC_FLAG_L2_WRITING) #define HDR_L2_EVICTED(hdr) ((hdr)->b_flags & ARC_FLAG_L2_EVICTED) #define HDR_L2_WRITE_HEAD(hdr) ((hdr)->b_flags & ARC_FLAG_L2_WRITE_HEAD) +#define HDR_ISTYPE_METADATA(hdr) \ + ((hdr)->b_flags & ARC_FLAG_BUFC_METADATA) +#define HDR_ISTYPE_DATA(hdr) (!HDR_ISTYPE_METADATA(hdr)) + +#define HDR_HAS_L1HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L1HDR) +#define HDR_HAS_L2HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR) + +/* For storing compression mode in b_flags */ +#define HDR_COMPRESS_OFFSET 24 +#define HDR_COMPRESS_NBITS 7 + +#define HDR_GET_COMPRESS(hdr) ((enum zio_compress)BF32_GET(hdr->b_flags, \ + HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS)) +#define HDR_SET_COMPRESS(hdr, cmp) BF32_SET(hdr->b_flags, \ + HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS, (cmp)) + /* * Other sizes */ -#define HDR_SIZE ((int64_t)sizeof (arc_buf_hdr_t)) -#define L2HDR_SIZE ((int64_t)sizeof (l2arc_buf_hdr_t)) +#define HDR_FULL_SIZE ((int64_t)sizeof (arc_buf_hdr_t)) +#define HDR_L2ONLY_SIZE ((int64_t)offsetof(arc_buf_hdr_t, b_l1hdr)) /* * Hash table routines @@ -820,7 +898,7 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_onl /* * L2ARC Internals */ -typedef struct l2arc_dev { +struct l2arc_dev { vdev_t *l2ad_vdev; /* vdev */ spa_t *l2ad_spa; /* spa */ uint64_t l2ad_hand; /* next write location */ @@ -829,15 +907,15 @@ typedef struct l2arc_dev { uint64_t l2ad_evict; /* last addr eviction reached */ boolean_t l2ad_first; /* first sweep through */ boolean_t l2ad_writing; /* currently writing */ - list_t *l2ad_buflist; /* buffer list */ + kmutex_t l2ad_mtx; /* lock for buffer list */ + list_t l2ad_buflist; /* buffer list */ list_node_t l2ad_node; /* device list node */ -} l2arc_dev_t; +}; static list_t L2ARC_dev_list; /* device list */ static list_t *l2arc_dev_list; /* device list pointer */ static kmutex_t l2arc_dev_mtx; /* device list mutex */ static l2arc_dev_t *l2arc_dev_last; /* last device used */ -static kmutex_t l2arc_buflist_mtx; /* mutex for all buflists */ static list_t L2ARC_free_on_write; /* free after write buf list */ static list_t *l2arc_free_on_write; /* free after write list ptr */ static kmutex_t l2arc_free_on_write_mtx; /* mutex for list */ @@ -857,18 +935,6 @@ typedef struct l2arc_write_callback { arc_buf_hdr_t *l2wcb_head; /* head of write buflist */ } l2arc_write_callback_t; -struct l2arc_buf_hdr { - /* protected by arc_buf_hdr mutex */ - l2arc_dev_t *b_dev; /* L2ARC device */ - uint64_t b_daddr; /* disk address, offset byte */ - /* compression applied to buffer data */ - enum zio_compress b_compress; - /* real alloc'd buffer size depending on b_compress applied */ - int b_asize; - /* temporary buffer holder for in-flight compressed data */ - void *b_tmp_cdata; -}; - typedef struct l2arc_data_free { /* protected by l2arc_free_on_write_mtx */ void *l2df_data; @@ -887,12 +953,13 @@ static int arc_evict_needed(arc_buf_cont static void arc_evict_ghost(arc_state_t *, uint64_t, int64_t); static void arc_buf_watch(arc_buf_t *); +static arc_buf_contents_t arc_buf_type(arc_buf_hdr_t *); +static uint32_t arc_bufc_to_flags(arc_buf_contents_t); + static boolean_t l2arc_write_eligible(uint64_t, arc_buf_hdr_t *); static void l2arc_read_done(zio_t *); -static void l2arc_hdr_stat_add(void); -static void l2arc_hdr_stat_remove(void); -static boolean_t l2arc_compress_buf(l2arc_buf_hdr_t *); +static boolean_t l2arc_compress_buf(arc_buf_hdr_t *); static void l2arc_decompress_zio(zio_t *, arc_buf_hdr_t *, enum zio_compress); static void l2arc_release_cdata_buf(arc_buf_hdr_t *); @@ -915,8 +982,7 @@ buf_hash(uint64_t spa, const dva_t *dva, #define BUF_EMPTY(buf) \ ((buf)->b_dva.dva_word[0] == 0 && \ - (buf)->b_dva.dva_word[1] == 0 && \ - (buf)->b_cksum0 == 0) + (buf)->b_dva.dva_word[1] == 0) #define BUF_EQUAL(spa, dva, birth, buf) \ ((buf)->b_dva.dva_word[0] == (dva)->dva_word[0]) && \ @@ -929,7 +995,6 @@ buf_discard_identity(arc_buf_hdr_t *hdr) hdr->b_dva.dva_word[0] = 0; hdr->b_dva.dva_word[1] = 0; hdr->b_birth = 0; - hdr->b_cksum0 = 0; } static arc_buf_hdr_t * @@ -959,6 +1024,7 @@ buf_hash_find(uint64_t spa, const blkptr * equal to elem in the hash table, then the already existing element * will be returned and the new element will not be inserted. * Otherwise returns NULL. + * If lockp == NULL, the caller is assumed to already hold the hash lock. */ static arc_buf_hdr_t * buf_hash_insert(arc_buf_hdr_t *hdr, kmutex_t **lockp) @@ -971,8 +1037,14 @@ buf_hash_insert(arc_buf_hdr_t *hdr, kmut ASSERT(!DVA_IS_EMPTY(&hdr->b_dva)); ASSERT(hdr->b_birth != 0); ASSERT(!HDR_IN_HASH_TABLE(hdr)); - *lockp = hash_lock; - mutex_enter(hash_lock); + + if (lockp != NULL) { + *lockp = hash_lock; + mutex_enter(hash_lock); + } else { + ASSERT(MUTEX_HELD(hash_lock)); + } + for (fhdr = buf_hash_table.ht_table[idx], i = 0; fhdr != NULL; fhdr = fhdr->b_hash_next, i++) { if (BUF_EQUAL(hdr->b_spa, &hdr->b_dva, hdr->b_birth, fhdr)) @@ -1027,7 +1099,8 @@ buf_hash_remove(arc_buf_hdr_t *hdr) /* * Global data structures and functions for the buf kmem cache. */ -static kmem_cache_t *hdr_cache; +static kmem_cache_t *hdr_full_cache; +static kmem_cache_t *hdr_l2only_cache; static kmem_cache_t *buf_cache; static void @@ -1039,7 +1112,8 @@ buf_fini(void) (buf_hash_table.ht_mask + 1) * sizeof (void *)); for (i = 0; i < BUF_LOCKS; i++) mutex_destroy(&buf_hash_table.ht_locks[i].ht_lock); - kmem_cache_destroy(hdr_cache); + kmem_cache_destroy(hdr_full_cache); + kmem_cache_destroy(hdr_l2only_cache); kmem_cache_destroy(buf_cache); } @@ -1049,15 +1123,27 @@ buf_fini(void) */ /* ARGSUSED */ static int -hdr_cons(void *vbuf, void *unused, int kmflag) +hdr_full_cons(void *vbuf, void *unused, int kmflag) +{ + arc_buf_hdr_t *hdr = vbuf; + + bzero(hdr, HDR_FULL_SIZE); + cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL); + refcount_create(&hdr->b_l1hdr.b_refcnt); + mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); + arc_space_consume(HDR_FULL_SIZE, ARC_SPACE_HDRS); + + return (0); +} + +/* ARGSUSED */ +static int +hdr_l2only_cons(void *vbuf, void *unused, int kmflag) { arc_buf_hdr_t *hdr = vbuf; - bzero(hdr, sizeof (arc_buf_hdr_t)); - refcount_create(&hdr->b_refcnt); - cv_init(&hdr->b_cv, NULL, CV_DEFAULT, NULL); - mutex_init(&hdr->b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); - arc_space_consume(sizeof (arc_buf_hdr_t), ARC_SPACE_HDRS); + bzero(hdr, HDR_L2ONLY_SIZE); + arc_space_consume(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); return (0); } @@ -1081,15 +1167,25 @@ buf_cons(void *vbuf, void *unused, int k */ /* ARGSUSED */ static void -hdr_dest(void *vbuf, void *unused) +hdr_full_dest(void *vbuf, void *unused) { arc_buf_hdr_t *hdr = vbuf; ASSERT(BUF_EMPTY(hdr)); - refcount_destroy(&hdr->b_refcnt); - cv_destroy(&hdr->b_cv); - mutex_destroy(&hdr->b_freeze_lock); - arc_space_return(sizeof (arc_buf_hdr_t), ARC_SPACE_HDRS); + cv_destroy(&hdr->b_l1hdr.b_cv); + refcount_destroy(&hdr->b_l1hdr.b_refcnt); + mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); + arc_space_return(HDR_FULL_SIZE, ARC_SPACE_HDRS); +} + +/* ARGSUSED */ +static void +hdr_l2only_dest(void *vbuf, void *unused) +{ + arc_buf_hdr_t *hdr = vbuf; + + ASSERT(BUF_EMPTY(hdr)); + arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS); } /* ARGSUSED */ @@ -1143,8 +1239,11 @@ retry: goto retry; } - hdr_cache = kmem_cache_create("arc_buf_hdr_t", sizeof (arc_buf_hdr_t), - 0, hdr_cons, hdr_dest, hdr_recl, NULL, NULL, 0); + hdr_full_cache = kmem_cache_create("arc_buf_hdr_t_full", HDR_FULL_SIZE, + 0, hdr_full_cons, hdr_full_dest, hdr_recl, NULL, NULL, 0); + hdr_l2only_cache = kmem_cache_create("arc_buf_hdr_t_l2only", + HDR_L2ONLY_SIZE, 0, hdr_l2only_cons, hdr_l2only_dest, hdr_recl, + NULL, NULL, 0); buf_cache = kmem_cache_create("arc_buf_t", sizeof (arc_buf_t), 0, buf_cons, buf_dest, NULL, NULL, NULL, 0); @@ -1158,6 +1257,81 @@ retry: } } +/* + * Transition between the two allocation states for the arc_buf_hdr struct. + * The arc_buf_hdr struct can be allocated with (hdr_full_cache) or without + * (hdr_l2only_cache) the fields necessary for the L1 cache - the smaller + * version is used when a cache buffer is only in the L2ARC in order to reduce + * memory usage. + */ +static arc_buf_hdr_t * +arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, kmem_cache_t *new) +{ + ASSERT(HDR_HAS_L2HDR(hdr)); + + arc_buf_hdr_t *nhdr; + l2arc_dev_t *dev = hdr->b_l2hdr.b_dev; + + ASSERT((old == hdr_full_cache && new == hdr_l2only_cache) || + (old == hdr_l2only_cache && new == hdr_full_cache)); + + nhdr = kmem_cache_alloc(new, KM_PUSHPAGE); + + ASSERT(MUTEX_HELD(HDR_LOCK(hdr))); + buf_hash_remove(hdr); + + bcopy(hdr, nhdr, HDR_L2ONLY_SIZE); + if (new == hdr_full_cache) { + nhdr->b_flags |= ARC_FLAG_HAS_L1HDR; + /* + * arc_access and arc_change_state need to be aware that a + * header has just come out of L2ARC, so we set its state to + * l2c_only even though it's about to change. + */ + nhdr->b_l1hdr.b_state = arc_l2c_only; + } else { + ASSERT(hdr->b_l1hdr.b_buf == NULL); + ASSERT0(hdr->b_l1hdr.b_datacnt); + ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); + /* + * We might be removing the L1hdr of a buffer which was just + * written out to L2ARC. If such a buffer is compressed then we + * need to free its b_tmp_cdata before destroying the header. + */ + if (hdr->b_l1hdr.b_tmp_cdata != NULL && + HDR_GET_COMPRESS(hdr) != ZIO_COMPRESS_OFF) + l2arc_release_cdata_buf(hdr); + nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR; + } + /* + * The header has been reallocated so we need to re-insert it into any + * lists it was on. + */ + (void) buf_hash_insert(nhdr, NULL); + + ASSERT(list_link_active(&hdr->b_l2hdr.b_l2node)); + + mutex_enter(&dev->l2ad_mtx); + + /* + * We must place the realloc'ed header back into the list at + * the same spot. Otherwise, if it's placed earlier in the list, + * l2arc_write_buffers() could find it during the function's + * write phase, and try to write it out to the l2arc. + */ + list_insert_after(&dev->l2ad_buflist, hdr, nhdr); + list_remove(&dev->l2ad_buflist, hdr); + + mutex_exit(&dev->l2ad_mtx); + + buf_discard_identity(hdr); + hdr->b_freeze_cksum = NULL; + kmem_cache_free(old, hdr); + + return (nhdr); +} + + #define ARC_MINTIME (hz>>4) /* 62 ms */ static void @@ -1168,16 +1342,15 @@ arc_cksum_verify(arc_buf_t *buf) if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; - mutex_enter(&buf->b_hdr->b_freeze_lock); - if (buf->b_hdr->b_freeze_cksum == NULL || - (buf->b_hdr->b_flags & ARC_FLAG_IO_ERROR)) { - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); + if (buf->b_hdr->b_freeze_cksum == NULL || HDR_IO_ERROR(buf->b_hdr)) { + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); return; } fletcher_2_native(buf->b_data, buf->b_hdr->b_size, &zc); if (!ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc)) panic("buffer modified while frozen!"); - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); } static int @@ -1186,10 +1359,10 @@ arc_cksum_equal(arc_buf_t *buf) zio_cksum_t zc; int equal; - mutex_enter(&buf->b_hdr->b_freeze_lock); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); fletcher_2_native(buf->b_data, buf->b_hdr->b_size, &zc); equal = ZIO_CHECKSUM_EQUAL(*buf->b_hdr->b_freeze_cksum, zc); - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); return (equal); } @@ -1200,15 +1373,15 @@ arc_cksum_compute(arc_buf_t *buf, boolea if (!force && !(zfs_flags & ZFS_DEBUG_MODIFY)) return; - mutex_enter(&buf->b_hdr->b_freeze_lock); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); if (buf->b_hdr->b_freeze_cksum != NULL) { - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); return; } buf->b_hdr->b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP); fletcher_2_native(buf->b_data, buf->b_hdr->b_size, buf->b_hdr->b_freeze_cksum); - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); #ifdef illumos arc_buf_watch(buf); #endif /* illumos */ @@ -1259,30 +1432,58 @@ arc_buf_watch(arc_buf_t *buf) } #endif /* illumos */ +static arc_buf_contents_t +arc_buf_type(arc_buf_hdr_t *hdr) +{ + if (HDR_ISTYPE_METADATA(hdr)) { + return (ARC_BUFC_METADATA); + } else { + return (ARC_BUFC_DATA); + } +} + +static uint32_t +arc_bufc_to_flags(arc_buf_contents_t type) +{ + switch (type) { + case ARC_BUFC_DATA: + /* metadata field is 0 if buffer contains normal data */ + return (0); + case ARC_BUFC_METADATA: + return (ARC_FLAG_BUFC_METADATA); + default: + break; + } + panic("undefined ARC buffer type!"); + return ((uint32_t)-1); +} + void arc_buf_thaw(arc_buf_t *buf) { if (zfs_flags & ZFS_DEBUG_MODIFY) { - if (buf->b_hdr->b_state != arc_anon) + if (buf->b_hdr->b_l1hdr.b_state != arc_anon) panic("modifying non-anon buffer!"); - if (buf->b_hdr->b_flags & ARC_FLAG_IO_IN_PROGRESS) + if (HDR_IO_IN_PROGRESS(buf->b_hdr)) panic("modifying buffer while i/o in progress!"); arc_cksum_verify(buf); } - mutex_enter(&buf->b_hdr->b_freeze_lock); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); if (buf->b_hdr->b_freeze_cksum != NULL) { kmem_free(buf->b_hdr->b_freeze_cksum, sizeof (zio_cksum_t)); buf->b_hdr->b_freeze_cksum = NULL; } +#ifdef ZFS_DEBUG if (zfs_flags & ZFS_DEBUG_MODIFY) { - if (buf->b_hdr->b_thawed) - kmem_free(buf->b_hdr->b_thawed, 1); - buf->b_hdr->b_thawed = kmem_alloc(1, KM_SLEEP); + if (buf->b_hdr->b_l1hdr.b_thawed != NULL) + kmem_free(buf->b_hdr->b_l1hdr.b_thawed, 1); + buf->b_hdr->b_l1hdr.b_thawed = kmem_alloc(1, KM_SLEEP); } +#endif - mutex_exit(&buf->b_hdr->b_freeze_lock); + mutex_exit(&buf->b_hdr->b_l1hdr.b_freeze_lock); #ifdef illumos arc_buf_unwatch(buf); @@ -1301,7 +1502,7 @@ arc_buf_freeze(arc_buf_t *buf) mutex_enter(hash_lock); ASSERT(buf->b_hdr->b_freeze_cksum != NULL || - buf->b_hdr->b_state == arc_anon); + buf->b_hdr->b_l1hdr.b_state == arc_anon); arc_cksum_compute(buf, B_FALSE); mutex_exit(hash_lock); @@ -1312,7 +1513,7 @@ get_buf_info(arc_buf_hdr_t *hdr, arc_sta { uint64_t buf_hashid = buf_hash(hdr->b_spa, &hdr->b_dva, hdr->b_birth); - if (hdr->b_type == ARC_BUFC_METADATA) + if (arc_buf_type(hdr) == ARC_BUFC_METADATA) buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1); else { buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1); @@ -1327,32 +1528,36 @@ get_buf_info(arc_buf_hdr_t *hdr, arc_sta static void add_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag) { + ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT(MUTEX_HELD(hash_lock)); + arc_state_t *state = hdr->b_l1hdr.b_state; - if ((refcount_add(&hdr->b_refcnt, tag) == 1) && - (hdr->b_state != arc_anon)) { - uint64_t delta = hdr->b_size * hdr->b_datacnt; - uint64_t *size = &hdr->b_state->arcs_lsize[hdr->b_type]; - list_t *list; - kmutex_t *lock; + if ((refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && + (state != arc_anon)) { + /* We don't use the L2-only state list. */ + if (state != arc_l2c_only) { + uint64_t delta = hdr->b_size * hdr->b_l1hdr.b_datacnt; + uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; + list_t *list; + kmutex_t *lock; - get_buf_info(hdr, hdr->b_state, &list, &lock); - ASSERT(!MUTEX_HELD(lock)); - mutex_enter(lock); - ASSERT(list_link_active(&hdr->b_arc_node)); - list_remove(list, hdr); - if (GHOST_STATE(hdr->b_state)) { - ASSERT0(hdr->b_datacnt); - ASSERT3P(hdr->b_buf, ==, NULL); - delta = hdr->b_size; - } - ASSERT(delta > 0); - ASSERT3U(*size, >=, delta); - atomic_add_64(size, -delta); - mutex_exit(lock); + get_buf_info(hdr, state, &list, &lock); + ASSERT(!MUTEX_HELD(lock)); + mutex_enter(lock); + ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); + list_remove(list, hdr); + if (GHOST_STATE(state)) { + ASSERT0(hdr->b_l1hdr.b_datacnt); + ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); + delta = hdr->b_size; + } + ASSERT(delta > 0); + ASSERT3U(*size, >=, delta); + atomic_add_64(size, -delta); + mutex_exit(lock); + } /* remove the prefetch flag if we get a reference */ - if (hdr->b_flags & ARC_FLAG_PREFETCH) - hdr->b_flags &= ~ARC_FLAG_PREFETCH; + hdr->b_flags &= ~ARC_FLAG_PREFETCH; } } @@ -1360,24 +1565,30 @@ static int remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag) { int cnt; - arc_state_t *state = hdr->b_state; + arc_state_t *state = hdr->b_l1hdr.b_state; + ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT(state == arc_anon || MUTEX_HELD(hash_lock)); ASSERT(!GHOST_STATE(state)); - if (((cnt = refcount_remove(&hdr->b_refcnt, tag)) == 0) && + /* + * arc_l2c_only counts as a ghost state so we don't need to explicitly + * check to prevent usage of the arc_l2c_only list. + */ + if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { - uint64_t *size = &state->arcs_lsize[hdr->b_type]; + uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; list_t *list; kmutex_t *lock; get_buf_info(hdr, state, &list, &lock); ASSERT(!MUTEX_HELD(lock)); mutex_enter(lock); - ASSERT(!list_link_active(&hdr->b_arc_node)); + ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); list_insert_head(list, hdr); - ASSERT(hdr->b_datacnt > 0); - atomic_add_64(size, hdr->b_size * hdr->b_datacnt); + ASSERT(hdr->b_l1hdr.b_datacnt > 0); + atomic_add_64(size, hdr->b_size * + hdr->b_l1hdr.b_datacnt); mutex_exit(lock); } return (cnt); @@ -1391,44 +1602,64 @@ static void arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr, kmutex_t *hash_lock) { - arc_state_t *old_state = hdr->b_state; - int64_t refcnt = refcount_count(&hdr->b_refcnt); + arc_state_t *old_state; + int64_t refcnt; + uint32_t datacnt; uint64_t from_delta, to_delta; + arc_buf_contents_t buftype = arc_buf_type(hdr); list_t *list; kmutex_t *lock; + /* + * We almost always have an L1 hdr here, since we call arc_hdr_realloc() + * in arc_read() when bringing a buffer out of the L2ARC. However, the + * L1 hdr doesn't always exist when we change state to arc_anon before + * destroying a header, in which case reallocating to add the L1 hdr is + * pointless. + */ + if (HDR_HAS_L1HDR(hdr)) { + old_state = hdr->b_l1hdr.b_state; + refcnt = refcount_count(&hdr->b_l1hdr.b_refcnt); + datacnt = hdr->b_l1hdr.b_datacnt; + } else { + old_state = arc_l2c_only; + refcnt = 0; + datacnt = 0; + } + ASSERT(MUTEX_HELD(hash_lock)); ASSERT3P(new_state, !=, old_state); - ASSERT(refcnt == 0 || hdr->b_datacnt > 0); - ASSERT(hdr->b_datacnt == 0 || !GHOST_STATE(new_state)); - ASSERT(hdr->b_datacnt <= 1 || old_state != arc_anon); + ASSERT(refcnt == 0 || datacnt > 0); + ASSERT(!GHOST_STATE(new_state) || datacnt == 0); + ASSERT(old_state != arc_anon || datacnt <= 1); - from_delta = to_delta = hdr->b_datacnt * hdr->b_size; + from_delta = to_delta = datacnt * hdr->b_size; /* * If this buffer is evictable, transfer it from the * old state list to the new state list. */ if (refcnt == 0) { - if (old_state != arc_anon) { + if (old_state != arc_anon && old_state != arc_l2c_only) { int use_mutex; - uint64_t *size = &old_state->arcs_lsize[hdr->b_type]; + uint64_t *size = &old_state->arcs_lsize[buftype]; get_buf_info(hdr, old_state, &list, &lock); use_mutex = !MUTEX_HELD(lock); if (use_mutex) mutex_enter(lock); - ASSERT(list_link_active(&hdr->b_arc_node)); + ASSERT(HDR_HAS_L1HDR(hdr)); + ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); list_remove(list, hdr); /* * If prefetching out of the ghost cache, * we will have a non-zero datacnt. */ - if (GHOST_STATE(old_state) && hdr->b_datacnt == 0) { + if (GHOST_STATE(old_state) && datacnt == 0) { /* ghost elements have a ghost size */ - ASSERT(hdr->b_buf == NULL); + ASSERT(hdr->b_l1hdr.b_buf == NULL); from_delta = hdr->b_size; } ASSERT3U(*size, >=, from_delta); @@ -1437,10 +1668,17 @@ arc_change_state(arc_state_t *new_state, if (use_mutex) mutex_exit(lock); } - if (new_state != arc_anon) { + if (new_state != arc_anon && new_state != arc_l2c_only) { int use_mutex; - uint64_t *size = &new_state->arcs_lsize[hdr->b_type]; + uint64_t *size = &new_state->arcs_lsize[buftype]; + /* + * An L1 header always exists here, since if we're + * moving to some L1-cached state (i.e. not l2c_only or + * anonymous), we realloc the header to add an L1hdr + * beforehand. + */ + ASSERT(HDR_HAS_L1HDR(hdr)); get_buf_info(hdr, new_state, &list, &lock); use_mutex = !MUTEX_HELD(lock); if (use_mutex) @@ -1450,8 +1688,8 @@ arc_change_state(arc_state_t *new_state, /* ghost elements have a ghost size */ if (GHOST_STATE(new_state)) { - ASSERT(hdr->b_datacnt == 0); - ASSERT(hdr->b_buf == NULL); + ASSERT(datacnt == 0); + ASSERT(hdr->b_l1hdr.b_buf == NULL); to_delta = hdr->b_size; } atomic_add_64(size, to_delta); @@ -1465,20 +1703,22 @@ arc_change_state(arc_state_t *new_state, if (new_state == arc_anon && HDR_IN_HASH_TABLE(hdr)) buf_hash_remove(hdr); - /* adjust state sizes */ - if (to_delta) + /* adjust state sizes (ignore arc_l2c_only) */ + if (to_delta && new_state != arc_l2c_only) atomic_add_64(&new_state->arcs_size, to_delta); - if (from_delta) { + if (from_delta && old_state != arc_l2c_only) { ASSERT3U(old_state->arcs_size, >=, from_delta); atomic_add_64(&old_state->arcs_size, -from_delta); } - hdr->b_state = new_state; + if (HDR_HAS_L1HDR(hdr)) + hdr->b_l1hdr.b_state = new_state; - /* adjust l2arc hdr stats */ - if (new_state == arc_l2c_only) - l2arc_hdr_stat_add(); - else if (old_state == arc_l2c_only) - l2arc_hdr_stat_remove(); + /* + * L2 headers should never be on the L2 state list since they don't + * have L1 headers allocated. + */ + ASSERT(list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && + list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); } void @@ -1534,31 +1774,36 @@ arc_space_return(uint64_t space, arc_spa } arc_buf_t * -arc_buf_alloc(spa_t *spa, int size, void *tag, arc_buf_contents_t type) +arc_buf_alloc(spa_t *spa, int32_t size, void *tag, arc_buf_contents_t type) { arc_buf_hdr_t *hdr; arc_buf_t *buf; ASSERT3U(size, >, 0); - hdr = kmem_cache_alloc(hdr_cache, KM_PUSHPAGE); + hdr = kmem_cache_alloc(hdr_full_cache, KM_PUSHPAGE); ASSERT(BUF_EMPTY(hdr)); + ASSERT3P(hdr->b_freeze_cksum, ==, NULL); hdr->b_size = size; - hdr->b_type = type; hdr->b_spa = spa_load_guid(spa); - hdr->b_state = arc_anon; - hdr->b_arc_access = 0; + buf = kmem_cache_alloc(buf_cache, KM_PUSHPAGE); buf->b_hdr = hdr; buf->b_data = NULL; buf->b_efunc = NULL; buf->b_private = NULL; buf->b_next = NULL; - hdr->b_buf = buf; + + hdr->b_flags = arc_bufc_to_flags(type); + hdr->b_flags |= ARC_FLAG_HAS_L1HDR; + + hdr->b_l1hdr.b_buf = buf; + hdr->b_l1hdr.b_state = arc_anon; + hdr->b_l1hdr.b_arc_access = 0; + hdr->b_l1hdr.b_datacnt = 1; + arc_get_data_buf(buf); - hdr->b_datacnt = 1; - hdr->b_flags = 0; - ASSERT(refcount_is_zero(&hdr->b_refcnt)); - (void) refcount_add(&hdr->b_refcnt, tag); + ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag); return (buf); } @@ -1591,8 +1836,9 @@ arc_return_buf(arc_buf_t *buf, void *tag arc_buf_hdr_t *hdr = buf->b_hdr; ASSERT(buf->b_data != NULL); - (void) refcount_add(&hdr->b_refcnt, tag); - (void) refcount_remove(&hdr->b_refcnt, arc_onloan_tag); + ASSERT(HDR_HAS_L1HDR(hdr)); + (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag); + (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); atomic_add_64(&arc_loaned_bytes, -hdr->b_size); } @@ -1601,12 +1847,12 @@ arc_return_buf(arc_buf_t *buf, void *tag void arc_loan_inuse_buf(arc_buf_t *buf, void *tag) { - arc_buf_hdr_t *hdr; + arc_buf_hdr_t *hdr = buf->b_hdr; ASSERT(buf->b_data != NULL); - hdr = buf->b_hdr; - (void) refcount_add(&hdr->b_refcnt, arc_onloan_tag); - (void) refcount_remove(&hdr->b_refcnt, tag); + ASSERT(HDR_HAS_L1HDR(hdr)); + (void) refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); buf->b_efunc = NULL; buf->b_private = NULL; @@ -1620,15 +1866,16 @@ arc_buf_clone(arc_buf_t *from) arc_buf_hdr_t *hdr = from->b_hdr; uint64_t size = hdr->b_size; - ASSERT(hdr->b_state != arc_anon); + ASSERT(HDR_HAS_L1HDR(hdr)); + ASSERT(hdr->b_l1hdr.b_state != arc_anon); buf = kmem_cache_alloc(buf_cache, KM_PUSHPAGE); buf->b_hdr = hdr; buf->b_data = NULL; buf->b_efunc = NULL; buf->b_private = NULL; - buf->b_next = hdr->b_buf; - hdr->b_buf = buf; + buf->b_next = hdr->b_l1hdr.b_buf; + hdr->b_l1hdr.b_buf = buf; arc_get_data_buf(buf); bcopy(from->b_data, buf->b_data, size); @@ -1638,11 +1885,11 @@ arc_buf_clone(arc_buf_t *from) * then track the size and number of duplicates. These stats will be * updated as duplicate buffers are created and destroyed. */ - if (hdr->b_type == ARC_BUFC_DATA) { + if (HDR_ISTYPE_DATA(hdr)) { ARCSTAT_BUMP(arcstat_duplicate_buffers); ARCSTAT_INCR(arcstat_duplicate_buffers_size, size); } - hdr->b_datacnt += 1; + hdr->b_l1hdr.b_datacnt += 1; return (buf); } @@ -1665,17 +1912,20 @@ arc_buf_add_ref(arc_buf_t *buf, void* ta hash_lock = HDR_LOCK(buf->b_hdr); mutex_enter(hash_lock); hdr = buf->b_hdr; + ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); mutex_exit(&buf->b_evict_lock); - ASSERT(hdr->b_state == arc_mru || hdr->b_state == arc_mfu); + ASSERT(hdr->b_l1hdr.b_state == arc_mru || + hdr->b_l1hdr.b_state == arc_mfu); + add_reference(hdr, hash_lock, tag); DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); arc_access(hdr, hash_lock); mutex_exit(hash_lock); ARCSTAT_BUMP(arcstat_hits); - ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_FLAG_PREFETCH), - demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, + ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr), + demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, hits); } @@ -1718,18 +1968,26 @@ arc_buf_data_free(arc_buf_t *buf, void ( static void arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr) { - l2arc_buf_hdr_t *l2hdr = hdr->b_l2hdr; + ASSERT(HDR_HAS_L2HDR(hdr)); + ASSERT(MUTEX_HELD(&hdr->b_l2hdr.b_dev->l2ad_mtx)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 07:28:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA93A0E44D; Sat, 3 Oct 2015 07:28:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E87711A3; Sat, 3 Oct 2015 07:28:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937SsQX063499; Sat, 3 Oct 2015 07:28:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937SrZt063496; Sat, 3 Oct 2015 07:28:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030728.t937SrZt063496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:28: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: r288548 - in stable/10/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:28:54 -0000 Author: mav Date: Sat Oct 3 07:28:52 2015 New Revision: 288548 URL: https://svnweb.freebsd.org/changeset/base/288548 Log: MFC r286574: 5445 Add more visibility via arcstats; specifically arc_state_t stats and differentiate between "data" and "metadata" Reviewed by: Basil Crow Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Bayard Bell Approved by: Robert Mustacchi Author: Prakash Surya illumos/illumos-gate@4076b1bf41cfd9f968a33ed54a7ae76d9e996fe8 Modified: stable/10/sys/cddl/compat/opensolaris/sys/kstat.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/kstat.h Sat Oct 3 07:27:58 2015 (r288547) +++ stable/10/sys/cddl/compat/opensolaris/sys/kstat.h Sat Oct 3 07:28:52 2015 (r288548) @@ -35,12 +35,17 @@ #define KSTAT_FLAG_VIRTUAL 0x01 +#define KSTAT_READ 0 +#define KSTAT_WRITE 1 + typedef struct kstat { void *ks_data; u_int ks_ndata; #ifdef _KERNEL struct sysctl_ctx_list ks_sysctl_ctx; struct sysctl_oid *ks_sysctl_root; + int (*ks_update)(struct kstat *, int); /* dynamic update */ + void *ks_private; /* arbitrary provider-private data */ #endif } kstat_t; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:27:58 2015 (r288547) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:28:52 2015 (r288548) @@ -387,9 +387,137 @@ typedef struct arc_stats { kstat_named_t arcstat_c_min; kstat_named_t arcstat_c_max; kstat_named_t arcstat_size; + /* + * Number of bytes consumed by internal ARC structures necessary + * for tracking purposes; these structures are not actually + * backed by ARC buffers. This includes arc_buf_hdr_t structures + * (allocated via arc_buf_hdr_t_full and arc_buf_hdr_t_l2only + * caches), and arc_buf_t structures (allocated via arc_buf_t + * cache). + */ kstat_named_t arcstat_hdr_size; + /* + * Number of bytes consumed by ARC buffers of type equal to + * ARC_BUFC_DATA. This is generally consumed by buffers backing + * on disk user data (e.g. plain file contents). + */ kstat_named_t arcstat_data_size; + /* + * Number of bytes consumed by ARC buffers of type equal to + * ARC_BUFC_METADATA. This is generally consumed by buffers + * backing on disk data that is used for internal ZFS + * structures (e.g. ZAP, dnode, indirect blocks, etc). + */ + kstat_named_t arcstat_metadata_size; + /* + * Number of bytes consumed by various buffers and structures + * not actually backed with ARC buffers. This includes bonus + * buffers (allocated directly via zio_buf_* functions), + * dmu_buf_impl_t structures (allocated via dmu_buf_impl_t + * cache), and dnode_t structures (allocated via dnode_t cache). + */ kstat_named_t arcstat_other_size; + /* + * Total number of bytes consumed by ARC buffers residing in the + * arc_anon state. This includes *all* buffers in the arc_anon + * state; e.g. data, metadata, evictable, and unevictable buffers + * are all included in this value. + */ + kstat_named_t arcstat_anon_size; + /* + * Number of bytes consumed by ARC buffers that meet the + * following criteria: backing buffers of type ARC_BUFC_DATA, + * residing in the arc_anon state, and are eligible for eviction + * (e.g. have no outstanding holds on the buffer). + */ + kstat_named_t arcstat_anon_evictable_data; + /* + * Number of bytes consumed by ARC buffers that meet the + * following criteria: backing buffers of type ARC_BUFC_METADATA, + * residing in the arc_anon state, and are eligible for eviction + * (e.g. have no outstanding holds on the buffer). + */ + kstat_named_t arcstat_anon_evictable_metadata; + /* + * Total number of bytes consumed by ARC buffers residing in the + * arc_mru state. This includes *all* buffers in the arc_mru + * state; e.g. data, metadata, evictable, and unevictable buffers + * are all included in this value. + */ + kstat_named_t arcstat_mru_size; + /* + * Number of bytes consumed by ARC buffers that meet the + * following criteria: backing buffers of type ARC_BUFC_DATA, + * residing in the arc_mru state, and are eligible for eviction + * (e.g. have no outstanding holds on the buffer). + */ + kstat_named_t arcstat_mru_evictable_data; + /* + * Number of bytes consumed by ARC buffers that meet the + * following criteria: backing buffers of type ARC_BUFC_METADATA, + * residing in the arc_mru state, and are eligible for eviction + * (e.g. have no outstanding holds on the buffer). + */ + kstat_named_t arcstat_mru_evictable_metadata; + /* + * Total number of bytes that *would have been* consumed by ARC + * buffers in the arc_mru_ghost state. The key thing to note + * here, is the fact that this size doesn't actually indicate + * RAM consumption. The ghost lists only consist of headers and + * don't actually have ARC buffers linked off of these headers. + * Thus, *if* the headers had associated ARC buffers, these + * buffers *would have* consumed this number of bytes. + */ + kstat_named_t arcstat_mru_ghost_size; + /* + * Number of bytes that *would have been* consumed by ARC + * buffers that are eligible for eviction, of type + * ARC_BUFC_DATA, and linked off the arc_mru_ghost state. + */ + kstat_named_t arcstat_mru_ghost_evictable_data; + /* + * Number of bytes that *would have been* consumed by ARC + * buffers that are eligible for eviction, of type + * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + */ + kstat_named_t arcstat_mru_ghost_evictable_metadata; + /* + * Total number of bytes consumed by ARC buffers residing in the + * arc_mfu state. This includes *all* buffers in the arc_mfu + * state; e.g. data, metadata, evictable, and unevictable buffers + * are all included in this value. + */ + kstat_named_t arcstat_mfu_size; + /* + * Number of bytes consumed by ARC buffers that are eligible for + * eviction, of type ARC_BUFC_DATA, and reside in the arc_mfu + * state. + */ + kstat_named_t arcstat_mfu_evictable_data; + /* + * Number of bytes consumed by ARC buffers that are eligible for + * eviction, of type ARC_BUFC_METADATA, and reside in the + * arc_mfu state. + */ + kstat_named_t arcstat_mfu_evictable_metadata; + /* + * Total number of bytes that *would have been* consumed by ARC + * buffers in the arc_mfu_ghost state. See the comment above + * arcstat_mru_ghost_size for more details. + */ + kstat_named_t arcstat_mfu_ghost_size; + /* + * Number of bytes that *would have been* consumed by ARC + * buffers that are eligible for eviction, of type + * ARC_BUFC_DATA, and linked off the arc_mfu_ghost state. + */ + kstat_named_t arcstat_mfu_ghost_evictable_data; + /* + * Number of bytes that *would have been* consumed by ARC + * buffers that are eligible for eviction, of type + * ARC_BUFC_METADATA, and linked off the arc_mru_ghost state. + */ + kstat_named_t arcstat_mfu_ghost_evictable_metadata; kstat_named_t arcstat_l2_hits; kstat_named_t arcstat_l2_misses; kstat_named_t arcstat_l2_feeds; @@ -472,7 +600,23 @@ static arc_stats_t arc_stats = { { "size", KSTAT_DATA_UINT64 }, { "hdr_size", KSTAT_DATA_UINT64 }, { "data_size", KSTAT_DATA_UINT64 }, + { "metadata_size", KSTAT_DATA_UINT64 }, { "other_size", KSTAT_DATA_UINT64 }, + { "anon_size", KSTAT_DATA_UINT64 }, + { "anon_evictable_data", KSTAT_DATA_UINT64 }, + { "anon_evictable_metadata", KSTAT_DATA_UINT64 }, + { "mru_size", KSTAT_DATA_UINT64 }, + { "mru_evictable_data", KSTAT_DATA_UINT64 }, + { "mru_evictable_metadata", KSTAT_DATA_UINT64 }, + { "mru_ghost_size", KSTAT_DATA_UINT64 }, + { "mru_ghost_evictable_data", KSTAT_DATA_UINT64 }, + { "mru_ghost_evictable_metadata", KSTAT_DATA_UINT64 }, + { "mfu_size", KSTAT_DATA_UINT64 }, + { "mfu_evictable_data", KSTAT_DATA_UINT64 }, + { "mfu_evictable_metadata", KSTAT_DATA_UINT64 }, + { "mfu_ghost_size", KSTAT_DATA_UINT64 }, + { "mfu_ghost_evictable_data", KSTAT_DATA_UINT64 }, + { "mfu_ghost_evictable_metadata", KSTAT_DATA_UINT64 }, { "l2_hits", KSTAT_DATA_UINT64 }, { "l2_misses", KSTAT_DATA_UINT64 }, { "l2_feeds", KSTAT_DATA_UINT64 }, @@ -1730,6 +1874,9 @@ arc_space_consume(uint64_t space, arc_sp case ARC_SPACE_DATA: ARCSTAT_INCR(arcstat_data_size, space); break; + case ARC_SPACE_META: + ARCSTAT_INCR(arcstat_metadata_size, space); + break; case ARC_SPACE_OTHER: ARCSTAT_INCR(arcstat_other_size, space); break; @@ -1741,7 +1888,9 @@ arc_space_consume(uint64_t space, arc_sp break; } - ARCSTAT_INCR(arcstat_meta_used, space); + if (type != ARC_SPACE_DATA) + ARCSTAT_INCR(arcstat_meta_used, space); + atomic_add_64(&arc_size, space); } @@ -1754,6 +1903,9 @@ arc_space_return(uint64_t space, arc_spa case ARC_SPACE_DATA: ARCSTAT_INCR(arcstat_data_size, -space); break; + case ARC_SPACE_META: + ARCSTAT_INCR(arcstat_metadata_size, -space); + break; case ARC_SPACE_OTHER: ARCSTAT_INCR(arcstat_other_size, -space); break; @@ -1765,10 +1917,13 @@ arc_space_return(uint64_t space, arc_spa break; } - ASSERT(arc_meta_used >= space); - if (arc_meta_max < arc_meta_used) - arc_meta_max = arc_meta_used; - ARCSTAT_INCR(arcstat_meta_used, -space); + if (type != ARC_SPACE_DATA) { + ASSERT(arc_meta_used >= space); + if (arc_meta_max < arc_meta_used) + arc_meta_max = arc_meta_used; + ARCSTAT_INCR(arcstat_meta_used, -space); + } + ASSERT(arc_size >= space); atomic_add_64(&arc_size, -space); } @@ -2009,12 +2164,11 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ if (!recycle) { if (type == ARC_BUFC_METADATA) { arc_buf_data_free(buf, zio_buf_free); - arc_space_return(size, ARC_SPACE_DATA); + arc_space_return(size, ARC_SPACE_META); } else { ASSERT(type == ARC_BUFC_DATA); arc_buf_data_free(buf, zio_data_buf_free); - ARCSTAT_INCR(arcstat_data_size, -size); - atomic_add_64(&arc_size, -size); + arc_space_return(size, ARC_SPACE_DATA); } } if (list_link_active(&buf->b_hdr->b_l1hdr.b_arc_node)) { @@ -3099,6 +3253,20 @@ arc_reclaim_thread(void *dummy __unused) } #endif + /* + * This is necessary in order for the mdb ::arc dcmd to + * show up to date information. Since the ::arc command + * does not call the kstat's update function, without + * this call, the command may show stale stats for the + * anon, mru, mru_ghost, mfu, and mfu_ghost lists. Even + * with this change, the data might be up to 1 second + * out of date; but that should suffice. The arc_state_t + * structures can be queried directly if more accurate + * information is needed. + */ + if (arc_ksp != NULL) + arc_ksp->ks_update(arc_ksp, KSTAT_READ); + /* block until needed, or one second, whichever is shorter */ CALLB_CPR_SAFE_BEGIN(&cpr); (void) cv_timedwait(&arc_reclaim_thr_cv, @@ -3236,12 +3404,11 @@ arc_get_data_buf(arc_buf_t *buf) if (!arc_evict_needed(type)) { if (type == ARC_BUFC_METADATA) { buf->b_data = zio_buf_alloc(size); - arc_space_consume(size, ARC_SPACE_DATA); + arc_space_consume(size, ARC_SPACE_META); } else { ASSERT(type == ARC_BUFC_DATA); buf->b_data = zio_data_buf_alloc(size); - ARCSTAT_INCR(arcstat_data_size, size); - atomic_add_64(&arc_size, size); + arc_space_consume(size, ARC_SPACE_DATA); } goto out; } @@ -3268,12 +3435,11 @@ arc_get_data_buf(arc_buf_t *buf) if ((buf->b_data = arc_evict(state, 0, size, TRUE, type)) == NULL) { if (type == ARC_BUFC_METADATA) { buf->b_data = zio_buf_alloc(size); - arc_space_consume(size, ARC_SPACE_DATA); + arc_space_consume(size, ARC_SPACE_META); } else { ASSERT(type == ARC_BUFC_DATA); buf->b_data = zio_data_buf_alloc(size); - ARCSTAT_INCR(arcstat_data_size, size); - atomic_add_64(&arc_size, size); + arc_space_consume(size, ARC_SPACE_DATA); } ARCSTAT_BUMP(arcstat_recycle_miss); } @@ -4434,6 +4600,48 @@ arc_memory_throttle(uint64_t reserve, ui return (0); } +static void +arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, + kstat_named_t *evict_data, kstat_named_t *evict_metadata) +{ + size->value.ui64 = state->arcs_size; + evict_data->value.ui64 = state->arcs_lsize[ARC_BUFC_DATA]; + evict_metadata->value.ui64 = state->arcs_lsize[ARC_BUFC_METADATA]; +} + +static int +arc_kstat_update(kstat_t *ksp, int rw) +{ + arc_stats_t *as = ksp->ks_data; + + if (rw == KSTAT_WRITE) { + return (EACCES); + } else { + arc_kstat_update_state(arc_anon, + &as->arcstat_anon_size, + &as->arcstat_anon_evictable_data, + &as->arcstat_anon_evictable_metadata); + arc_kstat_update_state(arc_mru, + &as->arcstat_mru_size, + &as->arcstat_mru_evictable_data, + &as->arcstat_mru_evictable_metadata); + arc_kstat_update_state(arc_mru_ghost, + &as->arcstat_mru_ghost_size, + &as->arcstat_mru_ghost_evictable_data, + &as->arcstat_mru_ghost_evictable_metadata); + arc_kstat_update_state(arc_mfu, + &as->arcstat_mfu_size, + &as->arcstat_mfu_evictable_data, + &as->arcstat_mfu_evictable_metadata); + arc_kstat_update_state(arc_mfu_ghost, + &as->arcstat_mfu_ghost_size, + &as->arcstat_mfu_ghost_evictable_data, + &as->arcstat_mfu_ghost_evictable_metadata); + } + + return (0); +} + void arc_tempreserve_clear(uint64_t reserve) { @@ -4657,6 +4865,7 @@ arc_init(void) if (arc_ksp != NULL) { arc_ksp->ks_data = &arc_stats; + arc_ksp->ks_update = arc_kstat_update; kstat_install(arc_ksp); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Oct 3 07:27:58 2015 (r288547) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Oct 3 07:28:52 2015 (r288548) @@ -115,6 +115,7 @@ typedef enum arc_buf_contents { */ typedef enum arc_space_type { ARC_SPACE_DATA, + ARC_SPACE_META, ARC_SPACE_HDRS, ARC_SPACE_L2HDRS, ARC_SPACE_OTHER, From owner-svn-src-all@freebsd.org Sat Oct 3 07:29:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFB7FA0E521; Sat, 3 Oct 2015 07:29:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE4951309; Sat, 3 Oct 2015 07:29:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937Tw8U063685; Sat, 3 Oct 2015 07:29:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937Tu5k063670; Sat, 3 Oct 2015 07:29:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030729.t937Tu5k063670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:29:56 +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: r288549 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:29:59 -0000 Author: mav Date: Sat Oct 3 07:29:56 2015 New Revision: 288549 URL: https://svnweb.freebsd.org/changeset/base/288549 Log: MFC r286575: 5056 ZFS deadlock on db_mtx and dn_holds Reviewed by: Will Andrews Reviewed by: Matt Ahrens Reviewed by: George Wilson Approved by: Dan McDonald Author: Justin Gibbs illumos/illumos-gate@bc9014e6a81272073b9854d9f65dd59e18d18c35 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:29:56 2015 (r288549) @@ -24,6 +24,7 @@ * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ #include @@ -54,10 +55,16 @@ static void dbuf_destroy(dmu_buf_impl_t static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); +#ifndef __lint +extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu, + dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp); +#endif /* ! __lint */ + /* * Global data structures and functions for the dbuf cache. */ static kmem_cache_t *dbuf_cache; +static taskq_t *dbu_evict_taskq; /* ARGSUSED */ static int @@ -231,17 +238,72 @@ dbuf_hash_remove(dmu_buf_impl_t *db) static arc_evict_func_t dbuf_do_evict; +typedef enum { + DBVU_EVICTING, + DBVU_NOT_EVICTING +} dbvu_verify_type_t; + +static void +dbuf_verify_user(dmu_buf_impl_t *db, dbvu_verify_type_t verify_type) +{ +#ifdef ZFS_DEBUG + int64_t holds; + + if (db->db_user == NULL) + return; + + /* Only data blocks support the attachment of user data. */ + ASSERT(db->db_level == 0); + + /* Clients must resolve a dbuf before attaching user data. */ + ASSERT(db->db.db_data != NULL); + ASSERT3U(db->db_state, ==, DB_CACHED); + + holds = refcount_count(&db->db_holds); + if (verify_type == DBVU_EVICTING) { + /* + * Immediate eviction occurs when holds == dirtycnt. + * For normal eviction buffers, holds is zero on + * eviction, except when dbuf_fix_old_data() calls + * dbuf_clear_data(). However, the hold count can grow + * during eviction even though db_mtx is held (see + * dmu_bonus_hold() for an example), so we can only + * test the generic invariant that holds >= dirtycnt. + */ + ASSERT3U(holds, >=, db->db_dirtycnt); + } else { + if (db->db_immediate_evict == TRUE) + ASSERT3U(holds, >=, db->db_dirtycnt); + else + ASSERT3U(holds, >, 0); + } +#endif +} + static void dbuf_evict_user(dmu_buf_impl_t *db) { + dmu_buf_user_t *dbu = db->db_user; + ASSERT(MUTEX_HELD(&db->db_mtx)); - if (db->db_level != 0 || db->db_evict_func == NULL) + if (dbu == NULL) return; - db->db_evict_func(&db->db, db->db_user_ptr); - db->db_user_ptr = NULL; - db->db_evict_func = NULL; + dbuf_verify_user(db, DBVU_EVICTING); + db->db_user = NULL; + +#ifdef ZFS_DEBUG + if (dbu->dbu_clear_on_evict_dbufp != NULL) + *dbu->dbu_clear_on_evict_dbufp = NULL; +#endif + + /* + * Invoke the callback from a taskq to avoid lock order reversals + * and limit stack depth. + */ + taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func, dbu, 0, + &dbu->dbu_tqent); } boolean_t @@ -302,6 +364,12 @@ retry: for (i = 0; i < DBUF_MUTEXES; i++) mutex_init(&h->hash_mutexes[i], NULL, MUTEX_DEFAULT, NULL); + + /* + * All entries are queued via taskq_dispatch_ent(), so min/maxalloc + * configuration is not required. + */ + dbu_evict_taskq = taskq_create("dbu_evict", 1, minclsyspri, 0, 0, 0); } void @@ -314,6 +382,7 @@ dbuf_fini(void) mutex_destroy(&h->hash_mutexes[i]); kmem_free(h->hash_table, (h->hash_table_mask + 1) * sizeof (void *)); kmem_cache_destroy(dbuf_cache); + taskq_destroy(dbu_evict_taskq); } /* @@ -431,21 +500,27 @@ dbuf_verify(dmu_buf_impl_t *db) #endif static void +dbuf_clear_data(dmu_buf_impl_t *db) +{ + ASSERT(MUTEX_HELD(&db->db_mtx)); + dbuf_evict_user(db); + db->db_buf = NULL; + db->db.db_data = NULL; + if (db->db_state != DB_NOFILL) + db->db_state = DB_UNCACHED; +} + +static void dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf) { ASSERT(MUTEX_HELD(&db->db_mtx)); + ASSERT(buf != NULL); + db->db_buf = buf; - if (buf != NULL) { - ASSERT(buf->b_data != NULL); - db->db.db_data = buf->b_data; - if (!arc_released(buf)) - arc_set_callback(buf, dbuf_do_evict, db); - } else { - dbuf_evict_user(db); - db->db.db_data = NULL; - if (db->db_state != DB_NOFILL) - db->db_state = DB_UNCACHED; - } + ASSERT(buf->b_data != NULL); + db->db.db_data = buf->b_data; + if (!arc_released(buf)) + arc_set_callback(buf, dbuf_do_evict, db); } /* @@ -467,7 +542,7 @@ dbuf_loan_arcbuf(dmu_buf_impl_t *db) } else { abuf = db->db_buf; arc_loan_inuse_buf(abuf, db); - dbuf_set_data(db, NULL); + dbuf_clear_data(db); mutex_exit(&db->db_mtx); } return (abuf); @@ -703,7 +778,7 @@ dbuf_noread(dmu_buf_impl_t *db) dbuf_set_data(db, arc_buf_alloc(spa, db->db.db_size, db, type)); db->db_state = DB_FILL; } else if (db->db_state == DB_NOFILL) { - dbuf_set_data(db, NULL); + dbuf_clear_data(db); } else { ASSERT3U(db->db_state, ==, DB_CACHED); } @@ -759,7 +834,7 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, ui dr->dt.dl.dr_data = arc_buf_alloc(spa, size, db, type); bcopy(db->db.db_data, dr->dt.dl.dr_data->b_data, size); } else { - dbuf_set_data(db, NULL); + dbuf_clear_data(db); } } @@ -810,7 +885,8 @@ void dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next, db_search; + dmu_buf_impl_t db_search; + dmu_buf_impl_t *db, *db_next; uint64_t txg = tx->tx_txg; avl_index_t where; @@ -1388,7 +1464,7 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_ arc_buf_t *buf = db->db_buf; ASSERT(db->db_state == DB_NOFILL || arc_released(buf)); - dbuf_set_data(db, NULL); + dbuf_clear_data(db); VERIFY(arc_buf_remove_ref(buf, db)); dbuf_evict(db); return (B_TRUE); @@ -1728,8 +1804,7 @@ dbuf_create(dnode_t *dn, uint8_t level, db->db_parent = parent; db->db_blkptr = blkptr; - db->db_user_ptr = NULL; - db->db_evict_func = NULL; + db->db_user = NULL; db->db_immediate_evict = 0; db->db_freed_in_flight = 0; @@ -2195,7 +2270,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, /* * This dbuf has anonymous data associated with it. */ - dbuf_set_data(db, NULL); + dbuf_clear_data(db); VERIFY(arc_buf_remove_ref(buf, db)); dbuf_evict(db); } else { @@ -2228,7 +2303,8 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, } else { dbuf_clear(db); } - } else if (arc_buf_eviction_needed(db->db_buf)) { + } else if (db->db_objset->os_evicting || + arc_buf_eviction_needed(db->db_buf)) { dbuf_clear(db); } else { mutex_exit(&db->db_mtx); @@ -2247,51 +2323,57 @@ dbuf_refcount(dmu_buf_impl_t *db) } void * -dmu_buf_set_user(dmu_buf_t *db_fake, void *user_ptr, - dmu_buf_evict_func_t *evict_func) +dmu_buf_replace_user(dmu_buf_t *db_fake, dmu_buf_user_t *old_user, + dmu_buf_user_t *new_user) { - return (dmu_buf_update_user(db_fake, NULL, user_ptr, evict_func)); + dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; + + mutex_enter(&db->db_mtx); + dbuf_verify_user(db, DBVU_NOT_EVICTING); + if (db->db_user == old_user) + db->db_user = new_user; + else + old_user = db->db_user; + dbuf_verify_user(db, DBVU_NOT_EVICTING); + mutex_exit(&db->db_mtx); + + return (old_user); } void * -dmu_buf_set_user_ie(dmu_buf_t *db_fake, void *user_ptr, - dmu_buf_evict_func_t *evict_func) +dmu_buf_set_user(dmu_buf_t *db_fake, dmu_buf_user_t *user) { - dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; - - db->db_immediate_evict = TRUE; - return (dmu_buf_update_user(db_fake, NULL, user_ptr, evict_func)); + return (dmu_buf_replace_user(db_fake, NULL, user)); } void * -dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr, void *user_ptr, - dmu_buf_evict_func_t *evict_func) +dmu_buf_set_user_ie(dmu_buf_t *db_fake, dmu_buf_user_t *user) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; - ASSERT(db->db_level == 0); - - ASSERT((user_ptr == NULL) == (evict_func == NULL)); - - mutex_enter(&db->db_mtx); - if (db->db_user_ptr == old_user_ptr) { - db->db_user_ptr = user_ptr; - db->db_evict_func = evict_func; - } else { - old_user_ptr = db->db_user_ptr; - } + db->db_immediate_evict = TRUE; + return (dmu_buf_set_user(db_fake, user)); +} - mutex_exit(&db->db_mtx); - return (old_user_ptr); +void * +dmu_buf_remove_user(dmu_buf_t *db_fake, dmu_buf_user_t *user) +{ + return (dmu_buf_replace_user(db_fake, user, NULL)); } void * dmu_buf_get_user(dmu_buf_t *db_fake) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; - ASSERT(!refcount_is_zero(&db->db_holds)); - return (db->db_user_ptr); + dbuf_verify_user(db, DBVU_NOT_EVICTING); + return (db->db_user); +} + +void +dmu_buf_user_evict_wait() +{ + taskq_wait(dbu_evict_taskq); } boolean_t Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:29:56 2015 (r288549) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ @@ -357,7 +358,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat zfs_prop_to_name(ZFS_PROP_SECONDARYCACHE), secondary_cache_changed_cb, os); } - if (!dsl_dataset_is_snapshot(ds)) { + if (!ds->ds_is_snapshot) { if (err == 0) { err = dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_CHECKSUM), @@ -419,7 +420,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat os->os_secondary_cache = ZFS_CACHE_ALL; } - if (ds == NULL || !dsl_dataset_is_snapshot(ds)) + if (ds == NULL || !ds->ds_is_snapshot) os->os_zil_header = os->os_phys->os_zil_header; os->os_zil = zil_alloc(os, &os->os_zil_header); @@ -438,16 +439,13 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL); - DMU_META_DNODE(os) = dnode_special_open(os, - &os->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT, - &os->os_meta_dnode); + dnode_special_open(os, &os->os_phys->os_meta_dnode, + DMU_META_DNODE_OBJECT, &os->os_meta_dnode); if (arc_buf_size(os->os_phys_buf) >= sizeof (objset_phys_t)) { - DMU_USERUSED_DNODE(os) = dnode_special_open(os, - &os->os_phys->os_userused_dnode, DMU_USERUSED_OBJECT, - &os->os_userused_dnode); - DMU_GROUPUSED_DNODE(os) = dnode_special_open(os, - &os->os_phys->os_groupused_dnode, DMU_GROUPUSED_OBJECT, - &os->os_groupused_dnode); + dnode_special_open(os, &os->os_phys->os_userused_dnode, + DMU_USERUSED_OBJECT, &os->os_userused_dnode); + dnode_special_open(os, &os->os_phys->os_groupused_dnode, + DMU_GROUPUSED_OBJECT, &os->os_groupused_dnode); } *osp = os; @@ -535,7 +533,7 @@ dmu_objset_own(const char *name, dmu_obj } else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) { dsl_dataset_disown(ds, tag); return (SET_ERROR(EINVAL)); - } else if (!readonly && dsl_dataset_is_snapshot(ds)) { + } else if (!readonly && ds->ds_is_snapshot) { dsl_dataset_disown(ds, tag); return (SET_ERROR(EROFS)); } @@ -591,41 +589,53 @@ dmu_objset_disown(objset_t *os, void *ta void dmu_objset_evict_dbufs(objset_t *os) { + dnode_t dn_marker; dnode_t *dn; mutex_enter(&os->os_lock); - - /* process the mdn last, since the other dnodes have holds on it */ - list_remove(&os->os_dnodes, DMU_META_DNODE(os)); - list_insert_tail(&os->os_dnodes, DMU_META_DNODE(os)); - - /* - * Find the first dnode with holds. We have to do this dance - * because dnode_add_ref() only works if you already have a - * hold. If there are no holds then it has no dbufs so OK to - * skip. - */ - for (dn = list_head(&os->os_dnodes); - dn && !dnode_add_ref(dn, FTAG); - dn = list_next(&os->os_dnodes, dn)) - continue; - - while (dn) { - dnode_t *next_dn = dn; - - do { - next_dn = list_next(&os->os_dnodes, next_dn); - } while (next_dn && !dnode_add_ref(next_dn, FTAG)); - - mutex_exit(&os->os_lock); - dnode_evict_dbufs(dn); - dnode_rele(dn, FTAG); - mutex_enter(&os->os_lock); - dn = next_dn; + dn = list_head(&os->os_dnodes); + while (dn != NULL) { + /* + * Skip dnodes without holds. We have to do this dance + * because dnode_add_ref() only works if there is already a + * hold. If the dnode has no holds, then it has no dbufs. + */ + if (dnode_add_ref(dn, FTAG)) { + list_insert_after(&os->os_dnodes, dn, &dn_marker); + mutex_exit(&os->os_lock); + + dnode_evict_dbufs(dn); + dnode_rele(dn, FTAG); + + mutex_enter(&os->os_lock); + dn = list_next(&os->os_dnodes, &dn_marker); + list_remove(&os->os_dnodes, &dn_marker); + } else { + dn = list_next(&os->os_dnodes, dn); + } } mutex_exit(&os->os_lock); + + if (DMU_USERUSED_DNODE(os) != NULL) { + dnode_evict_dbufs(DMU_GROUPUSED_DNODE(os)); + dnode_evict_dbufs(DMU_USERUSED_DNODE(os)); + } + dnode_evict_dbufs(DMU_META_DNODE(os)); } +/* + * Objset eviction processing is split into into two pieces. + * The first marks the objset as evicting, evicts any dbufs that + * have a refcount of zero, and then queues up the objset for the + * second phase of eviction. Once os->os_dnodes has been cleared by + * dnode_buf_pageout()->dnode_destroy(), the second phase is executed. + * The second phase closes the special dnodes, dequeues the objset from + * the list of those undergoing eviction, and finally frees the objset. + * + * NOTE: Due to asynchronous eviction processing (invocation of + * dnode_buf_pageout()), it is possible for the meta dnode for the + * objset to have no holds even though os->os_dnodes is not empty. + */ void dmu_objset_evict(objset_t *os) { @@ -635,7 +645,7 @@ dmu_objset_evict(objset_t *os) ASSERT(!dmu_objset_is_dirty(os, t)); if (ds) { - if (!dsl_dataset_is_snapshot(ds)) { + if (!ds->ds_is_snapshot) { VERIFY0(dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_CHECKSUM), checksum_changed_cb, os)); @@ -672,8 +682,24 @@ dmu_objset_evict(objset_t *os) if (os->os_sa) sa_tear_down(os); + os->os_evicting = B_TRUE; dmu_objset_evict_dbufs(os); + mutex_enter(&os->os_lock); + spa_evicting_os_register(os->os_spa, os); + if (list_is_empty(&os->os_dnodes)) { + mutex_exit(&os->os_lock); + dmu_objset_evict_done(os); + } else { + mutex_exit(&os->os_lock); + } +} + +void +dmu_objset_evict_done(objset_t *os) +{ + ASSERT3P(list_head(&os->os_dnodes), ==, NULL); + dnode_special_close(&os->os_meta_dnode); if (DMU_USERUSED_DNODE(os)) { dnode_special_close(&os->os_userused_dnode); @@ -681,8 +707,6 @@ dmu_objset_evict(objset_t *os) } zil_free(os->os_zil); - ASSERT3P(list_head(&os->os_dnodes), ==, NULL); - VERIFY(arc_buf_remove_ref(os->os_phys_buf, &os->os_phys_buf)); /* @@ -697,6 +721,7 @@ dmu_objset_evict(objset_t *os) mutex_destroy(&os->os_lock); mutex_destroy(&os->os_obj_lock); mutex_destroy(&os->os_user_ptr_lock); + spa_evicting_os_deregister(os->os_spa, os); kmem_free(os, sizeof (objset_t)); } @@ -895,7 +920,7 @@ dmu_objset_clone_check(void *arg, dmu_tx return (error); /* You can only clone snapshots, not the head datasets. */ - if (!dsl_dataset_is_snapshot(origin)) { + if (!origin->ds_is_snapshot) { dsl_dataset_rele(origin, FTAG); return (SET_ERROR(EINVAL)); } @@ -1459,7 +1484,7 @@ int dmu_objset_is_snapshot(objset_t *os) { if (os->os_dsl_dataset != NULL) - return (dsl_dataset_is_snapshot(os->os_dsl_dataset)); + return (os->os_dsl_dataset->ds_is_snapshot); else return (B_FALSE); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:29:56 2015 (r288549) @@ -636,7 +636,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, fromtxg = fromzb->zbm_creation_txg; } dsl_dataset_name(ds, drr->drr_u.drr_begin.drr_toname); - if (!dsl_dataset_is_snapshot(ds)) { + if (!ds->ds_is_snapshot) { (void) strlcat(drr->drr_u.drr_begin.drr_toname, "@--head--", sizeof (drr->drr_u.drr_begin.drr_toname)); } @@ -852,11 +852,11 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl ASSERT(dsl_pool_config_held(dp)); /* tosnap must be a snapshot */ - if (!dsl_dataset_is_snapshot(ds)) + if (!ds->ds_is_snapshot) return (SET_ERROR(EINVAL)); /* fromsnap, if provided, must be a snapshot */ - if (fromds != NULL && !dsl_dataset_is_snapshot(fromds)) + if (fromds != NULL && !fromds->ds_is_snapshot) return (SET_ERROR(EINVAL)); /* @@ -1105,7 +1105,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t dsl_dataset_rele(ds, FTAG); return (error); } - if (!dsl_dataset_is_snapshot(origin)) { + if (!origin->ds_is_snapshot) { dsl_dataset_rele(origin, FTAG); dsl_dataset_rele(ds, FTAG); return (SET_ERROR(EINVAL)); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Sat Oct 3 07:29:56 2015 (r288549) @@ -534,7 +534,7 @@ traverse_impl(spa_t *spa, dsl_dataset_t cv_init(&pd.pd_cv, NULL, CV_DEFAULT, NULL); /* See comment on ZIL traversal in dsl_scan_visitds. */ - if (ds != NULL && !dsl_dataset_is_snapshot(ds) && !BP_IS_HOLE(rootbp)) { + if (ds != NULL && !ds->ds_is_snapshot && !BP_IS_HOLE(rootbp)) { arc_flags_t flags = ARC_FLAG_WAIT; objset_phys_t *osp; arc_buf_t *buf; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Oct 3 07:29:56 2015 (r288549) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ #include @@ -405,8 +406,9 @@ static dnode_t * dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db, uint64_t object, dnode_handle_t *dnh) { - dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); + dnode_t *dn; + dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); ASSERT(!POINTER_IS_VALID(dn->dn_objset)); dn->dn_moved = 0; @@ -443,13 +445,31 @@ dnode_create(objset_t *os, dnode_phys_t ASSERT(DMU_OT_IS_VALID(dn->dn_phys->dn_type)); mutex_enter(&os->os_lock); - list_insert_head(&os->os_dnodes, dn); + if (dnh->dnh_dnode != NULL) { + /* Lost the allocation race. */ + mutex_exit(&os->os_lock); + kmem_cache_free(dnode_cache, dn); + return (dnh->dnh_dnode); + } + + /* + * Exclude special dnodes from os_dnodes so an empty os_dnodes + * signifies that the special dnodes have no references from + * their children (the entries in os_dnodes). This allows + * dnode_destroy() to easily determine if the last child has + * been removed and then complete eviction of the objset. + */ + if (!DMU_OBJECT_IS_SPECIAL(object)) + list_insert_head(&os->os_dnodes, dn); membar_producer(); + /* - * Everything else must be valid before assigning dn_objset makes the - * dnode eligible for dnode_move(). + * Everything else must be valid before assigning dn_objset + * makes the dnode eligible for dnode_move(). */ dn->dn_objset = os; + + dnh->dnh_dnode = dn; mutex_exit(&os->os_lock); arc_space_consume(sizeof (dnode_t), ARC_SPACE_OTHER); @@ -463,12 +483,18 @@ static void dnode_destroy(dnode_t *dn) { objset_t *os = dn->dn_objset; + boolean_t complete_os_eviction = B_FALSE; ASSERT((dn->dn_id_flags & DN_ID_NEW_EXIST) == 0); mutex_enter(&os->os_lock); POINTER_INVALIDATE(&dn->dn_objset); - list_remove(&os->os_dnodes, dn); + if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { + list_remove(&os->os_dnodes, dn); + complete_os_eviction = + list_is_empty(&os->os_dnodes) && + list_link_active(&os->os_evicting_node); + } mutex_exit(&os->os_lock); /* the dnode can no longer move, so we can release the handle */ @@ -503,6 +529,9 @@ dnode_destroy(dnode_t *dn) dmu_zfetch_rele(&dn->dn_zfetch); kmem_cache_free(dnode_cache, dn); arc_space_return(sizeof (dnode_t), ARC_SPACE_OTHER); + + if (complete_os_eviction) + dmu_objset_evict_done(os); } void @@ -971,33 +1000,32 @@ dnode_special_close(dnode_handle_t *dnh) */ while (refcount_count(&dn->dn_holds) > 0) delay(1); + ASSERT(dn->dn_dbuf == NULL || + dmu_buf_get_user(&dn->dn_dbuf->db) == NULL); zrl_add(&dnh->dnh_zrlock); dnode_destroy(dn); /* implicit zrl_remove() */ zrl_destroy(&dnh->dnh_zrlock); dnh->dnh_dnode = NULL; } -dnode_t * +void dnode_special_open(objset_t *os, dnode_phys_t *dnp, uint64_t object, dnode_handle_t *dnh) { - dnode_t *dn = dnode_create(os, dnp, NULL, object, dnh); - dnh->dnh_dnode = dn; + dnode_t *dn; + + dn = dnode_create(os, dnp, NULL, object, dnh); zrl_init(&dnh->dnh_zrlock); DNODE_VERIFY(dn); - return (dn); } static void -dnode_buf_pageout(dmu_buf_t *db, void *arg) +dnode_buf_pageout(void *dbu) { - dnode_children_t *children_dnodes = arg; + dnode_children_t *children_dnodes = dbu; int i; - int epb = db->db_size >> DNODE_SHIFT; - ASSERT(epb == children_dnodes->dnc_count); - - for (i = 0; i < epb; i++) { + for (i = 0; i < children_dnodes->dnc_count; i++) { dnode_handle_t *dnh = &children_dnodes->dnc_children[i]; dnode_t *dn; @@ -1027,7 +1055,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *a dnh->dnh_dnode = NULL; } kmem_free(children_dnodes, sizeof (dnode_children_t) + - epb * sizeof (dnode_handle_t)); + children_dnodes->dnc_count * sizeof (dnode_handle_t)); } /* @@ -1117,10 +1145,11 @@ dnode_hold_impl(objset_t *os, uint64_t o dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) { zrl_init(&dnh[i].dnh_zrlock); - dnh[i].dnh_dnode = NULL; } - if (winner = dmu_buf_set_user(&db->db, children_dnodes, - dnode_buf_pageout)) { + dmu_buf_init_user(&children_dnodes->dnc_dbu, + dnode_buf_pageout, NULL); + winner = dmu_buf_set_user(&db->db, &children_dnodes->dnc_dbu); + if (winner != NULL) { for (i = 0; i < epb; i++) { zrl_destroy(&dnh[i].dnh_zrlock); @@ -1135,17 +1164,11 @@ dnode_hold_impl(objset_t *os, uint64_t o dnh = &children_dnodes->dnc_children[idx]; zrl_add(&dnh->dnh_zrlock); - if ((dn = dnh->dnh_dnode) == NULL) { + dn = dnh->dnh_dnode; + if (dn == NULL) { dnode_phys_t *phys = (dnode_phys_t *)db->db.db_data+idx; - dnode_t *winner; dn = dnode_create(os, phys, db, object, dnh); - winner = atomic_cas_ptr(&dnh->dnh_dnode, NULL, dn); - if (winner != NULL) { - zrl_add(&dnh->dnh_zrlock); - dnode_destroy(dn); /* implicit zrl_remove() */ - dn = winner; - } } mutex_enter(&dn->dn_mtx); @@ -1159,10 +1182,10 @@ dnode_hold_impl(objset_t *os, uint64_t o dbuf_rele(db, FTAG); return (type == DMU_OT_NONE ? ENOENT : EEXIST); } - mutex_exit(&dn->dn_mtx); - if (refcount_add(&dn->dn_holds, tag) == 1) dbuf_add_ref(db, dnh); + mutex_exit(&dn->dn_mtx); + /* Now we can rely on the hold to prevent the dnode from moving. */ zrl_remove(&dnh->dnh_zrlock); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Sat Oct 3 07:29:56 2015 (r288549) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ #include @@ -397,49 +398,37 @@ dnode_sync_free_range(void *arg, uint64_ void dnode_evict_dbufs(dnode_t *dn) { - int progress; - int pass = 0; + dmu_buf_impl_t db_marker; + dmu_buf_impl_t *db, *db_next; + + mutex_enter(&dn->dn_dbufs_mtx); + for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { - do { - dmu_buf_impl_t *db, *db_next; - int evicting = FALSE; - - progress = FALSE; - mutex_enter(&dn->dn_dbufs_mtx); - for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { - db_next = AVL_NEXT(&dn->dn_dbufs, db); #ifdef DEBUG - DB_DNODE_ENTER(db); - ASSERT3P(DB_DNODE(db), ==, dn); - DB_DNODE_EXIT(db); + DB_DNODE_ENTER(db); + ASSERT3P(DB_DNODE(db), ==, dn); + DB_DNODE_EXIT(db); #endif /* DEBUG */ - mutex_enter(&db->db_mtx); - if (db->db_state == DB_EVICTING) { - progress = TRUE; - evicting = TRUE; - mutex_exit(&db->db_mtx); - } else if (refcount_is_zero(&db->db_holds)) { - progress = TRUE; - dbuf_clear(db); /* exits db_mtx for us */ - } else { - mutex_exit(&db->db_mtx); - } + mutex_enter(&db->db_mtx); + if (db->db_state != DB_EVICTING && + refcount_is_zero(&db->db_holds)) { + db_marker.db_level = db->db_level; + db_marker.db_blkid = db->db_blkid; + db_marker.db_state = DB_SEARCH; + avl_insert_here(&dn->dn_dbufs, &db_marker, db, + AVL_BEFORE); + + dbuf_clear(db); + db_next = AVL_NEXT(&dn->dn_dbufs, &db_marker); + avl_remove(&dn->dn_dbufs, &db_marker); + } else { + mutex_exit(&db->db_mtx); + db_next = AVL_NEXT(&dn->dn_dbufs, db); } - /* - * NB: we need to drop dn_dbufs_mtx between passes so - * that any DB_EVICTING dbufs can make progress. - * Ideally, we would have some cv we could wait on, but - * since we don't, just wait a bit to give the other - * thread a chance to run. - */ - mutex_exit(&dn->dn_dbufs_mtx); - if (evicting) - delay(1); - pass++; - ASSERT(pass < 100); /* sanity check */ - } while (progress); + } + mutex_exit(&dn->dn_dbufs_mtx); dnode_evict_bonus(dn); } @@ -504,7 +493,6 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *t dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); dnode_evict_dbufs(dn); ASSERT(avl_is_empty(&dn->dn_dbufs)); - ASSERT3P(dn->dn_bonus, ==, NULL); /* * XXX - It would be nice to assert this, but we may still Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c Sat Oct 3 07:29:56 2015 (r288549) @@ -120,7 +120,7 @@ dsl_bookmark_create_check_impl(dsl_datas int error; zfs_bookmark_phys_t bmark_phys; - if (!dsl_dataset_is_snapshot(snapds)) + if (!snapds->ds_is_snapshot) return (SET_ERROR(EINVAL)); error = dsl_bookmark_hold_ds(dp, bookmark_name, Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:28:52 2015 (r288548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 07:29:56 2015 (r288549) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. + * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ #include @@ -77,7 +78,6 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, max_recor #define DS_REF_MAX (1ULL << 62) extern inline dsl_dataset_phys_t *dsl_dataset_phys(dsl_dataset_t *ds); -extern inline boolean_t dsl_dataset_is_snapshot(dsl_dataset_t *ds); /* * Figure out how much of this delta should be propogated to the dsl_dir @@ -161,7 +161,7 @@ dsl_dataset_block_kill(dsl_dataset_t *ds } ASSERT3P(tx->tx_pool, ==, ds->ds_dir->dd_pool); - ASSERT(!dsl_dataset_is_snapshot(ds)); + ASSERT(!ds->ds_is_snapshot); dmu_buf_will_dirty(ds->ds_dbuf, tx); if (bp->blk_birth > dsl_dataset_phys(ds)->ds_prev_snap_txg) { @@ -259,14 +259,15 @@ dsl_dataset_block_freeable(dsl_dataset_t return (B_TRUE); } -/* ARGSUSED */ static void -dsl_dataset_evict(dmu_buf_t *db, void *dsv) +dsl_dataset_evict(void *dbu) { - dsl_dataset_t *ds = dsv; + dsl_dataset_t *ds = dbu; ASSERT(ds->ds_owner == NULL); + ds->ds_dbuf = NULL; + unique_remove(ds->ds_fsid_guid); if (ds->ds_objset != NULL) @@ -278,10 +279,10 @@ dsl_dataset_evict(dmu_buf_t *db, void *d } bplist_destroy(&ds->ds_pending_deadlist); - if (dsl_dataset_phys(ds)->ds_deadlist_obj != 0) + if (ds->ds_deadlist.dl_os != NULL) dsl_deadlist_close(&ds->ds_deadlist); if (ds->ds_dir) - dsl_dir_rele(ds->ds_dir, ds); + dsl_dir_async_rele(ds->ds_dir, ds); ASSERT(!list_link_active(&ds->ds_synced_link)); @@ -417,6 +418,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP); ds->ds_dbuf = dbuf; ds->ds_object = dsobj; + ds->ds_is_snapshot = dsl_dataset_phys(ds)->ds_num_children != 0; mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&ds->ds_opening_lock, NULL, MUTEX_DEFAULT, NULL); @@ -456,7 +458,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin return (err); } - if (!dsl_dataset_is_snapshot(ds)) { + if (!ds->ds_is_snapshot) { ds->ds_snapname[0] = '\0'; if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) { err = dsl_dataset_hold_obj(dp, @@ -483,7 +485,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin } } - if (err == 0 && !dsl_dataset_is_snapshot(ds)) { + if (err == 0 && !ds->ds_is_snapshot) { err = dsl_prop_get_int_ds(ds, zfs_prop_to_name(ZFS_PROP_REFRESERVATION), &ds->ds_reserved); @@ -496,8 +498,11 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin ds->ds_reserved = ds->ds_quota = 0; } - if (err != 0 || (winner = dmu_buf_set_user_ie(dbuf, ds, - dsl_dataset_evict)) != NULL) { + dmu_buf_init_user(&ds->ds_dbu, dsl_dataset_evict, &ds->ds_dbuf); + if (err == 0) + winner = dmu_buf_set_user_ie(dbuf, &ds->ds_dbu); + + if (err != 0 || winner != NULL) { bplist_destroy(&ds->ds_pending_deadlist); dsl_deadlist_close(&ds->ds_deadlist); if (ds->ds_prev) @@ -919,7 +924,7 @@ dsl_dataset_recalc_head_uniq(dsl_dataset uint64_t mrs_used; uint64_t dlused, dlcomp, dluncomp; - ASSERT(!dsl_dataset_is_snapshot(ds)); + ASSERT(!ds->ds_is_snapshot); if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) mrs_used = dsl_dataset_phys(ds->ds_prev)->ds_referenced_bytes; @@ -1675,7 +1680,7 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED, dsl_dataset_phys(ds)->ds_uncompressed_bytes); - if (dsl_dataset_is_snapshot(ds)) { + if (ds->ds_is_snapshot) { dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio); dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED, dsl_dataset_phys(ds)->ds_unique_bytes); @@ -1743,7 +1748,7 @@ dsl_dataset_fast_stat(dsl_dataset_t *ds, dsl_dataset_phys(ds)->ds_flags & DS_FLAG_INCONSISTENT; stat->dds_guid = dsl_dataset_phys(ds)->ds_guid; stat->dds_origin[0] = '\0'; - if (dsl_dataset_is_snapshot(ds)) { + if (ds->ds_is_snapshot) { stat->dds_is_snapshot = B_TRUE; stat->dds_num_clones = dsl_dataset_phys(ds)->ds_num_children - 1; @@ -2023,7 +2028,7 @@ dsl_dataset_rollback_check(void *arg, dm return (error); /* must not be a snapshot */ - if (dsl_dataset_is_snapshot(ds)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 07:30:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CADB3A0E610; Sat, 3 Oct 2015 07:30:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59AB7156D; Sat, 3 Oct 2015 07:30:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t937UeHP097642 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 3 Oct 2015 10:30:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t937UeHP097642 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t937UeT0097641; Sat, 3 Oct 2015 10:30:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Oct 2015 10:30:40 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, gjb@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151003073040.GE11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> <1443803276.66572.72.camel@freebsd.org> <20151003070256.GD11284@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151003070256.GD11284@kib.kiev.ua> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:30:47 -0000 On Sat, Oct 03, 2015 at 10:02:56AM +0300, Konstantin Belousov wrote: > On Fri, Oct 02, 2015 at 10:27:56AM -0600, Ian Lepore wrote: > > On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > > > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > > > Some arm documentation refers to the need for "support code" when the > > > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > > > be just the RPi I think). Do we have that support code? What happens > > > > if it's missing? I can't actually find any info on exactly what that > > > > support code is supposed to do. For all I know, we have the required > > > > code in libm. Or maybe what's needed is exception-handling code in the > > > > kernel. I can't find any info on what they mean by "support code" in > > > > this context. > > > The fpscr register is user-modifiable, so whatever happens after the > > > change, could as well happen before it. > > > > > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > > > Flush-to-zero. But I was sure that the text refers to the modes when > > > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > > > fault handler must do something to allow the computation to proceed. > > > > > > > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > > > looked in a few of the TRMs for different cortex-a series processors and > > > > they say the hardware handles all combinations of rounding and flush to > > > > zero without support software. But we should probably be on the lookout > > > > for reports of misbehaving apps on RPi after this change, just in case > > > > this setting has been protecting us from our ignorance there. > > > > > > I did found the reference to the support code in the VFP11 TRM, which in > > > turns point to > > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > > > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > > > indeed I would need to not enable FZ on the affected hardware. > > > > > > > That link opened a reference to a cortex-a57 chip for me. I've had > > problems trying to share links to arm's documentation site, something > > about the way that navbar stuff works makes pasting links not-work. > I tried to reference > App Notes and tutorials -> All Application Notes -> AN098 - VFP > Support Code > > > > > We support one arm11/VFPv2 chipset, the one used on RPi. It's the only > > actual armv6 chip we support, all the other stuff supported by the arch > > we call armv6 is really armv7. The TRM for the arm1176JZF-S core used > > on RPi is the one that mentions needing support code. > > Yes, testing on original RPi, done by Glen, demostrates it. The test > program I used is at > https://www.kib.kiev.ua/kib/perl_opbasic_arith_175.c > https://www.kib.kiev.ua/kib/perl_opbasic_arith_175 is the compiled binary > with -mfloat-abi=softfp > > Also the following untested on RPi patch should fix this. I verified > that it still starts with FZ bit cleared, on VFP v3 (RPi 2): > https://www.kib.kiev.ua/kib/rpi-fz.1.patch Use https://www.kib.kiev.ua/kib/rpi-fz.2.patch instead, VFP v3 might also declare that denormals are not supported in hw, apparently. From owner-svn-src-all@freebsd.org Sat Oct 3 07:30:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B41ACA0E65D; Sat, 3 Oct 2015 07:30:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4BFF18B2; Sat, 3 Oct 2015 07:30:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937Uu4k067445; Sat, 3 Oct 2015 07:30:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937UunL067444; Sat, 3 Oct 2015 07:30:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030730.t937UunL067444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:30:56 +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: r288550 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:30:56 -0000 Author: mav Date: Sat Oct 3 07:30:55 2015 New Revision: 288550 URL: https://svnweb.freebsd.org/changeset/base/288550 Log: MFC r286576: Fix r286570 build with debug. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:29:56 2015 (r288549) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:30:55 2015 (r288550) @@ -1861,8 +1861,10 @@ arc_change_state(arc_state_t *new_state, * L2 headers should never be on the L2 state list since they don't * have L1 headers allocated. */ +#ifdef illumos ASSERT(list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); +#endif } void From owner-svn-src-all@freebsd.org Sat Oct 3 07:31:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBC1A0E813; Sat, 3 Oct 2015 07:31:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E7F01A90; Sat, 3 Oct 2015 07:31:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937Vhl0067588; Sat, 3 Oct 2015 07:31:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937Vhno067587; Sat, 3 Oct 2015 07:31:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030731.t937Vhno067587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288551 - stable/10/sys/cddl/compat/opensolaris/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:31:43 -0000 Author: mav Date: Sat Oct 3 07:31:42 2015 New Revision: 288551 URL: https://svnweb.freebsd.org/changeset/base/288551 Log: MFC r286578: Fix r286574 build in user-space. Modified: stable/10/sys/cddl/compat/opensolaris/sys/kstat.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/kstat.h Sat Oct 3 07:30:55 2015 (r288550) +++ stable/10/sys/cddl/compat/opensolaris/sys/kstat.h Sat Oct 3 07:31:42 2015 (r288551) @@ -44,9 +44,9 @@ typedef struct kstat { #ifdef _KERNEL struct sysctl_ctx_list ks_sysctl_ctx; struct sysctl_oid *ks_sysctl_root; +#endif int (*ks_update)(struct kstat *, int); /* dynamic update */ void *ks_private; /* arbitrary provider-private data */ -#endif } kstat_t; typedef struct kstat_named { From owner-svn-src-all@freebsd.org Sat Oct 3 07:32:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 240EEA0E8EA; Sat, 3 Oct 2015 07:32:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0864A1C3C; Sat, 3 Oct 2015 07:32:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937WZ8W067742; Sat, 3 Oct 2015 07:32:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937WZ5G067738; Sat, 3 Oct 2015 07:32:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030732.t937WZ5G067738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288552 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:32:36 -0000 Author: mav Date: Sat Oct 3 07:32:34 2015 New Revision: 288552 URL: https://svnweb.freebsd.org/changeset/base/288552 Log: MFC r286579: 5313 Allow I/Os to be aggregated across ZIO priority classes Reviewed by: Andriy Gapon Reviewed by: Will Andrews Reviewed by: Matt Ahrens Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Justin T. Gibbs illumos/illumos-gate@fe319232d24f4ae183730a5a24a09423d8ab4429 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sat Oct 3 07:31:42 2015 (r288551) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sat Oct 3 07:32:34 2015 (r288552) @@ -113,6 +113,8 @@ struct vdev_queue { vdev_t *vq_vdev; vdev_queue_class_t vq_class[ZIO_PRIORITY_NUM_QUEUEABLE]; avl_tree_t vq_active_tree; + avl_tree_t vq_read_offset_tree; + avl_tree_t vq_write_offset_tree; uint64_t vq_last_offset; hrtime_t vq_io_complete_ts; /* time last i/o completed */ kmutex_t vq_lock; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:31:42 2015 (r288551) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:32:34 2015 (r288552) @@ -461,6 +461,7 @@ struct zio { uint64_t io_offset; hrtime_t io_timestamp; avl_node_t io_queue_node; + avl_node_t io_offset_node; /* Internal pipeline state */ enum zio_flag io_flags; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Oct 3 07:31:42 2015 (r288551) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Oct 3 07:32:34 2015 (r288552) @@ -302,6 +302,22 @@ vdev_queue_offset_compare(const void *x1 return (0); } +static inline avl_tree_t * +vdev_queue_class_tree(vdev_queue_t *vq, zio_priority_t p) +{ + return (&vq->vq_class[p].vqc_queued_tree); +} + +static inline avl_tree_t * +vdev_queue_type_tree(vdev_queue_t *vq, zio_type_t t) +{ + ASSERT(t == ZIO_TYPE_READ || t == ZIO_TYPE_WRITE); + if (t == ZIO_TYPE_READ) + return (&vq->vq_read_offset_tree); + else + return (&vq->vq_write_offset_tree); +} + int vdev_queue_timestamp_compare(const void *x1, const void *x2) { @@ -336,19 +352,27 @@ vdev_queue_init(vdev_t *vd) avl_create(&vq->vq_active_tree, vdev_queue_offset_compare, sizeof (zio_t), offsetof(struct zio, io_queue_node)); + avl_create(vdev_queue_type_tree(vq, ZIO_TYPE_READ), + vdev_queue_offset_compare, sizeof (zio_t), + offsetof(struct zio, io_offset_node)); + avl_create(vdev_queue_type_tree(vq, ZIO_TYPE_WRITE), + vdev_queue_offset_compare, sizeof (zio_t), + offsetof(struct zio, io_offset_node)); for (zio_priority_t p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) { + int (*compfn) (const void *, const void *); + /* - * The synchronous i/o queues are FIFO rather than LBA ordered. - * This provides more consistent latency for these i/os, and - * they tend to not be tightly clustered anyway so there is - * little to no throughput loss. + * The synchronous i/o queues are dispatched in FIFO rather + * than LBA order. This provides more consistent latency for + * these i/os. */ - boolean_t fifo = (p == ZIO_PRIORITY_SYNC_READ || - p == ZIO_PRIORITY_SYNC_WRITE); - avl_create(&vq->vq_class[p].vqc_queued_tree, - fifo ? vdev_queue_timestamp_compare : - vdev_queue_offset_compare, + if (p == ZIO_PRIORITY_SYNC_READ || p == ZIO_PRIORITY_SYNC_WRITE) + compfn = vdev_queue_timestamp_compare; + else + compfn = vdev_queue_offset_compare; + + avl_create(vdev_queue_class_tree(vq, p), compfn, sizeof (zio_t), offsetof(struct zio, io_queue_node)); } @@ -361,8 +385,10 @@ vdev_queue_fini(vdev_t *vd) vdev_queue_t *vq = &vd->vdev_queue; for (zio_priority_t p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) - avl_destroy(&vq->vq_class[p].vqc_queued_tree); + avl_destroy(vdev_queue_class_tree(vq, p)); avl_destroy(&vq->vq_active_tree); + avl_destroy(vdev_queue_type_tree(vq, ZIO_TYPE_READ)); + avl_destroy(vdev_queue_type_tree(vq, ZIO_TYPE_WRITE)); mutex_destroy(&vq->vq_lock); } @@ -373,7 +399,8 @@ vdev_queue_io_add(vdev_queue_t *vq, zio_ spa_t *spa = zio->io_spa; ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); - avl_add(&vq->vq_class[zio->io_priority].vqc_queued_tree, zio); + avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio); + avl_add(vdev_queue_type_tree(vq, zio->io_type), zio); #ifdef illumos mutex_enter(&spa->spa_iokstat_lock); @@ -390,7 +417,8 @@ vdev_queue_io_remove(vdev_queue_t *vq, z spa_t *spa = zio->io_spa; ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); - avl_remove(&vq->vq_class[zio->io_priority].vqc_queued_tree, zio); + avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio); + avl_remove(vdev_queue_type_tree(vq, zio->io_type), zio); #ifdef illumos mutex_enter(&spa->spa_iokstat_lock); @@ -563,7 +591,7 @@ vdev_queue_class_to_issue(vdev_queue_t * /* find a queue that has not reached its minimum # outstanding i/os */ for (p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) { - if (avl_numnodes(&vq->vq_class[p].vqc_queued_tree) > 0 && + if (avl_numnodes(vdev_queue_class_tree(vq, p)) > 0 && vq->vq_class[p].vqc_active < vdev_queue_class_min_active(p)) return (p); @@ -574,7 +602,7 @@ vdev_queue_class_to_issue(vdev_queue_t * * maximum # outstanding i/os. */ for (p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) { - if (avl_numnodes(&vq->vq_class[p].vqc_queued_tree) > 0 && + if (avl_numnodes(vdev_queue_class_tree(vq, p)) > 0 && vq->vq_class[p].vqc_active < vdev_queue_class_max_active(spa, p)) return (p); @@ -642,7 +670,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, z * recording the last non-option I/O. */ flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT; - t = &vq->vq_class[zio->io_priority].vqc_queued_tree; + t = vdev_queue_type_tree(vq, zio->io_type); while ((dio = AVL_PREV(t, first)) != NULL && (dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags && IO_SPAN(dio, last) <= zfs_vdev_aggregation_limit && @@ -751,7 +779,7 @@ vdev_queue_io_to_issue(vdev_queue_t *vq) zio_t *zio, *aio; zio_priority_t p; avl_index_t idx; - vdev_queue_class_t *vqc; + avl_tree_t *tree; zio_t search; again: @@ -770,13 +798,13 @@ again: * * For FIFO queues (sync), issue the i/o with the lowest timestamp. */ - vqc = &vq->vq_class[p]; + tree = vdev_queue_class_tree(vq, p); search.io_timestamp = 0; search.io_offset = vq->vq_last_offset + 1; - VERIFY3P(avl_find(&vqc->vqc_queued_tree, &search, &idx), ==, NULL); - zio = avl_nearest(&vqc->vqc_queued_tree, idx, AVL_AFTER); + VERIFY3P(avl_find(tree, &search, &idx), ==, NULL); + zio = avl_nearest(tree, idx, AVL_AFTER); if (zio == NULL) - zio = avl_first(&vqc->vqc_queued_tree); + zio = avl_first(tree); ASSERT3U(zio->io_priority, ==, p); aio = vdev_queue_aggregate(vq, zio); From owner-svn-src-all@freebsd.org Sat Oct 3 07:33:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A591A0EA21; Sat, 3 Oct 2015 07:33:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC1741E77; Sat, 3 Oct 2015 07:33:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937XS7D068049; Sat, 3 Oct 2015 07:33:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937XSUb068044; Sat, 3 Oct 2015 07:33:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030733.t937XSUb068044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:33:28 +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: r288553 - in stable/10: cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:33:29 -0000 Author: mav Date: Sat Oct 3 07:33:27 2015 New Revision: 288553 URL: https://svnweb.freebsd.org/changeset/base/288553 Log: MFC r286587: 5746 more checksumming in zfs send Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Bayard Bell Approved by: Albert Lee Author: Matthew Ahrens illumos/illumos-gate@98110f08fa182032082d98be2ddb9391fcd62bf1 Modified: stable/10/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Sat Oct 3 07:32:34 2015 (r288552) +++ stable/10/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Sat Oct 3 07:33:27 2015 (r288553) @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -83,7 +84,6 @@ safe_malloc(size_t size) * * Read while computing incremental checksum */ - static size_t ssread(void *buf, size_t len, zio_cksum_t *cksum) { @@ -92,7 +92,7 @@ ssread(void *buf, size_t len, zio_cksum_ if ((outlen = fread(buf, len, 1, send_stream)) == 0) return (0); - if (do_cksum && cksum) { + if (do_cksum) { if (do_byteswap) fletcher_4_incremental_byteswap(buf, len, cksum); else @@ -102,6 +102,34 @@ ssread(void *buf, size_t len, zio_cksum_ return (outlen); } +static size_t +read_hdr(dmu_replay_record_t *drr, zio_cksum_t *cksum) +{ + ASSERT3U(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), + ==, sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t)); + size_t r = ssread(drr, sizeof (*drr) - sizeof (zio_cksum_t), cksum); + if (r == 0) + return (0); + zio_cksum_t saved_cksum = *cksum; + r = ssread(&drr->drr_u.drr_checksum.drr_checksum, + sizeof (zio_cksum_t), cksum); + if (r == 0) + return (0); + if (!ZIO_CHECKSUM_IS_ZERO(&drr->drr_u.drr_checksum.drr_checksum) && + !ZIO_CHECKSUM_EQUAL(saved_cksum, + drr->drr_u.drr_checksum.drr_checksum)) { + fprintf(stderr, "invalid checksum\n"); + (void) printf("Incorrect checksum in record header.\n"); + (void) printf("Expected checksum = %llx/%llx/%llx/%llx\n", + saved_cksum.zc_word[0], + saved_cksum.zc_word[1], + saved_cksum.zc_word[2], + saved_cksum.zc_word[3]); + exit(1); + } + return (sizeof (*drr)); +} + /* * Print part of a block in ASCII characters */ @@ -183,8 +211,10 @@ main(int argc, char *argv[]) struct drr_free *drrf = &thedrr.drr_u.drr_free; struct drr_spill *drrs = &thedrr.drr_u.drr_spill; struct drr_write_embedded *drrwe = &thedrr.drr_u.drr_write_embedded; + struct drr_checksum *drrc = &thedrr.drr_u.drr_checksum; char c; boolean_t verbose = B_FALSE; + boolean_t very_verbose = B_FALSE; boolean_t first = B_TRUE; /* * dump flag controls whether the contents of any modified data blocks @@ -202,11 +232,14 @@ main(int argc, char *argv[]) do_cksum = B_FALSE; break; case 'v': + if (verbose) + very_verbose = B_TRUE; verbose = B_TRUE; break; case 'd': dump = B_TRUE; verbose = B_TRUE; + very_verbose = B_TRUE; break; case ':': (void) fprintf(stderr, @@ -230,7 +263,7 @@ main(int argc, char *argv[]) send_stream = stdin; pcksum = zc; - while (ssread(drr, sizeof (dmu_replay_record_t), &zc)) { + while (read_hdr(drr, &zc)) { /* * If this is the first DMU record being processed, check for @@ -432,7 +465,7 @@ main(int argc, char *argv[]) if (verbose) { (void) printf("WRITE object = %llu type = %u " "checksum type = %u\n" - "offset = %llu length = %llu " + " offset = %llu length = %llu " "props = %llx\n", (u_longlong_t)drrw->drr_object, drrw->drr_type, @@ -476,9 +509,9 @@ main(int argc, char *argv[]) if (verbose) { (void) printf("WRITE_BYREF object = %llu " "checksum type = %u props = %llx\n" - "offset = %llu length = %llu\n" + " offset = %llu length = %llu\n" "toguid = %llx refguid = %llx\n" - "refobject = %llu refoffset = %llu\n", + " refobject = %llu refoffset = %llu\n", (u_longlong_t)drrwbr->drr_object, drrwbr->drr_checksumtype, (u_longlong_t)drrwbr->drr_key.ddk_prop, @@ -538,7 +571,7 @@ main(int argc, char *argv[]) if (verbose) { (void) printf("WRITE_EMBEDDED object = %llu " "offset = %llu length = %llu\n" - "toguid = %llx comp = %u etype = %u " + " toguid = %llx comp = %u etype = %u " "lsize = %u psize = %u\n", (u_longlong_t)drrwe->drr_object, (u_longlong_t)drrwe->drr_offset, @@ -553,6 +586,13 @@ main(int argc, char *argv[]) P2ROUNDUP(drrwe->drr_psize, 8), &zc); break; } + if (drr->drr_type != DRR_BEGIN && very_verbose) { + (void) printf(" checksum = %llx/%llx/%llx/%llx\n", + (longlong_t)drrc->drr_checksum.zc_word[0], + (longlong_t)drrc->drr_checksum.zc_word[1], + (longlong_t)drrc->drr_checksum.zc_word[2], + (longlong_t)drrc->drr_checksum.zc_word[3]); + } pcksum = zc; } free(buf); Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 3 07:32:34 2015 (r288552) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 3 07:33:27 2015 (r288553) @@ -188,10 +188,28 @@ ddt_update(libzfs_handle_t *hdl, dedup_t } static int -cksum_and_write(const void *buf, uint64_t len, zio_cksum_t *zc, int outfd) +dump_record(dmu_replay_record_t *drr, void *payload, int payload_len, + zio_cksum_t *zc, int outfd) { - fletcher_4_incremental_native(buf, len, zc); - return (write(outfd, buf, len)); + ASSERT3U(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), + ==, sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t)); + fletcher_4_incremental_native(drr, + offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), zc); + if (drr->drr_type != DRR_BEGIN) { + ASSERT(ZIO_CHECKSUM_IS_ZERO(&drr->drr_u. + drr_checksum.drr_checksum)); + drr->drr_u.drr_checksum.drr_checksum = *zc; + } + fletcher_4_incremental_native(&drr->drr_u.drr_checksum.drr_checksum, + sizeof (zio_cksum_t), zc); + if (write(outfd, drr, sizeof (*drr)) == -1) + return (errno); + if (payload_len != 0) { + fletcher_4_incremental_native(payload, payload_len, zc); + if (write(outfd, payload, payload_len) == -1) + return (errno); + } + return (0); } /* @@ -218,26 +236,18 @@ cksummer(void *arg) char *buf = zfs_alloc(dda->dedup_hdl, SPA_MAXBLOCKSIZE); dmu_replay_record_t thedrr; dmu_replay_record_t *drr = &thedrr; - struct drr_begin *drrb = &thedrr.drr_u.drr_begin; - struct drr_end *drre = &thedrr.drr_u.drr_end; - struct drr_object *drro = &thedrr.drr_u.drr_object; - struct drr_write *drrw = &thedrr.drr_u.drr_write; - struct drr_spill *drrs = &thedrr.drr_u.drr_spill; - struct drr_write_embedded *drrwe = &thedrr.drr_u.drr_write_embedded; FILE *ofp; int outfd; - dmu_replay_record_t wbr_drr = {0}; - struct drr_write_byref *wbr_drrr = &wbr_drr.drr_u.drr_write_byref; dedup_table_t ddt; zio_cksum_t stream_cksum; uint64_t physmem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE); uint64_t numbuckets; ddt.max_ddt_size = - MAX((physmem * MAX_DDT_PHYSMEM_PERCENT)/100, - SMALLEST_POSSIBLE_MAX_DDT_MB<<20); + MAX((physmem * MAX_DDT_PHYSMEM_PERCENT) / 100, + SMALLEST_POSSIBLE_MAX_DDT_MB << 20); - numbuckets = ddt.max_ddt_size/(sizeof (dedup_entry_t)); + numbuckets = ddt.max_ddt_size / (sizeof (dedup_entry_t)); /* * numbuckets must be a power of 2. Increase number to @@ -253,32 +263,29 @@ cksummer(void *arg) ddt.numhashbits = high_order_bit(numbuckets) - 1; ddt.ddt_full = B_FALSE; - /* Initialize the write-by-reference block. */ - wbr_drr.drr_type = DRR_WRITE_BYREF; - wbr_drr.drr_payloadlen = 0; - outfd = dda->outputfd; ofp = fdopen(dda->inputfd, "r"); - while (ssread(drr, sizeof (dmu_replay_record_t), ofp) != 0) { + while (ssread(drr, sizeof (*drr), ofp) != 0) { switch (drr->drr_type) { case DRR_BEGIN: { - int fflags; + struct drr_begin *drrb = &drr->drr_u.drr_begin; + int fflags; + int sz = 0; ZIO_SET_CHECKSUM(&stream_cksum, 0, 0, 0, 0); + ASSERT3U(drrb->drr_magic, ==, DMU_BACKUP_MAGIC); + /* set the DEDUP feature flag for this stream */ fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); fflags |= (DMU_BACKUP_FEATURE_DEDUP | DMU_BACKUP_FEATURE_DEDUPPROPS); DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags); - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) - goto out; if (DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_COMPOUNDSTREAM && drr->drr_payloadlen != 0) { - int sz = drr->drr_payloadlen; + sz = drr->drr_payloadlen; if (sz > SPA_MAXBLOCKSIZE) { buf = zfs_realloc(dda->dedup_hdl, buf, @@ -287,64 +294,60 @@ cksummer(void *arg) (void) ssread(buf, sz, ofp); if (ferror(stdin)) perror("fread"); - if (cksum_and_write(buf, sz, &stream_cksum, - outfd) == -1) - goto out; } + if (dump_record(drr, buf, sz, &stream_cksum, + outfd) != 0) + goto out; break; } case DRR_END: { + struct drr_end *drre = &drr->drr_u.drr_end; /* use the recalculated checksum */ - ZIO_SET_CHECKSUM(&drre->drr_checksum, - stream_cksum.zc_word[0], stream_cksum.zc_word[1], - stream_cksum.zc_word[2], stream_cksum.zc_word[3]); - if ((write(outfd, drr, - sizeof (dmu_replay_record_t))) == -1) + drre->drr_checksum = stream_cksum; + if (dump_record(drr, NULL, 0, &stream_cksum, + outfd) != 0) goto out; break; } case DRR_OBJECT: { - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) - goto out; + struct drr_object *drro = &drr->drr_u.drr_object; if (drro->drr_bonuslen > 0) { (void) ssread(buf, P2ROUNDUP((uint64_t)drro->drr_bonuslen, 8), ofp); - if (cksum_and_write(buf, - P2ROUNDUP((uint64_t)drro->drr_bonuslen, 8), - &stream_cksum, outfd) == -1) - goto out; } + if (dump_record(drr, buf, + P2ROUNDUP((uint64_t)drro->drr_bonuslen, 8), + &stream_cksum, outfd) != 0) + goto out; break; } case DRR_SPILL: { - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) - goto out; + struct drr_spill *drrs = &drr->drr_u.drr_spill; (void) ssread(buf, drrs->drr_length, ofp); - if (cksum_and_write(buf, drrs->drr_length, - &stream_cksum, outfd) == -1) + if (dump_record(drr, buf, drrs->drr_length, + &stream_cksum, outfd) != 0) goto out; break; } case DRR_FREEOBJECTS: { - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) + if (dump_record(drr, NULL, 0, &stream_cksum, + outfd) != 0) goto out; break; } case DRR_WRITE: { + struct drr_write *drrw = &drr->drr_u.drr_write; dataref_t dataref; (void) ssread(buf, drrw->drr_length, ofp); @@ -382,7 +385,13 @@ cksummer(void *arg) if (ddt_update(dda->dedup_hdl, &ddt, &drrw->drr_key.ddk_cksum, drrw->drr_key.ddk_prop, &dataref)) { + dmu_replay_record_t wbr_drr = {0}; + struct drr_write_byref *wbr_drrr = + &wbr_drr.drr_u.drr_write_byref; + /* block already present in stream */ + wbr_drr.drr_type = DRR_WRITE_BYREF; + wbr_drrr->drr_object = drrw->drr_object; wbr_drrr->drr_offset = drrw->drr_offset; wbr_drrr->drr_length = drrw->drr_length; @@ -402,19 +411,13 @@ cksummer(void *arg) wbr_drrr->drr_key.ddk_prop = drrw->drr_key.ddk_prop; - if (cksum_and_write(&wbr_drr, - sizeof (dmu_replay_record_t), &stream_cksum, - outfd) == -1) + if (dump_record(&wbr_drr, NULL, 0, + &stream_cksum, outfd) != 0) goto out; } else { /* block not previously seen */ - if (cksum_and_write(drr, - sizeof (dmu_replay_record_t), &stream_cksum, - outfd) == -1) - goto out; - if (cksum_and_write(buf, - drrw->drr_length, - &stream_cksum, outfd) == -1) + if (dump_record(drr, buf, drrw->drr_length, + &stream_cksum, outfd) != 0) goto out; } break; @@ -422,28 +425,27 @@ cksummer(void *arg) case DRR_WRITE_EMBEDDED: { - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) - goto out; + struct drr_write_embedded *drrwe = + &drr->drr_u.drr_write_embedded; (void) ssread(buf, P2ROUNDUP((uint64_t)drrwe->drr_psize, 8), ofp); - if (cksum_and_write(buf, + if (dump_record(drr, buf, P2ROUNDUP((uint64_t)drrwe->drr_psize, 8), - &stream_cksum, outfd) == -1) + &stream_cksum, outfd) != 0) goto out; break; } case DRR_FREE: { - if (cksum_and_write(drr, sizeof (dmu_replay_record_t), - &stream_cksum, outfd) == -1) + if (dump_record(drr, NULL, 0, &stream_cksum, + outfd) != 0) goto out; break; } default: - (void) printf("INVALID record type 0x%x\n", + (void) fprintf(stderr, "INVALID record type 0x%x\n", drr->drr_type); /* should never happen, so assert */ assert(B_FALSE); @@ -1470,18 +1472,11 @@ zfs_send(zfs_handle_t *zhp, const char * sizeof (drr.drr_u.drr_begin.drr_toname), "%s@%s", zhp->zfs_name, tosnap); drr.drr_payloadlen = buflen; - err = cksum_and_write(&drr, sizeof (drr), &zc, outfd); - /* write header nvlist */ - if (err != -1 && packbuf != NULL) { - err = cksum_and_write(packbuf, buflen, &zc, - outfd); - } + err = dump_record(&drr, packbuf, buflen, &zc, outfd); free(packbuf); - if (err == -1) { - err = errno; + if (err != 0) goto stderr_out; - } /* write end record */ bzero(&drr, sizeof (drr)); @@ -1714,6 +1709,8 @@ recv_read(libzfs_handle_t *hdl, int fd, int rv; int len = ilen; + assert(ilen <= SPA_MAXBLOCKSIZE); + do { rv = read(fd, cp, len); cp += rv; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:32:34 2015 (r288552) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:33:27 2015 (r288553) @@ -73,7 +73,6 @@ dump_bytes(dmu_sendarg_t *dsp, void *buf struct iovec aiov; ASSERT0(len % 8); - fletcher_4_incremental_native(buf, len, &dsp->dsa_zc); aiov.iov_base = buf; aiov.iov_len = len; auio.uio_iov = &aiov; @@ -99,6 +98,38 @@ dump_bytes(dmu_sendarg_t *dsp, void *buf return (dsp->dsa_err); } +/* + * For all record types except BEGIN, fill in the checksum (overlaid in + * drr_u.drr_checksum.drr_checksum). The checksum verifies everything + * up to the start of the checksum itself. + */ +static int +dump_record(dmu_sendarg_t *dsp, void *payload, int payload_len) +{ + ASSERT3U(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), + ==, sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t)); + fletcher_4_incremental_native(dsp->dsa_drr, + offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), + &dsp->dsa_zc); + if (dsp->dsa_drr->drr_type != DRR_BEGIN) { + ASSERT(ZIO_CHECKSUM_IS_ZERO(&dsp->dsa_drr->drr_u. + drr_checksum.drr_checksum)); + dsp->dsa_drr->drr_u.drr_checksum.drr_checksum = dsp->dsa_zc; + } + fletcher_4_incremental_native(&dsp->dsa_drr-> + drr_u.drr_checksum.drr_checksum, + sizeof (zio_cksum_t), &dsp->dsa_zc); + if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) + return (SET_ERROR(EINTR)); + if (payload_len != 0) { + fletcher_4_incremental_native(payload, payload_len, + &dsp->dsa_zc); + if (dump_bytes(dsp, payload, payload_len) != 0) + return (SET_ERROR(EINTR)); + } + return (0); +} + static int dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, uint64_t length) @@ -143,8 +174,7 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o */ if (dsp->dsa_pending_op != PENDING_NONE && dsp->dsa_pending_op != PENDING_FREE) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -167,8 +197,7 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o return (0); } else { /* not a continuation. Push out pending record */ - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -181,8 +210,7 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o drrf->drr_length = length; drrf->drr_toguid = dsp->dsa_toguid; if (length == -1ULL) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); } else { dsp->dsa_pending_op = PENDING_FREE; @@ -214,12 +242,11 @@ dump_write(dmu_sendarg_t *dsp, dmu_objec * of different types. */ if (dsp->dsa_pending_op != PENDING_NONE) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } - /* write a DATA record */ + /* write a WRITE record */ bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); dsp->dsa_drr->drr_type = DRR_WRITE; drrw->drr_object = object; @@ -245,9 +272,7 @@ dump_write(dmu_sendarg_t *dsp, dmu_objec drrw->drr_key.ddk_cksum = bp->blk_cksum; } - if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) - return (SET_ERROR(EINTR)); - if (dump_bytes(dsp, data, blksz) != 0) + if (dump_record(dsp, data, blksz) != 0) return (SET_ERROR(EINTR)); return (0); } @@ -261,8 +286,7 @@ dump_write_embedded(dmu_sendarg_t *dsp, &(dsp->dsa_drr->drr_u.drr_write_embedded); if (dsp->dsa_pending_op != PENDING_NONE) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (EINTR); dsp->dsa_pending_op = PENDING_NONE; } @@ -282,9 +306,7 @@ dump_write_embedded(dmu_sendarg_t *dsp, decode_embedded_bp_compressed(bp, buf); - if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) - return (EINTR); - if (dump_bytes(dsp, buf, P2ROUNDUP(drrw->drr_psize, 8)) != 0) + if (dump_record(dsp, buf, P2ROUNDUP(drrw->drr_psize, 8)) != 0) return (EINTR); return (0); } @@ -295,8 +317,7 @@ dump_spill(dmu_sendarg_t *dsp, uint64_t struct drr_spill *drrs = &(dsp->dsa_drr->drr_u.drr_spill); if (dsp->dsa_pending_op != PENDING_NONE) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -308,9 +329,7 @@ dump_spill(dmu_sendarg_t *dsp, uint64_t drrs->drr_length = blksz; drrs->drr_toguid = dsp->dsa_toguid; - if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t))) - return (SET_ERROR(EINTR)); - if (dump_bytes(dsp, data, blksz)) + if (dump_record(dsp, data, blksz) != 0) return (SET_ERROR(EINTR)); return (0); } @@ -333,8 +352,7 @@ dump_freeobjects(dmu_sendarg_t *dsp, uin */ if (dsp->dsa_pending_op != PENDING_NONE && dsp->dsa_pending_op != PENDING_FREEOBJECTS) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -348,8 +366,7 @@ dump_freeobjects(dmu_sendarg_t *dsp, uin return (0); } else { /* can't be aggregated. Push out pending record */ - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -376,8 +393,7 @@ dump_dnode(dmu_sendarg_t *dsp, uint64_t return (dump_freeobjects(dsp, object, 1)); if (dsp->dsa_pending_op != PENDING_NONE) { - if (dump_bytes(dsp, dsp->dsa_drr, - sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) return (SET_ERROR(EINTR)); dsp->dsa_pending_op = PENDING_NONE; } @@ -398,11 +414,10 @@ dump_dnode(dmu_sendarg_t *dsp, uint64_t drro->drr_blksz > SPA_OLD_MAXBLOCKSIZE) drro->drr_blksz = SPA_OLD_MAXBLOCKSIZE; - if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) - return (SET_ERROR(EINTR)); - - if (dump_bytes(dsp, DN_BONUS(dnp), P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0) + if (dump_record(dsp, DN_BONUS(dnp), + P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0) { return (SET_ERROR(EINTR)); + } /* Free anything past the end of the file. */ if (dump_free(dsp, object, (dnp->dn_maxblkid + 1) * @@ -651,7 +666,6 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsp->dsa_os = os; dsp->dsa_off = off; dsp->dsa_toguid = dsl_dataset_phys(ds)->ds_guid; - ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0); dsp->dsa_pending_op = PENDING_NONE; dsp->dsa_incremental = (fromzb != NULL); dsp->dsa_featureflags = featureflags; @@ -663,7 +677,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_long_hold(ds, FTAG); dsl_pool_rele(dp, tag); - if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) { + if (dump_record(dsp, NULL, 0) != 0) { err = dsp->dsa_err; goto out; } @@ -672,7 +686,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, backup_cb, dsp); if (dsp->dsa_pending_op != PENDING_NONE) - if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) + if (dump_record(dsp, NULL, 0) != 0) err = SET_ERROR(EINTR); if (err != 0) { @@ -686,7 +700,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, drr->drr_u.drr_end.drr_checksum = dsp->dsa_zc; drr->drr_u.drr_end.drr_toguid = dsp->dsa_toguid; - if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) { + if (dump_record(dsp, NULL, 0) != 0) { err = dsp->dsa_err; goto out; } @@ -1251,14 +1265,20 @@ dmu_recv_begin(char *tofs, char *tosnap, } struct restorearg { + objset_t *os; int err; boolean_t byteswap; kthread_t *td; struct file *fp; - char *buf; uint64_t voff; int bufsize; /* amount of memory allocated for buf */ + + dmu_replay_record_t *drr; + dmu_replay_record_t *next_drr; + char *buf; zio_cksum_t cksum; + zio_cksum_t prev_cksum; + avl_tree_t *guid_to_ds_map; }; @@ -1323,14 +1343,11 @@ restore_bytes(struct restorearg *ra, voi return (error); } -static void * -restore_read(struct restorearg *ra, int len, char *buf) +static int +restore_read(struct restorearg *ra, int len, void *buf) { int done = 0; - if (buf == NULL) - buf = ra->buf; - /* some things will require 8-byte alignment, so everything must */ ASSERT0(len % 8); ASSERT3U(len, <=, ra->bufsize); @@ -1346,24 +1363,21 @@ restore_read(struct restorearg *ra, int ra->voff += len - done - resid; done = len - resid; if (ra->err != 0) - return (NULL); + return (ra->err); } ASSERT3U(done, ==, len); - if (ra->byteswap) - fletcher_4_incremental_byteswap(buf, len, &ra->cksum); - else - fletcher_4_incremental_native(buf, len, &ra->cksum); - return (buf); + return (0); } static void -backup_byteswap(dmu_replay_record_t *drr) +byteswap_record(dmu_replay_record_t *drr) { #define DO64(X) (drr->drr_u.X = BSWAP_64(drr->drr_u.X)) #define DO32(X) (drr->drr_u.X = BSWAP_32(drr->drr_u.X)) drr->drr_type = BSWAP_32(drr->drr_type); drr->drr_payloadlen = BSWAP_32(drr->drr_payloadlen); + switch (drr->drr_type) { case DRR_BEGIN: DO64(drr_begin.drr_magic); @@ -1393,10 +1407,7 @@ backup_byteswap(dmu_replay_record_t *drr DO64(drr_write.drr_offset); DO64(drr_write.drr_length); DO64(drr_write.drr_toguid); - DO64(drr_write.drr_key.ddk_cksum.zc_word[0]); - DO64(drr_write.drr_key.ddk_cksum.zc_word[1]); - DO64(drr_write.drr_key.ddk_cksum.zc_word[2]); - DO64(drr_write.drr_key.ddk_cksum.zc_word[3]); + ZIO_CHECKSUM_BSWAP(&drr->drr_u.drr_write.drr_key.ddk_cksum); DO64(drr_write.drr_key.ddk_prop); break; case DRR_WRITE_BYREF: @@ -1407,10 +1418,8 @@ backup_byteswap(dmu_replay_record_t *drr DO64(drr_write_byref.drr_refguid); DO64(drr_write_byref.drr_refobject); DO64(drr_write_byref.drr_refoffset); - DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[0]); - DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[1]); - DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[2]); - DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[3]); + ZIO_CHECKSUM_BSWAP(&drr->drr_u.drr_write_byref. + drr_key.ddk_cksum); DO64(drr_write_byref.drr_key.ddk_prop); break; case DRR_WRITE_EMBEDDED: @@ -1433,13 +1442,15 @@ backup_byteswap(dmu_replay_record_t *drr DO64(drr_spill.drr_toguid); break; case DRR_END: - DO64(drr_end.drr_checksum.zc_word[0]); - DO64(drr_end.drr_checksum.zc_word[1]); - DO64(drr_end.drr_checksum.zc_word[2]); - DO64(drr_end.drr_checksum.zc_word[3]); DO64(drr_end.drr_toguid); + ZIO_CHECKSUM_BSWAP(&drr->drr_u.drr_end.drr_checksum); break; } + + if (drr->drr_type != DRR_BEGIN) { + ZIO_CHECKSUM_BSWAP(&drr->drr_u.drr_checksum.drr_checksum); + } + #undef DO64 #undef DO32 } @@ -1456,11 +1467,10 @@ deduce_nblkptr(dmu_object_type_t bonus_t } static int -restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) +restore_object(struct restorearg *ra, struct drr_object *drro, void *data) { dmu_object_info_t doi; dmu_tx_t *tx; - void *data = NULL; uint64_t object; int err; @@ -1471,23 +1481,17 @@ restore_object(struct restorearg *ra, ob drro->drr_compress >= ZIO_COMPRESS_FUNCTIONS || P2PHASE(drro->drr_blksz, SPA_MINBLOCKSIZE) || drro->drr_blksz < SPA_MINBLOCKSIZE || - drro->drr_blksz > spa_maxblocksize(dmu_objset_spa(os)) || + drro->drr_blksz > spa_maxblocksize(dmu_objset_spa(ra->os)) || drro->drr_bonuslen > DN_MAX_BONUSLEN) { return (SET_ERROR(EINVAL)); } - err = dmu_object_info(os, drro->drr_object, &doi); + err = dmu_object_info(ra->os, drro->drr_object, &doi); if (err != 0 && err != ENOENT) return (SET_ERROR(EINVAL)); object = err == 0 ? drro->drr_object : DMU_NEW_OBJECT; - if (drro->drr_bonuslen) { - data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); - if (ra->err != 0) - return (ra->err); - } - /* * If we are losing blkptrs or changing the block size this must * be a new file instance. We must clear out the previous file @@ -1501,14 +1505,14 @@ restore_object(struct restorearg *ra, ob if (drro->drr_blksz != doi.doi_data_block_size || nblkptr < doi.doi_nblkptr) { - err = dmu_free_long_range(os, drro->drr_object, + err = dmu_free_long_range(ra->os, drro->drr_object, 0, DMU_OBJECT_END); if (err != 0) return (SET_ERROR(EINVAL)); } } - tx = dmu_tx_create(os); + tx = dmu_tx_create(ra->os); dmu_tx_hold_bonus(tx, object); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { @@ -1518,7 +1522,7 @@ restore_object(struct restorearg *ra, ob if (object == DMU_NEW_OBJECT) { /* currently free, want to be allocated */ - err = dmu_object_claim(os, drro->drr_object, + err = dmu_object_claim(ra->os, drro->drr_object, drro->drr_type, drro->drr_blksz, drro->drr_bonustype, drro->drr_bonuslen, tx); } else if (drro->drr_type != doi.doi_type || @@ -1526,7 +1530,7 @@ restore_object(struct restorearg *ra, ob drro->drr_bonustype != doi.doi_bonus_type || drro->drr_bonuslen != doi.doi_bonus_size) { /* currently allocated, but with different properties */ - err = dmu_object_reclaim(os, drro->drr_object, + err = dmu_object_reclaim(ra->os, drro->drr_object, drro->drr_type, drro->drr_blksz, drro->drr_bonustype, drro->drr_bonuslen, tx); } @@ -1535,14 +1539,15 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); } - dmu_object_set_checksum(os, drro->drr_object, drro->drr_checksumtype, - tx); - dmu_object_set_compress(os, drro->drr_object, drro->drr_compress, tx); + dmu_object_set_checksum(ra->os, drro->drr_object, + drro->drr_checksumtype, tx); + dmu_object_set_compress(ra->os, drro->drr_object, + drro->drr_compress, tx); if (data != NULL) { dmu_buf_t *db; - VERIFY(0 == dmu_bonus_hold(os, drro->drr_object, FTAG, &db)); + VERIFY0(dmu_bonus_hold(ra->os, drro->drr_object, FTAG, &db)); dmu_buf_will_dirty(db, tx); ASSERT3U(db->db_size, >=, drro->drr_bonuslen); @@ -1561,7 +1566,7 @@ restore_object(struct restorearg *ra, ob /* ARGSUSED */ static int -restore_freeobjects(struct restorearg *ra, objset_t *os, +restore_freeobjects(struct restorearg *ra, struct drr_freeobjects *drrfo) { uint64_t obj; @@ -1571,13 +1576,13 @@ restore_freeobjects(struct restorearg *r for (obj = drrfo->drr_firstobj; obj < drrfo->drr_firstobj + drrfo->drr_numobjs; - (void) dmu_object_next(os, &obj, FALSE, 0)) { + (void) dmu_object_next(ra->os, &obj, FALSE, 0)) { int err; - if (dmu_object_info(os, obj, NULL) != 0) + if (dmu_object_info(ra->os, obj, NULL) != 0) continue; - err = dmu_free_long_object(os, obj); + err = dmu_free_long_object(ra->os, obj); if (err != 0) return (err); } @@ -1585,49 +1590,37 @@ restore_freeobjects(struct restorearg *r } static int -restore_write(struct restorearg *ra, objset_t *os, - struct drr_write *drrw) +restore_write(struct restorearg *ra, struct drr_write *drrw, arc_buf_t *abuf) { dmu_tx_t *tx; - void *data; int err; if (drrw->drr_offset + drrw->drr_length < drrw->drr_offset || !DMU_OT_IS_VALID(drrw->drr_type)) return (SET_ERROR(EINVAL)); - if (dmu_object_info(os, drrw->drr_object, NULL) != 0) + if (dmu_object_info(ra->os, drrw->drr_object, NULL) != 0) return (SET_ERROR(EINVAL)); - dmu_buf_t *bonus; - if (dmu_bonus_hold(os, drrw->drr_object, FTAG, &bonus) != 0) - return (SET_ERROR(EINVAL)); - - arc_buf_t *abuf = dmu_request_arcbuf(bonus, drrw->drr_length); - - data = restore_read(ra, drrw->drr_length, abuf->b_data); - if (data == NULL) { - dmu_return_arcbuf(abuf); - dmu_buf_rele(bonus, FTAG); - return (ra->err); - } - - tx = dmu_tx_create(os); + tx = dmu_tx_create(ra->os); dmu_tx_hold_write(tx, drrw->drr_object, drrw->drr_offset, drrw->drr_length); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { - dmu_return_arcbuf(abuf); - dmu_buf_rele(bonus, FTAG); dmu_tx_abort(tx); return (err); } if (ra->byteswap) { dmu_object_byteswap_t byteswap = DMU_OT_BYTESWAP(drrw->drr_type); - dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); + dmu_ot_byteswap[byteswap].ob_func(abuf->b_data, + drrw->drr_length); } + + dmu_buf_t *bonus; + if (dmu_bonus_hold(ra->os, drrw->drr_object, FTAG, &bonus) != 0) + return (SET_ERROR(EINVAL)); dmu_assign_arcbuf(bonus, drrw->drr_offset, abuf, tx); dmu_tx_commit(tx); dmu_buf_rele(bonus, FTAG); @@ -1642,8 +1635,7 @@ restore_write(struct restorearg *ra, obj * data from the stream to fulfill this write. */ static int -restore_write_byref(struct restorearg *ra, objset_t *os, - struct drr_write_byref *drrwbr) +restore_write_byref(struct restorearg *ra, struct drr_write_byref *drrwbr) { dmu_tx_t *tx; int err; @@ -1669,7 +1661,7 @@ restore_write_byref(struct restorearg *r if (dmu_objset_from_ds(gmep->gme_ds, &ref_os)) return (SET_ERROR(EINVAL)); } else { - ref_os = os; + ref_os = ra->os; } err = dmu_buf_hold(ref_os, drrwbr->drr_refobject, @@ -1677,7 +1669,7 @@ restore_write_byref(struct restorearg *r if (err != 0) return (err); - tx = dmu_tx_create(os); + tx = dmu_tx_create(ra->os); dmu_tx_hold_write(tx, drrwbr->drr_object, drrwbr->drr_offset, drrwbr->drr_length); @@ -1686,7 +1678,7 @@ restore_write_byref(struct restorearg *r dmu_tx_abort(tx); return (err); } - dmu_write(os, drrwbr->drr_object, + dmu_write(ra->os, drrwbr->drr_object, drrwbr->drr_offset, drrwbr->drr_length, dbp->db_data, tx); dmu_buf_rele(dbp, FTAG); dmu_tx_commit(tx); @@ -1694,12 +1686,11 @@ restore_write_byref(struct restorearg *r } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 07:34:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9CD8A0EACA; Sat, 3 Oct 2015 07:34:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FB661FDD; Sat, 3 Oct 2015 07:34:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937YMP0068203; Sat, 3 Oct 2015 07:34:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937YMlT068202; Sat, 3 Oct 2015 07:34:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030734.t937YMlT068202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:34:22 +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: r288554 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:34:22 -0000 Author: mav Date: Sat Oct 3 07:34:21 2015 New Revision: 288554 URL: https://svnweb.freebsd.org/changeset/base/288554 Log: MFC r286589: 5820 verify failed in zio_done(): BP_EQUAL(bp, io_bp_orig) Reviewed by: Alex Reece Reviewed by: George Wilson Reviewed by: Steven Hartland Approved by: Garrett D'Amore Author: Matthew Ahrens illumod/illumos-gate@34e8acef009195effafdcf6417aec385e241796e Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:33:27 2015 (r288553) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:34:21 2015 (r288554) @@ -1653,19 +1653,32 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg); /* - * Assume the on-disk data is X, the current syncing data is Y, - * and the current in-memory data is Z (currently in dmu_sync). - * X and Z are identical but Y is has been modified. Normally, - * when X and Z are the same we will perform a nopwrite but if Y - * is different we must disable nopwrite since the resulting write - * of Y to disk can free the block containing X. If we allowed a - * nopwrite to occur the block pointing to Z would reference a freed - * block. Since this is a rare case we simplify this by disabling - * nopwrite if the current dmu_sync-ing dbuf has been modified in - * a previous transaction. + * Assume the on-disk data is X, the current syncing data (in + * txg - 1) is Y, and the current in-memory data is Z (currently + * in dmu_sync). + * + * We usually want to perform a nopwrite if X and Z are the + * same. However, if Y is different (i.e. the BP is going to + * change before this write takes effect), then a nopwrite will + * be incorrect - we would override with X, which could have + * been freed when Y was written. + * + * (Note that this is not a concern when we are nop-writing from + * syncing context, because X and Y must be identical, because + * all previous txgs have been synced.) + * + * Therefore, we disable nopwrite if the current BP could change + * before this TXG. There are two ways it could change: by + * being dirty (dr_next is non-NULL), or by being freed + * (dnode_block_freed()). This behavior is verified by + * zio_done(), which VERIFYs that the override BP is identical + * to the on-disk BP. */ - if (dr->dr_next) + DB_DNODE_ENTER(db); + dn = DB_DNODE(db); + if (dr->dr_next != NULL || dnode_block_freed(dn, db->db_blkid)) zp.zp_nopwrite = B_FALSE; + DB_DNODE_EXIT(db); ASSERT(dr->dr_txg == txg); if (dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC || From owner-svn-src-all@freebsd.org Sat Oct 3 07:35:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98C42A0EB79; Sat, 3 Oct 2015 07:35:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2AD1131; Sat, 3 Oct 2015 07:35:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937ZCE3068358; Sat, 3 Oct 2015 07:35:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937ZCRK068357; Sat, 3 Oct 2015 07:35:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030735.t937ZCRK068357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:35:12 +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: r288555 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:35:12 -0000 Author: mav Date: Sat Oct 3 07:35:11 2015 New Revision: 288555 URL: https://svnweb.freebsd.org/changeset/base/288555 Log: MFC r286593: Local addition and mismerge fix for r286579. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Oct 3 07:34:21 2015 (r288554) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Oct 3 07:35:11 2015 (r288555) @@ -311,11 +311,12 @@ vdev_queue_class_tree(vdev_queue_t *vq, static inline avl_tree_t * vdev_queue_type_tree(vdev_queue_t *vq, zio_type_t t) { - ASSERT(t == ZIO_TYPE_READ || t == ZIO_TYPE_WRITE); if (t == ZIO_TYPE_READ) return (&vq->vq_read_offset_tree); - else + else if (t == ZIO_TYPE_WRITE) return (&vq->vq_write_offset_tree); + else + return (NULL); } int @@ -397,10 +398,13 @@ static void vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio) { spa_t *spa = zio->io_spa; + avl_tree_t *qtt; ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio); - avl_add(vdev_queue_type_tree(vq, zio->io_type), zio); + qtt = vdev_queue_type_tree(vq, zio->io_type); + if (qtt) + avl_add(qtt, zio); #ifdef illumos mutex_enter(&spa->spa_iokstat_lock); @@ -415,10 +419,13 @@ static void vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio) { spa_t *spa = zio->io_spa; + avl_tree_t *qtt; ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio); - avl_remove(vdev_queue_type_tree(vq, zio->io_type), zio); + qtt = vdev_queue_type_tree(vq, zio->io_type); + if (qtt) + avl_remove(qtt, zio); #ifdef illumos mutex_enter(&spa->spa_iokstat_lock); @@ -636,15 +643,6 @@ vdev_queue_aggregate(vdev_queue_t *vq, z if (zio->io_flags & ZIO_FLAG_DONT_AGGREGATE) return (NULL); - /* - * The synchronous i/o queues are not sorted by LBA, so we can't - * find adjacent i/os. These i/os tend to not be tightly clustered, - * or too large to aggregate, so this has little impact on performance. - */ - if (zio->io_priority == ZIO_PRIORITY_SYNC_READ || - zio->io_priority == ZIO_PRIORITY_SYNC_WRITE) - return (NULL); - first = last = zio; if (zio->io_type == ZIO_TYPE_READ) @@ -671,7 +669,7 @@ vdev_queue_aggregate(vdev_queue_t *vq, z */ flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT; t = vdev_queue_type_tree(vq, zio->io_type); - while ((dio = AVL_PREV(t, first)) != NULL && + while (t != NULL && (dio = AVL_PREV(t, first)) != NULL && (dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags && IO_SPAN(dio, last) <= zfs_vdev_aggregation_limit && IO_GAP(dio, first) <= maxgap) { From owner-svn-src-all@freebsd.org Sat Oct 3 07:43:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76B63A0F29E; Sat, 3 Oct 2015 07:43:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5929E17B5; Sat, 3 Oct 2015 07:43:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937hYPD072945; Sat, 3 Oct 2015 07:43:34 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937hY8Y072944; Sat, 3 Oct 2015 07:43:34 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201510030743.t937hY8Y072944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 3 Oct 2015 07:43:34 +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: r288556 - stable/10/sys/vm 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:43:34 -0000 Author: alc Date: Sat Oct 3 07:43:33 2015 New Revision: 288556 URL: https://svnweb.freebsd.org/changeset/base/288556 Log: MFC r288281 The conversion of kmem_alloc_attr() from operating on a vm map to a vmem arena in r254025 introduced a bug in the case when an allocation is only partially successful. Specifically, the vm object lock was not being acquired before freeing the allocated pages. To address this bug, replace the existing code by a call to kmem_unback(). Change the type of a variable in kmem_alloc_attr() so that an allocation of two or more gigabytes won't fail. Replace the error handling code in kmem_back() by a call to kmem_unback(). Modified: stable/10/sys/vm/vm_kern.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_kern.c ============================================================================== --- stable/10/sys/vm/vm_kern.c Sat Oct 3 07:35:11 2015 (r288555) +++ stable/10/sys/vm/vm_kern.c Sat Oct 3 07:43:33 2015 (r288556) @@ -159,11 +159,10 @@ kmem_alloc_attr(vmem_t *vmem, vm_size_t vm_paddr_t high, vm_memattr_t memattr) { vm_object_t object = vmem == kmem_arena ? kmem_object : kernel_object; - vm_offset_t addr; + vm_offset_t addr, i; vm_ooffset_t offset; vm_page_t m; int pflags, tries; - int i; size = round_page(size); if (vmem_alloc(vmem, size, M_BESTFIT | flags, &addr)) @@ -184,18 +183,7 @@ retry: tries++; goto retry; } - /* - * Unmap and free the pages. - */ - if (i != 0) - pmap_remove(kernel_pmap, addr, addr + i); - while (i != 0) { - i -= PAGE_SIZE; - m = vm_page_lookup(object, - OFF_TO_IDX(offset + i)); - vm_page_unwire(m, 0); - vm_page_free(m); - } + kmem_unback(object, addr, i); vmem_free(vmem, addr, size); return (0); } @@ -353,25 +341,13 @@ retry: * aren't on any queues. */ if (m == NULL) { + VM_OBJECT_WUNLOCK(object); if ((flags & M_NOWAIT) == 0) { - VM_OBJECT_WUNLOCK(object); VM_WAIT; VM_OBJECT_WLOCK(object); goto retry; } - /* - * Unmap and free the pages. - */ - if (i != 0) - pmap_remove(kernel_pmap, addr, addr + i); - while (i != 0) { - i -= PAGE_SIZE; - m = vm_page_lookup(object, - OFF_TO_IDX(offset + i)); - vm_page_unwire(m, 0); - vm_page_free(m); - } - VM_OBJECT_WUNLOCK(object); + kmem_unback(object, addr, i); return (KERN_NO_SPACE); } if (flags & M_ZERO && (m->flags & PG_ZERO) == 0) @@ -387,6 +363,15 @@ retry: return (KERN_SUCCESS); } +/* + * kmem_unback: + * + * Unmap and free the physical pages underlying the specified virtual + * address range. + * + * A physical page must exist within the specified object at each index + * that is being unmapped. + */ void kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { From owner-svn-src-all@freebsd.org Sat Oct 3 07:45:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 946E6A0F447; Sat, 3 Oct 2015 07:45:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83C7F194C; Sat, 3 Oct 2015 07:45:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937jDKD073205; Sat, 3 Oct 2015 07:45:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937jDOg073204; Sat, 3 Oct 2015 07:45:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030745.t937jDOg073204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:45: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: r288557 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:45:13 -0000 Author: mav Date: Sat Oct 3 07:45:12 2015 New Revision: 288557 URL: https://svnweb.freebsd.org/changeset/base/288557 Log: MFC r286598: 5701 zpool list reports incorrect "alloc" value for cache devices Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:43:33 2015 (r288556) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:45:12 2015 (r288557) @@ -965,6 +965,16 @@ uint64_t zfs_crc64_table[256]; #define L2ARC_FEED_SECS 1 /* caching interval secs */ #define L2ARC_FEED_MIN_MS 200 /* min caching interval ms */ +/* + * Used to distinguish headers that are being process by + * l2arc_write_buffers(), but have yet to be assigned to a l2arc disk + * address. This can happen when the header is added to the l2arc's list + * of buffers to write in the first stage of l2arc_write_buffers(), but + * has not yet been written out which happens in the second stage of + * l2arc_write_buffers(). + */ +#define L2ARC_ADDR_UNSET ((uint64_t)(-1)) + #define l2arc_writes_sent ARCSTAT(arcstat_l2_writes_sent) #define l2arc_writes_done ARCSTAT(arcstat_l2_writes_done) @@ -1048,12 +1058,12 @@ struct l2arc_dev { uint64_t l2ad_hand; /* next write location */ uint64_t l2ad_start; /* first addr on device */ uint64_t l2ad_end; /* last addr on device */ - uint64_t l2ad_evict; /* last addr eviction reached */ boolean_t l2ad_first; /* first sweep through */ boolean_t l2ad_writing; /* currently writing */ kmutex_t l2ad_mtx; /* lock for buffer list */ list_t l2ad_buflist; /* buffer list */ list_node_t l2ad_node; /* device list node */ + refcount_t l2ad_alloc; /* allocated bytes */ }; static list_t L2ARC_dev_list; /* device list */ @@ -1425,6 +1435,7 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem buf_hash_remove(hdr); bcopy(hdr, nhdr, HDR_L2ONLY_SIZE); + if (new == hdr_full_cache) { nhdr->b_flags |= ARC_FLAG_HAS_L1HDR; /* @@ -1468,6 +1479,20 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem mutex_exit(&dev->l2ad_mtx); + /* + * Since we're using the pointer address as the tag when + * incrementing and decrementing the l2ad_alloc refcount, we + * must remove the old pointer (that we're about to destroy) and + * add the new pointer to the refcount. Otherwise we'd remove + * the wrong pointer address when calling arc_hdr_destroy() later. + */ + + (void) refcount_remove_many(&dev->l2ad_alloc, + hdr->b_l2hdr.b_asize, hdr); + + (void) refcount_add_many(&dev->l2ad_alloc, + nhdr->b_l2hdr.b_asize, nhdr); + buf_discard_identity(hdr); hdr->b_freeze_cksum = NULL; kmem_cache_free(old, hdr); @@ -2219,6 +2244,57 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ } static void +arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) +{ + l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; + l2arc_dev_t *dev = l2hdr->b_dev; + + ASSERT(MUTEX_HELD(&dev->l2ad_mtx)); + ASSERT(HDR_HAS_L2HDR(hdr)); + + list_remove(&dev->l2ad_buflist, hdr); + + /* + * We don't want to leak the b_tmp_cdata buffer that was + * allocated in l2arc_write_buffers() + */ + arc_buf_l2_cdata_free(hdr); + + /* + * If the l2hdr's b_daddr is equal to L2ARC_ADDR_UNSET, then + * this header is being processed by l2arc_write_buffers() (i.e. + * it's in the first stage of l2arc_write_buffers()). + * Re-affirming that truth here, just to serve as a reminder. If + * b_daddr does not equal L2ARC_ADDR_UNSET, then the header may or + * may not have its HDR_L2_WRITING flag set. (the write may have + * completed, in which case HDR_L2_WRITING will be false and the + * b_daddr field will point to the address of the buffer on disk). + */ + IMPLY(l2hdr->b_daddr == L2ARC_ADDR_UNSET, HDR_L2_WRITING(hdr)); + + /* + * If b_daddr is equal to L2ARC_ADDR_UNSET, we're racing with + * l2arc_write_buffers(). Since we've just removed this header + * from the l2arc buffer list, this header will never reach the + * second stage of l2arc_write_buffers(), which increments the + * accounting stats for this header. Thus, we must be careful + * not to decrement them for this header either. + */ + if (l2hdr->b_daddr != L2ARC_ADDR_UNSET) { + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); + ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); + + vdev_space_update(dev->l2ad_vdev, + -l2hdr->b_asize, 0, 0); + + (void) refcount_remove_many(&dev->l2ad_alloc, + l2hdr->b_asize, hdr); + } + + hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR; +} + +static void arc_hdr_destroy(arc_buf_hdr_t *hdr) { if (HDR_HAS_L1HDR(hdr)) { @@ -2231,31 +2307,29 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) ASSERT(!HDR_IN_HASH_TABLE(hdr)); if (HDR_HAS_L2HDR(hdr)) { - l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; - boolean_t buflist_held = MUTEX_HELD(&l2hdr->b_dev->l2ad_mtx); - - if (!buflist_held) { - mutex_enter(&l2hdr->b_dev->l2ad_mtx); - l2hdr = &hdr->b_l2hdr; - } + l2arc_dev_t *dev = hdr->b_l2hdr.b_dev; + boolean_t buflist_held = MUTEX_HELD(&dev->l2ad_mtx); - trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, - l2hdr->b_asize, 0); - list_remove(&l2hdr->b_dev->l2ad_buflist, hdr); + if (!buflist_held) + mutex_enter(&dev->l2ad_mtx); /* - * We don't want to leak the b_tmp_cdata buffer that was - * allocated in l2arc_write_buffers() - */ - arc_buf_l2_cdata_free(hdr); - - ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); - ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); + * Even though we checked this conditional above, we + * need to check this again now that we have the + * l2ad_mtx. This is because we could be racing with + * another thread calling l2arc_evict() which might have + * destroyed this header's L2 portion as we were waiting + * to acquire the l2ad_mtx. If that happens, we don't + * want to re-destroy the header's L2 portion. + */ + if (HDR_HAS_L2HDR(hdr)) { + trim_map_free(dev->l2ad_vdev, hdr->b_l2hdr.b_daddr, + hdr->b_l2hdr.b_asize, 0); + arc_hdr_l2hdr_destroy(hdr); + } if (!buflist_held) - mutex_exit(&l2hdr->b_dev->l2ad_mtx); - - hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR; + mutex_exit(&dev->l2ad_mtx); } if (!BUF_EMPTY(hdr)) @@ -4274,23 +4348,23 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT(refcount_count(&hdr->b_l1hdr.b_refcnt) > 0); if (HDR_HAS_L2HDR(hdr)) { - ARCSTAT_INCR(arcstat_l2_asize, -hdr->b_l2hdr.b_asize); - ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); - mutex_enter(&hdr->b_l2hdr.b_dev->l2ad_mtx); - trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev, - hdr->b_l2hdr.b_daddr, hdr->b_l2hdr.b_asize, 0); - list_remove(&hdr->b_l2hdr.b_dev->l2ad_buflist, hdr); /* - * We don't want to leak the b_tmp_cdata buffer that was - * allocated in l2arc_write_buffers() + * We have to recheck this conditional again now that + * we're holding the l2ad_mtx to prevent a race with + * another thread which might be concurrently calling + * l2arc_evict(). In that case, l2arc_evict() might have + * destroyed the header's L2 portion as we were waiting + * to acquire the l2ad_mtx. */ - arc_buf_l2_cdata_free(hdr); + if (HDR_HAS_L2HDR(hdr)) { + trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev, + hdr->b_l2hdr.b_daddr, hdr->b_l2hdr.b_asize, 0); + arc_hdr_l2hdr_destroy(hdr); + } mutex_exit(&hdr->b_l2hdr.b_dev->l2ad_mtx); - - hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR; } /* @@ -5358,6 +5432,10 @@ l2arc_write_done(zio_t *zio) ARCSTAT_INCR(arcstat_l2_asize, -hdr->b_l2hdr.b_asize); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); + + bytes_dropped += hdr->b_l2hdr.b_asize; + (void) refcount_remove_many(&dev->l2ad_alloc, + hdr->b_l2hdr.b_asize, hdr); } /* @@ -5514,7 +5592,6 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t d arc_buf_hdr_t *hdr, *hdr_prev; kmutex_t *hash_lock; uint64_t taddr; - int64_t bytes_evicted = 0; buflist = &dev->l2ad_buflist; @@ -5599,21 +5676,11 @@ top: hdr->b_flags |= ARC_FLAG_L2_EVICTED; } - /* Tell ARC this no longer exists in L2ARC. */ - ARCSTAT_INCR(arcstat_l2_asize, -hdr->b_l2hdr.b_asize); - ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); - hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR; - list_remove(buflist, hdr); - - /* This may have been leftover after a failed write. */ - hdr->b_flags &= ~ARC_FLAG_L2_WRITING; + arc_hdr_l2hdr_destroy(hdr); } mutex_exit(hash_lock); } mutex_exit(&dev->l2ad_mtx); - - vdev_space_update(dev->l2ad_vdev, -bytes_evicted, 0, 0); - dev->l2ad_evict = taddr; } /* @@ -5773,6 +5840,28 @@ l2arc_write_buffers(spa_t *spa, l2arc_de hdr->b_l2hdr.b_asize = hdr->b_size; hdr->b_l1hdr.b_tmp_cdata = hdr->b_l1hdr.b_buf->b_data; + /* + * Explicitly set the b_daddr field to a known + * value which means "invalid address". This + * enables us to differentiate which stage of + * l2arc_write_buffers() the particular header + * is in (e.g. this loop, or the one below). + * ARC_FLAG_L2_WRITING is not enough to make + * this distinction, and we need to know in + * order to do proper l2arc vdev accounting in + * arc_release() and arc_hdr_destroy(). + * + * Note, we can't use a new flag to distinguish + * the two stages because we don't hold the + * header's hash_lock below, in the second stage + * of this function. Thus, we can't simply + * change the b_flags field to denote that the + * IO has been sent. We can change the b_daddr + * field of the L2 portion, though, since we'll + * be holding the l2ad_mtx; which is why we're + * using it to denote the header's state change. + */ + hdr->b_l2hdr.b_daddr = L2ARC_ADDR_UNSET; hdr->b_flags |= ARC_FLAG_HAS_L2HDR; list_insert_head(&dev->l2ad_buflist, hdr); @@ -5862,6 +5951,13 @@ l2arc_write_buffers(spa_t *spa, l2arc_de if (!L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr))) hdr->b_l1hdr.b_tmp_cdata = NULL; + /* + * We need to do this regardless if buf_sz is zero or + * not, otherwise, when this l2hdr is evicted we'll + * remove a reference that was never added. + */ + (void) refcount_add_many(&dev->l2ad_alloc, buf_sz, hdr); + /* Compression may have squashed the buffer to zero length. */ if (buf_sz != 0) { uint64_t buf_a_sz; @@ -5876,6 +5972,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de (void) zio_nowait(wzio); stats_size += buf_sz; + /* * Keep the clock hand suitably device-aligned. */ @@ -5900,7 +5997,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de */ if (dev->l2ad_hand >= (dev->l2ad_end - target_sz)) { dev->l2ad_hand = dev->l2ad_start; - dev->l2ad_evict = dev->l2ad_start; dev->l2ad_first = B_FALSE; } @@ -6207,7 +6303,6 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) adddev->l2ad_start = VDEV_LABEL_START_SIZE; adddev->l2ad_end = VDEV_LABEL_START_SIZE + vdev_get_min_asize(vd); adddev->l2ad_hand = adddev->l2ad_start; - adddev->l2ad_evict = adddev->l2ad_start; adddev->l2ad_first = B_TRUE; adddev->l2ad_writing = B_FALSE; @@ -6220,6 +6315,7 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) offsetof(arc_buf_hdr_t, b_l2hdr.b_l2node)); vdev_space_update(vd, 0, 0, adddev->l2ad_end - adddev->l2ad_hand); + refcount_create(&adddev->l2ad_alloc); /* * Add device to global list @@ -6265,6 +6361,7 @@ l2arc_remove_vdev(vdev_t *vd) l2arc_evict(remdev, 0, B_TRUE); list_destroy(&remdev->l2ad_buflist); mutex_destroy(&remdev->l2ad_mtx); + refcount_destroy(&remdev->l2ad_alloc); kmem_free(remdev, sizeof (l2arc_dev_t)); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:46:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C7BEA0F546; Sat, 3 Oct 2015 07:46:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CE801AAE; Sat, 3 Oct 2015 07:46:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937k4QL073355; Sat, 3 Oct 2015 07:46:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937k4Iu073354; Sat, 3 Oct 2015 07:46:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030746.t937k4Iu073354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:46: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: r288558 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:46:04 -0000 Author: mav Date: Sat Oct 3 07:46:03 2015 New Revision: 288558 URL: https://svnweb.freebsd.org/changeset/base/288558 Log: MFC r286600: 5808 spa_check_logs is not necessary on readonly pools Reviewed by: George Wilson Reviewed by: Paul Dagnelie Reviewed by: Simon Klinkert Reviewed by: Will Andrews Approved by: Gordon Ross Author: Matthew Ahrens illumos/illumos-gate@23367a2f2caec1ccb4d918bdd0f2fc2c9cadcd06 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 07:45:12 2015 (r288557) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 07:46:03 2015 (r288558) @@ -2752,7 +2752,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_ if (rvd->vdev_state <= VDEV_STATE_CANT_OPEN) return (SET_ERROR(ENXIO)); - if (spa_check_logs(spa)) { + if (spa_writeable(spa) && spa_check_logs(spa)) { *ereport = FM_EREPORT_ZFS_LOG_REPLAY; return (spa_vdev_err(rvd, VDEV_AUX_BAD_LOG, ENXIO)); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:47:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0166BA0F69A; Sat, 3 Oct 2015 07:47:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9B4C1C2E; Sat, 3 Oct 2015 07:47:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937lY8D073573; Sat, 3 Oct 2015 07:47:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937lYco073568; Sat, 3 Oct 2015 07:47:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030747.t937lYco073568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:47:34 +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: r288559 - in stable/10: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:47:35 -0000 Author: mav Date: Sat Oct 3 07:47:33 2015 New Revision: 288559 URL: https://svnweb.freebsd.org/changeset/base/288559 Log: MFC r286603: 5810 zdb should print details of bpobj Reviewed by: Prakash Surya Reviewed by: Alex Reece Reviewed by: George Wilson Reviewed by: Will Andrews Reviewed by: Simon Klinkert Approved by: Gordon Ross Author: Matthew Ahrens illumos/illumos-gate@732885fca09e11183dd0ea69aaaab5588fb7dbff Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 07:46:03 2015 (r288558) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 07:47:33 2015 (r288559) @@ -95,6 +95,8 @@ int zopt_objects = 0; libzfs_handle_t *g_zfs; uint64_t max_inflight = 1000; +static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -418,6 +420,79 @@ dump_zap(objset_t *os, uint64_t object, zap_cursor_fini(&zc); } +static void +dump_bpobj(objset_t *os, uint64_t object, void *data, size_t size) +{ + bpobj_phys_t *bpop = data; + char bytes[32], comp[32], uncomp[32]; + + if (bpop == NULL) + return; + + zdb_nicenum(bpop->bpo_bytes, bytes); + zdb_nicenum(bpop->bpo_comp, comp); + zdb_nicenum(bpop->bpo_uncomp, uncomp); + + (void) printf("\t\tnum_blkptrs = %llu\n", + (u_longlong_t)bpop->bpo_num_blkptrs); + (void) printf("\t\tbytes = %s\n", bytes); + if (size >= BPOBJ_SIZE_V1) { + (void) printf("\t\tcomp = %s\n", comp); + (void) printf("\t\tuncomp = %s\n", uncomp); + } + if (size >= sizeof (*bpop)) { + (void) printf("\t\tsubobjs = %llu\n", + (u_longlong_t)bpop->bpo_subobjs); + (void) printf("\t\tnum_subobjs = %llu\n", + (u_longlong_t)bpop->bpo_num_subobjs); + } + + if (dump_opt['d'] < 5) + return; + + for (uint64_t i = 0; i < bpop->bpo_num_blkptrs; i++) { + char blkbuf[BP_SPRINTF_LEN]; + blkptr_t bp; + + int err = dmu_read(os, object, + i * sizeof (bp), sizeof (bp), &bp, 0); + if (err != 0) { + (void) printf("got error %u from dmu_read\n", err); + break; + } + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), &bp); + (void) printf("\t%s\n", blkbuf); + } +} + +/* ARGSUSED */ +static void +dump_bpobj_subobjs(objset_t *os, uint64_t object, void *data, size_t size) +{ + dmu_object_info_t doi; + + VERIFY0(dmu_object_info(os, object, &doi)); + uint64_t *subobjs = kmem_alloc(doi.doi_max_offset, KM_SLEEP); + + int err = dmu_read(os, object, 0, doi.doi_max_offset, subobjs, 0); + if (err != 0) { + (void) printf("got error %u from dmu_read\n", err); + kmem_free(subobjs, doi.doi_max_offset); + return; + } + + int64_t last_nonzero = -1; + for (uint64_t i = 0; i < doi.doi_max_offset / 8; i++) { + if (subobjs[i] != 0) + last_nonzero = i; + } + + for (int64_t i = 0; i <= last_nonzero; i++) { + (void) printf("\t%llu\n", (longlong_t)subobjs[i]); + } + kmem_free(subobjs, doi.doi_max_offset); +} + /*ARGSUSED*/ static void dump_ddt_zap(objset_t *os, uint64_t object, void *data, size_t size) @@ -1397,7 +1472,7 @@ dump_bpobj_cb(void *arg, const blkptr_t } static void -dump_bpobj(bpobj_t *bpo, char *name, int indent) +dump_full_bpobj(bpobj_t *bpo, char *name, int indent) { char bytes[32]; char comp[32]; @@ -1411,11 +1486,12 @@ dump_bpobj(bpobj_t *bpo, char *name, int zdb_nicenum(bpo->bpo_phys->bpo_comp, comp); zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp); (void) printf(" %*s: object %llu, %llu local blkptrs, " - "%llu subobjs, %s (%s/%s comp)\n", + "%llu subobjs in object %llu, %s (%s/%s comp)\n", indent * 8, name, (u_longlong_t)bpo->bpo_object, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, (u_longlong_t)bpo->bpo_phys->bpo_num_subobjs, + (u_longlong_t)bpo->bpo_phys->bpo_subobjs, bytes, comp, uncomp); for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) { @@ -1432,7 +1508,7 @@ dump_bpobj(bpobj_t *bpo, char *name, int error, (u_longlong_t)subobj); continue; } - dump_bpobj(&subbpo, "subobj", indent + 1); + dump_full_bpobj(&subbpo, "subobj", indent + 1); bpobj_close(&subbpo); } } else { @@ -1466,7 +1542,7 @@ dump_deadlist(dsl_deadlist_t *dl) return; if (dl->dl_oldfmt) { - dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); + dump_full_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); return; } @@ -1491,8 +1567,7 @@ dump_deadlist(dsl_deadlist_t *dl) (void) snprintf(buf, sizeof (buf), "mintxg %llu -> ", (longlong_t)dle->dle_mintxg, (longlong_t)dle->dle_bpobj.bpo_object); - - dump_bpobj(&dle->dle_bpobj, buf, 0); + dump_full_bpobj(&dle->dle_bpobj, buf, 0); } else { (void) printf("mintxg %llu -> obj %llu\n", (longlong_t)dle->dle_mintxg, @@ -1684,8 +1759,8 @@ static object_viewer_t *object_viewer[DM dump_uint64, /* object array */ dump_none, /* packed nvlist */ dump_packed_nvlist, /* packed nvlist size */ - dump_none, /* bplist */ - dump_none, /* bplist header */ + dump_none, /* bpobj */ + dump_bpobj, /* bpobj header */ dump_none, /* SPA space map header */ dump_none, /* SPA space map */ dump_none, /* ZIL intent log */ @@ -1732,7 +1807,7 @@ static object_viewer_t *object_viewer[DM dump_zap, /* deadlist */ dump_none, /* deadlist hdr */ dump_zap, /* dsl clones */ - dump_none, /* bpobj subobjs */ + dump_bpobj_subobjs, /* bpobj subobjs */ dump_unknown, /* Unknown type, must be last */ }; @@ -2961,10 +3036,11 @@ dump_zpool(spa_t *spa) uint64_t refcount; dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { - dump_bpobj(&spa->spa_deferred_bpobj, + dump_full_bpobj(&spa->spa_deferred_bpobj, "Deferred frees", 0); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { - dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj, + dump_full_bpobj( + &spa->spa_dsl_pool->dp_free_bpobj, "Pool snapshot frees", 0); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Sat Oct 3 07:46:03 2015 (r288558) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Sat Oct 3 07:47:33 2015 (r288559) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. */ #include @@ -256,9 +256,8 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_i dbuf = NULL; } if (free) { - i++; VERIFY3U(0, ==, dmu_free_range(bpo->bpo_os, bpo->bpo_object, - i * sizeof (blkptr_t), -1ULL, tx)); + (i + 1) * sizeof (blkptr_t), -1ULL, tx)); } if (err || !bpo->bpo_havesubobj || bpo->bpo_phys->bpo_subobjs == 0) goto out; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h Sat Oct 3 07:46:03 2015 (r288558) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h Sat Oct 3 07:47:33 2015 (r288559) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_BPOBJ_H @@ -77,7 +77,6 @@ void bpobj_close(bpobj_t *bpo); int bpobj_iterate(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx); int bpobj_iterate_nofree(bpobj_t *bpo, bpobj_itor_t func, void *, dmu_tx_t *); -int bpobj_iterate_dbg(bpobj_t *bpo, uint64_t *itorp, blkptr_t *bp); void bpobj_enqueue_subobj(bpobj_t *bpo, uint64_t subobj, dmu_tx_t *tx); void bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, dmu_tx_t *tx); From owner-svn-src-all@freebsd.org Sat Oct 3 07:48:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ECDCA0F755; Sat, 3 Oct 2015 07:48:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F0071D80; Sat, 3 Oct 2015 07:48:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937mQ5M073718; Sat, 3 Oct 2015 07:48:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937mQqv073717; Sat, 3 Oct 2015 07:48:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030748.t937mQqv073717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:48: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: r288560 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:48:26 -0000 Author: mav Date: Sat Oct 3 07:48:25 2015 New Revision: 288560 URL: https://svnweb.freebsd.org/changeset/base/288560 Log: MFC r286605: 5812 assertion failed in zrl_tryenter(): zr_owner==NULL Reviewed by: George Wilson Reviewed by: Alex Reece Reviewed by: Will Andrews Approved by: Gordon Ross Author: Matthew Ahrens illumos/illumos-gate@8df173054ca442cd8845a7364c3edad9d6822351 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Sat Oct 3 07:47:33 2015 (r288559) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Sat Oct 3 07:48:25 2015 (r288560) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014 by Delphix. All rights reserved. */ /* @@ -42,7 +43,7 @@ * A ZRL can be locked only while there are zero references, so ZRL_LOCKED is * treated as zero references. */ -#define ZRL_LOCKED ((uint32_t)-1) +#define ZRL_LOCKED -1 #define ZRL_DESTROYED -2 void @@ -60,7 +61,7 @@ zrl_init(zrlock_t *zrl) void zrl_destroy(zrlock_t *zrl) { - ASSERT(zrl->zr_refcount == 0); + ASSERT0(zrl->zr_refcount); mutex_destroy(&zrl->zr_mtx); zrl->zr_refcount = ZRL_DESTROYED; @@ -80,7 +81,7 @@ zrl_add(zrlock_t *zrl) uint32_t cas = atomic_cas_32( (uint32_t *)&zrl->zr_refcount, n, n + 1); if (cas == n) { - ASSERT((int32_t)n >= 0); + ASSERT3S((int32_t)n, >=, 0); #ifdef ZFS_DEBUG if (zrl->zr_owner == curthread) { DTRACE_PROBE2(zrlock__reentry, @@ -98,7 +99,7 @@ zrl_add(zrlock_t *zrl) while (zrl->zr_refcount == ZRL_LOCKED) { cv_wait(&zrl->zr_cv, &zrl->zr_mtx); } - ASSERT(zrl->zr_refcount >= 0); + ASSERT3S(zrl->zr_refcount, >=, 0); zrl->zr_refcount++; #ifdef ZFS_DEBUG zrl->zr_owner = curthread; @@ -112,14 +113,14 @@ zrl_remove(zrlock_t *zrl) { uint32_t n; - n = atomic_dec_32_nv((uint32_t *)&zrl->zr_refcount); - ASSERT((int32_t)n >= 0); #ifdef ZFS_DEBUG if (zrl->zr_owner == curthread) { zrl->zr_owner = NULL; zrl->zr_caller = NULL; } #endif + n = atomic_dec_32_nv((uint32_t *)&zrl->zr_refcount); + ASSERT3S((int32_t)n, >=, 0); } int @@ -132,14 +133,14 @@ zrl_tryenter(zrlock_t *zrl) (uint32_t *)&zrl->zr_refcount, 0, ZRL_LOCKED); if (cas == 0) { #ifdef ZFS_DEBUG - ASSERT(zrl->zr_owner == NULL); + ASSERT3P(zrl->zr_owner, ==, NULL); zrl->zr_owner = curthread; #endif return (1); } } - ASSERT((int32_t)n > ZRL_DESTROYED); + ASSERT3S((int32_t)n, >, ZRL_DESTROYED); return (0); } @@ -147,11 +148,11 @@ zrl_tryenter(zrlock_t *zrl) void zrl_exit(zrlock_t *zrl) { - ASSERT(zrl->zr_refcount == ZRL_LOCKED); + ASSERT3S(zrl->zr_refcount, ==, ZRL_LOCKED); mutex_enter(&zrl->zr_mtx); #ifdef ZFS_DEBUG - ASSERT(zrl->zr_owner == curthread); + ASSERT3P(zrl->zr_owner, ==, curthread); zrl->zr_owner = NULL; membar_producer(); /* make sure the owner store happens first */ #endif @@ -163,7 +164,7 @@ zrl_exit(zrlock_t *zrl) int zrl_refcount(zrlock_t *zrl) { - ASSERT(zrl->zr_refcount > ZRL_DESTROYED); + ASSERT3S(zrl->zr_refcount, >, ZRL_DESTROYED); int n = (int)zrl->zr_refcount; return (n <= 0 ? 0 : n); @@ -172,7 +173,7 @@ zrl_refcount(zrlock_t *zrl) int zrl_is_zero(zrlock_t *zrl) { - ASSERT(zrl->zr_refcount > ZRL_DESTROYED); + ASSERT3S(zrl->zr_refcount, >, ZRL_DESTROYED); return (zrl->zr_refcount <= 0); } @@ -180,7 +181,7 @@ zrl_is_zero(zrlock_t *zrl) int zrl_is_locked(zrlock_t *zrl) { - ASSERT(zrl->zr_refcount > ZRL_DESTROYED); + ASSERT3S(zrl->zr_refcount, >, ZRL_DESTROYED); return (zrl->zr_refcount == ZRL_LOCKED); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:49:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D768A0F7F2; Sat, 3 Oct 2015 07:49:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13E421ECD; Sat, 3 Oct 2015 07:49:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937nGtU073868; Sat, 3 Oct 2015 07:49:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937nGqT073867; Sat, 3 Oct 2015 07:49:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030749.t937nGqT073867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:49:16 +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: r288561 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:49:17 -0000 Author: mav Date: Sat Oct 3 07:49:16 2015 New Revision: 288561 URL: https://svnweb.freebsd.org/changeset/base/288561 Log: MFC r286623: Remove extra lock, that IMO only creates potential problems now. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:48:25 2015 (r288560) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:49:16 2015 (r288561) @@ -4776,7 +4776,6 @@ arc_tempreserve_space(uint64_t reserve, return (0); } -static kmutex_t arc_lowmem_lock; #ifdef _KERNEL static eventhandler_tag arc_event_lowmem = NULL; @@ -4784,8 +4783,6 @@ static void arc_lowmem(void *arg __unused, int howto __unused) { - /* Serialize access via arc_lowmem_lock. */ - mutex_enter(&arc_lowmem_lock); mutex_enter(&arc_reclaim_thr_lock); needfree = 1; DTRACE_PROBE(arc__needfree); @@ -4796,12 +4793,9 @@ arc_lowmem(void *arg __unused, int howto * here from ARC itself and may hold ARC locks and thus risk a deadlock * with ARC reclaim thread. */ - if (curproc == pageproc) { - while (needfree) - msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0); - } + if (curproc == pageproc) + msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0); mutex_exit(&arc_reclaim_thr_lock); - mutex_exit(&arc_lowmem_lock); } #endif @@ -4812,7 +4806,6 @@ arc_init(void) mutex_init(&arc_reclaim_thr_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arc_reclaim_thr_cv, NULL, CV_DEFAULT, NULL); - mutex_init(&arc_lowmem_lock, NULL, MUTEX_DEFAULT, NULL); /* Convert seconds to clock ticks */ arc_min_prefetch_lifespan = 1 * hz; @@ -5052,7 +5045,6 @@ arc_fini(void) ASSERT0(arc_loaned_bytes); - mutex_destroy(&arc_lowmem_lock); #ifdef _KERNEL if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); From owner-svn-src-all@freebsd.org Sat Oct 3 07:50:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A51DA0F8F9; Sat, 3 Oct 2015 07:50:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A31610F1; Sat, 3 Oct 2015 07:50:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937oFF5074565; Sat, 3 Oct 2015 07:50:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937oFXZ074564; Sat, 3 Oct 2015 07:50:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030750.t937oFXZ074564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:50:15 +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: r288562 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:50:16 -0000 Author: mav Date: Sat Oct 3 07:50:15 2015 New Revision: 288562 URL: https://svnweb.freebsd.org/changeset/base/288562 Log: MFC r286625: 5376 arc_kmem_reap_now() should not result in clearing arc_no_grow Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Steven Hartland Reviewed by: Richard Elling Approved by: Dan McDonald Author: Matthew Ahrens illumos/illumos-gate@2ec99e3e987d8aa273f1e9ba2b983557d058198c Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:49:16 2015 (r288561) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:50:15 2015 (r288562) @@ -153,13 +153,7 @@ static kmutex_t arc_reclaim_thr_lock; static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ static uint8_t arc_thread_exit; -#define ARC_REDUCE_DNLC_PERCENT 3 -uint_t arc_reduce_dnlc_percent = ARC_REDUCE_DNLC_PERCENT; - -typedef enum arc_reclaim_strategy { - ARC_RECLAIM_AGGR, /* Aggressive reclaim strategy */ - ARC_RECLAIM_CONS /* Conservative reclaim strategy */ -} arc_reclaim_strategy_t; +uint_t arc_reduce_dnlc_percent = 3; /* * The number of iterations through arc_evict_*() before we @@ -174,7 +168,19 @@ static int arc_grow_retry = 60; static int arc_p_min_shift = 4; /* log2(fraction of arc to reclaim) */ -static int arc_shrink_shift = 5; +static int arc_shrink_shift = 7; + +/* + * log2(fraction of ARC which must be free to allow growing). + * I.e. If there is less than arc_c >> arc_no_grow_shift free memory, + * when reading a new block into the ARC, we will evict an equal-sized block + * from the ARC. + * + * This must be less than arc_shrink_shift, so that when we shrink the ARC, + * we will still not allow it to grow. + */ +int arc_no_grow_shift = 5; + /* * minimum lifespan of a prefetch block in clock ticks @@ -3058,13 +3064,10 @@ arc_flush(spa_t *spa) } void -arc_shrink(void) +arc_shrink(int64_t to_free) { if (arc_c > arc_c_min) { - uint64_t to_free; - - to_free = arc_c >> arc_shrink_shift; DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, arc_c_min, uint64_t, arc_p, uint64_t, to_free); if (arc_c > arc_c_min + to_free) @@ -3092,44 +3095,76 @@ arc_shrink(void) } } -static int needfree = 0; +static long needfree = 0; -static int -arc_reclaim_needed(void) +typedef enum free_memory_reason_t { + FMR_UNKNOWN, + FMR_NEEDFREE, + FMR_LOTSFREE, + FMR_SWAPFS_MINFREE, + FMR_PAGES_PP_MAXIMUM, + FMR_HEAP_ARENA, + FMR_ZIO_ARENA, + FMR_ZIO_FRAG, +} free_memory_reason_t; + +int64_t last_free_memory; +free_memory_reason_t last_free_reason; + +/* + * Additional reserve of pages for pp_reserve. + */ +int64_t arc_pages_pp_reserve = 64; + +/* + * Additional reserve of pages for swapfs. + */ +int64_t arc_swapfs_reserve = 64; + +/* + * Return the amount of memory that can be consumed before reclaim will be + * needed. Positive if there is sufficient free memory, negative indicates + * the amount of memory that needs to be freed up. + */ +static int64_t +arc_available_memory(void) { + int64_t lowest = INT64_MAX; + int64_t n; + free_memory_reason_t r = FMR_UNKNOWN; #ifdef _KERNEL - - if (needfree) { - DTRACE_PROBE(arc__reclaim_needfree); - return (1); + if (needfree > 0) { + n = PAGESIZE * (-needfree); + if (n < lowest) { + lowest = n; + r = FMR_NEEDFREE; + } } /* * Cooperate with pagedaemon when it's time for it to scan * and reclaim some pages. */ - if (freemem < zfs_arc_free_target) { - DTRACE_PROBE2(arc__reclaim_freemem, uint64_t, - freemem, uint64_t, zfs_arc_free_target); - return (1); + n = PAGESIZE * (int64_t)(freemem - zfs_arc_free_target); + if (n < lowest) { + lowest = n; + r = FMR_LOTSFREE; } #ifdef sun /* - * take 'desfree' extra pages, so we reclaim sooner, rather than later - */ - extra = desfree; - - /* * check that we're out of range of the pageout scanner. It starts to * schedule paging if freemem is less than lotsfree and needfree. * lotsfree is the high-water mark for pageout, and needfree is the * number of needed free pages. We add extra pages here to make sure * the scanner doesn't start up while we're freeing memory. */ - if (freemem < lotsfree + needfree + extra) - return (1); + n = PAGESIZE * (freemem - lotsfree - needfree - desfree); + if (n < lowest) { + lowest = n; + r = FMR_LOTSFREE; + } /* * check to make sure that swapfs has enough space so that anon @@ -3138,8 +3173,13 @@ arc_reclaim_needed(void) * swap pages. We also add a bit of extra here just to prevent * circumstances from getting really dire. */ - if (availrmem < swapfs_minfree + swapfs_reserve + extra) - return (1); + n = PAGESIZE * (availrmem - swapfs_minfree - swapfs_reserve - + desfree - arc_swapfs_reserve); + if (n < lowest) { + lowest = n; + r = FMR_SWAPFS_MINFREE; + } + /* * Check that we have enough availrmem that memory locking (e.g., via @@ -3148,8 +3188,12 @@ arc_reclaim_needed(void) * drops below pages_pp_maximum, page locking mechanisms such as * page_pp_lock() will fail.) */ - if (availrmem <= pages_pp_maximum) - return (1); + n = PAGESIZE * (availrmem - pages_pp_maximum - + arc_pages_pp_reserve); + if (n < lowest) { + lowest = n; + r = FMR_PAGES_PP_MAXIMUM; + } #endif /* sun */ #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) @@ -3164,12 +3208,11 @@ arc_reclaim_needed(void) * heap is allocated. (Or, in the calculation, if less than 1/4th is * free) */ - if (vmem_size(heap_arena, VMEM_FREE) < - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2)) { - DTRACE_PROBE2(arc__reclaim_used, uint64_t, - vmem_size(heap_arena, VMEM_FREE), uint64_t, - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC)) >> 2); - return (1); + n = vmem_size(heap_arena, VMEM_FREE) - + (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2) + if (n < lowest) { + lowest = n; + r = FMR_HEAP_ARENA; } #define zio_arena NULL #else @@ -3185,29 +3228,50 @@ arc_reclaim_needed(void) * to aggressively evict memory from the arc in order to avoid * memory fragmentation issues. */ - if (zio_arena != NULL && - vmem_size(zio_arena, VMEM_FREE) < - (vmem_size(zio_arena, VMEM_ALLOC) >> 4)) - return (1); + if (zio_arena != NULL) { + n = vmem_size(zio_arena, VMEM_FREE) - + (vmem_size(zio_arena, VMEM_ALLOC) >> 4); + if (n < lowest) { + lowest = n; + r = FMR_ZIO_ARENA; + } + } /* * Above limits know nothing about real level of KVA fragmentation. * Start aggressive reclamation if too little sequential KVA left. */ - if (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) { - DTRACE_PROBE2(arc__reclaim_maxfree, uint64_t, - vmem_size(heap_arena, VMEM_MAXFREE), - uint64_t, zfs_max_recordsize); - return (1); + if (lowest > 0) { + n = (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) ? + -(vmem_size(heap_arena, VMEM_ALLOC) >> 4) : INT64_MAX; + if (n < lowest) { + lowest = n; + r = FMR_ZIO_FRAG; + } } #else /* _KERNEL */ + /* Every 100 calls, free a small amount */ if (spa_get_random(100) == 0) - return (1); + lowest = -1024; #endif /* _KERNEL */ - DTRACE_PROBE(arc__reclaim_no); - return (0); + last_free_memory = lowest; + last_free_reason = r; + DTRACE_PROBE2(arc__available_memory, int64_t, lowest, int, r); + return (lowest); +} + + +/* + * Determine if the system is under memory pressure and is asking + * to reclaim memory. A return value of TRUE indicates that the system + * is under memory pressure and that the arc should adjust accordingly. + */ +static boolean_t +arc_reclaim_needed(void) +{ + return (arc_available_memory() < 0); } extern kmem_cache_t *zio_buf_cache[]; @@ -3215,7 +3279,7 @@ extern kmem_cache_t *zio_data_buf_cache[ extern kmem_cache_t *range_seg_cache; static __noinline void -arc_kmem_reap_now(arc_reclaim_strategy_t strat) +arc_kmem_reap_now(void) { size_t i; kmem_cache_t *prev_cache = NULL; @@ -3238,13 +3302,6 @@ arc_kmem_reap_now(arc_reclaim_strategy_t #endif #endif - /* - * An aggressive reclamation will shrink the cache size as well as - * reap free buffers from the arc kmem caches. - */ - if (strat == ARC_RECLAIM_AGGR) - arc_shrink(); - for (i = 0; i < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; i++) { if (zio_buf_cache[i] != prev_cache) { prev_cache = zio_buf_cache[i]; @@ -3261,12 +3318,13 @@ arc_kmem_reap_now(arc_reclaim_strategy_t kmem_cache_reap_now(range_seg_cache); #ifdef sun - /* - * Ask the vmem arena to reclaim unused memory from its - * quantum caches. - */ - if (zio_arena != NULL && strat == ARC_RECLAIM_AGGR) + if (zio_arena != NULL) { + /* + * Ask the vmem arena to reclaim unused memory from its + * quantum caches. + */ vmem_qcache_reap(zio_arena); + } #endif DTRACE_PROBE(arc__kmem_reap_end); } @@ -3275,46 +3333,44 @@ static void arc_reclaim_thread(void *dummy __unused) { clock_t growtime = 0; - arc_reclaim_strategy_t last_reclaim = ARC_RECLAIM_CONS; callb_cpr_t cpr; CALLB_CPR_INIT(&cpr, &arc_reclaim_thr_lock, callb_generic_cpr, FTAG); mutex_enter(&arc_reclaim_thr_lock); while (arc_thread_exit == 0) { - if (arc_reclaim_needed()) { + int64_t free_memory = arc_available_memory(); + if (free_memory < 0) { - if (arc_no_grow) { - if (last_reclaim == ARC_RECLAIM_CONS) { - DTRACE_PROBE(arc__reclaim_aggr_no_grow); - last_reclaim = ARC_RECLAIM_AGGR; - } else { - last_reclaim = ARC_RECLAIM_CONS; - } - } else { - arc_no_grow = TRUE; - last_reclaim = ARC_RECLAIM_AGGR; - DTRACE_PROBE(arc__reclaim_aggr); - membar_producer(); - } + arc_no_grow = B_TRUE; + arc_warm = B_TRUE; - /* reset the growth delay for every reclaim */ + /* + * Wait at least zfs_grow_retry (default 60) seconds + * before considering growing. + */ growtime = ddi_get_lbolt() + (arc_grow_retry * hz); - if (needfree && last_reclaim == ARC_RECLAIM_CONS) { - /* - * If needfree is TRUE our vm_lowmem hook - * was called and in that case we must free some - * memory, so switch to aggressive mode. - */ - arc_no_grow = TRUE; - last_reclaim = ARC_RECLAIM_AGGR; - } - arc_kmem_reap_now(last_reclaim); - arc_warm = B_TRUE; + arc_kmem_reap_now(); - } else if (arc_no_grow && ddi_get_lbolt() >= growtime) { - arc_no_grow = FALSE; + /* + * If we are still low on memory, shrink the ARC + * so that we have arc_shrink_min free space. + */ + free_memory = arc_available_memory(); + + int64_t to_free = + (arc_c >> arc_shrink_shift) - free_memory; + if (to_free > 0) { +#ifdef _KERNEL + to_free = MAX(to_free, ptob(needfree)); +#endif + arc_shrink(to_free); + } + } else if (free_memory < arc_c >> arc_no_grow_shift) { + arc_no_grow = B_TRUE; + } else if (ddi_get_lbolt() >= growtime) { + arc_no_grow = B_FALSE; } arc_adjust(); @@ -4784,7 +4840,8 @@ arc_lowmem(void *arg __unused, int howto { mutex_enter(&arc_reclaim_thr_lock); - needfree = 1; + /* XXX: Memory deficit should be passed as argument. */ + needfree = btoc(arc_c >> arc_shrink_shift); DTRACE_PROBE(arc__needfree); cv_signal(&arc_reclaim_thr_cv); @@ -4868,6 +4925,12 @@ arc_init(void) if (zfs_arc_shrink_shift > 0) arc_shrink_shift = zfs_arc_shrink_shift; + /* + * Ensure that arc_no_grow_shift is less than arc_shrink_shift. + */ + if (arc_no_grow_shift >= arc_shrink_shift) + arc_no_grow_shift = arc_shrink_shift - 1; + if (zfs_arc_p_min_shift > 0) arc_p_min_shift = zfs_arc_p_min_shift; From owner-svn-src-all@freebsd.org Sat Oct 3 07:51:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B53EEA0FA04; Sat, 3 Oct 2015 07:51:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5B6F1315; Sat, 3 Oct 2015 07:51:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937pA8k077131; Sat, 3 Oct 2015 07:51:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937pAlU077130; Sat, 3 Oct 2015 07:51:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030751.t937pAlU077130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:51:10 +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: r288563 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:51:10 -0000 Author: mav Date: Sat Oct 3 07:51:09 2015 New Revision: 288563 URL: https://svnweb.freebsd.org/changeset/base/288563 Log: MFC r286626: Fix minor mismerge in r286574. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:50:15 2015 (r288562) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:51:09 2015 (r288563) @@ -4732,48 +4732,6 @@ arc_memory_throttle(uint64_t reserve, ui return (0); } -static void -arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, - kstat_named_t *evict_data, kstat_named_t *evict_metadata) -{ - size->value.ui64 = state->arcs_size; - evict_data->value.ui64 = state->arcs_lsize[ARC_BUFC_DATA]; - evict_metadata->value.ui64 = state->arcs_lsize[ARC_BUFC_METADATA]; -} - -static int -arc_kstat_update(kstat_t *ksp, int rw) -{ - arc_stats_t *as = ksp->ks_data; - - if (rw == KSTAT_WRITE) { - return (EACCES); - } else { - arc_kstat_update_state(arc_anon, - &as->arcstat_anon_size, - &as->arcstat_anon_evictable_data, - &as->arcstat_anon_evictable_metadata); - arc_kstat_update_state(arc_mru, - &as->arcstat_mru_size, - &as->arcstat_mru_evictable_data, - &as->arcstat_mru_evictable_metadata); - arc_kstat_update_state(arc_mru_ghost, - &as->arcstat_mru_ghost_size, - &as->arcstat_mru_ghost_evictable_data, - &as->arcstat_mru_ghost_evictable_metadata); - arc_kstat_update_state(arc_mfu, - &as->arcstat_mfu_size, - &as->arcstat_mfu_evictable_data, - &as->arcstat_mfu_evictable_metadata); - arc_kstat_update_state(arc_mfu_ghost, - &as->arcstat_mfu_ghost_size, - &as->arcstat_mfu_ghost_evictable_data, - &as->arcstat_mfu_ghost_evictable_metadata); - } - - return (0); -} - void arc_tempreserve_clear(uint64_t reserve) { @@ -4832,6 +4790,48 @@ arc_tempreserve_space(uint64_t reserve, return (0); } +static void +arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, + kstat_named_t *evict_data, kstat_named_t *evict_metadata) +{ + size->value.ui64 = state->arcs_size; + evict_data->value.ui64 = state->arcs_lsize[ARC_BUFC_DATA]; + evict_metadata->value.ui64 = state->arcs_lsize[ARC_BUFC_METADATA]; +} + +static int +arc_kstat_update(kstat_t *ksp, int rw) +{ + arc_stats_t *as = ksp->ks_data; + + if (rw == KSTAT_WRITE) { + return (EACCES); + } else { + arc_kstat_update_state(arc_anon, + &as->arcstat_anon_size, + &as->arcstat_anon_evictable_data, + &as->arcstat_anon_evictable_metadata); + arc_kstat_update_state(arc_mru, + &as->arcstat_mru_size, + &as->arcstat_mru_evictable_data, + &as->arcstat_mru_evictable_metadata); + arc_kstat_update_state(arc_mru_ghost, + &as->arcstat_mru_ghost_size, + &as->arcstat_mru_ghost_evictable_data, + &as->arcstat_mru_ghost_evictable_metadata); + arc_kstat_update_state(arc_mfu, + &as->arcstat_mfu_size, + &as->arcstat_mfu_evictable_data, + &as->arcstat_mfu_evictable_metadata); + arc_kstat_update_state(arc_mfu_ghost, + &as->arcstat_mfu_ghost_size, + &as->arcstat_mfu_ghost_evictable_data, + &as->arcstat_mfu_ghost_evictable_metadata); + } + + return (0); +} + #ifdef _KERNEL static eventhandler_tag arc_event_lowmem = NULL; From owner-svn-src-all@freebsd.org Sat Oct 3 07:52:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD927A0FB76; Sat, 3 Oct 2015 07:52:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDEAE175F; Sat, 3 Oct 2015 07:52:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937qB11077957; Sat, 3 Oct 2015 07:52:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937qBY9077956; Sat, 3 Oct 2015 07:52:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030752.t937qBY9077956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:52: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: r288564 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:52:12 -0000 Author: mav Date: Sat Oct 3 07:52:11 2015 New Revision: 288564 URL: https://svnweb.freebsd.org/changeset/base/288564 Log: MFC r286628: Fix r286625 build on i386. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:51:09 2015 (r288563) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:52:11 2015 (r288564) @@ -3209,7 +3209,7 @@ arc_available_memory(void) * free) */ n = vmem_size(heap_arena, VMEM_FREE) - - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2) + (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2); if (n < lowest) { lowest = n; r = FMR_HEAP_ARENA; From owner-svn-src-all@freebsd.org Sat Oct 3 07:53:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31CDCA0FC8E; Sat, 3 Oct 2015 07:53:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 220C418E2; Sat, 3 Oct 2015 07:53:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937r9Ku078120; Sat, 3 Oct 2015 07:53:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937r8n9078119; Sat, 3 Oct 2015 07:53:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030753.t937r8n9078119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:53:08 +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: r288565 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:53:09 -0000 Author: mav Date: Sat Oct 3 07:53:08 2015 New Revision: 288565 URL: https://svnweb.freebsd.org/changeset/base/288565 Log: MFC r286647: Fix assertion panic caused by combination of r286598 and TRIM. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:52:11 2015 (r288564) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:53:08 2015 (r288565) @@ -2329,8 +2329,10 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) * want to re-destroy the header's L2 portion. */ if (HDR_HAS_L2HDR(hdr)) { - trim_map_free(dev->l2ad_vdev, hdr->b_l2hdr.b_daddr, - hdr->b_l2hdr.b_asize, 0); + if (hdr->b_l2hdr.b_daddr != L2ARC_ADDR_UNSET) + trim_map_free(dev->l2ad_vdev, + hdr->b_l2hdr.b_daddr, + hdr->b_l2hdr.b_asize, 0); arc_hdr_l2hdr_destroy(hdr); } @@ -4415,8 +4417,10 @@ arc_release(arc_buf_t *buf, void *tag) * to acquire the l2ad_mtx. */ if (HDR_HAS_L2HDR(hdr)) { - trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev, - hdr->b_l2hdr.b_daddr, hdr->b_l2hdr.b_asize, 0); + if (hdr->b_l2hdr.b_daddr != L2ARC_ADDR_UNSET) + trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev, + hdr->b_l2hdr.b_daddr, + hdr->b_l2hdr.b_asize, 0); arc_hdr_l2hdr_destroy(hdr); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:53:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 780A5A0FD27; Sat, 3 Oct 2015 07:53:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB421A38; Sat, 3 Oct 2015 07:53:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937rvhQ078255; Sat, 3 Oct 2015 07:53:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937rvjA078254; Sat, 3 Oct 2015 07:53:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030753.t937rvjA078254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:53: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: r288566 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:53:57 -0000 Author: mav Date: Sat Oct 3 07:53:56 2015 New Revision: 288566 URL: https://svnweb.freebsd.org/changeset/base/288566 Log: MFC r286655: Fix set of sign extension bugs in r286625. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:53:08 2015 (r288565) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 07:53:56 2015 (r288566) @@ -3148,7 +3148,7 @@ arc_available_memory(void) * Cooperate with pagedaemon when it's time for it to scan * and reclaim some pages. */ - n = PAGESIZE * (int64_t)(freemem - zfs_arc_free_target); + n = PAGESIZE * ((int64_t)freemem - zfs_arc_free_target); if (n < lowest) { lowest = n; r = FMR_LOTSFREE; @@ -3210,7 +3210,7 @@ arc_available_memory(void) * heap is allocated. (Or, in the calculation, if less than 1/4th is * free) */ - n = vmem_size(heap_arena, VMEM_FREE) - + n = (int64_t)vmem_size(heap_arena, VMEM_FREE) - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2); if (n < lowest) { lowest = n; @@ -3231,7 +3231,7 @@ arc_available_memory(void) * memory fragmentation issues. */ if (zio_arena != NULL) { - n = vmem_size(zio_arena, VMEM_FREE) - + n = (int64_t)vmem_size(zio_arena, VMEM_FREE) - (vmem_size(zio_arena, VMEM_ALLOC) >> 4); if (n < lowest) { lowest = n; @@ -3245,7 +3245,8 @@ arc_available_memory(void) */ if (lowest > 0) { n = (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) ? - -(vmem_size(heap_arena, VMEM_ALLOC) >> 4) : INT64_MAX; + -((int64_t)vmem_size(heap_arena, VMEM_ALLOC) >> 4) : + INT64_MAX; if (n < lowest) { lowest = n; r = FMR_ZIO_FRAG; From owner-svn-src-all@freebsd.org Sat Oct 3 07:55:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61A16A0FE7A; Sat, 3 Oct 2015 07:55:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47D311BD4; Sat, 3 Oct 2015 07:55:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937tcD8078547; Sat, 3 Oct 2015 07:55:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937tbYH078544; Sat, 3 Oct 2015 07:55:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030755.t937tbYH078544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:55:37 +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: r288567 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:55:38 -0000 Author: mav Date: Sat Oct 3 07:55:37 2015 New Revision: 288567 URL: https://svnweb.freebsd.org/changeset/base/288567 Log: MFC r286677: 5695 dmu_sync'ed holes do not retain birth time illumos/illumos-gate@70163ac57e58ace1c5c94dfbe85dca5a974eff36 https://www.illumos.org/issues/5695 In dmu_sync_ready(), a hole block pointer will have it's logical size explicitly set as it's necessary for replay purposes. To "undo" this, dmu_sync_done() will zero out any hole that it finds. This becomes a problem when using the "hole_birth" feature, as this will also wipe out any birth time that might have happened to be set on the hole. ... As a fix, the logic to zero out a hole is only applied to old style holes with a birth time of zero. Holes created with the "hole_birth" feature enabled will have a non-zero birth time, and will be skipped (thus preserving the ltime, type, and level information as well). In addition, zdb was updated to also print the ltime, type, and level information for these new style holes. Previously, only the logical birth time would be printed. Author: Prakash Surya Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Christopher Siden Reviewed by: Bayard Bell Approved by: Dan McDonald Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:53:56 2015 (r288566) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:55:37 2015 (r288567) @@ -1485,7 +1485,19 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf dr->dt.dl.dr_overridden_by = *zio->io_bp; dr->dt.dl.dr_override_state = DR_OVERRIDDEN; dr->dt.dl.dr_copies = zio->io_prop.zp_copies; - if (BP_IS_HOLE(&dr->dt.dl.dr_overridden_by)) + + /* + * Old style holes are filled with all zeros, whereas + * new-style holes maintain their lsize, type, level, + * and birth time (see zio_write_compress). While we + * need to reset the BP_SET_LSIZE() call that happened + * in dmu_sync_ready for old style holes, we do *not* + * want to wipe out the information contained in new + * style holes. Thus, only zero out the block pointer if + * it's an old style hole. + */ + if (BP_IS_HOLE(&dr->dt.dl.dr_overridden_by) && + dr->dt.dl.dr_overridden_by.blk_birth == 0) BP_ZERO(&dr->dt.dl.dr_overridden_by); } else { dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Oct 3 07:53:56 2015 (r288566) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Oct 3 07:55:37 2015 (r288567) @@ -536,12 +536,13 @@ _NOTE(CONSTCOND) } while (0) if (bp == NULL) { \ len += func(buf + len, size - len, ""); \ } else if (BP_IS_HOLE(bp)) { \ - len += func(buf + len, size - len, ""); \ - if (bp->blk_birth > 0) { \ - len += func(buf + len, size - len, \ - " birth=%lluL", \ - (u_longlong_t)bp->blk_birth); \ - } \ + len += func(buf + len, size - len, \ + "HOLE [L%llu %s] " \ + "size=%llxL birth=%lluL", \ + (u_longlong_t)BP_GET_LEVEL(bp), \ + type, \ + (u_longlong_t)BP_GET_LSIZE(bp), \ + (u_longlong_t)bp->blk_birth); \ } else if (BP_IS_EMBEDDED(bp)) { \ len = func(buf + len, size - len, \ "EMBEDDED [L%llu %s] et=%u %s " \ From owner-svn-src-all@freebsd.org Sat Oct 3 07:57:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84037A0D02E; Sat, 3 Oct 2015 07:57:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71F741D6C; Sat, 3 Oct 2015 07:57:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937vYmB078818; Sat, 3 Oct 2015 07:57:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937vXwU078812; Sat, 3 Oct 2015 07:57:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030757.t937vXwU078812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:57:33 +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: r288568 - in stable/10: cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:57:34 -0000 Author: mav Date: Sat Oct 3 07:57:32 2015 New Revision: 288568 URL: https://svnweb.freebsd.org/changeset/base/288568 Log: MFC r286683: 5765 add support for estimating send stream size with lzc_send_space when source is a bookmark Reviewed by: Matthew Ahrens Reviewed by: Christopher Siden Reviewed by: Steven Hartland Reviewed by: Bayard Bell Approved by: Albert Lee Author: Max Grossman illumos/illumos-gate@643da460c8ca583e39ce053081754e24087f84c8 Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sat Oct 3 07:55:37 2015 (r288567) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sat Oct 3 07:57:32 2015 (r288568) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -532,18 +532,30 @@ lzc_send(const char *snapname, const cha } /* - * If fromsnap is NULL, a full (non-incremental) stream will be estimated. + * "from" can be NULL, a snapshot, or a bookmark. + * + * If from is NULL, a full (non-incremental) stream will be estimated. This + * is calculated very efficiently. + * + * If from is a snapshot, lzc_send_space uses the deadlists attached to + * each snapshot to efficiently estimate the stream size. + * + * If from is a bookmark, the indirect blocks in the destination snapshot + * are traversed, looking for blocks with a birth time since the creation TXG of + * the snapshot this bookmark was created from. This will result in + * significantly more I/O and be less efficient than a send space estimation on + * an equivalent snapshot. */ int -lzc_send_space(const char *snapname, const char *fromsnap, uint64_t *spacep) +lzc_send_space(const char *snapname, const char *from, uint64_t *spacep) { nvlist_t *args; nvlist_t *result; int err; args = fnvlist_alloc(); - if (fromsnap != NULL) - fnvlist_add_string(args, "fromsnap", fromsnap); + if (from != NULL) + fnvlist_add_string(args, "from", from); err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result); nvlist_free(args); if (err == 0) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:55:37 2015 (r288567) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:57:32 2015 (r288568) @@ -856,6 +856,40 @@ dmu_send(const char *tosnap, const char return (err); } +static int +dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t size, + uint64_t *sizep) +{ + int err; + /* + * Assume that space (both on-disk and in-stream) is dominated by + * data. We will adjust for indirect blocks and the copies property, + * but ignore per-object space used (eg, dnodes and DRR_OBJECT records). + */ + + /* + * Subtract out approximate space used by indirect blocks. + * Assume most space is used by data blocks (non-indirect, non-dnode). + * Assume all blocks are recordsize. Assume ditto blocks and + * internal fragmentation counter out compression. + * + * Therefore, space used by indirect blocks is sizeof(blkptr_t) per + * block, which we observe in practice. + */ + uint64_t recordsize; + err = dsl_prop_get_int_ds(ds, "recordsize", &recordsize); + if (err != 0) + return (err); + size -= size / recordsize * sizeof (blkptr_t); + + /* Add in the space for the record associated with each block. */ + size += size / recordsize * sizeof (dmu_replay_record_t); + + *sizep = size; + + return (0); +} + int dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds, uint64_t *sizep) { @@ -891,33 +925,61 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl return (err); } - /* - * Assume that space (both on-disk and in-stream) is dominated by - * data. We will adjust for indirect blocks and the copies property, - * but ignore per-object space used (eg, dnodes and DRR_OBJECT records). - */ + err = dmu_adjust_send_estimate_for_indirects(ds, size, sizep); + return (err); +} + +/* + * Simple callback used to traverse the blocks of a snapshot and sum their + * uncompressed size + */ +/* ARGSUSED */ +static int +dmu_calculate_send_traversal(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, + const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) +{ + uint64_t *spaceptr = arg; + if (bp != NULL && !BP_IS_HOLE(bp)) { + *spaceptr += BP_GET_UCSIZE(bp); + } + return (0); +} + +/* + * Given a desination snapshot and a TXG, calculate the approximate size of a + * send stream sent from that TXG. from_txg may be zero, indicating that the + * whole snapshot will be sent. + */ +int +dmu_send_estimate_from_txg(dsl_dataset_t *ds, uint64_t from_txg, + uint64_t *sizep) +{ + dsl_pool_t *dp = ds->ds_dir->dd_pool; + int err; + uint64_t size = 0; + + ASSERT(dsl_pool_config_held(dp)); + + /* tosnap must be a snapshot */ + if (!dsl_dataset_is_snapshot(ds)) + return (SET_ERROR(EINVAL)); + + /* verify that from_txg is before the provided snapshot was taken */ + if (from_txg >= dsl_dataset_phys(ds)->ds_creation_txg) { + return (SET_ERROR(EXDEV)); + } /* - * Subtract out approximate space used by indirect blocks. - * Assume most space is used by data blocks (non-indirect, non-dnode). - * Assume all blocks are recordsize. Assume ditto blocks and - * internal fragmentation counter out compression. - * - * Therefore, space used by indirect blocks is sizeof(blkptr_t) per - * block, which we observe in practice. + * traverse the blocks of the snapshot with birth times after + * from_txg, summing their uncompressed size */ - uint64_t recordsize; - err = dsl_prop_get_int_ds(ds, "recordsize", &recordsize); - if (err != 0) + err = traverse_dataset(ds, from_txg, TRAVERSE_POST, + dmu_calculate_send_traversal, &size); + if (err) return (err); - size -= size / recordsize * sizeof (blkptr_t); - - /* Add in the space for the record associated with each block. */ - size += size / recordsize * sizeof (dmu_replay_record_t); - - *sizep = size; - return (0); + err = dmu_adjust_send_estimate_for_indirects(ds, size, sizep); + return (err); } typedef struct dmu_recv_begin_arg { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Sat Oct 3 07:55:37 2015 (r288567) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Sat Oct 3 07:57:32 2015 (r288568) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -45,6 +45,8 @@ int dmu_send(const char *tosnap, const c #endif int dmu_send_estimate(struct dsl_dataset *ds, struct dsl_dataset *fromds, uint64_t *sizep); +int dmu_send_estimate_from_txg(struct dsl_dataset *ds, uint64_t fromtxg, + uint64_t *sizep); int dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, boolean_t embedok, boolean_t large_block_ok, #ifdef illumos Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 07:55:37 2015 (r288567) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 07:57:32 2015 (r288568) @@ -201,6 +201,9 @@ dsl_dataset_phys(dsl_dataset_t *ds) */ #define MAX_TAG_PREFIX_LEN 17 +#define dsl_dataset_is_snapshot(ds) \ + (dsl_dataset_phys(ds)->ds_num_children != 0) + #define DS_UNIQUE_IS_ACCURATE(ds) \ ((dsl_dataset_phys(ds)->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 3 07:55:37 2015 (r288567) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 3 07:57:32 2015 (r288568) @@ -5488,7 +5488,8 @@ zfs_ioc_send_new(const char *snapname, n * of bytes that will be written to the fd supplied to zfs_ioc_send_new(). * * innvl: { - * (optional) "fromsnap" -> full snap name to send an incremental from + * (optional) "from" -> full snap or bookmark name to send an incremental + * from * } * * outnvl: { @@ -5499,7 +5500,6 @@ static int zfs_ioc_send_space(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl) { dsl_pool_t *dp; - dsl_dataset_t *fromsnap = NULL; dsl_dataset_t *tosnap; int error; char *fromname; @@ -5515,27 +5515,55 @@ zfs_ioc_send_space(const char *snapname, return (error); } - error = nvlist_lookup_string(innvl, "fromsnap", &fromname); + error = nvlist_lookup_string(innvl, "from", &fromname); if (error == 0) { - error = dsl_dataset_hold(dp, fromname, FTAG, &fromsnap); - if (error != 0) { - dsl_dataset_rele(tosnap, FTAG); - dsl_pool_rele(dp, FTAG); - return (error); + if (strchr(fromname, '@') != NULL) { + /* + * If from is a snapshot, hold it and use the more + * efficient dmu_send_estimate to estimate send space + * size using deadlists. + */ + dsl_dataset_t *fromsnap; + error = dsl_dataset_hold(dp, fromname, FTAG, &fromsnap); + if (error != 0) + goto out; + error = dmu_send_estimate(tosnap, fromsnap, &space); + dsl_dataset_rele(fromsnap, FTAG); + } else if (strchr(fromname, '#') != NULL) { + /* + * If from is a bookmark, fetch the creation TXG of the + * snapshot it was created from and use that to find + * blocks that were born after it. + */ + zfs_bookmark_phys_t frombm; + + error = dsl_bookmark_lookup(dp, fromname, tosnap, + &frombm); + if (error != 0) + goto out; + error = dmu_send_estimate_from_txg(tosnap, + frombm.zbm_creation_txg, &space); + } else { + /* + * from is not properly formatted as a snapshot or + * bookmark + */ + error = SET_ERROR(EINVAL); + goto out; } + } else { + // If estimating the size of a full send, use dmu_send_estimate + error = dmu_send_estimate(tosnap, NULL, &space); } - error = dmu_send_estimate(tosnap, fromsnap, &space); fnvlist_add_uint64(outnvl, "space", space); - if (fromsnap != NULL) - dsl_dataset_rele(fromsnap, FTAG); +out: dsl_dataset_rele(tosnap, FTAG); dsl_pool_rele(dp, FTAG); return (error); } - static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST]; static void From owner-svn-src-all@freebsd.org Sat Oct 3 07:58:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC3AEA0D10D; Sat, 3 Oct 2015 07:58:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB3071EC0; Sat, 3 Oct 2015 07:58:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937wV4t078990; Sat, 3 Oct 2015 07:58:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937wThd078976; Sat, 3 Oct 2015 07:58:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030758.t937wThd078976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:58: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: r288569 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:58:32 -0000 Author: mav Date: Sat Oct 3 07:58:28 2015 New Revision: 288569 URL: https://svnweb.freebsd.org/changeset/base/288569 Log: MFC r286686: 5269 zpool import slow illumos/illumos-gate@12380e1e701fda28c9e9f32d01cafb54af279eb5 https://www.illumos.org/issues/5269 When importing a pool (at boot or with zpool import) with many filesystem, the process can take minutes. It doesn't matter whether the pool has been exported cleanly or uncleanly. The problem is that each dataset has its own log chain. On import, all datasets have to be checked if there are logs to replay. The idea is to speed up this process by paralellizing it. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Dan McDonald Approved by: Dan McDonald Author: Arne Jansen Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:58:28 2015 (r288569) @@ -25,6 +25,7 @@ * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2015, STRATO AG, Inc. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -49,6 +50,7 @@ #include #include #include +#include /* * Needed to close a window in dnode_move() that allows the objset to be freed @@ -56,6 +58,16 @@ */ krwlock_t os_lock; +/* + * Tunable to overwrite the maximum number of threads for the parallization + * of dmu_objset_find_dp, needed to speed up the import of pools with many + * datasets. + * Default is 4 times the number of leaf vdevs. + */ +int dmu_find_threads = 0; + +static void dmu_objset_find_dp_cb(void *arg); + void dmu_objset_init(void) { @@ -504,6 +516,25 @@ dmu_objset_hold(const char *name, void * return (err); } +static int +dmu_objset_own_impl(dsl_dataset_t *ds, dmu_objset_type_t type, + boolean_t readonly, void *tag, objset_t **osp) +{ + int err; + + err = dmu_objset_from_ds(ds, osp); + if (err != 0) { + dsl_dataset_disown(ds, tag); + } else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) { + dsl_dataset_disown(ds, tag); + return (SET_ERROR(EINVAL)); + } else if (!readonly && dsl_dataset_is_snapshot(ds)) { + dsl_dataset_disown(ds, tag); + return (SET_ERROR(EROFS)); + } + return (err); +} + /* * dsl_pool must not be held when this is called. * Upon successful return, there will be a longhold on the dataset, @@ -525,21 +556,26 @@ dmu_objset_own(const char *name, dmu_obj dsl_pool_rele(dp, FTAG); return (err); } - - err = dmu_objset_from_ds(ds, osp); + err = dmu_objset_own_impl(ds, type, readonly, tag, osp); dsl_pool_rele(dp, FTAG); - if (err != 0) { - dsl_dataset_disown(ds, tag); - } else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) { - dsl_dataset_disown(ds, tag); - return (SET_ERROR(EINVAL)); - } else if (!readonly && ds->ds_is_snapshot) { - dsl_dataset_disown(ds, tag); - return (SET_ERROR(EROFS)); - } + return (err); } +int +dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type, + boolean_t readonly, void *tag, objset_t **osp) +{ + dsl_dataset_t *ds; + int err; + + err = dsl_dataset_own_obj(dp, obj, tag, &ds); + if (err != 0) + return (err); + + return (dmu_objset_own_impl(ds, type, readonly, tag, osp)); +} + void dmu_objset_rele(objset_t *os, void *tag) { @@ -1580,30 +1616,41 @@ dmu_dir_list_next(objset_t *os, int name return (0); } -/* - * Find objsets under and including ddobj, call func(ds) on each. - */ -int -dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj, - int func(dsl_pool_t *, dsl_dataset_t *, void *), void *arg, int flags) +typedef struct dmu_objset_find_ctx { + taskq_t *dc_tq; + dsl_pool_t *dc_dp; + uint64_t dc_ddobj; + int (*dc_func)(dsl_pool_t *, dsl_dataset_t *, void *); + void *dc_arg; + int dc_flags; + kmutex_t *dc_error_lock; + int *dc_error; +} dmu_objset_find_ctx_t; + +static void +dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp) { + dsl_pool_t *dp = dcp->dc_dp; + dmu_objset_find_ctx_t *child_dcp; dsl_dir_t *dd; dsl_dataset_t *ds; zap_cursor_t zc; zap_attribute_t *attr; uint64_t thisobj; - int err; + int err = 0; - ASSERT(dsl_pool_config_held(dp)); + /* don't process if there already was an error */ + if (*dcp->dc_error != 0) + goto out; - err = dsl_dir_hold_obj(dp, ddobj, NULL, FTAG, &dd); + err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, NULL, FTAG, &dd); if (err != 0) - return (err); + goto out; /* Don't visit hidden ($MOS & $ORIGIN) objsets. */ if (dd->dd_myname[0] == '$') { dsl_dir_rele(dd, FTAG); - return (0); + goto out; } thisobj = dsl_dir_phys(dd)->dd_head_dataset_obj; @@ -1612,7 +1659,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 /* * Iterate over all children. */ - if (flags & DS_FIND_CHILDREN) { + if (dcp->dc_flags & DS_FIND_CHILDREN) { for (zap_cursor_init(&zc, dp->dp_meta_objset, dsl_dir_phys(dd)->dd_child_dir_zapobj); zap_cursor_retrieve(&zc, attr) == 0; @@ -1621,24 +1668,22 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 sizeof (uint64_t)); ASSERT3U(attr->za_num_integers, ==, 1); - err = dmu_objset_find_dp(dp, attr->za_first_integer, - func, arg, flags); - if (err != 0) - break; + child_dcp = kmem_alloc(sizeof (*child_dcp), KM_SLEEP); + *child_dcp = *dcp; + child_dcp->dc_ddobj = attr->za_first_integer; + if (dcp->dc_tq != NULL) + (void) taskq_dispatch(dcp->dc_tq, + dmu_objset_find_dp_cb, child_dcp, TQ_SLEEP); + else + dmu_objset_find_dp_impl(child_dcp); } zap_cursor_fini(&zc); - - if (err != 0) { - dsl_dir_rele(dd, FTAG); - kmem_free(attr, sizeof (zap_attribute_t)); - return (err); - } } /* * Iterate over all snapshots. */ - if (flags & DS_FIND_SNAPSHOTS) { + if (dcp->dc_flags & DS_FIND_SNAPSHOTS) { dsl_dataset_t *ds; err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); @@ -1659,7 +1704,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 attr->za_first_integer, FTAG, &ds); if (err != 0) break; - err = func(dp, ds, arg); + err = dcp->dc_func(dp, ds, dcp->dc_arg); dsl_dataset_rele(ds, FTAG); if (err != 0) break; @@ -1672,17 +1717,115 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint6 kmem_free(attr, sizeof (zap_attribute_t)); if (err != 0) - return (err); + goto out; /* * Apply to self. */ err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds); if (err != 0) - return (err); - err = func(dp, ds, arg); + goto out; + err = dcp->dc_func(dp, ds, dcp->dc_arg); dsl_dataset_rele(ds, FTAG); - return (err); + +out: + if (err != 0) { + mutex_enter(dcp->dc_error_lock); + /* only keep first error */ + if (*dcp->dc_error == 0) + *dcp->dc_error = err; + mutex_exit(dcp->dc_error_lock); + } + + kmem_free(dcp, sizeof (*dcp)); +} + +static void +dmu_objset_find_dp_cb(void *arg) +{ + dmu_objset_find_ctx_t *dcp = arg; + dsl_pool_t *dp = dcp->dc_dp; + + dsl_pool_config_enter(dp, FTAG); + + dmu_objset_find_dp_impl(dcp); + + dsl_pool_config_exit(dp, FTAG); +} + +/* + * Find objsets under and including ddobj, call func(ds) on each. + * The order for the enumeration is completely undefined. + * func is called with dsl_pool_config held. + */ +int +dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj, + int func(dsl_pool_t *, dsl_dataset_t *, void *), void *arg, int flags) +{ + int error = 0; + taskq_t *tq = NULL; + int ntasks; + dmu_objset_find_ctx_t *dcp; + kmutex_t err_lock; + + mutex_init(&err_lock, NULL, MUTEX_DEFAULT, NULL); + dcp = kmem_alloc(sizeof (*dcp), KM_SLEEP); + dcp->dc_tq = NULL; + dcp->dc_dp = dp; + dcp->dc_ddobj = ddobj; + dcp->dc_func = func; + dcp->dc_arg = arg; + dcp->dc_flags = flags; + dcp->dc_error_lock = &err_lock; + dcp->dc_error = &error; + + if ((flags & DS_FIND_SERIALIZE) || dsl_pool_config_held_writer(dp)) { + /* + * In case a write lock is held we can't make use of + * parallelism, as down the stack of the worker threads + * the lock is asserted via dsl_pool_config_held. + * In case of a read lock this is solved by getting a read + * lock in each worker thread, which isn't possible in case + * of a writer lock. So we fall back to the synchronous path + * here. + * In the future it might be possible to get some magic into + * dsl_pool_config_held in a way that it returns true for + * the worker threads so that a single lock held from this + * thread suffices. For now, stay single threaded. + */ + dmu_objset_find_dp_impl(dcp); + + return (error); + } + + ntasks = dmu_find_threads; + if (ntasks == 0) + ntasks = vdev_count_leaves(dp->dp_spa) * 4; + tq = taskq_create("dmu_objset_find", ntasks, minclsyspri, ntasks, + INT_MAX, 0); + if (tq == NULL) { + kmem_free(dcp, sizeof (*dcp)); + return (SET_ERROR(ENOMEM)); + } + dcp->dc_tq = tq; + + /* dcp will be freed by task */ + (void) taskq_dispatch(tq, dmu_objset_find_dp_cb, dcp, TQ_SLEEP); + + /* + * PORTING: this code relies on the property of taskq_wait to wait + * until no more tasks are queued and no more tasks are active. As + * we always queue new tasks from within other tasks, task_wait + * reliably waits for the full recursion to finish, even though we + * enqueue new tasks after taskq_wait has been called. + * On platforms other than illumos, taskq_wait may not have this + * property. + */ + taskq_wait(tq); + taskq_destroy(tq); + mutex_destroy(&err_lock); + + return (error); } /* Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Oct 3 07:58:28 2015 (r288569) @@ -855,7 +855,7 @@ dsl_pool_upgrade_clones(dsl_pool_t *dp, ASSERT(dp->dp_origin_snap != NULL); VERIFY0(dmu_objset_find_dp(dp, dp->dp_root_dir_obj, upgrade_clones_cb, - tx, DS_FIND_CHILDREN)); + tx, DS_FIND_CHILDREN | DS_FIND_SERIALIZE)); } /* ARGSUSED */ @@ -909,7 +909,7 @@ dsl_pool_upgrade_dir_clones(dsl_pool_t * VERIFY0(bpobj_open(&dp->dp_free_bpobj, dp->dp_meta_objset, obj)); VERIFY0(dmu_objset_find_dp(dp, dp->dp_root_dir_obj, - upgrade_dir_clones_cb, tx, DS_FIND_CHILDREN)); + upgrade_dir_clones_cb, tx, DS_FIND_CHILDREN | DS_FIND_SERIALIZE)); } void @@ -1153,3 +1153,9 @@ dsl_pool_config_held(dsl_pool_t *dp) { return (RRW_LOCK_HELD(&dp->dp_config_rwlock)); } + +boolean_t +dsl_pool_config_held_writer(dsl_pool_t *dp) +{ + return (RRW_WRITE_HELD(&dp->dp_config_rwlock)); +} Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 07:58:28 2015 (r288569) @@ -1789,13 +1789,14 @@ static boolean_t spa_check_logs(spa_t *spa) { boolean_t rv = B_FALSE; + dsl_pool_t *dp = spa_get_dsl(spa); switch (spa->spa_log_state) { case SPA_LOG_MISSING: /* need to recheck in case slog has been restored */ case SPA_LOG_UNKNOWN: - rv = (dmu_objset_find(spa->spa_name, zil_check_log_chain, - NULL, DS_FIND_CHILDREN) != 0); + rv = (dmu_objset_find_dp(dp, dp->dp_root_dir_obj, + zil_check_log_chain, NULL, DS_FIND_CHILDREN) != 0); if (rv) spa_set_log_state(spa, SPA_LOG_MISSING); break; @@ -2783,6 +2784,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_ spa->spa_load_max_txg == UINT64_MAX)) { dmu_tx_t *tx; int need_update = B_FALSE; + dsl_pool_t *dp = spa_get_dsl(spa); ASSERT(state != SPA_LOAD_TRYIMPORT); @@ -2795,9 +2797,8 @@ spa_load_impl(spa_t *spa, uint64_t pool_ */ spa->spa_claiming = B_TRUE; - tx = dmu_tx_create_assigned(spa_get_dsl(spa), - spa_first_txg(spa)); - (void) dmu_objset_find(spa_name(spa), + tx = dmu_tx_create_assigned(dp, spa_first_txg(spa)); + (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj, zil_claim, tx, DS_FIND_CHILDREN); dmu_tx_commit(tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 07:58:28 2015 (r288569) @@ -243,6 +243,7 @@ void zfs_znode_byteswap(void *buf, size_ #define DS_FIND_SNAPSHOTS (1<<0) #define DS_FIND_CHILDREN (1<<1) +#define DS_FIND_SERIALIZE (1<<2) /* * The maximum number of bytes that can be accessed as part of one Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Sat Oct 3 07:58:28 2015 (r288569) @@ -142,6 +142,8 @@ struct objset { int dmu_objset_hold(const char *name, void *tag, objset_t **osp); int dmu_objset_own(const char *name, dmu_objset_type_t type, boolean_t readonly, void *tag, objset_t **osp); +int dmu_objset_own_obj(struct dsl_pool *dp, uint64_t obj, + dmu_objset_type_t type, boolean_t readonly, void *tag, objset_t **osp); void dmu_objset_refresh_ownership(objset_t *os, void *tag); void dmu_objset_rele(objset_t *os, void *tag); void dmu_objset_disown(objset_t *os, void *tag); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Sat Oct 3 07:58:28 2015 (r288569) @@ -154,6 +154,7 @@ void dsl_pool_mos_diduse_space(dsl_pool_ void dsl_pool_config_enter(dsl_pool_t *dp, void *tag); void dsl_pool_config_exit(dsl_pool_t *dp, void *tag); boolean_t dsl_pool_config_held(dsl_pool_t *dp); +boolean_t dsl_pool_config_held_writer(dsl_pool_t *dp); boolean_t dsl_pool_need_dirty_delay(dsl_pool_t *dp); taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sat Oct 3 07:58:28 2015 (r288569) @@ -61,6 +61,7 @@ extern zio_t *vdev_probe(vdev_t *vd, zio extern boolean_t vdev_is_bootable(vdev_t *vd); extern vdev_t *vdev_lookup_top(spa_t *spa, uint64_t vdev); extern vdev_t *vdev_lookup_by_guid(vdev_t *vd, uint64_t guid); +extern int vdev_count_leaves(spa_t *spa); extern void vdev_dtl_dirty(vdev_t *vd, vdev_dtl_type_t d, uint64_t txg, uint64_t size); extern boolean_t vdev_dtl_contains(vdev_t *vd, vdev_dtl_type_t d, Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sat Oct 3 07:58:28 2015 (r288569) @@ -37,6 +37,9 @@ extern "C" { #endif +struct dsl_pool; +struct dsl_dataset; + /* * Intent log format: * @@ -404,8 +407,10 @@ extern void zil_itx_assign(zilog_t *zilo extern void zil_commit(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); -extern int zil_claim(const char *osname, void *txarg); -extern int zil_check_log_chain(const char *osname, void *txarg); +extern int zil_claim(struct dsl_pool *dp, + struct dsl_dataset *ds, void *txarg); +extern int zil_check_log_chain(struct dsl_pool *dp, + struct dsl_dataset *ds, void *tx); extern void zil_sync(zilog_t *zilog, dmu_tx_t *tx); extern void zil_clean(zilog_t *zilog, uint64_t synced_txg); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sat Oct 3 07:58:28 2015 (r288569) @@ -272,6 +272,26 @@ vdev_lookup_by_guid(vdev_t *vd, uint64_t return (NULL); } +static int +vdev_count_leaves_impl(vdev_t *vd) +{ + int n = 0; + + if (vd->vdev_ops->vdev_op_leaf) + return (1); + + for (int c = 0; c < vd->vdev_children; c++) + n += vdev_count_leaves_impl(vd->vdev_child[c]); + + return (n); +} + +int +vdev_count_leaves(spa_t *spa) +{ + return (vdev_count_leaves_impl(spa->spa_root_vdev)); +} + void vdev_add_child(vdev_t *pvd, vdev_t *cvd) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Oct 3 07:57:32 2015 (r288568) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Oct 3 07:58:28 2015 (r288569) @@ -639,7 +639,7 @@ zil_destroy_sync(zilog_t *zilog, dmu_tx_ } int -zil_claim(const char *osname, void *txarg) +zil_claim(dsl_pool_t *dp, dsl_dataset_t *ds, void *txarg) { dmu_tx_t *tx = txarg; uint64_t first_txg = dmu_tx_get_txg(tx); @@ -648,15 +648,16 @@ zil_claim(const char *osname, void *txar objset_t *os; int error; - error = dmu_objset_own(osname, DMU_OST_ANY, B_FALSE, FTAG, &os); + error = dmu_objset_own_obj(dp, ds->ds_object, + DMU_OST_ANY, B_FALSE, FTAG, &os); if (error != 0) { /* * EBUSY indicates that the objset is inconsistent, in which * case it can not have a ZIL. */ if (error != EBUSY) { - cmn_err(CE_WARN, "can't open objset for %s, error %u", - osname, error); + cmn_err(CE_WARN, "can't open objset for %llu, error %u", + (unsigned long long)ds->ds_object, error); } return (0); } @@ -703,8 +704,9 @@ zil_claim(const char *osname, void *txar * Checksum errors are ok as they indicate the end of the chain. * Any other error (no device or read failure) returns an error. */ +/* ARGSUSED */ int -zil_check_log_chain(const char *osname, void *tx) +zil_check_log_chain(dsl_pool_t *dp, dsl_dataset_t *ds, void *tx) { zilog_t *zilog; objset_t *os; @@ -713,9 +715,10 @@ zil_check_log_chain(const char *osname, ASSERT(tx == NULL); - error = dmu_objset_hold(osname, FTAG, &os); + error = dmu_objset_from_ds(ds, &os); if (error != 0) { - cmn_err(CE_WARN, "can't open objset for %s", osname); + cmn_err(CE_WARN, "can't open objset %llu, error %d", + (unsigned long long)ds->ds_object, error); return (0); } @@ -738,10 +741,8 @@ zil_check_log_chain(const char *osname, valid = vdev_log_state_valid(vd); spa_config_exit(os->os_spa, SCL_STATE, FTAG); - if (!valid) { - dmu_objset_rele(os, FTAG); + if (!valid) return (0); - } } /* @@ -754,8 +755,6 @@ zil_check_log_chain(const char *osname, error = zil_parse(zilog, zil_claim_log_block, zil_claim_log_record, tx, zilog->zl_header->zh_claim_txg ? -1ULL : spa_first_txg(os->os_spa)); - dmu_objset_rele(os, FTAG); - return ((error == ECKSUM || error == ENOENT) ? 0 : error); } From owner-svn-src-all@freebsd.org Sat Oct 3 07:59:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E843BA0D1A6; Sat, 3 Oct 2015 07:59:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4F311012; Sat, 3 Oct 2015 07:59:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t937xR8s079153; Sat, 3 Oct 2015 07:59:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t937xQoa079143; Sat, 3 Oct 2015 07:59:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030759.t937xQoa079143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 07:59: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: r288570 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 07:59:28 -0000 Author: mav Date: Sat Oct 3 07:59:25 2015 New Revision: 288570 URL: https://svnweb.freebsd.org/changeset/base/288570 Log: MFC r286689: 5981 Deadlock in dmu_objset_find_dp illumos/illumos-gate@1d3f896f5469c69c1339890ec3d68e9feddb0343 https://www.illumos.org/issues/5981 When dmu_objset_find_dp gets called with a read lock held, it fans out the work to the task queue. Each task in turn acquires its own read lock before calling the callback. If during this process anyone tries to a acquire a write lock, it will stall all read lock requests.Thus the tasks will never finish, the read lock of the caller will never get freed and the write lock never acquired. deadlock. Reviewed by: Matthew Ahrens Reviewed by: Dan McDonald Approved by: Robert Mustacchi Author: Arne Jansen Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:58:28 2015 (r288569) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:59:25 2015 (r288570) @@ -1746,7 +1746,15 @@ dmu_objset_find_dp_cb(void *arg) dmu_objset_find_ctx_t *dcp = arg; dsl_pool_t *dp = dcp->dc_dp; - dsl_pool_config_enter(dp, FTAG); + /* + * We need to get a pool_config_lock here, as there are several + * asssert(pool_config_held) down the stack. Getting a lock via + * dsl_pool_config_enter is risky, as it might be stalled by a + * pending writer. This would deadlock, as the write lock can + * only be granted when our parent thread gives up the lock. + * The _prio interface gives us priority over a pending writer. + */ + dsl_pool_config_enter_prio(dp, FTAG); dmu_objset_find_dp_impl(dcp); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Oct 3 07:58:28 2015 (r288569) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Oct 3 07:59:25 2015 (r288570) @@ -1143,6 +1143,13 @@ dsl_pool_config_enter(dsl_pool_t *dp, vo } void +dsl_pool_config_enter_prio(dsl_pool_t *dp, void *tag) +{ + ASSERT(!rrw_held(&dp->dp_config_rwlock, RW_READER)); + rrw_enter_read_prio(&dp->dp_config_rwlock, tag); +} + +void dsl_pool_config_exit(dsl_pool_t *dp, void *tag) { rrw_exit(&dp->dp_config_rwlock, tag); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c Sat Oct 3 07:58:28 2015 (r288569) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c Sat Oct 3 07:59:25 2015 (r288570) @@ -159,8 +159,8 @@ rrw_destroy(rrwlock_t *rrl) refcount_destroy(&rrl->rr_linked_rcount); } -void -rrw_enter_read(rrwlock_t *rrl, void *tag) +static void +rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag) { mutex_enter(&rrl->rr_lock); #if !defined(DEBUG) && defined(_KERNEL) @@ -176,7 +176,7 @@ rrw_enter_read(rrwlock_t *rrl, void *tag ASSERT(refcount_count(&rrl->rr_anon_rcount) >= 0); while (rrl->rr_writer != NULL || (rrl->rr_writer_wanted && - refcount_is_zero(&rrl->rr_anon_rcount) && + refcount_is_zero(&rrl->rr_anon_rcount) && !prio && rrn_find(rrl) == NULL)) cv_wait(&rrl->rr_cv, &rrl->rr_lock); @@ -192,6 +192,25 @@ rrw_enter_read(rrwlock_t *rrl, void *tag } void +rrw_enter_read(rrwlock_t *rrl, void *tag) +{ + rrw_enter_read_impl(rrl, B_FALSE, tag); +} + +/* + * take a read lock even if there are pending write lock requests. if we want + * to take a lock reentrantly, but from different threads (that have a + * relationship to each other), the normal detection mechanism to overrule + * the pending writer does not work, so we have to give an explicit hint here. + */ +void +rrw_enter_read_prio(rrwlock_t *rrl, void *tag) +{ + rrw_enter_read_impl(rrl, B_TRUE, tag); +} + + +void rrw_enter_write(rrwlock_t *rrl) { mutex_enter(&rrl->rr_lock); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Sat Oct 3 07:58:28 2015 (r288569) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Sat Oct 3 07:59:25 2015 (r288570) @@ -152,6 +152,7 @@ void dsl_pool_upgrade_dir_clones(dsl_poo void dsl_pool_mos_diduse_space(dsl_pool_t *dp, int64_t used, int64_t comp, int64_t uncomp); void dsl_pool_config_enter(dsl_pool_t *dp, void *tag); +void dsl_pool_config_enter_prio(dsl_pool_t *dp, void *tag); void dsl_pool_config_exit(dsl_pool_t *dp, void *tag); boolean_t dsl_pool_config_held(dsl_pool_t *dp); boolean_t dsl_pool_config_held_writer(dsl_pool_t *dp); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h Sat Oct 3 07:58:28 2015 (r288569) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h Sat Oct 3 07:59:25 2015 (r288570) @@ -69,6 +69,7 @@ void rrw_init(rrwlock_t *rrl, boolean_t void rrw_destroy(rrwlock_t *rrl); void rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag); void rrw_enter_read(rrwlock_t *rrl, void *tag); +void rrw_enter_read_prio(rrwlock_t *rrl, void *tag); void rrw_enter_write(rrwlock_t *rrl); void rrw_exit(rrwlock_t *rrl, void *tag); boolean_t rrw_held(rrwlock_t *rrl, krw_t rw); From owner-svn-src-all@freebsd.org Sat Oct 3 08:03:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5BC4A0D955; Sat, 3 Oct 2015 08:03:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2C291558; Sat, 3 Oct 2015 08:03:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9383f33083372; Sat, 3 Oct 2015 08:03:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9383bB2083349; Sat, 3 Oct 2015 08:03:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030803.t9383bB2083349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 08:03:37 +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: r288571 - in stable/10: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/open... 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 08:03:42 -0000 Author: mav Date: Sat Oct 3 08:03:36 2015 New Revision: 288571 URL: https://svnweb.freebsd.org/changeset/base/288571 Log: MFC r286705: 5960 zfs recv should prefetch indirect blocks 5925 zfs receive -o origin= Reviewed by: Prakash Surya Reviewed by: Matthew Ahrens Author: Paul Dagnelie While running 'zfs recv' we noticed that every 128th 8K block required a read. We were seeing that restore_write() was calling dmu_tx_hold_write() and the indirect block was not cached. We should prefetch upcoming indirect blocks to avoid having to go to disk and blocking the restore_write(). Allow an incremental send stream to be received as a clone, even if the stream does not mark it as a clone. Added: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c - copied unchanged from r286705, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bqueue.h - copied unchanged from r286705, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bqueue.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_priority.h - copied unchanged from r286705, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_priority.h Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 08:03:36 2015 (r288571) @@ -2429,6 +2429,9 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog dmu_object_type_t type; boolean_t is_metadata; + if (bp == NULL) + return (0); + if (dump_opt['b'] >= 5 && bp->blk_birth > 0) { char blkbuf[BP_SPRINTF_LEN]; snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); @@ -2918,7 +2921,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilo avl_index_t where; zdb_ddt_entry_t *zdde, zdde_search; - if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) + if (bp == NULL || BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) return (0); if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) { Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 08:03:36 2015 (r288571) @@ -191,11 +191,13 @@ .Nm .Cm receive Ns | Ns Cm recv .Op Fl vnFu +.Op Fl o Sy origin Ns = Ns Ar snapshot .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm receive Ns | Ns Cm recv .Op Fl vnFu .Op Fl d | e +.Op Fl o Sy origin Ns = Ns Ar snapshot .Ar filesystem .Nm .Cm allow @@ -2711,6 +2713,7 @@ feature. .Nm .Cm receive Ns | Ns Cm recv .Op Fl vnFu +.Op Fl o Sy origin Ns = Ns Ar snapshot .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc .It Xo @@ -2718,6 +2721,7 @@ feature. .Cm receive Ns | Ns Cm recv .Op Fl vnFu .Op Fl d | e +.Op Fl o Sy origin Ns = Ns Ar snapshot .Ar filesystem .Xc .Pp @@ -2802,6 +2806,10 @@ receive operation. Do not actually receive the stream. This can be useful in conjunction with the .Fl v option to verify the name the receive operation would use. +.It Fl o Sy origin Ns = Ns Ar snapshot +Forces the stream to be received as a clone of the given snapshot. +This is only valid if the stream is an incremental stream whose source +is the same as the provided origin. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 3 08:03:36 2015 (r288571) @@ -264,8 +264,9 @@ get_usage(zfs_help_t idx) return (gettext("\tpromote \n")); case HELP_RECEIVE: return (gettext("\treceive|recv [-vnFu] \n" - "\treceive|recv [-vnFu] [-d | -e] \n")); + "snapshot>\n" + "\treceive|recv [-vnFu] [-o origin=] [-d | -e] " + "\n")); case HELP_RENAME: return (gettext("\trename [-f] " "\n" @@ -791,7 +792,7 @@ zfs_do_create(int argc, char **argv) nomem(); break; case 'o': - if (parseprop(props, optarg)) + if (parseprop(props, optarg) != 0) goto error; break; case 's': @@ -3663,7 +3664,7 @@ zfs_do_snapshot(int argc, char **argv) while ((c = getopt(argc, argv, "ro:")) != -1) { switch (c) { case 'o': - if (parseprop(props, optarg)) + if (parseprop(props, optarg) != 0) return (1); break; case 'r': @@ -3922,10 +3923,19 @@ zfs_do_receive(int argc, char **argv) { int c, err; recvflags_t flags = { 0 }; + nvlist_t *props; + nvpair_t *nvp = NULL; + + if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) + nomem(); /* check options */ - while ((c = getopt(argc, argv, ":denuvF")) != -1) { + while ((c = getopt(argc, argv, ":o:denuvF")) != -1) { switch (c) { + case 'o': + if (parseprop(props, optarg) != 0) + return (1); + break; case 'd': flags.isprefix = B_TRUE; break; @@ -3970,6 +3980,13 @@ zfs_do_receive(int argc, char **argv) usage(B_FALSE); } + while ((nvp = nvlist_next_nvpair(props, nvp))) { + if (strcmp(nvpair_name(nvp), "origin") != 0) { + (void) fprintf(stderr, gettext("invalid option")); + usage(B_FALSE); + } + } + if (isatty(STDIN_FILENO)) { (void) fprintf(stderr, gettext("Error: Backup stream can not be read " @@ -3978,7 +3995,7 @@ zfs_do_receive(int argc, char **argv) return (1); } - err = zfs_receive(g_zfs, argv[0], &flags, STDIN_FILENO, NULL); + err = zfs_receive(g_zfs, argv[0], props, &flags, STDIN_FILENO, NULL); return (err != 0); } Modified: stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Oct 3 08:03:36 2015 (r288571) @@ -3586,7 +3586,8 @@ ztest_dmu_read_write(ztest_ds_t *zd, uin */ n = ztest_random(regions) * stride + ztest_random(width); s = 1 + ztest_random(2 * width - 1); - dmu_prefetch(os, bigobj, n * chunksize, s * chunksize); + dmu_prefetch(os, bigobj, 0, n * chunksize, s * chunksize, + ZIO_PRIORITY_SYNC_READ); /* * Pick a random index and compute the offsets into packobj and bigobj. @@ -5705,8 +5706,10 @@ ztest_run(ztest_shared_t *zs) * Right before closing the pool, kick off a bunch of async I/O; * spa_close() should wait for it to complete. */ - for (uint64_t object = 1; object < 50; object++) - dmu_prefetch(spa->spa_meta_objset, object, 0, 1ULL << 20); + for (uint64_t object = 1; object < 50; object++) { + dmu_prefetch(spa->spa_meta_objset, object, 0, 0, 1ULL << 20, + ZIO_PRIORITY_SYNC_READ); + } spa_close(spa, FTAG); Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 3 08:03:36 2015 (r288571) @@ -668,8 +668,8 @@ typedef struct recvflags { boolean_t nomount; } recvflags_t; -extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t *, - int, avl_tree_t *); +extern int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *, + recvflags_t *, int, avl_tree_t *); typedef enum diff_flags { ZFS_DIFF_PARSEABLE = 0x1, Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Oct 3 08:03:36 2015 (r288571) @@ -3535,7 +3535,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp } static int -zbookmark_compare(const void *a, const void *b) +zbookmark_mem_compare(const void *a, const void *b) { return (memcmp(a, b, sizeof (zbookmark_phys_t))); } @@ -3598,7 +3598,7 @@ zpool_get_errlog(zpool_handle_t *zhp, nv zc.zc_nvlist_dst_size; count -= zc.zc_nvlist_dst_size; - qsort(zb, count, sizeof (zbookmark_phys_t), zbookmark_compare); + qsort(zb, count, sizeof (zbookmark_phys_t), zbookmark_mem_compare); verify(nvlist_alloc(nverrlistp, 0, KM_SLEEP) == 0); Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 3 08:03:36 2015 (r288571) @@ -64,8 +64,9 @@ extern void zfs_setprop_error(libzfs_han /* We need to use something for ENODATA. */ #define ENODATA EIDRM -static int zfs_receive_impl(libzfs_handle_t *, const char *, recvflags_t *, - int, const char *, nvlist_t *, avl_tree_t *, char **, int, uint64_t *); +static int zfs_receive_impl(libzfs_handle_t *, const char *, const char *, + recvflags_t *, int, const char *, nvlist_t *, avl_tree_t *, char **, int, + uint64_t *); static const zio_cksum_t zero_cksum = { 0 }; @@ -2498,7 +2499,7 @@ zfs_receive_package(libzfs_handle_t *hdl * zfs_receive_one() will take care of it (ie, * recv_skip() and return 0). */ - error = zfs_receive_impl(hdl, destname, flags, fd, + error = zfs_receive_impl(hdl, destname, NULL, flags, fd, sendfs, stream_nv, stream_avl, top_zfs, cleanup_fd, action_handlep); if (error == ENODATA) { @@ -2631,9 +2632,9 @@ recv_skip(libzfs_handle_t *hdl, int fd, */ static int zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, - recvflags_t *flags, dmu_replay_record_t *drr, - dmu_replay_record_t *drr_noswap, const char *sendfs, - nvlist_t *stream_nv, avl_tree_t *stream_avl, char **top_zfs, int cleanup_fd, + const char *originsnap, recvflags_t *flags, dmu_replay_record_t *drr, + dmu_replay_record_t *drr_noswap, const char *sendfs, nvlist_t *stream_nv, + avl_tree_t *stream_avl, char **top_zfs, int cleanup_fd, uint64_t *action_handlep) { zfs_cmd_t zc = { 0 }; @@ -2798,10 +2799,15 @@ zfs_receive_one(libzfs_handle_t *hdl, in } if (flags->verbose) (void) printf("found clone origin %s\n", zc.zc_string); + } else if (originsnap) { + (void) strncpy(zc.zc_string, originsnap, ZFS_MAXNAMELEN); + if (flags->verbose) + (void) printf("using provided clone origin %s\n", + zc.zc_string); } stream_wantsnewfs = (drrb->drr_fromguid == 0 || - (drrb->drr_flags & DRR_FLAG_CLONE)); + (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap); if (stream_wantsnewfs) { /* @@ -3179,9 +3185,10 @@ zfs_receive_one(libzfs_handle_t *hdl, in } static int -zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap, recvflags_t *flags, - int infd, const char *sendfs, nvlist_t *stream_nv, avl_tree_t *stream_avl, - char **top_zfs, int cleanup_fd, uint64_t *action_handlep) +zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap, + const char *originsnap, recvflags_t *flags, int infd, const char *sendfs, + nvlist_t *stream_nv, avl_tree_t *stream_avl, char **top_zfs, int cleanup_fd, + uint64_t *action_handlep) { int err; dmu_replay_record_t drr, drr_noswap; @@ -3200,6 +3207,12 @@ zfs_receive_impl(libzfs_handle_t *hdl, c "(%s) does not exist"), tosnap); return (zfs_error(hdl, EZFS_NOENT, errbuf)); } + if (originsnap && + !zfs_dataset_exists(hdl, originsnap, ZFS_TYPE_DATASET)) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "specified origin fs " + "(%s) does not exist"), originsnap); + return (zfs_error(hdl, EZFS_NOENT, errbuf)); + } /* read in the BEGIN record */ if (0 != (err = recv_read(hdl, infd, &drr, sizeof (drr), B_FALSE, @@ -3272,14 +3285,14 @@ zfs_receive_impl(libzfs_handle_t *hdl, c *cp = '\0'; sendfs = nonpackage_sendfs; } - return (zfs_receive_one(hdl, infd, tosnap, flags, - &drr, &drr_noswap, sendfs, stream_nv, stream_avl, - top_zfs, cleanup_fd, action_handlep)); + return (zfs_receive_one(hdl, infd, tosnap, originsnap, flags, + &drr, &drr_noswap, sendfs, stream_nv, stream_avl, top_zfs, + cleanup_fd, action_handlep)); } else { assert(DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_COMPOUNDSTREAM); - return (zfs_receive_package(hdl, infd, tosnap, flags, - &drr, &zcksum, top_zfs, cleanup_fd, action_handlep)); + return (zfs_receive_package(hdl, infd, tosnap, flags, &drr, + &zcksum, top_zfs, cleanup_fd, action_handlep)); } } @@ -3290,18 +3303,24 @@ zfs_receive_impl(libzfs_handle_t *hdl, c * (-1 will override -2). */ int -zfs_receive(libzfs_handle_t *hdl, const char *tosnap, recvflags_t *flags, - int infd, avl_tree_t *stream_avl) +zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props, + recvflags_t *flags, int infd, avl_tree_t *stream_avl) { char *top_zfs = NULL; int err; int cleanup_fd; uint64_t action_handle = 0; + char *originsnap = NULL; + if (props) { + err = nvlist_lookup_string(props, "origin", &originsnap); + if (err && err != ENOENT) + return (err); + } cleanup_fd = open(ZFS_DEV, O_RDWR|O_EXCL); VERIFY(cleanup_fd >= 0); - err = zfs_receive_impl(hdl, tosnap, flags, infd, NULL, NULL, + err = zfs_receive_impl(hdl, tosnap, originsnap, flags, infd, NULL, NULL, stream_avl, &top_zfs, cleanup_fd, &action_handle); VERIFY(0 == close(cleanup_fd)); Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sat Oct 3 08:03:36 2015 (r288571) @@ -135,8 +135,18 @@ extern int aok; /* * DTrace SDT probes have different signatures in userland than they do in - * kernel. If they're being used in kernel code, re-define them out of + * the kernel. If they're being used in kernel code, re-define them out of * existence for their counterparts in libzpool. + * + * Here's an example of how to use the set-error probes in userland: + * zfs$target:::set-error /arg0 == EBUSY/ {stack();} + * + * Here's an example of how to use DTRACE_PROBE probes in userland: + * If there is a probe declared as follows: + * DTRACE_PROBE2(zfs__probe_name, uint64_t, blkid, dnode_t *, dn); + * Then you can use it as follows: + * zfs$target:::probe2 /copyinstr(arg0) == "zfs__probe_name"/ + * {printf("%u %p\n", arg1, arg2);} */ #ifdef DTRACE_PROBE Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Oct 3 08:03:36 2015 (r288571) @@ -22,7 +22,9 @@ # # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved. -# Copyright (c) 2013 by Delphix. All rights reserved. +# Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved. +# Copyright (c) 2012 Joyent, Inc. All rights reserved. +# Copyright (c) 2011, 2014 by Delphix. All rights reserved. # Copyright (c) 2013 by Saso Kiselkov. All rights reserved. # # @@ -36,6 +38,7 @@ ZFS_COMMON_OBJS += \ blkptr.o \ bpobj.o \ bptree.o \ + bqueue.o \ dbuf.o \ ddt.o \ ddt_zap.o \ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Sat Oct 3 08:03:36 2015 (r288571) @@ -154,7 +154,7 @@ bptree_visit_cb(spa_t *spa, zilog_t *zil int err; struct bptree_args *ba = arg; - if (BP_IS_HOLE(bp)) + if (bp == NULL || BP_IS_HOLE(bp)) return (0); err = ba->ba_func(ba->ba_arg, bp, ba->ba_tx); Copied: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c (from r286705, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c Sat Oct 3 08:03:36 2015 (r288571, copy of r286705, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c) @@ -0,0 +1,111 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +#include +#include + +static inline bqueue_node_t * +obj2node(bqueue_t *q, void *data) +{ + return ((bqueue_node_t *)((char *)data + q->bq_node_offset)); +} + +/* + * Initialize a blocking queue The maximum capacity of the queue is set to + * size. Types that want to be stored in a bqueue must contain a bqueue_node_t, + * and offset should give its offset from the start of the struct. Return 0 on + * success, or -1 on failure. + */ +int +bqueue_init(bqueue_t *q, uint64_t size, size_t node_offset) +{ + list_create(&q->bq_list, node_offset + sizeof (bqueue_node_t), + node_offset + offsetof(bqueue_node_t, bqn_node)); + cv_init(&q->bq_add_cv, NULL, CV_DEFAULT, NULL); + cv_init(&q->bq_pop_cv, NULL, CV_DEFAULT, NULL); + mutex_init(&q->bq_lock, NULL, MUTEX_DEFAULT, NULL); + q->bq_node_offset = node_offset; + q->bq_size = 0; + q->bq_maxsize = size; + return (0); +} + +/* + * Destroy a blocking queue. This function asserts that there are no + * elements in the queue, and no one is blocked on the condition + * variables. + */ +void +bqueue_destroy(bqueue_t *q) +{ + ASSERT0(q->bq_size); + cv_destroy(&q->bq_add_cv); + cv_destroy(&q->bq_pop_cv); + mutex_destroy(&q->bq_lock); + list_destroy(&q->bq_list); +} + +/* + * Add data to q, consuming size units of capacity. If there is insufficient + * capacity to consume size units, block until capacity exists. Asserts size is + * > 0. + */ +void +bqueue_enqueue(bqueue_t *q, void *data, uint64_t item_size) +{ + ASSERT3U(item_size, >, 0); + ASSERT3U(item_size, <, q->bq_maxsize); + mutex_enter(&q->bq_lock); + obj2node(q, data)->bqn_size = item_size; + while (q->bq_size + item_size > q->bq_maxsize) { + cv_wait(&q->bq_add_cv, &q->bq_lock); + } + q->bq_size += item_size; + list_insert_tail(&q->bq_list, data); + cv_signal(&q->bq_pop_cv); + mutex_exit(&q->bq_lock); +} +/* + * Take the first element off of q. If there are no elements on the queue, wait + * until one is put there. Return the removed element. + */ +void * +bqueue_dequeue(bqueue_t *q) +{ + void *ret; + uint64_t item_size; + mutex_enter(&q->bq_lock); + while (q->bq_size == 0) { + cv_wait(&q->bq_pop_cv, &q->bq_lock); + } + ret = list_remove_head(&q->bq_list); + item_size = obj2node(q, ret)->bqn_size; + q->bq_size -= item_size; + mutex_exit(&q->bq_lock); + cv_signal(&q->bq_add_cv); + return (ret); +} + +/* + * Returns true if the space used is 0. + */ +boolean_t +bqueue_empty(bqueue_t *q) +{ + return (q->bq_size == 0); +} Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 08:03:36 2015 (r288571) @@ -548,11 +548,35 @@ dbuf_loan_arcbuf(dmu_buf_impl_t *db) return (abuf); } +/* + * Calculate which level n block references the data at the level 0 offset + * provided. + */ uint64_t -dbuf_whichblock(dnode_t *dn, uint64_t offset) +dbuf_whichblock(dnode_t *dn, int64_t level, uint64_t offset) { - if (dn->dn_datablkshift) { - return (offset >> dn->dn_datablkshift); + if (dn->dn_datablkshift != 0 && dn->dn_indblkshift != 0) { + /* + * The level n blkid is equal to the level 0 blkid divided by + * the number of level 0s in a level n block. + * + * The level 0 blkid is offset >> datablkshift = + * offset / 2^datablkshift. + * + * The number of level 0s in a level n is the number of block + * pointers in an indirect block, raised to the power of level. + * This is 2^(indblkshift - SPA_BLKPTRSHIFT)^level = + * 2^(level*(indblkshift - SPA_BLKPTRSHIFT)). + * + * Thus, the level n blkid is: offset / + * ((2^datablkshift)*(2^(level*(indblkshift - SPA_BLKPTRSHIFT))) + * = offset / 2^(datablkshift + level * + * (indblkshift - SPA_BLKPTRSHIFT)) + * = offset >> (datablkshift + level * + * (indblkshift - SPA_BLKPTRSHIFT)) + */ + return (offset >> (dn->dn_datablkshift + level * + (dn->dn_indblkshift - SPA_BLKPTRSHIFT))); } else { ASSERT3U(offset, <, dn->dn_datablksz); return (0); @@ -1715,6 +1739,12 @@ dbuf_clear(dmu_buf_impl_t *db) dbuf_rele(parent, db); } +/* + * Note: While bpp will always be updated if the function returns success, + * parentp will not be updated if the dnode does not have dn_dbuf filled in; + * this happens when the dnode is the meta-dnode, or a userused or groupused + * object. + */ static int dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, int fail_sparse, dmu_buf_impl_t **parentp, blkptr_t **bpp) @@ -1755,7 +1785,7 @@ dbuf_findbp(dnode_t *dn, int level, uint } else if (level < nlevels-1) { /* this block is referenced from an indirect block */ int err = dbuf_hold_impl(dn, level+1, - blkid >> epbs, fail_sparse, NULL, parentp); + blkid >> epbs, fail_sparse, FALSE, NULL, parentp); if (err) return (err); err = dbuf_read(*parentp, NULL, @@ -1930,11 +1960,96 @@ dbuf_destroy(dmu_buf_impl_t *db) arc_space_return(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER); } +typedef struct dbuf_prefetch_arg { + spa_t *dpa_spa; /* The spa to issue the prefetch in. */ + zbookmark_phys_t dpa_zb; /* The target block to prefetch. */ + int dpa_epbs; /* Entries (blkptr_t's) Per Block Shift. */ + int dpa_curlevel; /* The current level that we're reading */ + zio_priority_t dpa_prio; /* The priority I/Os should be issued at. */ + zio_t *dpa_zio; /* The parent zio_t for all prefetches. */ + arc_flags_t dpa_aflags; /* Flags to pass to the final prefetch. */ +} dbuf_prefetch_arg_t; + +/* + * Actually issue the prefetch read for the block given. + */ +static void +dbuf_issue_final_prefetch(dbuf_prefetch_arg_t *dpa, blkptr_t *bp) +{ + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) + return; + + arc_flags_t aflags = + dpa->dpa_aflags | ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH; + + ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp)); + ASSERT3U(dpa->dpa_curlevel, ==, dpa->dpa_zb.zb_level); + ASSERT(dpa->dpa_zio != NULL); + (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, bp, NULL, NULL, + dpa->dpa_prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, + &aflags, &dpa->dpa_zb); +} + +/* + * Called when an indirect block above our prefetch target is read in. This + * will either read in the next indirect block down the tree or issue the actual + * prefetch if the next block down is our target. + */ +static void +dbuf_prefetch_indirect_done(zio_t *zio, arc_buf_t *abuf, void *private) +{ + dbuf_prefetch_arg_t *dpa = private; + + ASSERT3S(dpa->dpa_zb.zb_level, <, dpa->dpa_curlevel); + ASSERT3S(dpa->dpa_curlevel, >, 0); + if (zio != NULL) { + ASSERT3S(BP_GET_LEVEL(zio->io_bp), ==, dpa->dpa_curlevel); + ASSERT3U(BP_GET_LSIZE(zio->io_bp), ==, zio->io_size); + ASSERT3P(zio->io_spa, ==, dpa->dpa_spa); + } + + dpa->dpa_curlevel--; + + uint64_t nextblkid = dpa->dpa_zb.zb_blkid >> + (dpa->dpa_epbs * (dpa->dpa_curlevel - dpa->dpa_zb.zb_level)); + blkptr_t *bp = ((blkptr_t *)abuf->b_data) + + P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs); + if (BP_IS_HOLE(bp) || (zio != NULL && zio->io_error != 0)) { + kmem_free(dpa, sizeof (*dpa)); + } else if (dpa->dpa_curlevel == dpa->dpa_zb.zb_level) { + ASSERT3U(nextblkid, ==, dpa->dpa_zb.zb_blkid); + dbuf_issue_final_prefetch(dpa, bp); + kmem_free(dpa, sizeof (*dpa)); + } else { + arc_flags_t iter_aflags = ARC_FLAG_NOWAIT; + zbookmark_phys_t zb; + + ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp)); + + SET_BOOKMARK(&zb, dpa->dpa_zb.zb_objset, + dpa->dpa_zb.zb_object, dpa->dpa_curlevel, nextblkid); + + (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, + bp, dbuf_prefetch_indirect_done, dpa, dpa->dpa_prio, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, + &iter_aflags, &zb); + } + (void) arc_buf_remove_ref(abuf, private); +} + +/* + * Issue prefetch reads for the given block on the given level. If the indirect + * blocks above that block are not in memory, we will read them in + * asynchronously. As a result, this call never blocks waiting for a read to + * complete. + */ void -dbuf_prefetch(dnode_t *dn, uint64_t blkid, zio_priority_t prio) +dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blkid, zio_priority_t prio, + arc_flags_t aflags) { - dmu_buf_impl_t *db = NULL; - blkptr_t *bp = NULL; + blkptr_t bp; + int epbs, nlevels, curlevel; + uint64_t curblkid; ASSERT(blkid != DMU_BONUS_BLKID); ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); @@ -1942,35 +2057,104 @@ dbuf_prefetch(dnode_t *dn, uint64_t blki if (dnode_block_freed(dn, blkid)) return; - /* dbuf_find() returns with db_mtx held */ - if (db = dbuf_find(dn->dn_objset, dn->dn_object, 0, blkid)) { + /* + * This dnode hasn't been written to disk yet, so there's nothing to + * prefetch. + */ + nlevels = dn->dn_phys->dn_nlevels; + if (level >= nlevels || dn->dn_phys->dn_nblkptr == 0) + return; + + epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + if (dn->dn_phys->dn_maxblkid < blkid << (epbs * level)) + return; + + dmu_buf_impl_t *db = dbuf_find(dn->dn_objset, dn->dn_object, + level, blkid); + if (db != NULL) { + mutex_exit(&db->db_mtx); /* - * This dbuf is already in the cache. We assume that - * it is already CACHED, or else about to be either - * read or filled. + * This dbuf already exists. It is either CACHED, or + * (we assume) about to be read or filled. */ - mutex_exit(&db->db_mtx); return; } - if (dbuf_findbp(dn, 0, blkid, TRUE, &db, &bp) == 0) { - if (bp && !BP_IS_HOLE(bp) && !BP_IS_EMBEDDED(bp)) { - dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; - arc_flags_t aflags = - ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH; - zbookmark_phys_t zb; - - SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, - dn->dn_object, 0, blkid); - - (void) arc_read(NULL, dn->dn_objset->os_spa, - bp, NULL, NULL, prio, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, - &aflags, &zb); + /* + * Find the closest ancestor (indirect block) of the target block + * that is present in the cache. In this indirect block, we will + * find the bp that is at curlevel, curblkid. + */ + curlevel = level; + curblkid = blkid; + while (curlevel < nlevels - 1) { + int parent_level = curlevel + 1; + uint64_t parent_blkid = curblkid >> epbs; + dmu_buf_impl_t *db; + + if (dbuf_hold_impl(dn, parent_level, parent_blkid, + FALSE, TRUE, FTAG, &db) == 0) { + blkptr_t *bpp = db->db_buf->b_data; + bp = bpp[P2PHASE(curblkid, 1 << epbs)]; + dbuf_rele(db, FTAG); + break; } - if (db) - dbuf_rele(db, NULL); + + curlevel = parent_level; + curblkid = parent_blkid; + } + + if (curlevel == nlevels - 1) { + /* No cached indirect blocks found. */ + ASSERT3U(curblkid, <, dn->dn_phys->dn_nblkptr); + bp = dn->dn_phys->dn_blkptr[curblkid]; } + if (BP_IS_HOLE(&bp)) + return; + + ASSERT3U(curlevel, ==, BP_GET_LEVEL(&bp)); + + zio_t *pio = zio_root(dmu_objset_spa(dn->dn_objset), NULL, NULL, + ZIO_FLAG_CANFAIL); + + dbuf_prefetch_arg_t *dpa = kmem_zalloc(sizeof (*dpa), KM_SLEEP); + dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; + SET_BOOKMARK(&dpa->dpa_zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET, + dn->dn_object, level, blkid); + dpa->dpa_curlevel = curlevel; + dpa->dpa_prio = prio; + dpa->dpa_aflags = aflags; + dpa->dpa_spa = dn->dn_objset->os_spa; + dpa->dpa_epbs = epbs; + dpa->dpa_zio = pio; + + /* + * If we have the indirect just above us, no need to do the asynchronous + * prefetch chain; we'll just run the last step ourselves. If we're at + * a higher level, though, we want to issue the prefetches for all the + * indirect blocks asynchronously, so we can go on with whatever we were + * doing. + */ + if (curlevel == level) { + ASSERT3U(curblkid, ==, blkid); + dbuf_issue_final_prefetch(dpa, &bp); + kmem_free(dpa, sizeof (*dpa)); + } else { + arc_flags_t iter_aflags = ARC_FLAG_NOWAIT; + zbookmark_phys_t zb; + + SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET, + dn->dn_object, curlevel, curblkid); + (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, + &bp, dbuf_prefetch_indirect_done, dpa, prio, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, + &iter_aflags, &zb); + } + /* + * We use pio here instead of dpa_zio since it's possible that + * dpa may have already been freed. + */ + zio_nowait(pio); } /* @@ -1978,7 +2162,8 @@ dbuf_prefetch(dnode_t *dn, uint64_t blki * Note: dn_struct_rwlock must be held. */ int -dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid, int fail_sparse, +dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid, + boolean_t fail_sparse, boolean_t fail_uncached, void *tag, dmu_buf_impl_t **dbp) { dmu_buf_impl_t *db, *parent = NULL; @@ -1996,6 +2181,9 @@ top: blkptr_t *bp = NULL; int err; + if (fail_uncached) + return (SET_ERROR(ENOENT)); + ASSERT3P(parent, ==, NULL); err = dbuf_findbp(dn, level, blkid, fail_sparse, &parent, &bp); if (fail_sparse) { @@ -2012,6 +2200,11 @@ top: db = dbuf_create(dn, level, blkid, parent, bp); } + if (fail_uncached && db->db_state != DB_CACHED) { + mutex_exit(&db->db_mtx); + return (SET_ERROR(ENOENT)); + } + if (db->db_buf && refcount_is_zero(&db->db_holds)) { arc_buf_add_ref(db->db_buf, db); if (db->db_buf->b_data == NULL) { @@ -2067,16 +2260,14 @@ top: dmu_buf_impl_t * dbuf_hold(dnode_t *dn, uint64_t blkid, void *tag) { - dmu_buf_impl_t *db; - int err = dbuf_hold_impl(dn, 0, blkid, FALSE, tag, &db); - return (err ? NULL : db); + return (dbuf_hold_level(dn, 0, blkid, tag)); } dmu_buf_impl_t * dbuf_hold_level(dnode_t *dn, int level, uint64_t blkid, void *tag) { dmu_buf_impl_t *db; - int err = dbuf_hold_impl(dn, level, blkid, FALSE, tag, &db); + int err = dbuf_hold_impl(dn, level, blkid, FALSE, FALSE, tag, &db); return (err ? NULL : db); } @@ -2429,8 +2620,8 @@ dbuf_check_blkptr(dnode_t *dn, dmu_buf_i if (parent == NULL) { mutex_exit(&db->db_mtx); rw_enter(&dn->dn_struct_rwlock, RW_READER); - (void) dbuf_hold_impl(dn, db->db_level+1, - db->db_blkid >> epbs, FALSE, db, &parent); + parent = dbuf_hold_level(dn, db->db_level + 1, + db->db_blkid >> epbs, db); rw_exit(&dn->dn_struct_rwlock); mutex_enter(&db->db_mtx); db->db_parent = parent; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 08:03:36 2015 (r288571) @@ -142,7 +142,7 @@ dmu_buf_hold_noread(objset_t *os, uint64 err = dnode_hold(os, object, FTAG, &dn); if (err) return (err); - blkid = dbuf_whichblock(dn, offset); + blkid = dbuf_whichblock(dn, 0, offset); rw_enter(&dn->dn_struct_rwlock, RW_READER); db = dbuf_hold(dn, blkid, tag); rw_exit(&dn->dn_struct_rwlock); @@ -425,7 +425,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); - blkid = dbuf_whichblock(dn, offset); + blkid = dbuf_whichblock(dn, 0, offset); for (i = 0; i < nblks; i++) { dmu_buf_impl_t *db = dbuf_hold(dn, blkid+i, tag); if (db == NULL) { @@ -529,17 +529,16 @@ dmu_buf_rele_array(dmu_buf_t **dbp_fake, } /* - * Issue prefetch i/os for the given blocks. + * Issue prefetch i/os for the given blocks. If level is greater than 0, the + * indirect blocks prefeteched will be those that point to the blocks containing + * the data starting at offset, and continuing to offset + len. * - * Note: The assumption is that we *know* these blocks will be needed - * almost immediately. Therefore, the prefetch i/os will be issued at - * ZIO_PRIORITY_SYNC_READ - * - * Note: indirect blocks and other metadata will be read synchronously, - * causing this function to block if they are not already cached. + * Note that if the indirect blocks above the blocks being prefetched are not in + * cache, they will be asychronously read in. */ void -dmu_prefetch(objset_t *os, uint64_t object, uint64_t offset, uint64_t len) +dmu_prefetch(objset_t *os, uint64_t object, int64_t level, uint64_t offset, + uint64_t len, zio_priority_t pri) { dnode_t *dn; uint64_t blkid; @@ -555,8 +554,9 @@ dmu_prefetch(objset_t *os, uint64_t obje return; rw_enter(&dn->dn_struct_rwlock, RW_READER); - blkid = dbuf_whichblock(dn, object * sizeof (dnode_phys_t)); - dbuf_prefetch(dn, blkid, ZIO_PRIORITY_SYNC_READ); + blkid = dbuf_whichblock(dn, level, + object * sizeof (dnode_phys_t)); + dbuf_prefetch(dn, level, blkid, pri, 0); rw_exit(&dn->dn_struct_rwlock); return; } @@ -571,18 +571,24 @@ dmu_prefetch(objset_t *os, uint64_t obje return; rw_enter(&dn->dn_struct_rwlock, RW_READER); - if (dn->dn_datablkshift) { - int blkshift = dn->dn_datablkshift; - nblks = (P2ROUNDUP(offset + len, 1 << blkshift) - - P2ALIGN(offset, 1 << blkshift)) >> blkshift; + /* + * offset + len - 1 is the last byte we want to prefetch for, and offset + * is the first. Then dbuf_whichblk(dn, level, off + len - 1) is the + * last block we want to prefetch, and dbuf_whichblock(dn, level, + * offset) is the first. Then the number we need to prefetch is the + * last - first + 1. + */ + if (level > 0 || dn->dn_datablkshift != 0) { + nblks = dbuf_whichblock(dn, level, offset + len - 1) - + dbuf_whichblock(dn, level, offset) + 1; } else { nblks = (offset < dn->dn_datablksz); } if (nblks != 0) { - blkid = dbuf_whichblock(dn, offset); + blkid = dbuf_whichblock(dn, level, offset); for (int i = 0; i < nblks; i++) - dbuf_prefetch(dn, blkid + i, ZIO_PRIORITY_SYNC_READ); + dbuf_prefetch(dn, level, blkid + i, pri, 0); } rw_exit(&dn->dn_struct_rwlock); @@ -1394,7 +1400,7 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin DB_DNODE_ENTER(dbuf); dn = DB_DNODE(dbuf); rw_enter(&dn->dn_struct_rwlock, RW_READER); - blkid = dbuf_whichblock(dn, offset); + blkid = dbuf_whichblock(dn, 0, offset); VERIFY((db = dbuf_hold(dn, blkid, FTAG)) != NULL); rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(dbuf); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c Sat Oct 3 08:03:36 2015 (r288571) @@ -138,7 +138,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, cons if (issig(JUSTLOOKING) && issig(FORREAL)) return (SET_ERROR(EINTR)); - if (zb->zb_object != DMU_META_DNODE_OBJECT) + if (bp == NULL || zb->zb_object != DMU_META_DNODE_OBJECT) return (0); if (BP_IS_HOLE(bp)) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Sat Oct 3 08:03:36 2015 (r288571) @@ -148,6 +148,11 @@ dmu_object_free(objset_t *os, uint64_t o return (0); } +/* + * Return (in *objectp) the next object which is allocated (or a hole) + * after *object, taking into account only objects that may have been modified + * after the specified txg. + */ int dmu_object_next(objset_t *os, uint64_t *objectp, boolean_t hole, uint64_t txg) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 07:59:25 2015 (r288570) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 08:03:36 2015 (r288571) @@ -53,6 +53,7 @@ #include #include #include +#include #ifdef __FreeBSD__ #undef dump_write @@ -61,10 +62,34 @@ /* Set this tunable to TRUE to replace corrupt data with 0x2f5baddb10c */ int zfs_send_corrupt_data = B_FALSE; +int zfs_send_queue_length = 16 * 1024 * 1024; +int zfs_recv_queue_length = 16 * 1024 * 1024; static char *dmu_recv_tag = "dmu_recv_tag"; static const char *recv_clone_name = "%recv"; +#define BP_SPAN(datablkszsec, indblkshift, level) \ + (((uint64_t)datablkszsec) << (SPA_MINBLOCKSHIFT + \ + (level) * (indblkshift - SPA_BLKPTRSHIFT))) + +struct send_thread_arg { + bqueue_t q; + dsl_dataset_t *ds; /* Dataset to traverse */ + uint64_t fromtxg; /* Traverse from this txg */ + int flags; /* flags to pass to traverse_dataset */ + int error_code; + boolean_t cancel; +}; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 08:05:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F67AA0DAFD; Sat, 3 Oct 2015 08:05:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A4B517F0; Sat, 3 Oct 2015 08:05:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9385bs5083579; Sat, 3 Oct 2015 08:05:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9385YJ9083565; Sat, 3 Oct 2015 08:05:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030805.t9385YJ9083565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 08:05:34 +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: r288572 - in stable/10: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/o... 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 08:05:37 -0000 Author: mav Date: Sat Oct 3 08:05:33 2015 New Revision: 288572 URL: https://svnweb.freebsd.org/changeset/base/288572 Log: MFC r286708: 5959 clean up per-dataset feature count code Reviewed by: Toomas Soome Reviewed by: George Wilson Reviewed by: Alex Reece Approved by: Richard Lowe Author: Matthew Ahrens illumos/illumos-gate@ca0cc3918a1789fa839194af2a9245f801a06b1a A ZFS feature flags (large blocks) tracks its refcounts as the number of datasets that have ever used the feature. Several features of this type are planned to be added (new checksum functions). This code should be made common infrastructure rather than duplicating the code for each feature. Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/cddl/contrib/opensolaris/cmd/zhack/zhack.c stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 08:05:33 2015 (r288572) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ #include @@ -2222,7 +2222,7 @@ dump_label(const char *dev) (void) close(fd); } -static uint64_t num_large_blocks; +static uint64_t dataset_feature_count[SPA_FEATURES]; /*ARGSUSED*/ static int @@ -2236,8 +2236,15 @@ dump_one_dir(const char *dsname, void *a (void) printf("Could not open %s, error %d\n", dsname, error); return (0); } - if (dmu_objset_ds(os)->ds_large_blocks) - num_large_blocks++; + + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (!dmu_objset_ds(os)->ds_feature_inuse[f]) + continue; + ASSERT(spa_feature_table[f].fi_flags & + ZFEATURE_FLAG_PER_DATASET); + dataset_feature_count[f]++; + } + dump_dir(os); dmu_objset_disown(os, FTAG); fuid_table_destroy(); @@ -3036,7 +3043,6 @@ dump_zpool(spa_t *spa) dump_metaslab_groups(spa); if (dump_opt['d'] || dump_opt['i']) { - uint64_t refcount; dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { dump_full_bpobj(&spa->spa_deferred_bpobj, @@ -3058,17 +3064,29 @@ dump_zpool(spa_t *spa) (void) dmu_objset_find(spa_name(spa), dump_one_dir, NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN); - (void) feature_get_refcount(spa, - &spa_feature_table[SPA_FEATURE_LARGE_BLOCKS], &refcount); - if (num_large_blocks != refcount) { - (void) printf("large_blocks feature refcount mismatch: " - "expected %lld != actual %lld\n", - (longlong_t)num_large_blocks, - (longlong_t)refcount); - rc = 2; - } else { - (void) printf("Verified large_blocks feature refcount " - "is correct (%llu)\n", (longlong_t)refcount); + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + uint64_t refcount; + + if (!(spa_feature_table[f].fi_flags & + ZFEATURE_FLAG_PER_DATASET)) { + ASSERT0(dataset_feature_count[f]); + continue; + } + (void) feature_get_refcount(spa, + &spa_feature_table[f], &refcount); + if (dataset_feature_count[f] != refcount) { + (void) printf("%s feature refcount mismatch: " + "%lld datasets != %lld refcount\n", + spa_feature_table[f].fi_uname, + (longlong_t)dataset_feature_count[f], + (longlong_t)refcount); + rc = 2; + } else { + (void) printf("Verified %s feature refcount " + "of %llu is correct\n", + spa_feature_table[f].fi_uname, + (longlong_t)refcount); + } } } if (rc == 0 && (dump_opt['b'] || dump_opt['c'])) Modified: stable/10/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zhack/zhack.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/cddl/contrib/opensolaris/cmd/zhack/zhack.c Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -294,8 +294,8 @@ zhack_feature_enable_sync(void *arg, dmu feature_enable_sync(spa, feature, tx); spa_history_log_internal(spa, "zhack enable feature", tx, - "name=%s can_readonly=%u", - feature->fi_guid, feature->fi_can_readonly); + "guid=%s flags=%x", + feature->fi_guid, feature->fi_flags); } static void @@ -314,9 +314,7 @@ zhack_do_feature_enable(int argc, char * */ desc = NULL; feature.fi_uname = "zhack"; - feature.fi_mos = B_FALSE; - feature.fi_can_readonly = B_FALSE; - feature.fi_activate_on_enable = B_FALSE; + feature.fi_flags = 0; feature.fi_depends = nodeps; feature.fi_feature = SPA_FEATURE_NONE; @@ -324,7 +322,7 @@ zhack_do_feature_enable(int argc, char * while ((c = getopt(argc, argv, "rmd:")) != -1) { switch (c) { case 'r': - feature.fi_can_readonly = B_TRUE; + feature.fi_flags |= ZFEATURE_FLAG_READONLY_COMPAT; break; case 'd': desc = strdup(optarg); @@ -413,7 +411,7 @@ zhack_do_feature_ref(int argc, char **ar * disk later. */ feature.fi_uname = "zhack"; - feature.fi_mos = B_FALSE; + feature.fi_flags = 0; feature.fi_desc = NULL; feature.fi_depends = nodeps; feature.fi_feature = SPA_FEATURE_NONE; @@ -422,7 +420,7 @@ zhack_do_feature_ref(int argc, char **ar while ((c = getopt(argc, argv, "md")) != -1) { switch (c) { case 'm': - feature.fi_mos = B_TRUE; + feature.fi_flags |= ZFEATURE_FLAG_MOS; break; case 'd': decr = B_TRUE; @@ -455,10 +453,10 @@ zhack_do_feature_ref(int argc, char **ar if (0 == zap_contains(mos, spa->spa_feat_for_read_obj, feature.fi_guid)) { - feature.fi_can_readonly = B_FALSE; + feature.fi_flags &= ~ZFEATURE_FLAG_READONLY_COMPAT; } else if (0 == zap_contains(mos, spa->spa_feat_for_write_obj, feature.fi_guid)) { - feature.fi_can_readonly = B_TRUE; + feature.fi_flags |= ZFEATURE_FLAG_READONLY_COMPAT; } else { fatal(spa, FTAG, "feature is not enabled: %s", feature.fi_guid); } Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Oct 3 08:05:33 2015 (r288572) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. @@ -4986,7 +4986,8 @@ zpool_do_upgrade(int argc, char **argv) "---------------\n"); for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *fi = &spa_feature_table[i]; - const char *ro = fi->fi_can_readonly ? + const char *ro = + (fi->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? " (read-only compatible)" : ""; (void) printf("%-37s%s\n", fi->fi_uname, ro); Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. @@ -129,15 +129,15 @@ zfeature_depends_on(spa_feature_t fid, s static void zfeature_register(spa_feature_t fid, const char *guid, const char *name, - const char *desc, boolean_t readonly, boolean_t mos, - boolean_t activate_on_enable, const spa_feature_t *deps) + const char *desc, zfeature_flags_t flags, const spa_feature_t *deps) { zfeature_info_t *feature = &spa_feature_table[fid]; static spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; ASSERT(name != NULL); ASSERT(desc != NULL); - ASSERT(!readonly || !mos); + ASSERT((flags & ZFEATURE_FLAG_READONLY_COMPAT) == 0 || + (flags & ZFEATURE_FLAG_MOS) == 0); ASSERT3U(fid, <, SPA_FEATURES); ASSERT(zfeature_is_valid_guid(guid)); @@ -148,9 +148,7 @@ zfeature_register(spa_feature_t fid, con feature->fi_guid = guid; feature->fi_uname = name; feature->fi_desc = desc; - feature->fi_can_readonly = readonly; - feature->fi_mos = mos; - feature->fi_activate_on_enable = activate_on_enable; + feature->fi_flags = flags; feature->fi_depends = deps; } @@ -159,45 +157,46 @@ zpool_feature_init(void) { zfeature_register(SPA_FEATURE_ASYNC_DESTROY, "com.delphix:async_destroy", "async_destroy", - "Destroy filesystems asynchronously.", B_TRUE, B_FALSE, - B_FALSE, NULL); + "Destroy filesystems asynchronously.", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); zfeature_register(SPA_FEATURE_EMPTY_BPOBJ, "com.delphix:empty_bpobj", "empty_bpobj", - "Snapshots use less space.", B_TRUE, B_FALSE, - B_FALSE, NULL); + "Snapshots use less space.", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); zfeature_register(SPA_FEATURE_LZ4_COMPRESS, "org.illumos:lz4_compress", "lz4_compress", - "LZ4 compression algorithm support.", B_FALSE, B_FALSE, - B_TRUE, NULL); + "LZ4 compression algorithm support.", + ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, NULL); zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, "com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump", - "Crash dumps to multiple vdev pools.", B_FALSE, B_FALSE, - B_FALSE, NULL); + "Crash dumps to multiple vdev pools.", + 0, NULL); zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM, "com.delphix:spacemap_histogram", "spacemap_histogram", - "Spacemaps maintain space histograms.", B_TRUE, B_FALSE, - B_FALSE, NULL); + "Spacemaps maintain space histograms.", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); zfeature_register(SPA_FEATURE_ENABLED_TXG, "com.delphix:enabled_txg", "enabled_txg", - "Record txg at which a feature is enabled", B_TRUE, B_FALSE, - B_FALSE, NULL); + "Record txg at which a feature is enabled", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); static spa_feature_t hole_birth_deps[] = { SPA_FEATURE_ENABLED_TXG, SPA_FEATURE_NONE }; zfeature_register(SPA_FEATURE_HOLE_BIRTH, "com.delphix:hole_birth", "hole_birth", "Retain hole birth txg for more precise zfs send", - B_FALSE, B_TRUE, B_TRUE, hole_birth_deps); + ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, + hole_birth_deps); zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET, "com.delphix:extensible_dataset", "extensible_dataset", "Enhanced dataset functionality, used by other features.", - B_FALSE, B_FALSE, B_FALSE, NULL); + 0, NULL); static const spa_feature_t bookmarks_deps[] = { SPA_FEATURE_EXTENSIBLE_DATASET, @@ -206,7 +205,7 @@ zpool_feature_init(void) zfeature_register(SPA_FEATURE_BOOKMARKS, "com.delphix:bookmarks", "bookmarks", "\"zfs bookmark\" command", - B_TRUE, B_FALSE, B_FALSE, bookmarks_deps); + ZFEATURE_FLAG_READONLY_COMPAT, bookmarks_deps); static const spa_feature_t filesystem_limits_deps[] = { SPA_FEATURE_EXTENSIBLE_DATASET, @@ -214,13 +213,14 @@ zpool_feature_init(void) }; zfeature_register(SPA_FEATURE_FS_SS_LIMIT, "com.joyent:filesystem_limits", "filesystem_limits", - "Filesystem and snapshot limits.", B_TRUE, B_FALSE, B_FALSE, - filesystem_limits_deps); + "Filesystem and snapshot limits.", + ZFEATURE_FLAG_READONLY_COMPAT, filesystem_limits_deps); zfeature_register(SPA_FEATURE_EMBEDDED_DATA, "com.delphix:embedded_data", "embedded_data", "Blocks which compress very well use even less space.", - B_FALSE, B_TRUE, B_TRUE, NULL); + ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, + NULL); static const spa_feature_t large_blocks_deps[] = { SPA_FEATURE_EXTENSIBLE_DATASET, @@ -228,6 +228,6 @@ zpool_feature_init(void) }; zfeature_register(SPA_FEATURE_LARGE_BLOCKS, "org.open-zfs:large_blocks", "large_blocks", - "Support for blocks larger than 128KB.", B_FALSE, B_FALSE, B_FALSE, - large_blocks_deps); + "Support for blocks larger than 128KB.", + ZFEATURE_FLAG_PER_DATASET, large_blocks_deps); } Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -56,15 +56,23 @@ typedef enum spa_feature { #define SPA_FEATURE_DISABLED (-1ULL) +typedef enum zfeature_flags { + /* Can open pool readonly even if this feature is not supported. */ + ZFEATURE_FLAG_READONLY_COMPAT = (1 << 0), + /* Is this feature necessary to read the MOS? */ + ZFEATURE_FLAG_MOS = (1 << 1), + /* Activate this feature at the same time it is enabled. */ + ZFEATURE_FLAG_ACTIVATE_ON_ENABLE = (1 << 2), + /* Each dataset has a field set if it has ever used this feature. */ + ZFEATURE_FLAG_PER_DATASET = (1 << 3) +} zfeature_flags_t; + typedef struct zfeature_info { spa_feature_t fi_feature; const char *fi_uname; /* User-facing feature name */ const char *fi_guid; /* On-disk feature identifier */ const char *fi_desc; /* Feature description */ - boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */ - boolean_t fi_mos; /* Is the feature necessary to read the MOS? */ - /* Activate this feature at the same time it is enabled */ - boolean_t fi_activate_on_enable; + zfeature_flags_t fi_flags; /* array of dependencies, terminated by SPA_FEATURE_NONE */ const spa_feature_t *fi_depends; } zfeature_info_t; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 08:05:33 2015 (r288572) @@ -1573,6 +1573,11 @@ dmu_buf_write_embedded(dmu_buf_t *dbuf, struct dirty_leaf *dl; dmu_object_type_t type; + if (etype == BP_EMBEDDED_TYPE_DATA) { + ASSERT(spa_feature_is_active(dmu_objset_spa(db->db_objset), + SPA_FEATURE_EMBEDDED_DATA)); + } + DB_DNODE_ENTER(db); type = DB_DNODE(db)->dn_type; DB_DNODE_EXIT(db); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 08:05:33 2015 (r288572) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright 2014 HybridCluster. All rights reserved. @@ -721,7 +721,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, } #endif - if (large_block_ok && to_ds->ds_large_blocks) + if (large_block_ok && to_ds->ds_feature_inuse[SPA_FEATURE_LARGE_BLOCKS]) featureflags |= DMU_BACKUP_FEATURE_LARGE_BLOCKS; if (embedok && spa_feature_is_active(dp->dp_spa, SPA_FEATURE_EMBEDDED_DATA)) { @@ -1379,13 +1379,6 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t } VERIFY0(dsl_dataset_own_obj(dp, dsobj, dmu_recv_tag, &newds)); - if ((DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) & - DMU_BACKUP_FEATURE_LARGE_BLOCKS) && - !newds->ds_large_blocks) { - dsl_dataset_activate_large_blocks_sync_impl(dsobj, tx); - newds->ds_large_blocks = B_TRUE; - } - dmu_buf_will_dirty(newds->ds_dbuf, tx); dsl_dataset_phys(newds)->ds_flags |= DS_FLAG_INCONSISTENT; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Oct 3 08:05:33 2015 (r288572) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -130,8 +130,10 @@ dsl_dataset_block_born(dsl_dataset_t *ds dsl_dataset_phys(ds)->ds_compressed_bytes += compressed; dsl_dataset_phys(ds)->ds_uncompressed_bytes += uncompressed; dsl_dataset_phys(ds)->ds_unique_bytes += used; - if (BP_GET_LSIZE(bp) > SPA_OLD_MAXBLOCKSIZE) - ds->ds_need_large_blocks = B_TRUE; + if (BP_GET_LSIZE(bp) > SPA_OLD_MAXBLOCKSIZE) { + ds->ds_feature_activation_needed[SPA_FEATURE_LARGE_BLOCKS] = + B_TRUE; + } mutex_exit(&ds->ds_lock); dsl_dir_diduse_space(ds->ds_dir, DD_USED_HEAD, delta, compressed, uncompressed, tx); @@ -433,19 +435,23 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin offsetof(dmu_sendarg_t, dsa_link)); if (doi.doi_type == DMU_OTN_ZAP_METADATA) { - int zaperr = zap_contains(mos, dsobj, - DS_FIELD_LARGE_BLOCKS); - if (zaperr != ENOENT) { - VERIFY0(zaperr); - ds->ds_large_blocks = B_TRUE; + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (!(spa_feature_table[f].fi_flags & + ZFEATURE_FLAG_PER_DATASET)) + continue; + err = zap_contains(mos, dsobj, + spa_feature_table[f].fi_guid); + if (err == 0) { + ds->ds_feature_inuse[f] = B_TRUE; + } else { + ASSERT3U(err, ==, ENOENT); + err = 0; + } } } - if (err == 0) { - err = dsl_dir_hold_obj(dp, - dsl_dataset_phys(ds)->ds_dir_obj, NULL, ds, - &ds->ds_dir); - } + err = dsl_dir_hold_obj(dp, + dsl_dataset_phys(ds)->ds_dir_obj, NULL, ds, &ds->ds_dir); if (err != 0) { mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); @@ -701,6 +707,34 @@ dsl_dataset_tryown(dsl_dataset_t *ds, vo return (gotit); } +static void +dsl_dataset_activate_feature(uint64_t dsobj, spa_feature_t f, dmu_tx_t *tx) +{ + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + objset_t *mos = dmu_tx_pool(tx)->dp_meta_objset; + uint64_t zero = 0; + + VERIFY(spa_feature_table[f].fi_flags & ZFEATURE_FLAG_PER_DATASET); + + spa_feature_incr(spa, f, tx); + dmu_object_zapify(mos, dsobj, DMU_OT_DSL_DATASET, tx); + + VERIFY0(zap_add(mos, dsobj, spa_feature_table[f].fi_guid, + sizeof (zero), 1, &zero, tx)); +} + +void +dsl_dataset_deactivate_feature(uint64_t dsobj, spa_feature_t f, dmu_tx_t *tx) +{ + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + objset_t *mos = dmu_tx_pool(tx)->dp_meta_objset; + + VERIFY(spa_feature_table[f].fi_flags & ZFEATURE_FLAG_PER_DATASET); + + VERIFY0(zap_remove(mos, dsobj, spa_feature_table[f].fi_guid, tx)); + spa_feature_decr(spa, f, tx); +} + uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin, uint64_t flags, dmu_tx_t *tx) @@ -761,8 +795,10 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd dsphys->ds_flags |= dsl_dataset_phys(origin)->ds_flags & (DS_FLAG_INCONSISTENT | DS_FLAG_CI_DATASET); - if (origin->ds_large_blocks) - dsl_dataset_activate_large_blocks_sync_impl(dsobj, tx); + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (origin->ds_feature_inuse[f]) + dsl_dataset_activate_feature(dsobj, f, tx); + } dmu_buf_will_dirty(origin->ds_dbuf, tx); dsl_dataset_phys(origin)->ds_num_children++; @@ -1324,8 +1360,10 @@ dsl_dataset_snapshot_sync_impl(dsl_datas dsphys->ds_bp = dsl_dataset_phys(ds)->ds_bp; dmu_buf_rele(dbuf, FTAG); - if (ds->ds_large_blocks) - dsl_dataset_activate_large_blocks_sync_impl(dsobj, tx); + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (ds->ds_feature_inuse[f]) + dsl_dataset_activate_feature(dsobj, f, tx); + } ASSERT3U(ds->ds_prev != 0, ==, dsl_dataset_phys(ds)->ds_prev_snap_obj != 0); @@ -1617,9 +1655,13 @@ dsl_dataset_sync(dsl_dataset_t *ds, zio_ dmu_objset_sync(ds->ds_objset, zio, tx); - if (ds->ds_need_large_blocks && !ds->ds_large_blocks) { - dsl_dataset_activate_large_blocks_sync_impl(ds->ds_object, tx); - ds->ds_large_blocks = B_TRUE; + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (ds->ds_feature_activation_needed[f]) { + if (ds->ds_feature_inuse[f]) + continue; + dsl_dataset_activate_feature(ds->ds_object, f, tx); + ds->ds_feature_inuse[f] = B_TRUE; + } } } @@ -2783,6 +2825,40 @@ dsl_dataset_clone_swap_sync_impl(dsl_dat dsl_dataset_phys(clone)->ds_unique_bytes <= origin_head->ds_quota); ASSERT3P(clone->ds_prev, ==, origin_head->ds_prev); + /* + * Swap per-dataset feature flags. + */ + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (!(spa_feature_table[f].fi_flags & + ZFEATURE_FLAG_PER_DATASET)) { + ASSERT(!clone->ds_feature_inuse[f]); + ASSERT(!origin_head->ds_feature_inuse[f]); + continue; + } + + boolean_t clone_inuse = clone->ds_feature_inuse[f]; + boolean_t origin_head_inuse = origin_head->ds_feature_inuse[f]; + + if (clone_inuse) { + dsl_dataset_deactivate_feature(clone->ds_object, f, tx); + clone->ds_feature_inuse[f] = B_FALSE; + } + if (origin_head_inuse) { + dsl_dataset_deactivate_feature(origin_head->ds_object, + f, tx); + origin_head->ds_feature_inuse[f] = B_FALSE; + } + if (clone_inuse) { + dsl_dataset_activate_feature(origin_head->ds_object, + f, tx); + origin_head->ds_feature_inuse[f] = B_TRUE; + } + if (origin_head_inuse) { + dsl_dataset_activate_feature(clone->ds_object, f, tx); + clone->ds_feature_inuse[f] = B_TRUE; + } + } + dmu_buf_will_dirty(clone->ds_dbuf, tx); dmu_buf_will_dirty(origin_head->ds_dbuf, tx); @@ -3337,77 +3413,6 @@ dsl_dataset_space_wouldfree(dsl_dataset_ return (err); } -static int -dsl_dataset_activate_large_blocks_check(void *arg, dmu_tx_t *tx) -{ - const char *dsname = arg; - dsl_dataset_t *ds; - dsl_pool_t *dp = dmu_tx_pool(tx); - int error = 0; - - if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LARGE_BLOCKS)) - return (SET_ERROR(ENOTSUP)); - - ASSERT(spa_feature_is_enabled(dp->dp_spa, - SPA_FEATURE_EXTENSIBLE_DATASET)); - - error = dsl_dataset_hold(dp, dsname, FTAG, &ds); - if (error != 0) - return (error); - - if (ds->ds_large_blocks) - error = EALREADY; - dsl_dataset_rele(ds, FTAG); - - return (error); -} - -void -dsl_dataset_activate_large_blocks_sync_impl(uint64_t dsobj, dmu_tx_t *tx) -{ - spa_t *spa = dmu_tx_pool(tx)->dp_spa; - objset_t *mos = dmu_tx_pool(tx)->dp_meta_objset; - uint64_t zero = 0; - - spa_feature_incr(spa, SPA_FEATURE_LARGE_BLOCKS, tx); - dmu_object_zapify(mos, dsobj, DMU_OT_DSL_DATASET, tx); - - VERIFY0(zap_add(mos, dsobj, DS_FIELD_LARGE_BLOCKS, - sizeof (zero), 1, &zero, tx)); -} - -static void -dsl_dataset_activate_large_blocks_sync(void *arg, dmu_tx_t *tx) -{ - const char *dsname = arg; - dsl_dataset_t *ds; - - VERIFY0(dsl_dataset_hold(dmu_tx_pool(tx), dsname, FTAG, &ds)); - - dsl_dataset_activate_large_blocks_sync_impl(ds->ds_object, tx); - ASSERT(!ds->ds_large_blocks); - ds->ds_large_blocks = B_TRUE; - dsl_dataset_rele(ds, FTAG); -} - -int -dsl_dataset_activate_large_blocks(const char *dsname) -{ - int error; - - error = dsl_sync_task(dsname, - dsl_dataset_activate_large_blocks_check, - dsl_dataset_activate_large_blocks_sync, (void *)dsname, - 1, ZFS_SPACE_CHECK_RESERVED); - - /* - * EALREADY indicates that this dataset already supports large blocks. - */ - if (error == EALREADY) - error = 0; - return (error); -} - /* * Return TRUE if 'earlier' is an earlier snapshot in 'later's timeline. * For example, they could both be snapshots of the same filesystem, and @@ -3452,7 +3457,6 @@ dsl_dataset_is_before(dsl_dataset_t *lat return (ret); } - void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2013 by Joyent, Inc. All rights reserved. */ @@ -267,9 +267,11 @@ dsl_destroy_snapshot_sync_impl(dsl_datas obj = ds->ds_object; - if (ds->ds_large_blocks) { - ASSERT0(zap_contains(mos, obj, DS_FIELD_LARGE_BLOCKS)); - spa_feature_decr(dp->dp_spa, SPA_FEATURE_LARGE_BLOCKS, tx); + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (ds->ds_feature_inuse[f]) { + dsl_dataset_deactivate_feature(obj, f, tx); + ds->ds_feature_inuse[f] = B_FALSE; + } } if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) { ASSERT3P(ds->ds_prev, ==, NULL); @@ -736,12 +738,16 @@ dsl_destroy_head_sync_impl(dsl_dataset_t ASSERT0(ds->ds_reserved); } - if (ds->ds_large_blocks) - spa_feature_decr(dp->dp_spa, SPA_FEATURE_LARGE_BLOCKS, tx); + obj = ds->ds_object; - dsl_scan_ds_destroyed(ds, tx); + for (spa_feature_t f = 0; f < SPA_FEATURES; f++) { + if (ds->ds_feature_inuse[f]) { + dsl_dataset_deactivate_feature(obj, f, tx); + ds->ds_feature_inuse[f] = B_FALSE; + } + } - obj = ds->ds_object; + dsl_scan_ds_destroyed(ds, tx); if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) { /* This is a clone */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -145,8 +146,6 @@ typedef struct dsl_dataset { /* only used in syncing context, only valid for non-snapshots: */ struct dsl_dataset *ds_prev; uint64_t ds_bookmarks; /* DMU_OTN_ZAP_METADATA */ - boolean_t ds_large_blocks; - boolean_t ds_need_large_blocks; /* has internal locking: */ dsl_deadlist_t ds_deadlist; @@ -185,6 +184,18 @@ typedef struct dsl_dataset { kmutex_t ds_sendstream_lock; list_t ds_sendstreams; + /* + * For ZFEATURE_FLAG_PER_DATASET features, set if this dataset + * uses this feature. + */ + uint8_t ds_feature_inuse[SPA_FEATURES]; + + /* + * Set if we need to activate the feature on this dataset this txg + * (used only in syncing context). + */ + uint8_t ds_feature_activation_needed[SPA_FEATURES]; + /* Protected by ds_lock; keep at end of struct for better locality */ char ds_snapname[MAXNAMELEN]; } dsl_dataset_t; @@ -264,8 +275,6 @@ int dsl_dataset_space_written(dsl_datase int dsl_dataset_space_wouldfree(dsl_dataset_t *firstsnap, dsl_dataset_t *last, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); boolean_t dsl_dataset_is_dirty(dsl_dataset_t *ds); -int dsl_dataset_activate_large_blocks(const char *dsname); -void dsl_dataset_activate_large_blocks_sync_impl(uint64_t dsobj, dmu_tx_t *tx); int dsl_dsobj_to_dsname(char *pname, uint64_t obj, char *buf); @@ -305,6 +314,9 @@ void dsl_dataset_set_refreservation_sync void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx); int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result); +void dsl_dataset_deactivate_feature(uint64_t dsobj, + spa_feature_t f, dmu_tx_t *tx); + #ifdef ZFS_DEBUG #define dprintf_ds(ds, fmt, ...) do { \ if (zfs_flags & ZFS_DEBUG_DPRINTF) { \ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Sat Oct 3 08:03:36 2015 (r288571) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Sat Oct 3 08:05:33 2015 (r288572) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ #include @@ -245,7 +245,7 @@ feature_get_refcount_from_disk(spa_t *sp { int err; uint64_t refcount; - uint64_t zapobj = feature->fi_can_readonly ? + uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj; /* @@ -296,7 +296,7 @@ feature_sync(spa_t *spa, zfeature_info_t dmu_tx_t *tx) { ASSERT(VALID_FEATURE_OR_NONE(feature->fi_feature)); - uint64_t zapobj = feature->fi_can_readonly ? + uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj; VERIFY0(zap_update(spa->spa_meta_objset, zapobj, feature->fi_guid, @@ -322,7 +322,7 @@ feature_sync(spa_t *spa, zfeature_info_t if (refcount == 0) spa_deactivate_mos_feature(spa, feature->fi_guid); - else if (feature->fi_mos) + else if (feature->fi_flags & ZFEATURE_FLAG_MOS) spa_activate_mos_feature(spa, feature->fi_guid, tx); } @@ -333,8 +333,9 @@ feature_sync(spa_t *spa, zfeature_info_t void feature_enable_sync(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx) { - uint64_t initial_refcount = feature->fi_activate_on_enable ? 1 : 0; - uint64_t zapobj = feature->fi_can_readonly ? + uint64_t initial_refcount = + (feature->fi_flags & ZFEATURE_FLAG_ACTIVATE_ON_ENABLE) ? 1 : 0; + uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj; ASSERT(0 != zapobj); @@ -379,7 +380,7 @@ feature_do_action(spa_t *spa, spa_featur { uint64_t refcount; zfeature_info_t *feature = &spa_feature_table[fid]; - uint64_t zapobj = feature->fi_can_readonly ? + uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? spa->spa_feat_for_write_obj : spa->spa_feat_for_read_obj; ASSERT(VALID_FEATURE_FID(fid)); From owner-svn-src-all@freebsd.org Sat Oct 3 08:06:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B814EA0DC3A; Sat, 3 Oct 2015 08:06:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A86FC195F; Sat, 3 Oct 2015 08:06:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9386UR7083679; Sat, 3 Oct 2015 08:06:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9386UJ5083678; Sat, 3 Oct 2015 08:06:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030806.t9386UJ5083678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 08:06: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: r288573 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 08:06:30 -0000 Author: mav Date: Sat Oct 3 08:06:29 2015 New Revision: 288573 URL: https://svnweb.freebsd.org/changeset/base/288573 Log: MFC r286710: 6093 zfsctl_shares_lookup should only VN_RELE() on zfs_zget() success Reviewed by: Gordon Ross Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Dan McDonald illumos/illumos-gate@0f92170f1ec2737ee5a0e51b5f74093904811452 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 3 08:05:33 2015 (r288572) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 3 08:06:29 2015 (r288573) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. */ /* @@ -1149,10 +1150,11 @@ zfsctl_shares_lookup(ap) ZFS_EXIT(zfsvfs); return (SET_ERROR(ENOTSUP)); } - if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) + if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) { error = VOP_LOOKUP(ZTOV(dzp), vpp, cnp); + VN_RELE(ZTOV(dzp)); + } - VN_RELE(ZTOV(dzp)); ZFS_EXIT(zfsvfs); return (error); From owner-svn-src-all@freebsd.org Sat Oct 3 08:07:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71F22A0DCF7; Sat, 3 Oct 2015 08:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 628451AB8; Sat, 3 Oct 2015 08:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9387MBX083787; Sat, 3 Oct 2015 08:07:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9387MYN083786; Sat, 3 Oct 2015 08:07:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030807.t9387MYN083786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 08:07:22 +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: r288574 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 08:07:22 -0000 Author: mav Date: Sat Oct 3 08:07:21 2015 New Revision: 288574 URL: https://svnweb.freebsd.org/changeset/base/288574 Log: MFC r286712: 6096 ZFS_SMB_ACL_RENAME needs to cleanup better Reviewed by: Matthew Ahrens Reviewed by: Gordon Ross Reviewed by: George Wilson Approved by: Robert Mustacchi illumos/illumos-gate@8f5190a540d64d2debee6664bbc740e4c38f5b7f Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 3 08:06:29 2015 (r288573) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 3 08:07:21 2015 (r288574) @@ -5189,6 +5189,7 @@ zfs_ioc_smb_acl(zfs_cmd_t *zc) if ((error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &nvlist)) != 0) { VN_RELE(vp); + VN_RELE(ZTOV(sharedir)); ZFS_EXIT(zfsvfs); return (error); } From owner-svn-src-all@freebsd.org Sat Oct 3 09:15:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0DECA0EDD2; Sat, 3 Oct 2015 09:15:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FCE11CCB; Sat, 3 Oct 2015 09:15:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t939FOte012127; Sat, 3 Oct 2015 09:15:24 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t939FNAC012124; Sat, 3 Oct 2015 09:15:23 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510030915.t939FNAC012124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 09:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288575 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 09:15:24 -0000 Author: hrs Date: Sat Oct 3 09:15:23 2015 New Revision: 288575 URL: https://svnweb.freebsd.org/changeset/base/288575 Log: Add IFCAP_LINKSTATE support. Modified: head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_me.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_gif.c Sat Oct 3 09:15:23 2015 (r288575) @@ -197,6 +197,8 @@ gif_clone_create(struct if_clone *ifc, i GIF2IFP(sc)->if_transmit = gif_transmit; GIF2IFP(sc)->if_qflush = gif_qflush; GIF2IFP(sc)->if_output = gif_output; + GIF2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GIF2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GIF2IFP(sc)); bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t)); if (ng_gif_attach_p != NULL) @@ -1040,10 +1042,13 @@ gif_set_tunnel(struct ifnet *ifp, struct #if defined(INET) || defined(INET6) bad: #endif - if (error == 0 && sc->gif_family != 0) + if (error == 0 && sc->gif_family != 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; - else + if_link_state_change(ifp, LINK_STATE_UP); + } else { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); + } return (error); } @@ -1065,4 +1070,5 @@ gif_delete_tunnel(struct ifnet *ifp) free(sc->gif_hdr, M_GIF); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_gre.c Sat Oct 3 09:15:23 2015 (r288575) @@ -179,6 +179,8 @@ gre_clone_create(struct if_clone *ifc, i GRE2IFP(sc)->if_ioctl = gre_ioctl; GRE2IFP(sc)->if_transmit = gre_transmit; GRE2IFP(sc)->if_qflush = gre_qflush; + GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GRE2IFP(sc)); bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t)); GRE_LIST_LOCK(); @@ -648,8 +650,10 @@ gre_set_tunnel(struct ifnet *ifp, struct break; #endif } - if (error == 0) + if (error == 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (error); } @@ -668,6 +672,7 @@ gre_delete_tunnel(struct ifnet *ifp) free(sc->gre_hdr, M_GRE); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } int Modified: head/sys/net/if_me.c ============================================================================== --- head/sys/net/if_me.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_me.c Sat Oct 3 09:15:23 2015 (r288575) @@ -192,6 +192,8 @@ me_clone_create(struct if_clone *ifc, in ME2IFP(sc)->if_ioctl = me_ioctl; ME2IFP(sc)->if_transmit = me_transmit; ME2IFP(sc)->if_qflush = me_qflush; + ME2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + ME2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(ME2IFP(sc)); bpfattach(ME2IFP(sc), DLT_NULL, sizeof(u_int32_t)); ME_LIST_LOCK(); @@ -376,8 +378,10 @@ me_set_tunnel(struct ifnet *ifp, struct if (sc->me_ecookie == NULL) sc->me_ecookie = encap_attach_func(AF_INET, IPPROTO_MOBILE, me_encapcheck, &in_mobile_protosw, sc); - if (sc->me_ecookie != NULL) + if (sc->me_ecookie != NULL) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (0); } @@ -395,6 +399,7 @@ me_delete_tunnel(struct ifnet *ifp) sc->me_dst.s_addr = 0; ME_WUNLOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } static uint16_t From owner-svn-src-all@freebsd.org Sat Oct 3 09:22:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E15A0F522; Sat, 3 Oct 2015 09:22:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 988E0115B; Sat, 3 Oct 2015 09:22:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t939MMRb016106; Sat, 3 Oct 2015 09:22:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t939MMkH016104; Sat, 3 Oct 2015 09:22:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510030922.t939MMkH016104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 09:22:22 +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: r288576 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 09:22:22 -0000 Author: mav Date: Sat Oct 3 09:22:21 2015 New Revision: 288576 URL: https://svnweb.freebsd.org/changeset/base/288576 Log: Fix r288549 build on stable. For some reason this (odd) code builds on head, but not on stable. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 09:15:23 2015 (r288575) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 09:22:21 2015 (r288576) @@ -55,11 +55,6 @@ static void dbuf_destroy(dmu_buf_impl_t static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); -#ifndef __lint -extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu, - dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp); -#endif /* ! __lint */ - /* * Global data structures and functions for the dbuf cache. */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 09:15:23 2015 (r288575) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 09:22:21 2015 (r288576) @@ -558,7 +558,7 @@ extern void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp); #else /* __lint */ -inline void +static inline void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp) { From owner-svn-src-all@freebsd.org Sat Oct 3 09:33:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92728A0FCAD; Sat, 3 Oct 2015 09:33:33 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7649A184D; Sat, 3 Oct 2015 09:33:33 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t939XXdo020367; Sat, 3 Oct 2015 09:33:33 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t939XUR0020352; Sat, 3 Oct 2015 09:33:30 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201510030933.t939XUR0020352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Sat, 3 Oct 2015 09:33:30 +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: r288577 - in stable/9: contrib/bind9 contrib/bind9/bin/check contrib/bind9/bin/confgen contrib/bind9/bin/dig contrib/bind9/bin/dnssec contrib/bind9/bin/named contrib/bind9/bin/named/inc... 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 09:33:33 -0000 Author: erwin Date: Sat Oct 3 09:33:29 2015 New Revision: 288577 URL: https://svnweb.freebsd.org/changeset/base/288577 Log: Update BIND to 9.9.8 See release notes for notable changes: https://kb.isc.org/article/AA-01305 Note this is a direct commit to stable/9 as BIND is no longer in head. Sponsored by: DK Hostmaster A/S Added: stable/9/contrib/bind9/doc/arm/html-fixup.pl - copied unchanged from r288438, vendor/bind9/dist/doc/arm/html-fixup.pl Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/README stable/9/contrib/bind9/bin/check/check-tool.c stable/9/contrib/bind9/bin/check/named-checkconf.c stable/9/contrib/bind9/bin/check/named-checkzone.c stable/9/contrib/bind9/bin/confgen/keygen.c stable/9/contrib/bind9/bin/confgen/util.c stable/9/contrib/bind9/bin/dig/dig.1 stable/9/contrib/bind9/bin/dig/dig.c stable/9/contrib/bind9/bin/dig/dig.docbook stable/9/contrib/bind9/bin/dig/dig.html stable/9/contrib/bind9/bin/dig/dighost.c stable/9/contrib/bind9/bin/dig/nslookup.c stable/9/contrib/bind9/bin/dnssec/dnssec-dsfromkey.8 stable/9/contrib/bind9/bin/dnssec/dnssec-dsfromkey.c stable/9/contrib/bind9/bin/dnssec/dnssec-dsfromkey.docbook stable/9/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html stable/9/contrib/bind9/bin/dnssec/dnssec-keygen.c stable/9/contrib/bind9/bin/dnssec/dnssec-revoke.c stable/9/contrib/bind9/bin/dnssec/dnssec-settime.c stable/9/contrib/bind9/bin/dnssec/dnssec-signzone.c stable/9/contrib/bind9/bin/named/client.c stable/9/contrib/bind9/bin/named/config.c stable/9/contrib/bind9/bin/named/control.c stable/9/contrib/bind9/bin/named/include/named/lwdclient.h stable/9/contrib/bind9/bin/named/include/named/main.h stable/9/contrib/bind9/bin/named/include/named/server.h stable/9/contrib/bind9/bin/named/interfacemgr.c stable/9/contrib/bind9/bin/named/logconf.c stable/9/contrib/bind9/bin/named/lwdclient.c stable/9/contrib/bind9/bin/named/lwresd.c stable/9/contrib/bind9/bin/named/main.c stable/9/contrib/bind9/bin/named/named.8 stable/9/contrib/bind9/bin/named/named.docbook stable/9/contrib/bind9/bin/named/named.html stable/9/contrib/bind9/bin/named/query.c stable/9/contrib/bind9/bin/named/server.c stable/9/contrib/bind9/bin/named/statschannel.c stable/9/contrib/bind9/bin/named/update.c stable/9/contrib/bind9/bin/named/xfrout.c stable/9/contrib/bind9/bin/nsupdate/nsupdate.1 stable/9/contrib/bind9/bin/nsupdate/nsupdate.c stable/9/contrib/bind9/bin/nsupdate/nsupdate.docbook stable/9/contrib/bind9/bin/nsupdate/nsupdate.html stable/9/contrib/bind9/bin/rndc/rndc.8 stable/9/contrib/bind9/bin/rndc/rndc.c stable/9/contrib/bind9/bin/rndc/rndc.docbook stable/9/contrib/bind9/bin/rndc/rndc.html stable/9/contrib/bind9/bin/rndc/util.c stable/9/contrib/bind9/bin/tools/arpaname.c stable/9/contrib/bind9/bin/tools/isc-hmac-fixup.c stable/9/contrib/bind9/bin/tools/named-journalprint.c stable/9/contrib/bind9/config.h.in stable/9/contrib/bind9/configure.in stable/9/contrib/bind9/doc/arm/Bv9ARM-book.xml stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html stable/9/contrib/bind9/doc/arm/Bv9ARM.html stable/9/contrib/bind9/doc/arm/Bv9ARM.pdf stable/9/contrib/bind9/doc/arm/Makefile.in stable/9/contrib/bind9/doc/arm/man.arpaname.html stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html stable/9/contrib/bind9/doc/arm/man.dig.html stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html stable/9/contrib/bind9/doc/arm/man.dnssec-revoke.html stable/9/contrib/bind9/doc/arm/man.dnssec-settime.html stable/9/contrib/bind9/doc/arm/man.dnssec-signzone.html stable/9/contrib/bind9/doc/arm/man.dnssec-verify.html stable/9/contrib/bind9/doc/arm/man.genrandom.html stable/9/contrib/bind9/doc/arm/man.host.html stable/9/contrib/bind9/doc/arm/man.isc-hmac-fixup.html stable/9/contrib/bind9/doc/arm/man.named-checkconf.html stable/9/contrib/bind9/doc/arm/man.named-checkzone.html stable/9/contrib/bind9/doc/arm/man.named-journalprint.html stable/9/contrib/bind9/doc/arm/man.named.html stable/9/contrib/bind9/doc/arm/man.nsec3hash.html stable/9/contrib/bind9/doc/arm/man.nsupdate.html stable/9/contrib/bind9/doc/arm/man.rndc-confgen.html stable/9/contrib/bind9/doc/arm/man.rndc.conf.html stable/9/contrib/bind9/doc/arm/man.rndc.html stable/9/contrib/bind9/doc/arm/notes.html stable/9/contrib/bind9/doc/arm/notes.pdf stable/9/contrib/bind9/doc/arm/notes.xml stable/9/contrib/bind9/doc/misc/rfc-compliance stable/9/contrib/bind9/isc-config.sh.in stable/9/contrib/bind9/lib/bind9/api stable/9/contrib/bind9/lib/bind9/check.c stable/9/contrib/bind9/lib/dns/adb.c stable/9/contrib/bind9/lib/dns/api stable/9/contrib/bind9/lib/dns/cache.c stable/9/contrib/bind9/lib/dns/callbacks.c stable/9/contrib/bind9/lib/dns/client.c stable/9/contrib/bind9/lib/dns/diff.c stable/9/contrib/bind9/lib/dns/dispatch.c stable/9/contrib/bind9/lib/dns/dlz.c stable/9/contrib/bind9/lib/dns/dnssec.c stable/9/contrib/bind9/lib/dns/dst_api.c stable/9/contrib/bind9/lib/dns/dst_openssl.h stable/9/contrib/bind9/lib/dns/dst_parse.c stable/9/contrib/bind9/lib/dns/gssapi_link.c stable/9/contrib/bind9/lib/dns/gssapictx.c stable/9/contrib/bind9/lib/dns/hmac_link.c stable/9/contrib/bind9/lib/dns/include/dns/adb.h stable/9/contrib/bind9/lib/dns/include/dns/log.h stable/9/contrib/bind9/lib/dns/include/dns/message.h stable/9/contrib/bind9/lib/dns/include/dns/name.h stable/9/contrib/bind9/lib/dns/include/dns/resolver.h stable/9/contrib/bind9/lib/dns/include/dns/result.h stable/9/contrib/bind9/lib/dns/include/dns/rrl.h stable/9/contrib/bind9/lib/dns/include/dns/stats.h stable/9/contrib/bind9/lib/dns/include/dns/types.h stable/9/contrib/bind9/lib/dns/include/dns/update.h stable/9/contrib/bind9/lib/dns/include/dns/zone.h stable/9/contrib/bind9/lib/dns/include/dst/dst.h stable/9/contrib/bind9/lib/dns/journal.c stable/9/contrib/bind9/lib/dns/keytable.c stable/9/contrib/bind9/lib/dns/log.c stable/9/contrib/bind9/lib/dns/master.c stable/9/contrib/bind9/lib/dns/message.c stable/9/contrib/bind9/lib/dns/name.c stable/9/contrib/bind9/lib/dns/ncache.c stable/9/contrib/bind9/lib/dns/nsec.c stable/9/contrib/bind9/lib/dns/nsec3.c stable/9/contrib/bind9/lib/dns/openssl_link.c stable/9/contrib/bind9/lib/dns/openssldh_link.c stable/9/contrib/bind9/lib/dns/openssldsa_link.c stable/9/contrib/bind9/lib/dns/opensslecdsa_link.c stable/9/contrib/bind9/lib/dns/opensslgost_link.c stable/9/contrib/bind9/lib/dns/opensslrsa_link.c stable/9/contrib/bind9/lib/dns/order.c stable/9/contrib/bind9/lib/dns/private.c stable/9/contrib/bind9/lib/dns/rbt.c stable/9/contrib/bind9/lib/dns/rbtdb.c stable/9/contrib/bind9/lib/dns/rdata.c stable/9/contrib/bind9/lib/dns/rdata/any_255/tsig_250.c stable/9/contrib/bind9/lib/dns/rdata/ch_3/a_1.c stable/9/contrib/bind9/lib/dns/rdata/generic/afsdb_18.c stable/9/contrib/bind9/lib/dns/rdata/generic/caa_257.c stable/9/contrib/bind9/lib/dns/rdata/generic/cdnskey_60.c stable/9/contrib/bind9/lib/dns/rdata/generic/cds_59.c stable/9/contrib/bind9/lib/dns/rdata/generic/cert_37.c stable/9/contrib/bind9/lib/dns/rdata/generic/cname_5.c stable/9/contrib/bind9/lib/dns/rdata/generic/dlv_32769.c stable/9/contrib/bind9/lib/dns/rdata/generic/dname_39.c stable/9/contrib/bind9/lib/dns/rdata/generic/dnskey_48.c stable/9/contrib/bind9/lib/dns/rdata/generic/ds_43.c stable/9/contrib/bind9/lib/dns/rdata/generic/eui48_108.c stable/9/contrib/bind9/lib/dns/rdata/generic/eui64_109.c stable/9/contrib/bind9/lib/dns/rdata/generic/gpos_27.c stable/9/contrib/bind9/lib/dns/rdata/generic/hinfo_13.c stable/9/contrib/bind9/lib/dns/rdata/generic/hip_55.c stable/9/contrib/bind9/lib/dns/rdata/generic/ipseckey_45.c stable/9/contrib/bind9/lib/dns/rdata/generic/isdn_20.c stable/9/contrib/bind9/lib/dns/rdata/generic/key_25.c stable/9/contrib/bind9/lib/dns/rdata/generic/keydata_65533.c stable/9/contrib/bind9/lib/dns/rdata/generic/l32_105.c stable/9/contrib/bind9/lib/dns/rdata/generic/l64_106.c stable/9/contrib/bind9/lib/dns/rdata/generic/loc_29.c stable/9/contrib/bind9/lib/dns/rdata/generic/lp_107.c stable/9/contrib/bind9/lib/dns/rdata/generic/mb_7.c stable/9/contrib/bind9/lib/dns/rdata/generic/md_3.c stable/9/contrib/bind9/lib/dns/rdata/generic/mf_4.c stable/9/contrib/bind9/lib/dns/rdata/generic/mg_8.c stable/9/contrib/bind9/lib/dns/rdata/generic/minfo_14.c stable/9/contrib/bind9/lib/dns/rdata/generic/mr_9.c stable/9/contrib/bind9/lib/dns/rdata/generic/mx_15.c stable/9/contrib/bind9/lib/dns/rdata/generic/naptr_35.c stable/9/contrib/bind9/lib/dns/rdata/generic/nid_104.c stable/9/contrib/bind9/lib/dns/rdata/generic/ns_2.c stable/9/contrib/bind9/lib/dns/rdata/generic/nsec3_50.c stable/9/contrib/bind9/lib/dns/rdata/generic/nsec3param_51.c stable/9/contrib/bind9/lib/dns/rdata/generic/nsec_47.c stable/9/contrib/bind9/lib/dns/rdata/generic/null_10.c stable/9/contrib/bind9/lib/dns/rdata/generic/nxt_30.c stable/9/contrib/bind9/lib/dns/rdata/generic/openpgpkey_61.c stable/9/contrib/bind9/lib/dns/rdata/generic/opt_41.c stable/9/contrib/bind9/lib/dns/rdata/generic/proforma.c stable/9/contrib/bind9/lib/dns/rdata/generic/ptr_12.c stable/9/contrib/bind9/lib/dns/rdata/generic/rp_17.c stable/9/contrib/bind9/lib/dns/rdata/generic/rrsig_46.c stable/9/contrib/bind9/lib/dns/rdata/generic/rt_21.c stable/9/contrib/bind9/lib/dns/rdata/generic/sig_24.c stable/9/contrib/bind9/lib/dns/rdata/generic/soa_6.c stable/9/contrib/bind9/lib/dns/rdata/generic/spf_99.c stable/9/contrib/bind9/lib/dns/rdata/generic/sshfp_44.c stable/9/contrib/bind9/lib/dns/rdata/generic/tkey_249.c stable/9/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c stable/9/contrib/bind9/lib/dns/rdata/generic/txt_16.c stable/9/contrib/bind9/lib/dns/rdata/generic/unspec_103.c stable/9/contrib/bind9/lib/dns/rdata/generic/uri_256.c stable/9/contrib/bind9/lib/dns/rdata/generic/x25_19.c stable/9/contrib/bind9/lib/dns/rdata/hs_4/a_1.c stable/9/contrib/bind9/lib/dns/rdata/in_1/a6_38.c stable/9/contrib/bind9/lib/dns/rdata/in_1/a_1.c stable/9/contrib/bind9/lib/dns/rdata/in_1/aaaa_28.c stable/9/contrib/bind9/lib/dns/rdata/in_1/apl_42.c stable/9/contrib/bind9/lib/dns/rdata/in_1/dhcid_49.c stable/9/contrib/bind9/lib/dns/rdata/in_1/kx_36.c stable/9/contrib/bind9/lib/dns/rdata/in_1/nsap-ptr_23.c stable/9/contrib/bind9/lib/dns/rdata/in_1/nsap_22.c stable/9/contrib/bind9/lib/dns/rdata/in_1/px_26.c stable/9/contrib/bind9/lib/dns/rdata/in_1/srv_33.c stable/9/contrib/bind9/lib/dns/rdata/in_1/wks_11.c stable/9/contrib/bind9/lib/dns/request.c stable/9/contrib/bind9/lib/dns/resolver.c stable/9/contrib/bind9/lib/dns/result.c stable/9/contrib/bind9/lib/dns/rpz.c stable/9/contrib/bind9/lib/dns/rrl.c stable/9/contrib/bind9/lib/dns/sdb.c stable/9/contrib/bind9/lib/dns/sdlz.c stable/9/contrib/bind9/lib/dns/spnego.c stable/9/contrib/bind9/lib/dns/tcpmsg.c stable/9/contrib/bind9/lib/dns/tkey.c stable/9/contrib/bind9/lib/dns/tsig.c stable/9/contrib/bind9/lib/dns/update.c stable/9/contrib/bind9/lib/dns/view.c stable/9/contrib/bind9/lib/dns/xfrin.c stable/9/contrib/bind9/lib/dns/zone.c stable/9/contrib/bind9/lib/export/isc/unix/include/isc/Makefile.in stable/9/contrib/bind9/lib/export/samples/nsprobe.c stable/9/contrib/bind9/lib/export/samples/sample-async.c stable/9/contrib/bind9/lib/export/samples/sample-gai.c stable/9/contrib/bind9/lib/export/samples/sample-request.c stable/9/contrib/bind9/lib/export/samples/sample-update.c stable/9/contrib/bind9/lib/export/samples/sample.c stable/9/contrib/bind9/lib/irs/api stable/9/contrib/bind9/lib/irs/getaddrinfo.c stable/9/contrib/bind9/lib/isc/api stable/9/contrib/bind9/lib/isc/assertions.c stable/9/contrib/bind9/lib/isc/backtrace.c stable/9/contrib/bind9/lib/isc/commandline.c stable/9/contrib/bind9/lib/isc/entropy.c stable/9/contrib/bind9/lib/isc/error.c stable/9/contrib/bind9/lib/isc/heap.c stable/9/contrib/bind9/lib/isc/hmacmd5.c stable/9/contrib/bind9/lib/isc/hmacsha.c stable/9/contrib/bind9/lib/isc/httpd.c stable/9/contrib/bind9/lib/isc/include/isc/app.h stable/9/contrib/bind9/lib/isc/include/isc/mem.h stable/9/contrib/bind9/lib/isc/include/isc/namespace.h stable/9/contrib/bind9/lib/isc/include/isc/platform.h.in stable/9/contrib/bind9/lib/isc/include/isc/print.h stable/9/contrib/bind9/lib/isc/include/isc/safe.h stable/9/contrib/bind9/lib/isc/include/isc/util.h stable/9/contrib/bind9/lib/isc/lex.c stable/9/contrib/bind9/lib/isc/lib.c stable/9/contrib/bind9/lib/isc/mem.c stable/9/contrib/bind9/lib/isc/pool.c stable/9/contrib/bind9/lib/isc/print.c stable/9/contrib/bind9/lib/isc/pthreads/mutex.c stable/9/contrib/bind9/lib/isc/regex.c stable/9/contrib/bind9/lib/isc/rwlock.c stable/9/contrib/bind9/lib/isc/safe.c stable/9/contrib/bind9/lib/isc/socket_api.c stable/9/contrib/bind9/lib/isc/stats.c stable/9/contrib/bind9/lib/isc/task.c stable/9/contrib/bind9/lib/isc/timer.c stable/9/contrib/bind9/lib/isc/unix/app.c stable/9/contrib/bind9/lib/isc/unix/file.c stable/9/contrib/bind9/lib/isc/unix/ifiter_ioctl.c stable/9/contrib/bind9/lib/isc/unix/ifiter_sysctl.c stable/9/contrib/bind9/lib/isc/unix/net.c stable/9/contrib/bind9/lib/isc/unix/socket.c stable/9/contrib/bind9/lib/isccc/Makefile.in stable/9/contrib/bind9/lib/isccc/alist.c stable/9/contrib/bind9/lib/isccc/api stable/9/contrib/bind9/lib/isccc/cc.c stable/9/contrib/bind9/lib/isccc/sexpr.c stable/9/contrib/bind9/lib/isccfg/api stable/9/contrib/bind9/lib/isccfg/include/isccfg/cfg.h stable/9/contrib/bind9/lib/isccfg/include/isccfg/grammar.h stable/9/contrib/bind9/lib/isccfg/namedconf.c stable/9/contrib/bind9/lib/isccfg/parser.c stable/9/contrib/bind9/lib/lwres/api stable/9/contrib/bind9/lib/lwres/herror.c stable/9/contrib/bind9/lib/lwres/man/lwres.html stable/9/contrib/bind9/lib/lwres/man/lwres_buffer.html stable/9/contrib/bind9/lib/lwres/man/lwres_config.html stable/9/contrib/bind9/lib/lwres/man/lwres_context.html stable/9/contrib/bind9/lib/lwres/man/lwres_gabn.html stable/9/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_gethostent.html stable/9/contrib/bind9/lib/lwres/man/lwres_getipnode.html stable/9/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html stable/9/contrib/bind9/lib/lwres/man/lwres_gnba.html stable/9/contrib/bind9/lib/lwres/man/lwres_hstrerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_inetntop.html stable/9/contrib/bind9/lib/lwres/man/lwres_noop.html stable/9/contrib/bind9/lib/lwres/man/lwres_packet.html stable/9/contrib/bind9/lib/lwres/man/lwres_resutil.html stable/9/contrib/bind9/lib/lwres/print.c stable/9/contrib/bind9/version stable/9/lib/bind/config.h stable/9/lib/bind/isc/isc/platform.h stable/9/lib/bind/lwres/lwres/platform.h Directory Properties: stable/9/contrib/bind9/ (props changed) Modified: stable/9/contrib/bind9/CHANGES ============================================================================== --- stable/9/contrib/bind9/CHANGES Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/CHANGES Sat Oct 3 09:33:29 2015 (r288577) @@ -1,14 +1,318 @@ - --- 9.9.7-P2 released --- + --- 9.9.8 released --- + + --- 9.9.8rc1 released --- + +4193. [bug] Handle broken servers that return BADVERS incorrectly. + [RT #40427] + +4192. [bug] The default rrset-order of random was not always being + applied. [RT #40456] + +4191. [protocol] Accept DNS-SD non LDH PTR records in reverse zones + as per RFC 6763. [RT #37889] + +4190. [protocol] Accept Active Diretory gc._msdcs. name as + valid with check-names. still needs to be + LDH. [RT #40399] + +4189. [cleanup] Don't exit on overly long tokens in named.conf. + [RT #40418] + +4188. [bug] Support HTTP/1.0 client properly on the statistics + channel. [RT #40261] + +4187. [func] When any RR type implementation doesn't + implement totext() for the RDATA's wire + representation and returns ISC_R_NOTIMPLEMENTED, + such RDATA is now printed in unknown + presentation format (RFC 3597). RR types affected + include LOC(29) and APL(42). [RT #40317]. + +4183. [cleanup] Use timing-safe memory comparisons in cryptographic + code. Also, the timing-safe comparison functions have + been renamed to avoid possible confusion with + memcmp(). Thanks to Loganaden Velvindron of + AFRINIC. [RT #40148] + +4182. [cleanup] Use mnemonics for RR class and type comparisons. + [RT #40297] + +4181. [bug] Queued notify messages could be dequeued from the + wrong rate limiter queue. [RT #40350] + +4179. [bug] Fix double frees in getaddrinfo() in libirs. + [RT #40209] + +4178. [bug] Fix assertion failure in parsing UNSPEC(103) RR from + text. [RT #40274] + +4177. [bug] Fix assertion failure in parsing NSAP records from + text. [RT #40285] + +4176. [bug] Address race issues with lwresd. [RT #40284] + +4175. [bug] TKEY with GSS-API keys needed bigger buffers. + [RT #40333] + +4174. [bug] "dnssec-coverage -r" didn't handle time unit + suffixes correctly. [RT #38444] + +4173. [bug] dig +sigchase was not properly matching the trusted + key. [RT #40188] + +4172. [bug] Named / named-checkconf didn't handle a view of CLASS0. + [RT #40265] + +4171. [bug] Fixed incorrect class checks in TSIG RR + implementation. [RT #40287] + +4170. [security] An incorrect boundary check in the OPENPGPKEY + rdatatype could trigger an assertion failure. + (CVE-2015-5986) [RT #40286] + +4169. [test] Added a 'wire_test -d' option to read input as + raw binary data, for use as a fuzzing harness. + [RT #40312] + +4168. [security] A buffer accounting error could trigger an + assertion failure when parsing certain malformed + DNSSEC keys. (CVE-2015-5722) [RT #40212] + + --- 9.9.8b1 released --- 4165. [security] A failure to reset a value to NULL in tkey.c could result in an assertion failure. (CVE-2015-5477) [RT #40046] - --- 9.9.7-P1 released --- +4164. [bug] Don't rename slave files and journals on out of memory. + [RT #40033] + +4163. [bug] Address compiler warnings. [RT #40024] + +4162. [bug] httpdmgr->flags was not being initialized. [RT #40017] + +4159. [cleanup] Alphabetize dig's help output. [RT #39966] + +4158. [protocol] Support the printing of EDNS COOKIE and EXPIRE options. + [RT #39928] + +4154. [bug] A OPT record should be included with the FORMERR + response when there is a malformed EDNS option. + [RT #39647] + +4153. [bug] Check that non significant ECS bits are zero on + receipt. [RT #39647] + +4151. [bug] 'rndc flush' could cause a deadlock. [RT #39835] + +4150. [bug] win32: listen-on-v6 { any; }; was not working. Apply + minimal fix. [RT #39667] + +4149. [bug] Fixed a race condition in the getaddrinfo() + implementation in libirs. [RT #39899] + +4148. [bug] Fix a bug when printing zone names with '/' character + in XML and JSON statistics output. [RT #39873] + +4147. [bug] Filter-aaaa / filter-aaaa-on-v4 / filter-aaaa-on-v6 + was returning referrals rather than nodata responses + when the AAAA records were filtered. [RT #39843] -4138. [bug] An uninitialized value in validator.c could result +4146. [bug] Address reference leak that could prevent a clean + shutdown. [RT #37125] + +4145. [bug] Not all unassociated adb entries where being printed. + [RT #37125] + +4143. [bug] serial-query-rate was not effective for notify. + [RT #39858] + +4142. [bug] rndc addzone with view specified saved NZF config + that could not be read back by named. This has now + been fixed. [RT #39845] + +4138. [security] An uninitialized value in validator.c could result in an assertion failure. (CVE-2015-4620) [RT #39795] +4137. [bug] Make rndc reconfig report configuration errors the + same way rndc reload does. [RT #39635] + +4132. [cleanup] dig: added +rd as a synonym for +recurse, + added +class as an unabbreviated alternative + to +cl. [RT #39686] + +4130. [bug] The compatibility shim for *printf() misprinted some + large numbers. [RT #39586] + +4129. [port] Address API changes in OpenSSL 1.1.0. [RT #39532] + +4128. [bug] Address issues raised by Coverity 7.6. [RT #39537] + +4127. [protocol] CDS and CDNSKEY need to be signed by the key signing + key as per RFC 7344, Section 4.1. [RT #37215] + +4123. [port] Added %z (size_t) format options to the portable + internal printf/sprintf implementation. [RT #39586] + +4118. [bug] Teach isc-config.sh about irs. [RT #39213] + +4117. [protocol] Add EMPTY.AS112.ARPA as per RFC 7534. + +4113. [test] Check for Net::DNS is some system test + prerequisites. [RT #39369] + +4112. [bug] Named failed to load when "root-delegation-only" + was used without a list of domains to exclude. + [RT #39380] + +4111. [doc] Alphabetize rndc man page. [RT #39360] + +4110. [bug] Address memory leaks / null pointer dereferences + on out of memory. [RT #39310] + +4109. [port] linux: support reading the local port range from + net.ipv4.ip_local_port_range. [RT # 39379] + +4107. [bug] Address potential deadlock when updating zone content. + [RT #39269] + +4106. [port] Improve readline support. [RT #38938] + +4105. [port] Misc fixes for Microsoft Visual Studio + 2015 CTP6 in 64 bit mode. [RT #39308] + +4104. [bug] Address uninitialized elements. [RT #39252] + +4102. [bug] Fix a use after free bug introduced in change + #4094. [RT #39281] + +4101. [bug] dig: the +split option didn't work with +short. + [RT #39291] + +4100. [bug] Inherited owernames on the line immediately following + a $INCLUDE were not working. [RT #39268] + +4099. [port] clang: make unknown commandline options hard errors + when determining what options are supported. + [RT #39273] + +4098. [bug] Address use-after-free issue when using a + predecessor key with dnssec-settime. [RT #39272] + +4097. [func] Add additional logging about xfrin transfer status. + [RT #39170] + +4096. [bug] Fix a use after free of query->sendevent. + [RT #39132] + +4094. [bug] A race during shutdown or reconfiguration could + cause an assertion in mem.c. [RT #38979] + +4091. [cleanup] Some cleanups in isc mem code. [RT #38896] + +4090. [bug] Fix a crash while parsing malformed CAA RRs in + presentation format, i.e., from text such as + from master files. Thanks to John Van de + Meulebrouck Brendgard for discovering and + reporting this problem. [RT #39003] + +4089. [bug] Send notifies immediately for slave zones during + startup. [RT #38843] + +4088. [port] Fixed errors when building with libressl. [RT #38899] + +4087. [bug] Fix a crash due to use-after-free due to sequencing + of tasks actions. [RT #38495] + +4085. [bug] ISC_PLATFORM_HAVEXADDQ could be inconsistently set. + [RT #38828] + +4084. [bug] Fix a possible race in updating stats counters. + [RT #38826] + +4082. [bug] Incrementally sign large inline zone deltas. + [RT #37927] + +4081. [cleanup] Use dns_rdatalist_init consistently. [RT #38759] + +4077. [test] Add static-stub regression test for DS NXDOMAIN + return making the static stub disappear. [RT #38564] + +4076. [bug] Named could crash on shutdown with outstanding + reload / reconfig events. [RT #38622] + +4075. [bug] Increase nsupdate's input buffer to accomodate + very large RRs. [RT #38689] + +4074. [cleanup] Cleaned up more warnings from gcc -Wshadow. [RT #38708] + +4073. [cleanup] Add libjson-c version number reporting to + "named -V"; normalize version number formatting. + [RT #38056] + +4072. [func] Add a --enable-querytrace configure switch for + very verbose query trace logging. (This option + has a negative performance impact and should be + used only for debugging.) [RT #37520] + +4070. [bug] Fix a segfault in nslookup in a query such as + "nslookup isc.org AMS.SNS-PB.ISC.ORG -all". + [RT #38548] + +4069. [doc] Reorganize options in the nsupdate man page. + [RT #38515] + +4067. [cleanup] Reduce noise from RRL when query logging is + disabled. [RT #38648] + +4066. [doc] Reorganize options in the dig man page. [RT #38516] + +4064. [contrib] dnssec-keyset.sh: Generates a specified number + of DNSSEC keys with timing set to implement a + pre-publication key rollover strategy. Thanks + to Jeffry A. Spain. [RT #38459] + +4063. [bug] Asynchronous zone loads were not handled + correctly when the zone load was already in + progress; this could trigger a crash in zt.c. + [RT #37573] + +4062. [bug] Fix an out-of-bounds read in RPZ code. If the + read succeeded, it doesn't result in a bug + during operation. If the read failed, named + could segfault. [RT #38559] + +3938. [func] Added quotas to be used in recursive resolvers + that are under high query load for names in zones + whose authoritative servers are nonresponsive or + are experiencing a denial of service attack. + + - "fetches-per-server" limits the number of + simultaneous queries that can be sent to any + single authoritative server. The configured + value is a starting point; it is automatically + adjusted downward if the server is partially or + completely non-responsive. The algorithm used to + adjust the quota can be configured via the + "fetch-quota-params" option. + - "fetches-per-zone" limits the number of + simultaneous queries that can be sent for names + within a single domain. (Note: Unlike + "fetches-per-server", this value is not + self-tuning.) + - New stats counters have been added to count + queries spilled due to these quotas. + + These options are not available by default; + use "configure --enable-fetchlimit" (or + --enable-developer) to include them in the build. + + See the ARM for details of these options. [RT #37125] + +3937. [func] Added some debug logging to better indicate the + conditions causing SERVFAILs when resolving. + [RT #35538] + --- 9.9.7 released --- --- 9.9.7rc2 released --- @@ -16,7 +320,7 @@ 4061. [bug] Handle timeout in legacy system test. [RT #38573] 4060. [bug] dns_rdata_freestruct could be called on a - uninitialised structure when handling a error. + uninitialized structure when handling a error. [RT #38568] 4059. [bug] Addressed valgrind warnings. [RT #38549] Modified: stable/9/contrib/bind9/README ============================================================================== --- stable/9/contrib/bind9/README Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/README Sat Oct 3 09:33:29 2015 (r288577) @@ -51,15 +51,35 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes -BIND 9.9.7-P2 +BIND 9.9.8 - BIND 9.9.7-P1 is a security release addressing the flaw - described in CVE-2015-5477. + BIND 9.9.8 is a maintenance release and addresses bugs + found in BIND 9.9.7 and earlier, as well as the security + flaws described in CVE-2015-4620, CVE-2015-5477, + CVE-2015-5722, and CVE-2015-5986. + + It also makes the following new features available via a + compile-time option: + + - New "fetchlimit" quotas are now available for the use of + recursive resolvers that are are under high query load for + domains whose authoritative servers are nonresponsive or are + experiencing a denial of service attack. + + + "fetches-per-server" limits the number of simultaneous queries + that can be sent to any single authoritative server. The + configured value is a starting point; it is automatically + adjusted downward if the server is partially or completely + non-responsive. The algorithm used to adjust the quota can be + configured via the "fetch-quota-params" option. + + "fetches-per-zone" limits the number of simultaneous queries + that can be sent for names within a single domain. (Note: + Unlike "fetches-per-server", this value is not self-tuning.) + + New stats counters have been added to count + queries spilled due to these quotas. -BIND 9.9.7-P1 - - BIND 9.9.7-P1 is a security release addressing the flaw - described in CVE-2015-4620. + NOTE: These options are NOT built in by default; use + "configure --enable-fetchlimit" to enable them. BIND 9.9.7 Modified: stable/9/contrib/bind9/bin/check/check-tool.c ============================================================================== --- stable/9/contrib/bind9/bin/check/check-tool.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/check/check-tool.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include Modified: stable/9/contrib/bind9/bin/check/named-checkconf.c ============================================================================== --- stable/9/contrib/bind9/bin/check/named-checkconf.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/check/named-checkconf.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include Modified: stable/9/contrib/bind9/bin/check/named-checkzone.c ============================================================================== --- stable/9/contrib/bind9/bin/check/named-checkzone.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/check/named-checkzone.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2013, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include Modified: stable/9/contrib/bind9/bin/confgen/keygen.c ============================================================================== --- stable/9/contrib/bind9/bin/confgen/keygen.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/confgen/keygen.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -29,6 +29,7 @@ #include #include #include +#include #include #include Modified: stable/9/contrib/bind9/bin/confgen/util.c ============================================================================== --- stable/9/contrib/bind9/bin/confgen/util.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/confgen/util.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,6 +25,7 @@ #include #include +#include #include "util.h" Modified: stable/9/contrib/bind9/bin/dig/dig.1 ============================================================================== --- stable/9/contrib/bind9/bin/dig/dig.1 Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/dig/dig.1 Sat Oct 3 09:33:29 2015 (r288577) @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004-2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004-2011, 2013-2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -130,77 +130,97 @@ will perform a lookup for an A record. .RE .SH "OPTIONS" .PP -The -\fB\-b\fR -option sets the source IP address of the query to -\fIaddress\fR. This must be a valid address on one of the host's network interfaces or "0.0.0.0" or "::". An optional port may be specified by appending "#" +\-4 +.RS 4 +Use IPv4 only. +.RE .PP -The default query class (IN for internet) is overridden by the -\fB\-c\fR -option. +\-6 +.RS 4 +Use IPv6 only. +.RE +.PP +\-b \fIaddress\fR\fI[#port]\fR +.RS 4 +Set the source IP address of the query. The +\fIaddress\fR +must be a valid address on one of the host's network interfaces, or "0.0.0.0" or "::". An optional port may be specified by appending "#" +.RE +.PP +\-c \fIclass\fR +.RS 4 +Set the query class. The default \fIclass\fR -is any valid class, such as HS for Hesiod records or CH for Chaosnet records. +is IN; other classes are HS for Hesiod records or CH for Chaosnet records. +.RE .PP -The -\fB\-f\fR -option makes -\fBdig \fR -operate in batch mode by reading a list of lookup requests to process from the file -\fIfilename\fR. The file contains a number of queries, one per line. Each entry in the file should be organized in the same way they would be presented as queries to +\-f \fIfile\fR +.RS 4 +Batch mode: +\fBdig\fR +reads a list of lookup requests to process from the given +\fIfile\fR. Each line in the file should be organized in the same way they would be presented as queries to \fBdig\fR using the command\-line interface. +.RE .PP -The -\fB\-m\fR -option enables memory usage debugging. -.PP -If a non\-standard port number is to be queried, the -\fB\-p\fR -option is used. -\fIport#\fR -is the port number that -\fBdig\fR -will send its queries instead of the standard DNS port number 53. This option would be used to test a name server that has been configured to listen for queries on a non\-standard port number. +\-i +.RS 4 +Do reverse IPv6 lookups using the obsolete RFC1886 IP6.INT domain, which is no longer in use. Obsolete bit string label queries (RFC2874) are not attempted. +.RE .PP -The -\fB\-4\fR -option forces -\fBdig\fR -to only use IPv4 query transport. The -\fB\-6\fR -option forces -\fBdig\fR -to only use IPv6 query transport. +\-k \fIkeyfile\fR +.RS 4 +Sign queries using TSIG using a key read from the given file. Key files can be generated using +\fBtsig\-keygen\fR(8). When using TSIG authentication with +\fBdig\fR, the name server that is queried needs to know the key and algorithm that is being used. In BIND, this is done by providing appropriate +\fBkey\fR +and +\fBserver\fR +statements in +\fInamed.conf\fR. +.RE .PP -The -\fB\-t\fR -option sets the query type to -\fItype\fR. It can be any valid query type which is supported in BIND 9. The default query type is "A", unless the +\-m +.RS 4 +Enable memory usage debugging. +.RE +.PP +\-p \fIport\fR +.RS 4 +Send the query to a non\-standard port on the server, instead of the defaut port 53. This option would be used to test a name server that has been configured to listen for queries on a non\-standard port number. +.RE +.PP +\-q \fIname\fR +.RS 4 +The domain name to query. This is useful to distinguish the +\fIname\fR +from other arguments. +.RE +.PP +\-t \fItype\fR +.RS 4 +The resource record type to query. It can be any valid query type which is supported in BIND 9. The default query type is "A", unless the \fB\-x\fR -option is supplied to indicate a reverse lookup. A zone transfer can be requested by specifying a type of AXFR. When an incremental zone transfer (IXFR) is required, +option is supplied to indicate a reverse lookup. A zone transfer can be requested by specifying a type of AXFR. When an incremental zone transfer (IXFR) is required, set the \fItype\fR -is set to +to ixfr=N. The incremental zone transfer will contain the changes made to the zone since the serial number in the zone's SOA record was \fIN\fR. +.RE .PP -The -\fB\-q\fR -option sets the query name to -\fIname\fR. This is useful to distinguish the -\fIname\fR -from other arguments. -.PP -The -\fB\-v\fR -causes -\fBdig\fR -to print the version number and exit. +\-v +.RS 4 +Print the version number and exit. +.RE .PP -Reverse lookups \(em mapping addresses to names \(em are simplified by the -\fB\-x\fR -option. +\-x \fIaddr\fR +.RS 4 +Simplified reverse lookups, for mapping addresses to names. The \fIaddr\fR -is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address. When this option is used, there is no need to provide the +is an IPv4 address in dotted\-decimal notation, or a colon\-delimited IPv6 address. When the +\fB\-x\fR +is used, there is no need to provide the \fIname\fR, \fIclass\fR and @@ -208,35 +228,41 @@ and arguments. \fBdig\fR automatically performs a lookup for a name like -11.12.13.10.in\-addr.arpa -and sets the query type and class to PTR and IN respectively. By default, IPv6 addresses are looked up using nibble format under the IP6.ARPA domain. To use the older RFC1886 method using the IP6.INT domain specify the +94.2.0.192.in\-addr.arpa +and sets the query type and class to PTR and IN respectively. IPv6 addresses are looked up using nibble format under the IP6.ARPA domain (but see also the \fB\-i\fR -option. Bit string labels (RFC2874) are now experimental and are not attempted. +option). +.RE .PP -To sign the DNS queries sent by -\fBdig\fR -and their responses using transaction signatures (TSIG), specify a TSIG key file using the +\-y \fI[hmac:]\fR\fIkeyname:secret\fR +.RS 4 +Sign queries using TSIG with the given authentication key. +\fIkeyname\fR +is the name of the key, and +\fIsecret\fR +is the base64 encoded shared secret. +\fIhmac\fR +is the name of the key algorithm; valid choices are +hmac\-md5, +hmac\-sha1, +hmac\-sha224, +hmac\-sha256, +hmac\-sha384, or +hmac\-sha512. If +\fIhmac\fR +is not specified, the default is +hmac\-md5. +.sp +NOTE: You should use the \fB\-k\fR -option. You can also specify the TSIG key itself on the command line using the +option and avoid the \fB\-y\fR -option; -\fIhmac\fR -is the type of the TSIG, default HMAC\-MD5, -\fIname\fR -is the name of the TSIG key and -\fIkey\fR -is the actual key. The key is a base\-64 encoded string, typically generated by -\fBdnssec\-keygen\fR(8). Caution should be taken when using the +option, because with \fB\-y\fR -option on multi\-user systems as the key can be visible in the output from +the shared secret is supplied as a command line argument in clear text. This may be visible in the output from \fBps\fR(1) -or in the shell's history file. When using TSIG authentication with -\fBdig\fR, the name server that is queried needs to know the key and algorithm that is being used. In BIND, this is done by providing appropriate -\fBkey\fR -and -\fBserver\fR -statements in -\fInamed.conf\fR. +or in a history file maintained by the user's shell. +.RE .SH "QUERY OPTIONS" .PP \fBdig\fR @@ -245,7 +271,10 @@ provides a number of query options which Each query option is identified by a keyword preceded by a plus sign (+). Some keywords set or reset an option. These may be preceded by the string no to negate the meaning of that keyword. Other keywords assign values to options like the timeout interval. They have the form -\fB+keyword=value\fR. The query options are: +\fB+keyword=value\fR. Keywords may be abbreviated, provided the abbreviation is unambiguous; for example, ++cd +is equivalent to ++cdflag. The query options are: .PP \fB+[no]aaflag\fR .RS 4 @@ -300,7 +329,7 @@ bytes. The maximum and minimum sizes of Set [do not set] the CD (checking disabled) bit in the query. This requests the server to not perform DNSSEC validation of responses. .RE .PP -\fB+[no]cl\fR +\fB+[no]class\fR .RS 4 Display [do not display] the CLASS when printing the record. .RE @@ -421,6 +450,12 @@ Print [do not print] the query as it is Print [do not print] the question section of a query when an answer is returned. The default is to print the question section as a comment. .RE .PP +\fB+[no]rdflag\fR +.RS 4 +A synonym for +\fI+[no]recurse\fR. +.RE +.PP \fB+[no]recurse\fR .RS 4 Toggle the setting of the RD (recursion desired) bit in the query. This bit is set by default, which means @@ -518,6 +553,8 @@ Toggle tracing of the delegation path fr \fBdig\fR makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup. .sp +If @server is also specified, it affects only the initial query for the root zone name servers. +.sp \fB+dnssec\fR is also set when +trace is set to better emulate the default queries from a nameserver. .RE @@ -620,7 +657,7 @@ RFC1035. .PP There are probably too many query options. .SH "COPYRIGHT" -Copyright \(co 2004\-2011, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004\-2011, 2013\-2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000\-2003 Internet Software Consortium. .br Modified: stable/9/contrib/bind9/bin/dig/dig.c ============================================================================== --- stable/9/contrib/bind9/bin/dig/dig.c Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/dig/dig.c Sat Oct 3 09:33:29 2015 (r288577) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -165,71 +165,75 @@ help(void) { " q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n" " (Use ixfr=version for type ixfr)\n" " q-opt is one of:\n" -" -x dot-notation (shortcut for reverse lookups)\n" -" -i (use IP6.INT for IPv6 reverse lookups)\n" -" -f filename (batch mode)\n" +" -4 (use IPv4 query transport only)\n" +" -6 (use IPv6 query transport only)\n" " -b address[#port] (bind to source address/port)\n" +" -c class (specify query class)\n" +" -f filename (batch mode)\n" +" -i (use IP6.INT for IPv6 reverse lookups)\n" +" -k keyfile (specify tsig key file)\n" +" -m (enable memory usage debugging)\n" " -p port (specify port number)\n" " -q name (specify query name)\n" " -t type (specify query type)\n" -" -c class (specify query class)\n" -" -k keyfile (specify tsig key file)\n" +" -x dot-notation (shortcut for reverse lookups)\n" " -y [hmac:]name:key (specify named base64 tsig key)\n" -" -4 (use IPv4 query transport only)\n" -" -6 (use IPv6 query transport only)\n" -" -m (enable memory usage debugging)\n" " d-opt is of the form +keyword[=value], where keyword is:\n" -" +[no]vc (TCP mode)\n" -" +[no]tcp (TCP mode, alternate syntax)\n" -" +time=### (Set query timeout) [5]\n" -" +tries=### (Set number of UDP attempts) [3]\n" -" +retry=### (Set number of UDP retries) [2]\n" -" +domain=### (Set default domainname)\n" -" +bufsize=### (Set EDNS0 Max UDP packet size)\n" -" +ndots=### (Set NDOTS value)\n" -" +[no]edns[=###] (Set EDNS version) [0]\n" -" +[no]search (Set whether to use searchlist)\n" -" +[no]showsearch (Search with intermediate results)\n" -" +[no]defname (Ditto)\n" -" +[no]recurse (Recursive mode)\n" -" +[no]ignore (Don't revert to TCP for TC responses.)" -"\n" -" +[no]fail (Don't try next server on SERVFAIL)\n" -" +[no]besteffort (Try to parse even illegal messages)\n" " +[no]aaonly (Set AA flag in query (+[no]aaflag))\n" -" +[no]adflag (Set AD flag in query)\n" -" +[no]cdflag (Set CD flag in query)\n" +" +[no]additional (Control display of additional section)\n" +" +[no]adflag (Set AD flag in query (default on))\n" +" +[no]all (Set or clear all display flags)\n" +" +[no]answer (Control display of answer section)\n" +" +[no]authority (Control display of authority section)\n" +" +[no]besteffort (Try to parse even illegal messages)\n" +" +bufsize=### (Set EDNS0 Max UDP packet size)\n" +" +[no]cdflag (Set checking disabled flag in query)\n" " +[no]cl (Control display of class in records)\n" " +[no]cmd (Control display of command line)\n" " +[no]comments (Control display of comment lines)\n" +" +[no]defname (Use search list (+[no]search))\n" +" +[no]dnssec (Request DNSSEC records)\n" +" +domain=### (Set default domainname)\n" +" +[no]edns[=###] (Set EDNS version) [0]\n" +" +[no]fail (Don't try next server on SERVFAIL)\n" +" +[no]identify (ID responders in short answers)\n" +" +[no]ignore (Don't revert to TCP for TC responses.)" +"\n" +" +[no]keepopen (Keep the TCP socket open between queries)\n" +" +[no]multiline (Print records in an expanded format)\n" +" +ndots=### (Set search NDOTS value)\n" +" +[no]nsid (Request Name Server ID)\n" +" +[no]nssearch (Search all authoritative nameservers)\n" +" +[no]onesoa (AXFR prints only one soa record)\n" +" +[no]qr (Print question before sending)\n" +" +[no]question (Control display of question section)\n" +" +[no]recurse (Recursive mode)\n" +" +retry=### (Set number of UDP retries) [2]\n" " +[no]rrcomments (Control display of per-record " "comments)\n" -" +[no]question (Control display of question)\n" -" +[no]answer (Control display of answer)\n" -" +[no]authority (Control display of authority)\n" -" +[no]additional (Control display of additional)\n" -" +[no]stats (Control display of statistics)\n" -" +[no]short (Disable everything except short\n" +" +[no]search (Set whether to use searchlist)\n" +" +[no]short (Display nothing except short\n" " form of answer)\n" -" +[no]ttlid (Control display of ttls in records)\n" -" +[no]all (Set or clear all display flags)\n" -" +[no]qr (Print question before sending)\n" -" +[no]nssearch (Search all authoritative nameservers)\n" -" +[no]identify (ID responders in short answers)\n" -" +[no]trace (Trace delegation down from root [+dnssec])\n" -" +[no]dnssec (Request DNSSEC records)\n" -" +[no]nsid (Request Name Server ID)\n" +" +[no]showsearch (Search with intermediate results)\n" #ifdef DIG_SIGCHASE " +[no]sigchase (Chase DNSSEC signatures)\n" -" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n" +#endif +" +[no]split=## (Split hex/base64 fields into chunks)\n" +" +[no]stats (Control display of statistics)\n" +" +[no]tcp (TCP mode (+[no]vc))\n" +" +time=### (Set query timeout) [5]\n" +#ifdef DIG_SIGCHASE #if DIG_SIGCHASE_TD " +[no]topdown (Do DNSSEC validation top down mode)\n" #endif #endif -" +[no]split=## (Split hex/base64 fields into chunks)\n" -" +[no]multiline (Print records in an expanded format)\n" -" +[no]onesoa (AXFR prints only one soa record)\n" -" +[no]keepopen (Keep the TCP socket open between queries)\n" +" +[no]trace (Trace delegation down from root [+dnssec])\n" +" +tries=### (Set number of UDP attempts) [3]\n" +#ifdef DIG_SIGCHASE +" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n" +#endif +" +[no]ttlid (Control display of ttls in records)\n" +" +[no]vc (TCP mode (+[no]tcp))\n" " global d-opts and servers (before host name) affect all queries.\n" " local d-opts and servers (after host name) affect only that lookup.\n" " -h (print help and exit)\n" @@ -306,6 +310,7 @@ say_message(dns_rdata_t *rdata, dig_quer isc_result_t result; isc_uint64_t diff; char store[sizeof("12345678901234567890")]; + unsigned int styleflags = 0; if (query->lookup->trace || query->lookup->ns_search_only) { result = dns_rdatatype_totext(rdata->type, buf); @@ -313,7 +318,11 @@ say_message(dns_rdata_t *rdata, dig_quer return (result); ADD_STRING(buf, " "); } - result = dns_rdata_totext(rdata, NULL, buf); + + if (rrcomments) + styleflags |= DNS_STYLEFLAG_RRCOMMENT; + result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, + splitwidth, " ", buf); if (result == ISC_R_NOSPACE) return (result); check_result(result, "dns_rdata_totext"); @@ -831,8 +840,9 @@ plus_option(char *option, isc_boolean_t goto invalid_option; } break; - case 'l': /* cl */ - FULLCHECK("cl"); + case 'l': /* class */ + /* keep +cl for backwards compatibility */ + FULLCHECK2("cl", "class"); noclass = ISC_TF(!state); break; case 'm': /* cmd */ @@ -984,6 +994,10 @@ plus_option(char *option, isc_boolean_t break; case 'r': switch (cmd[1]) { + case 'd': /* rdflag */ + FULLCHECK("rdflag"); + lookup->recurse = state; + break; case 'e': switch (cmd[2]) { case 'c': /* recurse */ Modified: stable/9/contrib/bind9/bin/dig/dig.docbook ============================================================================== --- stable/9/contrib/bind9/bin/dig/dig.docbook Sat Oct 3 09:22:21 2015 (r288576) +++ stable/9/contrib/bind9/bin/dig/dig.docbook Sat Oct 3 09:33:29 2015 (r288577) @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> - - - - If a non-standard port number is to be queried, the - option is used. port# is - the port number that dig will send its - queries - instead of the standard DNS port number 53. This option would be used - to test a name server that has been configured to listen for queries - on a non-standard port number. - - - - The option forces dig - to only - use IPv4 query transport. The option forces - dig to only use IPv6 query transport. - - - - The option sets the query type to - type. It can be any valid query type - which is - supported in BIND 9. The default query type is "A", unless the - option is supplied to indicate a reverse lookup. - A zone transfer can be requested by specifying a type of AXFR. When - an incremental zone transfer (IXFR) is required, - type is set to ixfr=N. - The incremental zone transfer will contain the changes made to the zone *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 11:05:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FFBA0E424; Sat, 3 Oct 2015 11:05:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31F95151E; Sat, 3 Oct 2015 11:05:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93B5xo4057250; Sat, 3 Oct 2015 11:05:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93B5xB7057249; Sat, 3 Oct 2015 11:05:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031105.t93B5xB7057249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288579 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:05:59 -0000 Author: mav Date: Sat Oct 3 11:05:58 2015 New Revision: 288579 URL: https://svnweb.freebsd.org/changeset/base/288579 Log: Restore original array_rd_sz semantics. Before r278702 prefetch was blocked for I/Os > 1MB, after -- >= 1MB. 1MB I/Os are used for bulk operations in CTL (XCOPY, VERIFY), and disabling prefetch for them reduced the performance. This is temporary local patch, that should be replaced when upstreamed. Discussed with: mahrens MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 09:47:29 2015 (r288578) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:05:58 2015 (r288579) @@ -449,7 +449,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } if ((flags & DMU_READ_NO_PREFETCH) == 0 && read && - length < zfetch_array_rd_sz) { + length <= zfetch_array_rd_sz) { dmu_zfetch(&dn->dn_zfetch, blkid, nblks); } rw_exit(&dn->dn_struct_rwlock); From owner-svn-src-all@freebsd.org Sat Oct 3 11:10:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E1E7A0E702; Sat, 3 Oct 2015 11:10:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DB1F18E8; Sat, 3 Oct 2015 11:10:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BAtDI060094; Sat, 3 Oct 2015 11:10:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BAtPw060093; Sat, 3 Oct 2015 11:10:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031110.t93BAtPw060093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:10:55 +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: r288580 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:10:55 -0000 Author: mav Date: Sat Oct 3 11:10:54 2015 New Revision: 288580 URL: https://svnweb.freebsd.org/changeset/base/288580 Log: MFC r286762: Revert part of r205231, introducing multiple ARC state locks. This local implementation will be replaced by one from Illumos to reduce code divergence and make further merges easier. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:05:58 2015 (r288579) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:10:54 2015 (r288580) @@ -201,6 +201,9 @@ extern int zfs_prefetch_disable; */ static boolean_t arc_warm; +/* + * These tunables are for performance analysis. + */ uint64_t zfs_arc_max; uint64_t zfs_arc_min; uint64_t zfs_arc_meta_limit = 0; @@ -315,31 +318,13 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_meta * second level ARC benefit from these fast lookups. */ -#define ARCS_LOCK_PAD CACHE_LINE_SIZE -struct arcs_lock { - kmutex_t arcs_lock; -#ifdef _KERNEL - unsigned char pad[(ARCS_LOCK_PAD - sizeof (kmutex_t))]; -#endif -}; - -/* - * must be power of two for mask use to work - * - */ -#define ARC_BUFC_NUMDATALISTS 16 -#define ARC_BUFC_NUMMETADATALISTS 16 -#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS) - typedef struct arc_state { + list_t arcs_list[ARC_BUFC_NUMTYPES]; /* list of evictable buffers */ uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */ uint64_t arcs_size; /* total amount of data in this state */ - list_t arcs_lists[ARC_BUFC_NUMLISTS]; /* list of evictable buffers */ - struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(CACHE_LINE_SIZE); + kmutex_t arcs_mtx; } arc_state_t; -#define ARCS_LOCK(s, i) (&((s)->arcs_locks[(i)].arcs_lock)) - /* The 6 states: */ static arc_state_t ARC_anon; static arc_state_t ARC_mru; @@ -365,7 +350,6 @@ typedef struct arc_stats { kstat_named_t arcstat_mfu_ghost_hits; kstat_named_t arcstat_allocated; kstat_named_t arcstat_deleted; - kstat_named_t arcstat_stolen; kstat_named_t arcstat_recycle_miss; /* * Number of buffers that could not be evicted because the hash lock @@ -587,7 +571,6 @@ static arc_stats_t arc_stats = { { "mfu_ghost_hits", KSTAT_DATA_UINT64 }, { "allocated", KSTAT_DATA_UINT64 }, { "deleted", KSTAT_DATA_UINT64 }, - { "stolen", KSTAT_DATA_UINT64 }, { "recycle_miss", KSTAT_DATA_UINT64 }, { "mutex_miss", KSTAT_DATA_UINT64 }, { "evict_skip", KSTAT_DATA_UINT64 }, @@ -1684,23 +1667,6 @@ arc_buf_freeze(arc_buf_t *buf) } static void -get_buf_info(arc_buf_hdr_t *hdr, arc_state_t *state, list_t **list, kmutex_t **lock) -{ - uint64_t buf_hashid = buf_hash(hdr->b_spa, &hdr->b_dva, hdr->b_birth); - - if (arc_buf_type(hdr) == ARC_BUFC_METADATA) - buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1); - else { - buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1); - buf_hashid += ARC_BUFC_NUMMETADATALISTS; - } - - *list = &state->arcs_lists[buf_hashid]; - *lock = ARCS_LOCK(state, buf_hashid); -} - - -static void add_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag) { ASSERT(HDR_HAS_L1HDR(hdr)); @@ -1712,13 +1678,11 @@ add_reference(arc_buf_hdr_t *hdr, kmutex /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { uint64_t delta = hdr->b_size * hdr->b_l1hdr.b_datacnt; + list_t *list = &state->arcs_list[arc_buf_type(hdr)]; uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; - list_t *list; - kmutex_t *lock; - get_buf_info(hdr, state, &list, &lock); - ASSERT(!MUTEX_HELD(lock)); - mutex_enter(lock); + ASSERT(!MUTEX_HELD(&state->arcs_mtx)); + mutex_enter(&state->arcs_mtx); ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); list_remove(list, hdr); if (GHOST_STATE(state)) { @@ -1729,7 +1693,7 @@ add_reference(arc_buf_hdr_t *hdr, kmutex ASSERT(delta > 0); ASSERT3U(*size, >=, delta); atomic_add_64(size, -delta); - mutex_exit(lock); + mutex_exit(&state->arcs_mtx); } /* remove the prefetch flag if we get a reference */ hdr->b_flags &= ~ARC_FLAG_PREFETCH; @@ -1753,18 +1717,15 @@ remove_reference(arc_buf_hdr_t *hdr, kmu if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; - list_t *list; - kmutex_t *lock; - get_buf_info(hdr, state, &list, &lock); - ASSERT(!MUTEX_HELD(lock)); - mutex_enter(lock); + ASSERT(!MUTEX_HELD(&state->arcs_mtx)); + mutex_enter(&state->arcs_mtx); ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); - list_insert_head(list, hdr); + list_insert_head(&state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT(hdr->b_l1hdr.b_datacnt > 0); atomic_add_64(size, hdr->b_size * hdr->b_l1hdr.b_datacnt); - mutex_exit(lock); + mutex_exit(&state->arcs_mtx); } return (cnt); } @@ -1782,8 +1743,6 @@ arc_change_state(arc_state_t *new_state, uint32_t datacnt; uint64_t from_delta, to_delta; arc_buf_contents_t buftype = arc_buf_type(hdr); - list_t *list; - kmutex_t *lock; /* * We almost always have an L1 hdr here, since we call arc_hdr_realloc() @@ -1816,17 +1775,15 @@ arc_change_state(arc_state_t *new_state, */ if (refcnt == 0) { if (old_state != arc_anon && old_state != arc_l2c_only) { - int use_mutex; + int use_mutex = !MUTEX_HELD(&old_state->arcs_mtx); uint64_t *size = &old_state->arcs_lsize[buftype]; - get_buf_info(hdr, old_state, &list, &lock); - use_mutex = !MUTEX_HELD(lock); if (use_mutex) - mutex_enter(lock); + mutex_enter(&old_state->arcs_mtx); ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); - list_remove(list, hdr); + list_remove(&old_state->arcs_list[buftype], hdr); /* * If prefetching out of the ghost cache, @@ -1841,10 +1798,10 @@ arc_change_state(arc_state_t *new_state, atomic_add_64(size, -from_delta); if (use_mutex) - mutex_exit(lock); + mutex_exit(&old_state->arcs_mtx); } if (new_state != arc_anon && new_state != arc_l2c_only) { - int use_mutex; + int use_mutex = !MUTEX_HELD(&new_state->arcs_mtx); uint64_t *size = &new_state->arcs_lsize[buftype]; /* @@ -1854,23 +1811,21 @@ arc_change_state(arc_state_t *new_state, * beforehand. */ ASSERT(HDR_HAS_L1HDR(hdr)); - get_buf_info(hdr, new_state, &list, &lock); - use_mutex = !MUTEX_HELD(lock); if (use_mutex) - mutex_enter(lock); + mutex_enter(&new_state->arcs_mtx); - list_insert_head(list, hdr); + list_insert_head(&new_state->arcs_list[buftype], hdr); /* ghost elements have a ghost size */ if (GHOST_STATE(new_state)) { - ASSERT(datacnt == 0); + ASSERT0(datacnt); ASSERT(hdr->b_l1hdr.b_buf == NULL); to_delta = hdr->b_size; } atomic_add_64(size, to_delta); if (use_mutex) - mutex_exit(lock); + mutex_exit(&new_state->arcs_mtx); } } @@ -1892,10 +1847,8 @@ arc_change_state(arc_state_t *new_state, * L2 headers should never be on the L2 state list since they don't * have L1 headers allocated. */ -#ifdef illumos ASSERT(list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); -#endif } void @@ -2535,41 +2488,55 @@ arc_evict(arc_state_t *state, uint64_t s { arc_state_t *evicted_state; uint64_t bytes_evicted = 0, skipped = 0, missed = 0; - int64_t bytes_remaining; arc_buf_hdr_t *hdr, *hdr_prev = NULL; - list_t *evicted_list, *list, *evicted_list_start, *list_start; - kmutex_t *lock, *evicted_lock; kmutex_t *hash_lock; boolean_t have_lock; void *stolen = NULL; arc_buf_hdr_t marker = { 0 }; int count = 0; - static int evict_metadata_offset, evict_data_offset; - int i, idx, offset, list_count, lists; ASSERT(state == arc_mru || state == arc_mfu); evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; /* + * The ghost list lock must be acquired first in order to prevent + * a 3 party deadlock: + * + * - arc_evict_ghost acquires arc_*_ghost->arcs_mtx, followed by + * l2ad_mtx in arc_hdr_realloc + * - l2arc_write_buffers acquires l2ad_mtx, followed by arc_*->arcs_mtx + * - arc_evict acquires arc_*_ghost->arcs_mtx, followed by + * arc_*_ghost->arcs_mtx and forms a deadlock cycle. + * + * This situation is avoided by acquiring the ghost list lock first. + */ + mutex_enter(&evicted_state->arcs_mtx); + mutex_enter(&state->arcs_mtx); + + /* * Decide which "type" (data vs metadata) to recycle from. * * If we are over the metadata limit, recycle from metadata. * If we are under the metadata minimum, recycle from data. * Otherwise, recycle from whichever type has the oldest (least - * recently accessed) header. This is not yet implemented. + * recently accessed) header. */ if (recycle) { + arc_buf_hdr_t *data_hdr = + list_tail(&state->arcs_list[ARC_BUFC_DATA]); + arc_buf_hdr_t *metadata_hdr = + list_tail(&state->arcs_list[ARC_BUFC_METADATA]); arc_buf_contents_t realtype; - if (state->arcs_lsize[ARC_BUFC_DATA] == 0) { + + if (data_hdr == NULL) { realtype = ARC_BUFC_METADATA; - } else if (state->arcs_lsize[ARC_BUFC_METADATA] == 0) { + } else if (metadata_hdr == NULL) { realtype = ARC_BUFC_DATA; } else if (arc_meta_used >= arc_meta_limit) { realtype = ARC_BUFC_METADATA; } else if (arc_meta_used <= arc_meta_min) { realtype = ARC_BUFC_DATA; -#ifdef illumos } else if (HDR_HAS_L1HDR(data_hdr) && HDR_HAS_L1HDR(metadata_hdr) && data_hdr->b_l1hdr.b_arc_access < @@ -2577,11 +2544,6 @@ arc_evict(arc_state_t *state, uint64_t s realtype = ARC_BUFC_DATA; } else { realtype = ARC_BUFC_METADATA; -#else - } else { - /* TODO */ - realtype = type; -#endif } if (realtype != type) { /* @@ -2595,49 +2557,10 @@ arc_evict(arc_state_t *state, uint64_t s } } - if (type == ARC_BUFC_METADATA) { - offset = 0; - list_count = ARC_BUFC_NUMMETADATALISTS; - list_start = &state->arcs_lists[0]; - evicted_list_start = &evicted_state->arcs_lists[0]; - idx = evict_metadata_offset; - } else { - offset = ARC_BUFC_NUMMETADATALISTS; - list_start = &state->arcs_lists[offset]; - evicted_list_start = &evicted_state->arcs_lists[offset]; - list_count = ARC_BUFC_NUMDATALISTS; - idx = evict_data_offset; - } - bytes_remaining = evicted_state->arcs_lsize[type]; - lists = 0; - -evict_start: - list = &list_start[idx]; - evicted_list = &evicted_list_start[idx]; - lock = ARCS_LOCK(state, (offset + idx)); - evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); - - /* - * The ghost list lock must be acquired first in order to prevent - * a 3 party deadlock: - * - * - arc_evict_ghost acquires arc_*_ghost->arcs_mtx, followed by - * l2ad_mtx in arc_hdr_realloc - * - l2arc_write_buffers acquires l2ad_mtx, followed by arc_*->arcs_mtx - * - arc_evict acquires arc_*_ghost->arcs_mtx, followed by - * arc_*_ghost->arcs_mtx and forms a deadlock cycle. - * - * This situation is avoided by acquiring the ghost list lock first. - */ - mutex_enter(evicted_lock); - mutex_enter(lock); + list_t *list = &state->arcs_list[type]; for (hdr = list_tail(list); hdr; hdr = hdr_prev) { hdr_prev = list_prev(list, hdr); - if (HDR_HAS_L1HDR(hdr)) { - bytes_remaining -= - (hdr->b_size * hdr->b_l1hdr.b_datacnt); - } /* prefetch buffers have a minimum lifespan */ if (HDR_IO_IN_PROGRESS(hdr) || (spa && hdr->b_spa != spa) || @@ -2667,11 +2590,11 @@ evict_start: */ if (!recycle && count++ > arc_evict_iterations) { list_insert_after(list, hdr, &marker); - mutex_exit(lock); - mutex_exit(evicted_lock); + mutex_exit(&state->arcs_mtx); + mutex_exit(&evicted_state->arcs_mtx); kpreempt(KPREEMPT_SYNC); - mutex_enter(evicted_lock); - mutex_enter(lock); + mutex_enter(&evicted_state->arcs_mtx); + mutex_enter(&state->arcs_mtx); hdr_prev = list_prev(list, &marker); list_remove(list, &marker); count = 0; @@ -2741,35 +2664,17 @@ evict_start: mutex_exit(hash_lock); if (bytes >= 0 && bytes_evicted >= bytes) break; - if (bytes_remaining > 0) { - mutex_exit(evicted_lock); - mutex_exit(lock); - idx = ((idx + 1) & (list_count - 1)); - lists++; - goto evict_start; - } } else { missed += 1; } } - mutex_exit(lock); - mutex_exit(evicted_lock); + mutex_exit(&state->arcs_mtx); + mutex_exit(&evicted_state->arcs_mtx); - idx = ((idx + 1) & (list_count - 1)); - lists++; - - if (bytes_evicted < bytes) { - if (lists < list_count) - goto evict_start; - else - dprintf("only evicted %lld bytes from %x", - (longlong_t)bytes_evicted, state); - } - if (type == ARC_BUFC_METADATA) - evict_metadata_offset = idx; - else - evict_data_offset = idx; + if (bytes_evicted < bytes) + dprintf("only evicted %lld bytes from %x", + (longlong_t)bytes_evicted, state); if (skipped) ARCSTAT_INCR(arcstat_evict_skip, skipped); @@ -2784,8 +2689,6 @@ evict_start: * this chore to the arc_reclaim_thread(). */ - if (stolen) - ARCSTAT_BUMP(arcstat_stolen); return (stolen); } @@ -2798,29 +2701,15 @@ arc_evict_ghost(arc_state_t *state, uint { arc_buf_hdr_t *hdr, *hdr_prev; arc_buf_hdr_t marker = { 0 }; - list_t *list, *list_start; - kmutex_t *hash_lock, *lock; + list_t *list = &state->arcs_list[ARC_BUFC_DATA]; + kmutex_t *hash_lock; uint64_t bytes_deleted = 0; uint64_t bufs_skipped = 0; int count = 0; - static int evict_offset; - int list_count, idx = evict_offset; - int offset, lists = 0; ASSERT(GHOST_STATE(state)); - - /* - * data lists come after metadata lists - */ - list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS]; - list_count = ARC_BUFC_NUMDATALISTS; - offset = ARC_BUFC_NUMMETADATALISTS; - -evict_start: - list = &list_start[idx]; - lock = ARCS_LOCK(state, idx + offset); - - mutex_enter(lock); +top: + mutex_enter(&state->arcs_mtx); for (hdr = list_tail(list); hdr; hdr = hdr_prev) { hdr_prev = list_prev(list, hdr); if (arc_buf_type(hdr) >= ARC_BUFC_NUMTYPES) @@ -2845,9 +2734,9 @@ evict_start: */ if (count++ > arc_evict_iterations) { list_insert_after(list, hdr, &marker); - mutex_exit(lock); + mutex_exit(&state->arcs_mtx); kpreempt(KPREEMPT_SYNC); - mutex_enter(lock); + mutex_enter(&state->arcs_mtx); hdr_prev = list_prev(list, &marker); list_remove(list, &marker); count = 0; @@ -2889,10 +2778,10 @@ evict_start: * available, restart from where we left off. */ list_insert_after(list, hdr, &marker); - mutex_exit(lock); + mutex_exit(&state->arcs_mtx); mutex_enter(hash_lock); mutex_exit(hash_lock); - mutex_enter(lock); + mutex_enter(&state->arcs_mtx); hdr_prev = list_prev(list, &marker); list_remove(list, &marker); } else { @@ -2900,20 +2789,12 @@ evict_start: } } - mutex_exit(lock); - idx = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1)); - lists++; - - if (lists < list_count) - goto evict_start; + mutex_exit(&state->arcs_mtx); - evict_offset = idx; - if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] && + if (list == &state->arcs_list[ARC_BUFC_DATA] && (bytes < 0 || bytes_deleted < bytes)) { - list_start = &state->arcs_lists[0]; - list_count = ARC_BUFC_NUMMETADATALISTS; - offset = lists = 0; - goto evict_start; + list = &state->arcs_list[ARC_BUFC_METADATA]; + goto top; } if (bufs_skipped) { @@ -2993,23 +2874,14 @@ arc_adjust(void) static void arc_do_user_evicts(void) { - static arc_buf_t *tmp_arc_eviction_list; - - /* - * Move list over to avoid LOR - */ -restart: mutex_enter(&arc_eviction_mtx); - tmp_arc_eviction_list = arc_eviction_list; - arc_eviction_list = NULL; - mutex_exit(&arc_eviction_mtx); - - while (tmp_arc_eviction_list != NULL) { - arc_buf_t *buf = tmp_arc_eviction_list; - tmp_arc_eviction_list = buf->b_next; + while (arc_eviction_list != NULL) { + arc_buf_t *buf = arc_eviction_list; + arc_eviction_list = buf->b_next; mutex_enter(&buf->b_evict_lock); buf->b_hdr = NULL; mutex_exit(&buf->b_evict_lock); + mutex_exit(&arc_eviction_mtx); if (buf->b_efunc != NULL) VERIFY0(buf->b_efunc(buf->b_private)); @@ -3017,10 +2889,9 @@ restart: buf->b_efunc = NULL; buf->b_private = NULL; kmem_cache_free(buf_cache, buf); + mutex_enter(&arc_eviction_mtx); } - - if (arc_eviction_list != NULL) - goto restart; + mutex_exit(&arc_eviction_mtx); } /* @@ -3068,7 +2939,6 @@ arc_flush(spa_t *spa) void arc_shrink(int64_t to_free) { - if (arc_c > arc_c_min) { DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, arc_c_min, uint64_t, arc_p, uint64_t, to_free); @@ -3906,7 +3776,7 @@ arc_read_done(zio_t *zio) } /* - * "Read" the block block at the specified DVA (in bp) via the + * "Read" the block at the specified DVA (in bp) via the * cache. If the block is found in the cache, invoke the provided * callback immediately and return. Note that the `zio' parameter * in the callback will be NULL in this case, since no IO was @@ -4300,8 +4170,6 @@ arc_clear_callback(arc_buf_t *buf) kmutex_t *hash_lock; arc_evict_func_t *efunc = buf->b_efunc; void *private = buf->b_private; - list_t *list, *evicted_list; - kmutex_t *lock, *evicted_lock; mutex_enter(&buf->b_evict_lock); hdr = buf->b_hdr; @@ -4956,39 +4824,43 @@ arc_init(void) arc_l2c_only = &ARC_l2c_only; arc_size = 0; - for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { - mutex_init(&arc_anon->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mru_ghost->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_mfu_ghost->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock, - NULL, MUTEX_DEFAULT, NULL); - - list_create(&arc_mru->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - list_create(&arc_mru_ghost->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - list_create(&arc_mfu->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - list_create(&arc_mfu_ghost->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - list_create(&arc_mfu_ghost->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - list_create(&arc_l2c_only->arcs_lists[i], - sizeof (arc_buf_hdr_t), - offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); - } + mutex_init(&arc_anon->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mru_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_mfu_ghost->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&arc_l2c_only->arcs_mtx, NULL, MUTEX_DEFAULT, NULL); + + list_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mru->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); + list_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), + offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node)); buf_init(); @@ -5072,8 +4944,6 @@ arc_init(void) void arc_fini(void) { - int i; - mutex_enter(&arc_reclaim_thr_lock); arc_thread_exit = 1; cv_signal(&arc_reclaim_thr_cv); @@ -5094,20 +4964,21 @@ arc_fini(void) mutex_destroy(&arc_reclaim_thr_lock); cv_destroy(&arc_reclaim_thr_cv); - for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { - list_destroy(&arc_mru->arcs_lists[i]); - list_destroy(&arc_mru_ghost->arcs_lists[i]); - list_destroy(&arc_mfu->arcs_lists[i]); - list_destroy(&arc_mfu_ghost->arcs_lists[i]); - list_destroy(&arc_l2c_only->arcs_lists[i]); - - mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock); - mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock); - mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock); - mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock); - mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock); - mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock); - } + list_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); + list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); + list_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); + list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); + list_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]); + list_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); + list_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]); + list_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); + + mutex_destroy(&arc_anon->arcs_mtx); + mutex_destroy(&arc_mru->arcs_mtx); + mutex_destroy(&arc_mru_ghost->arcs_mtx); + mutex_destroy(&arc_mfu->arcs_mtx); + mutex_destroy(&arc_mfu_ghost->arcs_mtx); + mutex_destroy(&arc_l2c_only->arcs_mtx); buf_fini(); @@ -5611,27 +5482,26 @@ static list_t * l2arc_list_locked(int list_num, kmutex_t **lock) { list_t *list = NULL; - int idx; - ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS); + ASSERT(list_num >= 0 && list_num <= 3); - if (list_num < ARC_BUFC_NUMMETADATALISTS) { - idx = list_num; - list = &arc_mfu->arcs_lists[idx]; - *lock = ARCS_LOCK(arc_mfu, idx); - } else if (list_num < ARC_BUFC_NUMMETADATALISTS * 2) { - idx = list_num - ARC_BUFC_NUMMETADATALISTS; - list = &arc_mru->arcs_lists[idx]; - *lock = ARCS_LOCK(arc_mru, idx); - } else if (list_num < (ARC_BUFC_NUMMETADATALISTS * 2 + - ARC_BUFC_NUMDATALISTS)) { - idx = list_num - ARC_BUFC_NUMMETADATALISTS; - list = &arc_mfu->arcs_lists[idx]; - *lock = ARCS_LOCK(arc_mfu, idx); - } else { - idx = list_num - ARC_BUFC_NUMLISTS; - list = &arc_mru->arcs_lists[idx]; - *lock = ARCS_LOCK(arc_mru, idx); + switch (list_num) { + case 0: + list = &arc_mfu->arcs_list[ARC_BUFC_METADATA]; + *lock = &arc_mfu->arcs_mtx; + break; + case 1: + list = &arc_mru->arcs_list[ARC_BUFC_METADATA]; + *lock = &arc_mru->arcs_mtx; + break; + case 2: + list = &arc_mfu->arcs_list[ARC_BUFC_DATA]; + *lock = &arc_mfu->arcs_mtx; + break; + case 3: + list = &arc_mru->arcs_list[ARC_BUFC_DATA]; + *lock = &arc_mru->arcs_mtx; + break; } ASSERT(!(MUTEX_HELD(*lock))); @@ -5793,7 +5663,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Copy buffers for L2ARC writing. */ mutex_enter(&dev->l2ad_mtx); - for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) { + for (try = 0; try <= 3; try++) { uint64_t passed_sz = 0; list = l2arc_list_locked(try, &list_lock); @@ -5812,7 +5682,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de if (hdr == NULL) ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter); - headroom = target_sz * l2arc_headroom * 2 / ARC_BUFC_NUMLISTS; + headroom = target_sz * l2arc_headroom; if (do_headroom_boost) headroom = (headroom * l2arc_headroom_boost) / 100; From owner-svn-src-all@freebsd.org Sat Oct 3 11:11:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA52FA0E9EC; Sat, 3 Oct 2015 11:11:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D18771CB5; Sat, 3 Oct 2015 11:11:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BBvr7061227; Sat, 3 Oct 2015 11:11:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BBvIv061224; Sat, 3 Oct 2015 11:11:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031111.t93BBvIv061224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:11: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: r288581 - in stable/10/sys: cddl/contrib/opensolaris/uts/common cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/fs/zfs/sys conf 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:11:58 -0000 Author: mav Date: Sat Oct 3 11:11:56 2015 New Revision: 288581 URL: https://svnweb.freebsd.org/changeset/base/288581 Log: MFC r286763: 5497 lock contention on arcs_mtx Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Richard Elling Approved by: Dan McDonald Author: Prakash Surya illumos/illumos-gate@244781f10dcd82684fd8163c016540667842f203 This patch attempts to reduce lock contention on the current arc_state_t mutexes. These mutexes are used liberally to protect the number of LRU lists within the ARC (e.g. ARC_mru, ARC_mfu, etc). The granularity at which these locks are acquired has been shown to greatly affect the performance of highly concurrent, cached workloads. Added: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c - copied unchanged from r286763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h - copied unchanged from r286763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c stable/10/sys/conf/files Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Oct 3 11:10:54 2015 (r288580) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Oct 3 11:11:56 2015 (r288581) @@ -68,6 +68,7 @@ ZFS_COMMON_OBJS += \ lz4.o \ lzjb.o \ metaslab.o \ + multilist.o \ range_tree.o \ refcount.o \ rrwlock.o \ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:10:54 2015 (r288580) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:11:56 2015 (r288581) @@ -129,6 +129,7 @@ #include #include #include +#include #ifdef _KERNEL #include #endif @@ -149,21 +150,39 @@ int arc_procfd; #endif #endif /* illumos */ -static kmutex_t arc_reclaim_thr_lock; -static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ -static uint8_t arc_thread_exit; +static kmutex_t arc_reclaim_lock; +static kcondvar_t arc_reclaim_thread_cv; +static boolean_t arc_reclaim_thread_exit; +static kcondvar_t arc_reclaim_waiters_cv; + +static kmutex_t arc_user_evicts_lock; +static kcondvar_t arc_user_evicts_cv; +static boolean_t arc_user_evicts_thread_exit; uint_t arc_reduce_dnlc_percent = 3; /* - * The number of iterations through arc_evict_*() before we - * drop & reacquire the lock. + * The number of headers to evict in arc_evict_state_impl() before + * dropping the sublist lock and evicting from another sublist. A lower + * value means we're more likely to evict the "correct" header (i.e. the + * oldest header in the arc state), but comes with higher overhead + * (i.e. more invocations of arc_evict_state_impl()). */ -int arc_evict_iterations = 100; +int zfs_arc_evict_batch_limit = 10; + +/* + * The number of sublists used for each of the arc state lists. If this + * is not set to a suitable value by the user, it will be configured to + * the number of CPUs on the system in arc_init(). + */ +int zfs_arc_num_sublists_per_state = 0; /* number of seconds before growing cache again */ static int arc_grow_retry = 60; +/* shift of arc_c for calculating overflow limit in arc_get_data_buf */ +int zfs_arc_overflow_shift = 8; + /* shift of arc_c for calculating both min and max arc_p */ static int arc_p_min_shift = 4; @@ -319,10 +338,19 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_meta */ typedef struct arc_state { - list_t arcs_list[ARC_BUFC_NUMTYPES]; /* list of evictable buffers */ - uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */ - uint64_t arcs_size; /* total amount of data in this state */ - kmutex_t arcs_mtx; + /* + * list of evictable buffers + */ + multilist_t arcs_list[ARC_BUFC_NUMTYPES]; + /* + * total amount of evictable data in this state + */ + uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; + /* + * total amount of data in this state; this includes: evictable, + * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. + */ + uint64_t arcs_size; } arc_state_t; /* The 6 states: */ @@ -350,7 +378,6 @@ typedef struct arc_stats { kstat_named_t arcstat_mfu_ghost_hits; kstat_named_t arcstat_allocated; kstat_named_t arcstat_deleted; - kstat_named_t arcstat_recycle_miss; /* * Number of buffers that could not be evicted because the hash lock * was held by another thread. The lock may not necessarily be held @@ -364,9 +391,15 @@ typedef struct arc_stats { * not from the spa we're trying to evict from. */ kstat_named_t arcstat_evict_skip; + /* + * Number of times arc_evict_state() was unable to evict enough + * buffers to reach it's target amount. + */ + kstat_named_t arcstat_evict_not_enough; kstat_named_t arcstat_evict_l2_cached; kstat_named_t arcstat_evict_l2_eligible; kstat_named_t arcstat_evict_l2_ineligible; + kstat_named_t arcstat_evict_l2_skip; kstat_named_t arcstat_hash_elements; kstat_named_t arcstat_hash_elements_max; kstat_named_t arcstat_hash_collisions; @@ -517,7 +550,7 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_writes_sent; kstat_named_t arcstat_l2_writes_done; kstat_named_t arcstat_l2_writes_error; - kstat_named_t arcstat_l2_writes_hdr_miss; + kstat_named_t arcstat_l2_writes_lock_retry; kstat_named_t arcstat_l2_evict_lock_retry; kstat_named_t arcstat_l2_evict_reading; kstat_named_t arcstat_l2_evict_l1cached; @@ -571,12 +604,13 @@ static arc_stats_t arc_stats = { { "mfu_ghost_hits", KSTAT_DATA_UINT64 }, { "allocated", KSTAT_DATA_UINT64 }, { "deleted", KSTAT_DATA_UINT64 }, - { "recycle_miss", KSTAT_DATA_UINT64 }, { "mutex_miss", KSTAT_DATA_UINT64 }, { "evict_skip", KSTAT_DATA_UINT64 }, + { "evict_not_enough", KSTAT_DATA_UINT64 }, { "evict_l2_cached", KSTAT_DATA_UINT64 }, { "evict_l2_eligible", KSTAT_DATA_UINT64 }, { "evict_l2_ineligible", KSTAT_DATA_UINT64 }, + { "evict_l2_skip", KSTAT_DATA_UINT64 }, { "hash_elements", KSTAT_DATA_UINT64 }, { "hash_elements_max", KSTAT_DATA_UINT64 }, { "hash_collisions", KSTAT_DATA_UINT64 }, @@ -615,7 +649,7 @@ static arc_stats_t arc_stats = { { "l2_writes_sent", KSTAT_DATA_UINT64 }, { "l2_writes_done", KSTAT_DATA_UINT64 }, { "l2_writes_error", KSTAT_DATA_UINT64 }, - { "l2_writes_hdr_miss", KSTAT_DATA_UINT64 }, + { "l2_writes_lock_retry", KSTAT_DATA_UINT64 }, { "l2_evict_lock_retry", KSTAT_DATA_UINT64 }, { "l2_evict_reading", KSTAT_DATA_UINT64 }, { "l2_evict_l1cached", KSTAT_DATA_UINT64 }, @@ -792,7 +826,7 @@ typedef struct l1arc_buf_hdr { /* protected by arc state mutex */ arc_state_t *b_state; - list_node_t b_arc_node; + multilist_node_t b_arc_node; /* updated atomically */ clock_t b_arc_access; @@ -863,7 +897,6 @@ sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HAN #endif static arc_buf_t *arc_eviction_list; -static kmutex_t arc_eviction_mtx; static arc_buf_hdr_t arc_eviction_hdr; #define GHOST_STATE(state) \ @@ -1092,8 +1125,7 @@ static uint8_t l2arc_thread_exit; static void arc_get_data_buf(arc_buf_t *); static void arc_access(arc_buf_hdr_t *, kmutex_t *); -static int arc_evict_needed(arc_buf_contents_t); -static void arc_evict_ghost(arc_state_t *, uint64_t, int64_t); +static boolean_t arc_is_overflowing(); static void arc_buf_watch(arc_buf_t *); static arc_buf_contents_t arc_buf_type(arc_buf_hdr_t *); @@ -1274,6 +1306,7 @@ hdr_full_cons(void *vbuf, void *unused, cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL); refcount_create(&hdr->b_l1hdr.b_refcnt); mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); + multilist_link_init(&hdr->b_l1hdr.b_arc_node); arc_space_consume(HDR_FULL_SIZE, ARC_SPACE_HDRS); return (0); @@ -1318,6 +1351,7 @@ hdr_full_dest(void *vbuf, void *unused) cv_destroy(&hdr->b_l1hdr.b_cv); refcount_destroy(&hdr->b_l1hdr.b_refcnt); mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); + ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); arc_space_return(HDR_FULL_SIZE, ARC_SPACE_HDRS); } @@ -1354,7 +1388,7 @@ hdr_recl(void *unused) * which is after we do arc_fini(). */ if (!arc_dead) - cv_signal(&arc_reclaim_thr_cv); + cv_signal(&arc_reclaim_thread_cv); } static void @@ -1433,18 +1467,31 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem * l2c_only even though it's about to change. */ nhdr->b_l1hdr.b_state = arc_l2c_only; + + /* Verify previous threads set to NULL before freeing */ + ASSERT3P(nhdr->b_l1hdr.b_tmp_cdata, ==, NULL); } else { ASSERT(hdr->b_l1hdr.b_buf == NULL); ASSERT0(hdr->b_l1hdr.b_datacnt); - ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); + /* - * We might be removing the L1hdr of a buffer which was just - * written out to L2ARC. If such a buffer is compressed then we - * need to free its b_tmp_cdata before destroying the header. - */ - if (hdr->b_l1hdr.b_tmp_cdata != NULL && - HDR_GET_COMPRESS(hdr) != ZIO_COMPRESS_OFF) - l2arc_release_cdata_buf(hdr); + * If we've reached here, We must have been called from + * arc_evict_hdr(), as such we should have already been + * removed from any ghost list we were previously on + * (which protects us from racing with arc_evict_state), + * thus no locking is needed during this check. + */ + ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); + + /* + * A buffer must not be moved into the arc_l2c_only + * state if it's not finished being written out to the + * l2arc device. Otherwise, the b_l1hdr.b_tmp_cdata field + * might try to be accessed, even though it was removed. + */ + VERIFY(!HDR_L2_WRITING(hdr)); + VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); + nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR; } /* @@ -1677,14 +1724,13 @@ add_reference(arc_buf_hdr_t *hdr, kmutex (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { + arc_buf_contents_t type = arc_buf_type(hdr); uint64_t delta = hdr->b_size * hdr->b_l1hdr.b_datacnt; - list_t *list = &state->arcs_list[arc_buf_type(hdr)]; - uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; + multilist_t *list = &state->arcs_list[type]; + uint64_t *size = &state->arcs_lsize[type]; + + multilist_remove(list, hdr); - ASSERT(!MUTEX_HELD(&state->arcs_mtx)); - mutex_enter(&state->arcs_mtx); - ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); - list_remove(list, hdr); if (GHOST_STATE(state)) { ASSERT0(hdr->b_l1hdr.b_datacnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); @@ -1693,7 +1739,6 @@ add_reference(arc_buf_hdr_t *hdr, kmutex ASSERT(delta > 0); ASSERT3U(*size, >=, delta); atomic_add_64(size, -delta); - mutex_exit(&state->arcs_mtx); } /* remove the prefetch flag if we get a reference */ hdr->b_flags &= ~ARC_FLAG_PREFETCH; @@ -1716,22 +1761,21 @@ remove_reference(arc_buf_hdr_t *hdr, kmu */ if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { - uint64_t *size = &state->arcs_lsize[arc_buf_type(hdr)]; + arc_buf_contents_t type = arc_buf_type(hdr); + multilist_t *list = &state->arcs_list[type]; + uint64_t *size = &state->arcs_lsize[type]; + + multilist_insert(list, hdr); - ASSERT(!MUTEX_HELD(&state->arcs_mtx)); - mutex_enter(&state->arcs_mtx); - ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); - list_insert_head(&state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT(hdr->b_l1hdr.b_datacnt > 0); atomic_add_64(size, hdr->b_size * hdr->b_l1hdr.b_datacnt); - mutex_exit(&state->arcs_mtx); } return (cnt); } /* - * Move the supplied buffer to the indicated state. The mutex + * Move the supplied buffer to the indicated state. The hash lock * for the buffer must be held by the caller. */ static void @@ -1775,15 +1819,10 @@ arc_change_state(arc_state_t *new_state, */ if (refcnt == 0) { if (old_state != arc_anon && old_state != arc_l2c_only) { - int use_mutex = !MUTEX_HELD(&old_state->arcs_mtx); uint64_t *size = &old_state->arcs_lsize[buftype]; - if (use_mutex) - mutex_enter(&old_state->arcs_mtx); - ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(list_link_active(&hdr->b_l1hdr.b_arc_node)); - list_remove(&old_state->arcs_list[buftype], hdr); + multilist_remove(&old_state->arcs_list[buftype], hdr); /* * If prefetching out of the ghost cache, @@ -1796,12 +1835,8 @@ arc_change_state(arc_state_t *new_state, } ASSERT3U(*size, >=, from_delta); atomic_add_64(size, -from_delta); - - if (use_mutex) - mutex_exit(&old_state->arcs_mtx); } if (new_state != arc_anon && new_state != arc_l2c_only) { - int use_mutex = !MUTEX_HELD(&new_state->arcs_mtx); uint64_t *size = &new_state->arcs_lsize[buftype]; /* @@ -1811,10 +1846,7 @@ arc_change_state(arc_state_t *new_state, * beforehand. */ ASSERT(HDR_HAS_L1HDR(hdr)); - if (use_mutex) - mutex_enter(&new_state->arcs_mtx); - - list_insert_head(&new_state->arcs_list[buftype], hdr); + multilist_insert(&new_state->arcs_list[buftype], hdr); /* ghost elements have a ghost size */ if (GHOST_STATE(new_state)) { @@ -1823,9 +1855,6 @@ arc_change_state(arc_state_t *new_state, to_delta = hdr->b_size; } atomic_add_64(size, to_delta); - - if (use_mutex) - mutex_exit(&new_state->arcs_mtx); } } @@ -1847,8 +1876,8 @@ arc_change_state(arc_state_t *new_state, * L2 headers should never be on the L2 state list since they don't * have L1 headers allocated. */ - ASSERT(list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && - list_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); + ASSERT(multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && + multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); } void @@ -1941,6 +1970,7 @@ arc_buf_alloc(spa_t *spa, int32_t size, hdr->b_l1hdr.b_state = arc_anon; hdr->b_l1hdr.b_arc_access = 0; hdr->b_l1hdr.b_datacnt = 1; + hdr->b_l1hdr.b_tmp_cdata = NULL; arc_get_data_buf(buf); ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); @@ -2076,7 +2106,7 @@ arc_buf_free_on_write(void *data, size_t { l2arc_data_free_t *df; - df = kmem_alloc(sizeof (l2arc_data_free_t), KM_SLEEP); + df = kmem_alloc(sizeof (*df), KM_SLEEP); df->l2df_data = data; df->l2df_size = size; df->l2df_func = free_func; @@ -2120,19 +2150,49 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr if (!HDR_HAS_L1HDR(hdr)) return; - if (hdr->b_l1hdr.b_tmp_cdata == NULL) + /* + * The header isn't being written to the l2arc device, thus it + * shouldn't have a b_tmp_cdata to free. + */ + if (!HDR_L2_WRITING(hdr)) { + ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); + return; + } + + /* + * The header does not have compression enabled. This can be due + * to the buffer not being compressible, or because we're + * freeing the buffer before the second phase of + * l2arc_write_buffer() has started (which does the compression + * step). In either case, b_tmp_cdata does not point to a + * separately compressed buffer, so there's nothing to free (it + * points to the same buffer as the arc_buf_t's b_data field). + */ + if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_OFF) { + hdr->b_l1hdr.b_tmp_cdata = NULL; + return; + } + + /* + * There's nothing to free since the buffer was all zero's and + * compressed to a zero length buffer. + */ + if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_EMPTY) { + ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); return; + } + + ASSERT(L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr))); - ASSERT(HDR_L2_WRITING(hdr)); - arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata, hdr->b_size, - zio_data_buf_free); + arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata, + hdr->b_size, zio_data_buf_free); ARCSTAT_BUMP(arcstat_l2_cdata_free_on_write); hdr->b_l1hdr.b_tmp_cdata = NULL; } static void -arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t remove) +arc_buf_destroy(arc_buf_t *buf, boolean_t remove) { arc_buf_t **bufp; @@ -2147,17 +2207,17 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ arc_buf_unwatch(buf); #endif /* illumos */ - if (!recycle) { - if (type == ARC_BUFC_METADATA) { - arc_buf_data_free(buf, zio_buf_free); - arc_space_return(size, ARC_SPACE_META); - } else { - ASSERT(type == ARC_BUFC_DATA); - arc_buf_data_free(buf, zio_data_buf_free); - arc_space_return(size, ARC_SPACE_DATA); - } + if (type == ARC_BUFC_METADATA) { + arc_buf_data_free(buf, zio_buf_free); + arc_space_return(size, ARC_SPACE_META); + } else { + ASSERT(type == ARC_BUFC_DATA); + arc_buf_data_free(buf, zio_data_buf_free); + arc_space_return(size, ARC_SPACE_DATA); } - if (list_link_active(&buf->b_hdr->b_l1hdr.b_arc_node)) { + + /* protected by hash lock, if in the hash table */ + if (multilist_link_active(&buf->b_hdr->b_l1hdr.b_arc_node)) { uint64_t *cnt = &state->arcs_lsize[type]; ASSERT(refcount_is_zero( @@ -2305,20 +2365,19 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) arc_buf_t *buf = hdr->b_l1hdr.b_buf; if (buf->b_efunc != NULL) { - mutex_enter(&arc_eviction_mtx); + mutex_enter(&arc_user_evicts_lock); mutex_enter(&buf->b_evict_lock); ASSERT(buf->b_hdr != NULL); - arc_buf_destroy(hdr->b_l1hdr.b_buf, FALSE, - FALSE); + arc_buf_destroy(hdr->b_l1hdr.b_buf, FALSE); hdr->b_l1hdr.b_buf = buf->b_next; buf->b_hdr = &arc_eviction_hdr; buf->b_next = arc_eviction_list; arc_eviction_list = buf; mutex_exit(&buf->b_evict_lock); - mutex_exit(&arc_eviction_mtx); + cv_signal(&arc_user_evicts_cv); + mutex_exit(&arc_user_evicts_lock); } else { - arc_buf_destroy(hdr->b_l1hdr.b_buf, FALSE, - TRUE); + arc_buf_destroy(hdr->b_l1hdr.b_buf, TRUE); } } #ifdef ZFS_DEBUG @@ -2331,7 +2390,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) ASSERT3P(hdr->b_hash_next, ==, NULL); if (HDR_HAS_L1HDR(hdr)) { - ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); + ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); ASSERT3P(hdr->b_l1hdr.b_acb, ==, NULL); kmem_cache_free(hdr_full_cache, hdr); } else { @@ -2357,7 +2416,7 @@ arc_buf_free(arc_buf_t *buf, void *tag) (void) remove_reference(hdr, hash_lock, tag); if (hdr->b_l1hdr.b_datacnt > 1) { - arc_buf_destroy(buf, FALSE, TRUE); + arc_buf_destroy(buf, TRUE); } else { ASSERT(buf == hdr->b_l1hdr.b_buf); ASSERT(buf->b_efunc == NULL); @@ -2371,16 +2430,16 @@ arc_buf_free(arc_buf_t *buf, void *tag) * this buffer unless the write completes before we finish * decrementing the reference count. */ - mutex_enter(&arc_eviction_mtx); + mutex_enter(&arc_user_evicts_lock); (void) remove_reference(hdr, NULL, tag); ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); destroy_hdr = !HDR_IO_IN_PROGRESS(hdr); - mutex_exit(&arc_eviction_mtx); + mutex_exit(&arc_user_evicts_lock); if (destroy_hdr) arc_hdr_destroy(hdr); } else { if (remove_reference(hdr, NULL, tag) > 0) - arc_buf_destroy(buf, FALSE, TRUE); + arc_buf_destroy(buf, TRUE); else arc_hdr_destroy(hdr); } @@ -2409,7 +2468,7 @@ arc_buf_remove_ref(arc_buf_t *buf, void* (void) remove_reference(hdr, hash_lock, tag); if (hdr->b_l1hdr.b_datacnt > 1) { if (no_callback) - arc_buf_destroy(buf, FALSE, TRUE); + arc_buf_destroy(buf, TRUE); } else if (no_callback) { ASSERT(hdr->b_l1hdr.b_buf == buf && buf->b_next == NULL); ASSERT(buf->b_efunc == NULL); @@ -2470,418 +2529,675 @@ arc_buf_eviction_needed(arc_buf_t *buf) } /* - * Evict buffers from list until we've removed the specified number of - * bytes. Move the removed buffers to the appropriate evict state. - * If the recycle flag is set, then attempt to "recycle" a buffer: - * - look for a buffer to evict that is `bytes' long. - * - return the data block from this buffer rather than freeing it. - * This flag is used by callers that are trying to make space for a - * new buffer in a full arc cache. + * Evict the arc_buf_hdr that is provided as a parameter. The resultant + * state of the header is dependent on it's state prior to entering this + * function. The following transitions are possible: * - * This function makes a "best effort". It skips over any buffers - * it can't get a hash_lock on, and so may not catch all candidates. - * It may also return without evicting as much space as requested. + * - arc_mru -> arc_mru_ghost + * - arc_mfu -> arc_mfu_ghost + * - arc_mru_ghost -> arc_l2c_only + * - arc_mru_ghost -> deleted + * - arc_mfu_ghost -> arc_l2c_only + * - arc_mfu_ghost -> deleted */ -static void * -arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle, - arc_buf_contents_t type) +static int64_t +arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) { - arc_state_t *evicted_state; - uint64_t bytes_evicted = 0, skipped = 0, missed = 0; - arc_buf_hdr_t *hdr, *hdr_prev = NULL; - kmutex_t *hash_lock; - boolean_t have_lock; - void *stolen = NULL; - arc_buf_hdr_t marker = { 0 }; - int count = 0; + arc_state_t *evicted_state, *state; + int64_t bytes_evicted = 0; - ASSERT(state == arc_mru || state == arc_mfu); - - evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; + ASSERT(MUTEX_HELD(hash_lock)); + ASSERT(HDR_HAS_L1HDR(hdr)); - /* - * The ghost list lock must be acquired first in order to prevent - * a 3 party deadlock: - * - * - arc_evict_ghost acquires arc_*_ghost->arcs_mtx, followed by - * l2ad_mtx in arc_hdr_realloc - * - l2arc_write_buffers acquires l2ad_mtx, followed by arc_*->arcs_mtx - * - arc_evict acquires arc_*_ghost->arcs_mtx, followed by - * arc_*_ghost->arcs_mtx and forms a deadlock cycle. - * - * This situation is avoided by acquiring the ghost list lock first. - */ - mutex_enter(&evicted_state->arcs_mtx); - mutex_enter(&state->arcs_mtx); + state = hdr->b_l1hdr.b_state; + if (GHOST_STATE(state)) { + ASSERT(!HDR_IO_IN_PROGRESS(hdr)); + ASSERT(hdr->b_l1hdr.b_buf == NULL); - /* - * Decide which "type" (data vs metadata) to recycle from. - * - * If we are over the metadata limit, recycle from metadata. - * If we are under the metadata minimum, recycle from data. - * Otherwise, recycle from whichever type has the oldest (least - * recently accessed) header. - */ - if (recycle) { - arc_buf_hdr_t *data_hdr = - list_tail(&state->arcs_list[ARC_BUFC_DATA]); - arc_buf_hdr_t *metadata_hdr = - list_tail(&state->arcs_list[ARC_BUFC_METADATA]); - arc_buf_contents_t realtype; - - if (data_hdr == NULL) { - realtype = ARC_BUFC_METADATA; - } else if (metadata_hdr == NULL) { - realtype = ARC_BUFC_DATA; - } else if (arc_meta_used >= arc_meta_limit) { - realtype = ARC_BUFC_METADATA; - } else if (arc_meta_used <= arc_meta_min) { - realtype = ARC_BUFC_DATA; - } else if (HDR_HAS_L1HDR(data_hdr) && - HDR_HAS_L1HDR(metadata_hdr) && - data_hdr->b_l1hdr.b_arc_access < - metadata_hdr->b_l1hdr.b_arc_access) { - realtype = ARC_BUFC_DATA; - } else { - realtype = ARC_BUFC_METADATA; + /* + * l2arc_write_buffers() relies on a header's L1 portion + * (i.e. it's b_tmp_cdata field) during it's write phase. + * Thus, we cannot push a header onto the arc_l2c_only + * state (removing it's L1 piece) until the header is + * done being written to the l2arc. + */ + if (HDR_HAS_L2HDR(hdr) && HDR_L2_WRITING(hdr)) { + ARCSTAT_BUMP(arcstat_evict_l2_skip); + return (bytes_evicted); } - if (realtype != type) { + + ARCSTAT_BUMP(arcstat_deleted); + bytes_evicted += hdr->b_size; + + DTRACE_PROBE1(arc__delete, arc_buf_hdr_t *, hdr); + + if (HDR_HAS_L2HDR(hdr)) { /* - * If we want to evict from a different list, - * we can not recycle, because DATA vs METADATA - * buffers are segregated into different kmem - * caches (and vmem arenas). + * This buffer is cached on the 2nd Level ARC; + * don't destroy the header. */ - type = realtype; - recycle = B_FALSE; + arc_change_state(arc_l2c_only, hdr, hash_lock); + /* + * dropping from L1+L2 cached to L2-only, + * realloc to remove the L1 header. + */ + hdr = arc_hdr_realloc(hdr, hdr_full_cache, + hdr_l2only_cache); + } else { + arc_change_state(arc_anon, hdr, hash_lock); + arc_hdr_destroy(hdr); } + return (bytes_evicted); } - list_t *list = &state->arcs_list[type]; + ASSERT(state == arc_mru || state == arc_mfu); + evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - for (hdr = list_tail(list); hdr; hdr = hdr_prev) { - hdr_prev = list_prev(list, hdr); - /* prefetch buffers have a minimum lifespan */ - if (HDR_IO_IN_PROGRESS(hdr) || - (spa && hdr->b_spa != spa) || - ((hdr->b_flags & (ARC_FLAG_PREFETCH | ARC_FLAG_INDIRECT)) && - ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access < - arc_min_prefetch_lifespan)) { - skipped++; - continue; + /* prefetch buffers have a minimum lifespan */ + if (HDR_IO_IN_PROGRESS(hdr) || + ((hdr->b_flags & (ARC_FLAG_PREFETCH | ARC_FLAG_INDIRECT)) && + ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access < + arc_min_prefetch_lifespan)) { + ARCSTAT_BUMP(arcstat_evict_skip); + return (bytes_evicted); + } + + ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); + ASSERT3U(hdr->b_l1hdr.b_datacnt, >, 0); + while (hdr->b_l1hdr.b_buf) { + arc_buf_t *buf = hdr->b_l1hdr.b_buf; + if (!mutex_tryenter(&buf->b_evict_lock)) { + ARCSTAT_BUMP(arcstat_mutex_miss); + break; } - /* "lookahead" for better eviction candidate */ - if (recycle && hdr->b_size != bytes && - hdr_prev && hdr_prev->b_size == bytes) - continue; + if (buf->b_data != NULL) + bytes_evicted += hdr->b_size; + if (buf->b_efunc != NULL) { + mutex_enter(&arc_user_evicts_lock); + arc_buf_destroy(buf, FALSE); + hdr->b_l1hdr.b_buf = buf->b_next; + buf->b_hdr = &arc_eviction_hdr; + buf->b_next = arc_eviction_list; + arc_eviction_list = buf; + cv_signal(&arc_user_evicts_cv); + mutex_exit(&arc_user_evicts_lock); + mutex_exit(&buf->b_evict_lock); + } else { + mutex_exit(&buf->b_evict_lock); + arc_buf_destroy(buf, TRUE); + } + } - /* ignore markers */ - if (hdr->b_spa == 0) - continue; + if (HDR_HAS_L2HDR(hdr)) { + ARCSTAT_INCR(arcstat_evict_l2_cached, hdr->b_size); + } else { + if (l2arc_write_eligible(hdr->b_spa, hdr)) + ARCSTAT_INCR(arcstat_evict_l2_eligible, hdr->b_size); + else + ARCSTAT_INCR(arcstat_evict_l2_ineligible, hdr->b_size); + } + + if (hdr->b_l1hdr.b_datacnt == 0) { + arc_change_state(evicted_state, hdr, hash_lock); + ASSERT(HDR_IN_HASH_TABLE(hdr)); + hdr->b_flags |= ARC_FLAG_IN_HASH_TABLE; + hdr->b_flags &= ~ARC_FLAG_BUF_AVAILABLE; + DTRACE_PROBE1(arc__evict, arc_buf_hdr_t *, hdr); + } + + return (bytes_evicted); +} + +static uint64_t +arc_evict_state_impl(multilist_t *ml, int idx, arc_buf_hdr_t *marker, + uint64_t spa, int64_t bytes) +{ + multilist_sublist_t *mls; + uint64_t bytes_evicted = 0; + arc_buf_hdr_t *hdr; + kmutex_t *hash_lock; + int evict_count = 0; + + ASSERT3P(marker, !=, NULL); + IMPLY(bytes < 0, bytes == ARC_EVICT_ALL); + + mls = multilist_sublist_lock(ml, idx); + + for (hdr = multilist_sublist_prev(mls, marker); hdr != NULL; + hdr = multilist_sublist_prev(mls, marker)) { + if ((bytes != ARC_EVICT_ALL && bytes_evicted >= bytes) || + (evict_count >= zfs_arc_evict_batch_limit)) + break; /* - * It may take a long time to evict all the bufs requested. - * To avoid blocking all arc activity, periodically drop - * the arcs_mtx and give other threads a chance to run - * before reacquiring the lock. - * - * If we are looking for a buffer to recycle, we are in - * the hot code path, so don't sleep. + * To keep our iteration location, move the marker + * forward. Since we're not holding hdr's hash lock, we + * must be very careful and not remove 'hdr' from the + * sublist. Otherwise, other consumers might mistake the + * 'hdr' as not being on a sublist when they call the + * multilist_link_active() function (they all rely on + * the hash lock protecting concurrent insertions and + * removals). multilist_sublist_move_forward() was + * specifically implemented to ensure this is the case + * (only 'marker' will be removed and re-inserted). + */ + multilist_sublist_move_forward(mls, marker); + + /* + * The only case where the b_spa field should ever be + * zero, is the marker headers inserted by + * arc_evict_state(). It's possible for multiple threads + * to be calling arc_evict_state() concurrently (e.g. + * dsl_pool_close() and zio_inject_fault()), so we must + * skip any markers we see from these other threads. */ - if (!recycle && count++ > arc_evict_iterations) { - list_insert_after(list, hdr, &marker); - mutex_exit(&state->arcs_mtx); - mutex_exit(&evicted_state->arcs_mtx); - kpreempt(KPREEMPT_SYNC); - mutex_enter(&evicted_state->arcs_mtx); - mutex_enter(&state->arcs_mtx); - hdr_prev = list_prev(list, &marker); - list_remove(list, &marker); - count = 0; + if (hdr->b_spa == 0) + continue; + + /* we're only interested in evicting buffers of a certain spa */ + if (spa != 0 && hdr->b_spa != spa) { + ARCSTAT_BUMP(arcstat_evict_skip); continue; } hash_lock = HDR_LOCK(hdr); - have_lock = MUTEX_HELD(hash_lock); - if (have_lock || mutex_tryenter(hash_lock)) { - ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); - ASSERT3U(hdr->b_l1hdr.b_datacnt, >, 0); - while (hdr->b_l1hdr.b_buf) { - arc_buf_t *buf = hdr->b_l1hdr.b_buf; - if (!mutex_tryenter(&buf->b_evict_lock)) { - missed += 1; - break; - } - if (buf->b_data != NULL) { - bytes_evicted += hdr->b_size; - if (recycle && - arc_buf_type(hdr) == type && - hdr->b_size == bytes && - !HDR_L2_WRITING(hdr)) { - stolen = buf->b_data; - recycle = FALSE; - } - } - if (buf->b_efunc != NULL) { - mutex_enter(&arc_eviction_mtx); - arc_buf_destroy(buf, - buf->b_data == stolen, FALSE); - hdr->b_l1hdr.b_buf = buf->b_next; - buf->b_hdr = &arc_eviction_hdr; - buf->b_next = arc_eviction_list; - arc_eviction_list = buf; - mutex_exit(&arc_eviction_mtx); - mutex_exit(&buf->b_evict_lock); - } else { - mutex_exit(&buf->b_evict_lock); - arc_buf_destroy(buf, - buf->b_data == stolen, TRUE); - } - } - if (HDR_HAS_L2HDR(hdr)) { - ARCSTAT_INCR(arcstat_evict_l2_cached, - hdr->b_size); - } else { - if (l2arc_write_eligible(hdr->b_spa, hdr)) { - ARCSTAT_INCR(arcstat_evict_l2_eligible, - hdr->b_size); - } else { - ARCSTAT_INCR( - arcstat_evict_l2_ineligible, - hdr->b_size); - } - } + /* + * We aren't calling this function from any code path + * that would already be holding a hash lock, so we're + * asserting on this assumption to be defensive in case + * this ever changes. Without this check, it would be + * possible to incorrectly increment arcstat_mutex_miss + * below (e.g. if the code changed such that we called + * this function with a hash lock held). + */ + ASSERT(!MUTEX_HELD(hash_lock)); - if (hdr->b_l1hdr.b_datacnt == 0) { - arc_change_state(evicted_state, hdr, hash_lock); - ASSERT(HDR_IN_HASH_TABLE(hdr)); - hdr->b_flags |= ARC_FLAG_IN_HASH_TABLE; - hdr->b_flags &= ~ARC_FLAG_BUF_AVAILABLE; - DTRACE_PROBE1(arc__evict, arc_buf_hdr_t *, hdr); - } - if (!have_lock) - mutex_exit(hash_lock); - if (bytes >= 0 && bytes_evicted >= bytes) - break; + if (mutex_tryenter(hash_lock)) { + uint64_t evicted = arc_evict_hdr(hdr, hash_lock); + mutex_exit(hash_lock); + + bytes_evicted += evicted; + + /* + * If evicted is zero, arc_evict_hdr() must have + * decided to skip this header, don't increment + * evict_count in this case. + */ + if (evicted != 0) + evict_count++; + + /* + * If arc_size isn't overflowing, signal any + * threads that might happen to be waiting. + * + * For each header evicted, we wake up a single + * thread. If we used cv_broadcast, we could + * wake up "too many" threads causing arc_size + * to significantly overflow arc_c; since + * arc_get_data_buf() doesn't check for overflow + * when it's woken up (it doesn't because it's + * possible for the ARC to be overflowing while + * full of un-evictable buffers, and the + * function should proceed in this case). + * + * If threads are left sleeping, due to not + * using cv_broadcast, they will be woken up + * just before arc_reclaim_thread() sleeps. + */ + mutex_enter(&arc_reclaim_lock); + if (!arc_is_overflowing()) + cv_signal(&arc_reclaim_waiters_cv); + mutex_exit(&arc_reclaim_lock); } else { - missed += 1; + ARCSTAT_BUMP(arcstat_mutex_miss); } } - mutex_exit(&state->arcs_mtx); - mutex_exit(&evicted_state->arcs_mtx); + multilist_sublist_unlock(mls); - if (bytes_evicted < bytes) - dprintf("only evicted %lld bytes from %x", - (longlong_t)bytes_evicted, state); + return (bytes_evicted); +} + +/* + * Evict buffers from the given arc state, until we've removed the + * specified number of bytes. Move the removed buffers to the + * appropriate evict state. + * + * This function makes a "best effort". It skips over any buffers + * it can't get a hash_lock on, and so, may not catch all candidates. + * It may also return without evicting as much space as requested. + * + * If bytes is specified using the special value ARC_EVICT_ALL, this + * will evict all available (i.e. unlocked and evictable) buffers from + * the given arc state; which is used by arc_flush(). + */ +static uint64_t +arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes, + arc_buf_contents_t type) +{ + uint64_t total_evicted = 0; + multilist_t *ml = &state->arcs_list[type]; + int num_sublists; + arc_buf_hdr_t **markers; - if (skipped) - ARCSTAT_INCR(arcstat_evict_skip, skipped); + IMPLY(bytes < 0, bytes == ARC_EVICT_ALL); - if (missed) - ARCSTAT_INCR(arcstat_mutex_miss, missed); + num_sublists = multilist_get_num_sublists(ml); /* - * Note: we have just evicted some data into the ghost state, - * potentially putting the ghost size over the desired size. Rather - * that evicting from the ghost list in this hot code path, leave - * this chore to the arc_reclaim_thread(). + * If we've tried to evict from each sublist, made some + * progress, but still have not hit the target number of bytes + * to evict, we want to keep trying. The markers allow us to + * pick up where we left off for each individual sublist, rather + * than starting from the tail each time. */ + markers = kmem_zalloc(sizeof (*markers) * num_sublists, KM_SLEEP); + for (int i = 0; i < num_sublists; i++) { + markers[i] = kmem_cache_alloc(hdr_full_cache, KM_SLEEP); - return (stolen); -} + /* + * A b_spa of 0 is used to indicate that this header is + * a marker. This fact is used in arc_adjust_type() and + * arc_evict_state_impl(). + */ + markers[i]->b_spa = 0; -/* - * Remove buffers from list until we've removed the specified number of - * bytes. Destroy the buffers that are removed. - */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 11:13:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5B35A0EB2C; Sat, 3 Oct 2015 11:13:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6CE1E51; Sat, 3 Oct 2015 11:13:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BD2Iu061329; Sat, 3 Oct 2015 11:13:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BD2JT061328; Sat, 3 Oct 2015 11:13:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031113.t93BD2JT061328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:13:02 +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: r288582 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:13:02 -0000 Author: mav Date: Sat Oct 3 11:13:01 2015 New Revision: 288582 URL: https://svnweb.freebsd.org/changeset/base/288582 Log: MFC r286764: 6033 arc_adjust() should search MFU lists for oldest buffer when adjusting MFU size. illumos/illumos-gate@31c46cf23cd1cf4d66390a983dc5072d7d299ba2 https://www.illumos.org/issues/6033 When we're looking for the list containing oldest buffer we never actually look at the MFU lists even when we try to evict from MFU. looks like a copy paste error, the fix is here: Reviewed by: Saso Kiselkov Reviewed by: Xin Li Reviewed by: Prakash Surya Approved by: Matthew Ahrens Author: Alek Pinchuk Obtained from: illumos Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:11:56 2015 (r288581) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:13:01 2015 (r288582) @@ -23,7 +23,7 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -3118,7 +3118,7 @@ arc_adjust(void) */ target = arc_size - arc_c; - if (arc_adjust_type(arc_mru) == ARC_BUFC_METADATA && + if (arc_adjust_type(arc_mfu) == ARC_BUFC_METADATA && arc_meta_used > arc_meta_min) { bytes = arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); total_evicted += bytes; From owner-svn-src-all@freebsd.org Sat Oct 3 11:14:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 051CCA0EBF5; Sat, 3 Oct 2015 11:14:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDC241FBF; Sat, 3 Oct 2015 11:14:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BE5eP061425; Sat, 3 Oct 2015 11:14:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BE5cf061424; Sat, 3 Oct 2015 11:14:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031114.t93BE5cf061424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288583 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:14:06 -0000 Author: mav Date: Sat Oct 3 11:14:05 2015 New Revision: 288583 URL: https://svnweb.freebsd.org/changeset/base/288583 Log: MFC r286766: 5817 change type of arcs_size from uint64_t to refcount_t Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Adam Leventhal Reviewed by: Alex Reece Reviewed by: Richard Elling Approved by: Garrett D'Amore Author: Prakash Surya illumos/illumos-gate@2fd872a734cf486007a8dba532cec52bfb4d40e5 As a way to make it more difficult to introduce bugs into the ARC, and to make it easier to diagnose issues when bugs do creep in, it would be beneficial to change the type of the arc_state_t's arcs_size field to be a refcount_t instead of a uint64_t. This would allow us to make stricter checks when incrementing and decrementing the value with debugging enabled, but still fallback to simple, fast atomic operations when debugging is disabled. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:13:01 2015 (r288582) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:14:05 2015 (r288583) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ @@ -350,7 +350,7 @@ typedef struct arc_state { * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. */ - uint64_t arcs_size; + refcount_t arcs_size; } arc_state_t; /* The 6 states: */ @@ -1863,12 +1863,73 @@ arc_change_state(arc_state_t *new_state, buf_hash_remove(hdr); /* adjust state sizes (ignore arc_l2c_only) */ - if (to_delta && new_state != arc_l2c_only) - atomic_add_64(&new_state->arcs_size, to_delta); + + if (to_delta && new_state != arc_l2c_only) { + ASSERT(HDR_HAS_L1HDR(hdr)); + if (GHOST_STATE(new_state)) { + ASSERT0(datacnt); + + /* + * We moving a header to a ghost state, we first + * remove all arc buffers. Thus, we'll have a + * datacnt of zero, and no arc buffer to use for + * the reference. As a result, we use the arc + * header pointer for the reference. + */ + (void) refcount_add_many(&new_state->arcs_size, + hdr->b_size, hdr); + } else { + ASSERT3U(datacnt, !=, 0); + + /* + * Each individual buffer holds a unique reference, + * thus we must remove each of these references one + * at a time. + */ + for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; + buf = buf->b_next) { + (void) refcount_add_many(&new_state->arcs_size, + hdr->b_size, buf); + } + } + } + if (from_delta && old_state != arc_l2c_only) { - ASSERT3U(old_state->arcs_size, >=, from_delta); - atomic_add_64(&old_state->arcs_size, -from_delta); + ASSERT(HDR_HAS_L1HDR(hdr)); + if (GHOST_STATE(old_state)) { + /* + * When moving a header off of a ghost state, + * there's the possibility for datacnt to be + * non-zero. This is because we first add the + * arc buffer to the header prior to changing + * the header's state. Since we used the header + * for the reference when putting the header on + * the ghost state, we must balance that and use + * the header when removing off the ghost state + * (even though datacnt is non zero). + */ + + IMPLY(datacnt == 0, new_state == arc_anon || + new_state == arc_l2c_only); + + (void) refcount_remove_many(&old_state->arcs_size, + hdr->b_size, hdr); + } else { + ASSERT3P(datacnt, !=, 0); + + /* + * Each individual buffer holds a unique reference, + * thus we must remove each of these references one + * at a time. + */ + for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; + buf = buf->b_next) { + (void) refcount_remove_many( + &old_state->arcs_size, hdr->b_size, buf); + } + } } + if (HDR_HAS_L1HDR(hdr)) hdr->b_l1hdr.b_state = new_state; @@ -2227,8 +2288,8 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ ASSERT3U(*cnt, >=, size); atomic_add_64(cnt, -size); } - ASSERT3U(state->arcs_size, >=, size); - atomic_add_64(&state->arcs_size, -size); + + (void) refcount_remove_many(&state->arcs_size, size, buf); buf->b_data = NULL; /* @@ -2952,7 +3013,8 @@ arc_adjust_meta(void) * evict some from the MRU here, and some from the MFU below. */ target = MIN((int64_t)(arc_meta_used - arc_meta_limit), - (int64_t)(arc_anon->arcs_size + arc_mru->arcs_size - arc_p)); + (int64_t)(refcount_count(&arc_anon->arcs_size) + + refcount_count(&arc_mru->arcs_size) - arc_p)); total_evicted += arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); @@ -2962,7 +3024,7 @@ arc_adjust_meta(void) * space alloted to the MFU (which is defined as arc_c - arc_p). */ target = MIN((int64_t)(arc_meta_used - arc_meta_limit), - (int64_t)(arc_mfu->arcs_size - (arc_c - arc_p))); + (int64_t)(refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -3071,8 +3133,8 @@ arc_adjust(void) * arc_p here, and then evict more from the MFU below. */ target = MIN((int64_t)(arc_size - arc_c), - (int64_t)(arc_anon->arcs_size + arc_mru->arcs_size + arc_meta_used - - arc_p)); + (int64_t)(refcount_count(&arc_anon->arcs_size) + + refcount_count(&arc_mru->arcs_size) + arc_meta_used - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -3156,7 +3218,8 @@ arc_adjust(void) * cache. The following logic enforces these limits on the ghost * caches, and evicts from them as needed. */ - target = arc_mru->arcs_size + arc_mru_ghost->arcs_size - arc_c; + target = refcount_count(&arc_mru->arcs_size) + + refcount_count(&arc_mru_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mru_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -3174,7 +3237,8 @@ arc_adjust(void) * mru + mfu + mru ghost + mfu ghost <= 2 * arc_c * mru ghost + mfu ghost <= arc_c */ - target = arc_mru_ghost->arcs_size + arc_mfu_ghost->arcs_size - arc_c; + target = refcount_count(&arc_mru_ghost->arcs_size) + + refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mfu_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -3668,6 +3732,8 @@ arc_adapt(int bytes, arc_state_t *state) { int mult; uint64_t arc_p_min = (arc_c >> arc_p_min_shift); + int64_t mrug_size = refcount_count(&arc_mru_ghost->arcs_size); + int64_t mfug_size = refcount_count(&arc_mfu_ghost->arcs_size); if (state == arc_l2c_only) return; @@ -3682,16 +3748,14 @@ arc_adapt(int bytes, arc_state_t *state) * target size of the MRU list. */ if (state == arc_mru_ghost) { - mult = ((arc_mru_ghost->arcs_size >= arc_mfu_ghost->arcs_size) ? - 1 : (arc_mfu_ghost->arcs_size/arc_mru_ghost->arcs_size)); + mult = (mrug_size >= mfug_size) ? 1 : (mfug_size / mrug_size); mult = MIN(mult, 10); /* avoid wild arc_p adjustment */ arc_p = MIN(arc_c - arc_p_min, arc_p + bytes * mult); } else if (state == arc_mfu_ghost) { uint64_t delta; - mult = ((arc_mfu_ghost->arcs_size >= arc_mru_ghost->arcs_size) ? - 1 : (arc_mru_ghost->arcs_size/arc_mfu_ghost->arcs_size)); + mult = (mfug_size >= mrug_size) ? 1 : (mrug_size / mfug_size); mult = MIN(mult, 10); delta = MIN(bytes * mult, arc_p); @@ -3808,8 +3872,9 @@ arc_get_data_buf(arc_buf_t *buf) */ if (!GHOST_STATE(buf->b_hdr->b_l1hdr.b_state)) { arc_buf_hdr_t *hdr = buf->b_hdr; + arc_state_t *state = hdr->b_l1hdr.b_state; - atomic_add_64(&hdr->b_l1hdr.b_state->arcs_size, size); + (void) refcount_add_many(&state->arcs_size, size, buf); /* * If this is reached via arc_read, the link is @@ -3830,7 +3895,8 @@ arc_get_data_buf(arc_buf_t *buf) * data, and we have outgrown arc_p, update arc_p */ if (arc_size < arc_c && hdr->b_l1hdr.b_state == arc_anon && - arc_anon->arcs_size + arc_mru->arcs_size > arc_p) + (refcount_count(&arc_anon->arcs_size) + + refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); } ARCSTAT_BUMP(arcstat_allocated); @@ -4686,8 +4752,10 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_next = NULL; ASSERT3P(state, !=, arc_l2c_only); - ASSERT3U(state->arcs_size, >=, hdr->b_size); - atomic_add_64(&state->arcs_size, -hdr->b_size); + + (void) refcount_remove_many( + &state->arcs_size, hdr->b_size, buf); + if (refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { ASSERT3P(state, !=, arc_l2c_only); uint64_t *size = &state->arcs_lsize[type]; @@ -4730,7 +4798,7 @@ arc_release(arc_buf_t *buf, void *tag) (void) refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); buf->b_hdr = nhdr; mutex_exit(&buf->b_evict_lock); - atomic_add_64(&arc_anon->arcs_size, blksz); + (void) refcount_add_many(&arc_anon->arcs_size, blksz, buf); } else { mutex_exit(&buf->b_evict_lock); ASSERT(refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); @@ -4997,7 +5065,8 @@ arc_tempreserve_space(uint64_t reserve, * network delays from blocking transactions that are ready to be * assigned to a txg. */ - anon_size = MAX((int64_t)(arc_anon->arcs_size - arc_loaned_bytes), 0); + anon_size = MAX((int64_t)(refcount_count(&arc_anon->arcs_size) - + arc_loaned_bytes), 0); /* * Writes will, almost always, require additional memory allocations @@ -5034,7 +5103,7 @@ static void arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, kstat_named_t *evict_data, kstat_named_t *evict_metadata) { - size->value.ui64 = state->arcs_size; + size->value.ui64 = refcount_count(&state->arcs_size); evict_data->value.ui64 = state->arcs_lsize[ARC_BUFC_DATA]; evict_metadata->value.ui64 = state->arcs_lsize[ARC_BUFC_METADATA]; } @@ -5274,6 +5343,13 @@ arc_init(void) offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), zfs_arc_num_sublists_per_state, arc_state_multilist_index_func); + refcount_create(&arc_anon->arcs_size); + refcount_create(&arc_mru->arcs_size); + refcount_create(&arc_mru_ghost->arcs_size); + refcount_create(&arc_mfu->arcs_size); + refcount_create(&arc_mfu_ghost->arcs_size); + refcount_create(&arc_l2c_only->arcs_size); + buf_init(); arc_reclaim_thread_exit = FALSE; @@ -5400,6 +5476,13 @@ arc_fini(void) mutex_destroy(&arc_user_evicts_lock); cv_destroy(&arc_user_evicts_cv); + refcount_destroy(&arc_anon->arcs_size); + refcount_destroy(&arc_mru->arcs_size); + refcount_destroy(&arc_mru_ghost->arcs_size); + refcount_destroy(&arc_mfu->arcs_size); + refcount_destroy(&arc_mfu_ghost->arcs_size); + refcount_destroy(&arc_l2c_only->arcs_size); + multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); From owner-svn-src-all@freebsd.org Sat Oct 3 11:15:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A91EA0ECED; Sat, 3 Oct 2015 11:15:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF1021120; Sat, 3 Oct 2015 11:15:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BF1oX061529; Sat, 3 Oct 2015 11:15:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BF1dT061528; Sat, 3 Oct 2015 11:15:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031115.t93BF1dT061528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:15: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: r288584 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:15:02 -0000 Author: mav Date: Sat Oct 3 11:15:01 2015 New Revision: 288584 URL: https://svnweb.freebsd.org/changeset/base/288584 Log: MFC r286767: Fix minor mismerge sometimes earlier. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:14:05 2015 (r288583) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:15:01 2015 (r288584) @@ -2193,10 +2193,6 @@ arc_buf_data_free(arc_buf_t *buf, void ( } } -/* - * Free up buf->b_data and if 'remove' is set, then pull the - * arc_buf_t off of the the arc_buf_hdr_t's list and free it. - */ static void arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr) { @@ -2252,6 +2248,10 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr hdr->b_l1hdr.b_tmp_cdata = NULL; } +/* + * Free up buf->b_data and if 'remove' is set, then pull the + * arc_buf_t off of the the arc_buf_hdr_t's list and free it. + */ static void arc_buf_destroy(arc_buf_t *buf, boolean_t remove) { From owner-svn-src-all@freebsd.org Sat Oct 3 11:15:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A493A0EDAE; Sat, 3 Oct 2015 11:15:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A5031276; Sat, 3 Oct 2015 11:15:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BFovj061612; Sat, 3 Oct 2015 11:15:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BFoSk061611; Sat, 3 Oct 2015 11:15:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031115.t93BFoSk061611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:15: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: r288585 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:15:50 -0000 Author: mav Date: Sat Oct 3 11:15:49 2015 New Revision: 288585 URL: https://svnweb.freebsd.org/changeset/base/288585 Log: MFC r286770: Fix r286766 build with debug. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:15:01 2015 (r288584) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:15:49 2015 (r288585) @@ -1030,21 +1030,21 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, l2arc_nor &l2arc_norw, 0, "no reads during writes"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_size, CTLFLAG_RD, - &ARC_anon.arcs_size, 0, "size of anonymous state"); + &ARC_anon.arcs_size.rc_count, 0, "size of anonymous state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_metadata_lsize, CTLFLAG_RD, &ARC_anon.arcs_lsize[ARC_BUFC_METADATA], 0, "size of anonymous state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, anon_data_lsize, CTLFLAG_RD, &ARC_anon.arcs_lsize[ARC_BUFC_DATA], 0, "size of anonymous state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_size, CTLFLAG_RD, - &ARC_mru.arcs_size, 0, "size of mru state"); + &ARC_mru.arcs_size.rc_count, 0, "size of mru state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_metadata_lsize, CTLFLAG_RD, &ARC_mru.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mru state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_data_lsize, CTLFLAG_RD, &ARC_mru.arcs_lsize[ARC_BUFC_DATA], 0, "size of data in mru state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_size, CTLFLAG_RD, - &ARC_mru_ghost.arcs_size, 0, "size of mru ghost state"); + &ARC_mru_ghost.arcs_size.rc_count, 0, "size of mru ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_ghost_metadata_lsize, CTLFLAG_RD, &ARC_mru_ghost.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mru ghost state"); @@ -1053,14 +1053,14 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mru_gho "size of data in mru ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_size, CTLFLAG_RD, - &ARC_mfu.arcs_size, 0, "size of mfu state"); + &ARC_mfu.arcs_size.rc_count, 0, "size of mfu state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_metadata_lsize, CTLFLAG_RD, &ARC_mfu.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mfu state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_data_lsize, CTLFLAG_RD, &ARC_mfu.arcs_lsize[ARC_BUFC_DATA], 0, "size of data in mfu state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_size, CTLFLAG_RD, - &ARC_mfu_ghost.arcs_size, 0, "size of mfu ghost state"); + &ARC_mfu_ghost.arcs_size.rc_count, 0, "size of mfu ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_metadata_lsize, CTLFLAG_RD, &ARC_mfu_ghost.arcs_lsize[ARC_BUFC_METADATA], 0, "size of metadata in mfu ghost state"); @@ -1069,7 +1069,7 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_gho "size of data in mfu ghost state"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD, - &ARC_l2c_only.arcs_size, 0, "size of mru state"); + &ARC_l2c_only.arcs_size.rc_count, 0, "size of mru state"); /* * L2ARC Internals From owner-svn-src-all@freebsd.org Sat Oct 3 11:16:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D0C2A0EE81; Sat, 3 Oct 2015 11:16:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D7E213C2; Sat, 3 Oct 2015 11:16:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BGhwA061706; Sat, 3 Oct 2015 11:16:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BGhFI061705; Sat, 3 Oct 2015 11:16:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031116.t93BGhFI061705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288586 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:16:43 -0000 Author: mav Date: Sat Oct 3 11:16:42 2015 New Revision: 288586 URL: https://svnweb.freebsd.org/changeset/base/288586 Log: MFC r286774: 2618 arc.c mistypes in the comments Reviewed by: Jason King Reviewed by: Josef Sipek Approved by: Richard Lowe Author: Bart Coddens illumos/illumos-gate@fc98fea58e89224f6f13d7fae246d6cb5dfa35ea Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:15:49 2015 (r288585) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:16:42 2015 (r288586) @@ -82,9 +82,9 @@ * types of locks: 1) the hash table lock array, and 2) the * arc list locks. * - * Buffers do not have their own mutexs, rather they rely on the - * hash table mutexs for the bulk of their protection (i.e. most - * fields in the arc_buf_hdr_t are protected by these mutexs). + * Buffers do not have their own mutexes, rather they rely on the + * hash table mutexes for the bulk of their protection (i.e. most + * fields in the arc_buf_hdr_t are protected by these mutexes). * * buf_hash_find() returns the appropriate mutex (held) when it * locates the requested buffer in the hash table. It returns From owner-svn-src-all@freebsd.org Sat Oct 3 11:17:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA3F4A0EF4F; Sat, 3 Oct 2015 11:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A8AF15AC; Sat, 3 Oct 2015 11:17:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BHWKo061796; Sat, 3 Oct 2015 11:17:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BHW6K061795; Sat, 3 Oct 2015 11:17:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031117.t93BHW6K061795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:17:32 +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: r288587 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:17:32 -0000 Author: mav Date: Sat Oct 3 11:17:31 2015 New Revision: 288587 URL: https://svnweb.freebsd.org/changeset/base/288587 Log: MFC r286776: Remove some random accumulated diff from Illumos. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:16:42 2015 (r288586) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:17:31 2015 (r288587) @@ -2416,6 +2416,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (!BUF_EMPTY(hdr)) buf_discard_identity(hdr); + if (hdr->b_freeze_cksum != NULL) { kmem_free(hdr->b_freeze_cksum, sizeof (zio_cksum_t)); hdr->b_freeze_cksum = NULL; @@ -4658,8 +4659,6 @@ arc_release(arc_buf_t *buf, void *tag) { arc_buf_hdr_t *hdr = buf->b_hdr; - ASSERT(HDR_HAS_L1HDR(hdr)); - /* * It would be nice to assert that if it's DMU metadata (level > * 0 || it's the dnode file), then it must be syncing context. @@ -4667,6 +4666,9 @@ arc_release(arc_buf_t *buf, void *tag) */ mutex_enter(&buf->b_evict_lock); + + ASSERT(HDR_HAS_L1HDR(hdr)); + /* * We don't grab the hash lock prior to this check, because if * the buffer's header is in the arc_anon state, it won't be @@ -5897,6 +5899,7 @@ top: /* * Error - drop L2ARC entry. */ + list_remove(buflist, hdr); trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev, hdr->b_l2hdr.b_daddr, hdr->b_l2hdr.b_asize, 0); hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR; @@ -6437,14 +6440,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de buf_sz = hdr->b_l2hdr.b_asize; /* - * If the data has not been compressed, then clear b_tmp_cdata - * to make sure that it points only to a temporary compression - * buffer. - */ - if (!L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr))) - hdr->b_l1hdr.b_tmp_cdata = NULL; - - /* * We need to do this regardless if buf_sz is zero or * not, otherwise, when this l2hdr is evicted we'll * remove a reference that was never added. @@ -6537,6 +6532,12 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata, cdata, l2hdr->b_asize); + rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE); + if (rounded > csize) { + bzero((char *)cdata + csize, rounded - csize); + csize = rounded; + } + if (csize == 0) { /* zero block, indicate that there's nothing to write */ zio_data_buf_free(cdata, len); @@ -6545,19 +6546,11 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) hdr->b_l1hdr.b_tmp_cdata = NULL; ARCSTAT_BUMP(arcstat_l2_compress_zeros); return (B_TRUE); - } - - rounded = P2ROUNDUP(csize, - (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift); - if (rounded < len) { + } else if (csize > 0 && csize < len) { /* * Compression succeeded, we'll keep the cdata around for * writing and release it afterwards. */ - if (rounded > csize) { - bzero((char *)cdata + csize, rounded - csize); - csize = rounded; - } HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4); l2hdr->b_asize = csize; hdr->b_l1hdr.b_tmp_cdata = cdata; @@ -6674,6 +6667,7 @@ l2arc_release_cdata_buf(arc_buf_hdr_t *h hdr->b_size); hdr->b_l1hdr.b_tmp_cdata = NULL; } + } /* From owner-svn-src-all@freebsd.org Sat Oct 3 11:18:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B5C8A0F037; Sat, 3 Oct 2015 11:18:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9F01812; Sat, 3 Oct 2015 11:18:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BIVj6061892; Sat, 3 Oct 2015 11:18:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BIV3C061891; Sat, 3 Oct 2015 11:18:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031118.t93BIV3C061891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:18: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: r288588 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:18:31 -0000 Author: mav Date: Sat Oct 3 11:18:30 2015 New Revision: 288588 URL: https://svnweb.freebsd.org/changeset/base/288588 Log: MFC r286951: Restore part of r274628, reverted at r286776. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:17:31 2015 (r288587) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:18:30 2015 (r288588) @@ -6532,7 +6532,8 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata, cdata, l2hdr->b_asize); - rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE); + rounded = P2ROUNDUP(csize, + (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift); if (rounded > csize) { bzero((char *)cdata + csize, rounded - csize); csize = rounded; From owner-svn-src-all@freebsd.org Sat Oct 3 11:19:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FC24A0F0CD; Sat, 3 Oct 2015 11:19:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2011E1979; Sat, 3 Oct 2015 11:19:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BJXSo061988; Sat, 3 Oct 2015 11:19:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BJWTf061987; Sat, 3 Oct 2015 11:19:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031119.t93BJWTf061987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:19:32 +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: r288589 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:19:33 -0000 Author: mav Date: Sat Oct 3 11:19:32 2015 New Revision: 288589 URL: https://svnweb.freebsd.org/changeset/base/288589 Log: MFC r286983 (by avg): fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Sat Oct 3 11:18:30 2015 (r288588) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Sat Oct 3 11:19:32 2015 (r288589) @@ -220,7 +220,6 @@ static void sa_cache_destructor(void *buf, void *unused) { sa_handle_t *hdl = buf; - hdl->sa_dbu.dbu_evict_func = NULL; mutex_destroy(&hdl->sa_lock); } @@ -1385,6 +1384,7 @@ sa_handle_get_from_db(objset_t *os, dmu_ sa_handle_t *winner = NULL; handle = kmem_cache_alloc(sa_cache, KM_SLEEP); + handle->sa_dbu.dbu_evict_func = NULL; handle->sa_userp = userp; handle->sa_bonus = db; handle->sa_os = os; From owner-svn-src-all@freebsd.org Sat Oct 3 11:21:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 613ADA0F355; Sat, 3 Oct 2015 11:21:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 510851D11; Sat, 3 Oct 2015 11:21:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BLqPX065737; Sat, 3 Oct 2015 11:21:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BLpXV065734; Sat, 3 Oct 2015 11:21:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031121.t93BLpXV065734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:21: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: r288590 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:21:52 -0000 Author: mav Date: Sat Oct 3 11:21:50 2015 New Revision: 288590 URL: https://svnweb.freebsd.org/changeset/base/288590 Log: MFC r287103 (by avg): 5692 expose the number of hole blocks in a file FreeBSD porting notes: - only kernel-side changes are merged - the new ioctl is not actually implemented yet - thus, the goal is to synchronize DMU code illumos/illumos-gate@2bcf0248e992f292c7b814458bcdce2f004925d6 https://www.illumos.org/issues/5692 we would like to expose the number of hole (sparse) blocks in a file. this can be useful to for example if you want to fill in the holes with some data; knowing the number of holes in advances allows you to report progress on hole filling. We could use SEEK_HOLE to do that but it would be O(n) where n is the number of holes present in the file. Author: Max Grossman Reviewed by: Adam Leventhal Reviewed by: Matthew Ahrens Reviewed by: Boris Protopopov Approved by: Richard Lowe Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:19:32 2015 (r288589) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:21:50 2015 (r288590) @@ -1902,25 +1902,20 @@ int dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off) { dnode_t *dn; - int i, err; + int err; - err = dnode_hold(os, object, FTAG, &dn); - if (err) - return (err); /* * Sync any current changes before * we go trundling through the block pointers. */ - for (i = 0; i < TXG_SIZE; i++) { - if (list_link_active(&dn->dn_dirty_link[i])) - break; + err = dmu_object_wait_synced(os, object); + if (err) { + return (err); } - if (i != TXG_SIZE) { - dnode_rele(dn, FTAG); - txg_wait_synced(dmu_objset_pool(os), 0); - err = dnode_hold(os, object, FTAG, &dn); - if (err) - return (err); + + err = dnode_hold(os, object, FTAG, &dn); + if (err) { + return (err); } err = dnode_next_offset(dn, (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0); @@ -1929,6 +1924,36 @@ dmu_offset_next(objset_t *os, uint64_t o return (err); } +/* + * Given the ZFS object, if it contains any dirty nodes + * this function flushes all dirty blocks to disk. This + * ensures the DMU object info is updated. A more efficient + * future version might just find the TXG with the maximum + * ID and wait for that to be synced. + */ +int +dmu_object_wait_synced(objset_t *os, uint64_t object) { + dnode_t *dn; + int error, i; + + error = dnode_hold(os, object, FTAG, &dn); + if (error) { + return (error); + } + + for (i = 0; i < TXG_SIZE; i++) { + if (list_link_active(&dn->dn_dirty_link[i])) { + break; + } + } + dnode_rele(dn, FTAG); + if (i != TXG_SIZE) { + txg_wait_synced(dmu_objset_pool(os), 0); + } + + return (0); +} + void dmu_object_info_from_dnode(dnode_t *dn, dmu_object_info_t *doi) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 11:19:32 2015 (r288589) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Oct 3 11:21:50 2015 (r288590) @@ -915,6 +915,15 @@ int dmu_offset_next(objset_t *os, uint64 uint64_t *off); /* + * Check if a DMU object has any dirty blocks. If so, sync out + * all pending transaction groups. Otherwise, this function + * does not alter DMU state. This could be improved to only sync + * out the necessary transaction groups for this particular + * object. + */ +int dmu_object_wait_synced(objset_t *os, uint64_t object); + +/* * Initial setup and final teardown. */ extern void dmu_init(void); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 3 11:19:32 2015 (r288589) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 3 11:21:50 2015 (r288590) @@ -293,25 +293,32 @@ zfs_ioctl(vnode_t *vp, u_long com, intpt int *rvalp, caller_context_t *ct) { offset_t off; + offset_t ndata; + dmu_object_info_t doi; int error; zfsvfs_t *zfsvfs; znode_t *zp; switch (com) { case _FIOFFS: + { return (0); /* * The following two ioctls are used by bfu. Faking out, * necessary to avoid bfu errors. */ + } case _FIOGDIO: case _FIOSDIO: + { return (0); + } case _FIO_SEEK_DATA: case _FIO_SEEK_HOLE: -#ifdef sun + { +#ifdef illumos if (ddi_copyin((void *)data, &off, sizeof (off), flag)) return (SET_ERROR(EFAULT)); #else @@ -335,6 +342,48 @@ zfs_ioctl(vnode_t *vp, u_long com, intpt #endif return (0); } +#ifdef illumos + case _FIO_COUNT_FILLED: + { + /* + * _FIO_COUNT_FILLED adds a new ioctl command which + * exposes the number of filled blocks in a + * ZFS object. + */ + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + + /* + * Wait for all dirty blocks for this object + * to get synced out to disk, and the DMU info + * updated. + */ + error = dmu_object_wait_synced(zfsvfs->z_os, zp->z_id); + if (error) { + ZFS_EXIT(zfsvfs); + return (error); + } + + /* + * Retrieve fill count from DMU object. + */ + error = dmu_object_info(zfsvfs->z_os, zp->z_id, &doi); + if (error) { + ZFS_EXIT(zfsvfs); + return (error); + } + + ndata = doi.doi_fill_count; + + ZFS_EXIT(zfsvfs); + if (ddi_copyout(&ndata, (void *)data, sizeof (ndata), flag)) + return (SET_ERROR(EFAULT)); + return (0); + } +#endif + } return (SET_ERROR(ENOTTY)); } From owner-svn-src-all@freebsd.org Sat Oct 3 11:23:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDDA9A0F455; Sat, 3 Oct 2015 11:23:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE2A51E9E; Sat, 3 Oct 2015 11:23:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BN9OU065866; Sat, 3 Oct 2015 11:23:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BN9F7065865; Sat, 3 Oct 2015 11:23:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031123.t93BN9F7065865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288591 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:23:09 -0000 Author: mav Date: Sat Oct 3 11:23:08 2015 New Revision: 288591 URL: https://svnweb.freebsd.org/changeset/base/288591 Log: MFC r287280 (by delphij): In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc as parent. In the case of a send or receive, the curproc would be the userland application that issues the ioctl. This would trigger an assertion failure introduced in Solaris compatibility shims in r196458 when kernel is compiled with INVARIANTS. Fix this by using p0 (proc0 or kernel) as the parent thread when creating the kernel threads. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 11:21:50 2015 (r288590) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Oct 3 11:23:08 2015 (r288591) @@ -786,7 +786,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, to_arg.ds = to_ds; to_arg.fromtxg = fromtxg; to_arg.flags = TRAVERSE_PRE | TRAVERSE_PREFETCH; - (void) thread_create(NULL, 0, send_traverse_thread, &to_arg, 0, curproc, + (void) thread_create(NULL, 0, send_traverse_thread, &to_arg, 0, &p0, TS_RUN, minclsyspri); struct send_block_record *to_data; @@ -2446,7 +2446,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, rwa.os = ra.os; rwa.byteswap = drc->drc_byteswap; - (void) thread_create(NULL, 0, receive_writer_thread, &rwa, 0, curproc, + (void) thread_create(NULL, 0, receive_writer_thread, &rwa, 0, &p0, TS_RUN, minclsyspri); /* * We're reading rwa.err without locks, which is safe since we are the From owner-svn-src-all@freebsd.org Sat Oct 3 11:24:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95E4DA0F535; Sat, 3 Oct 2015 11:24:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A90B1FFF; Sat, 3 Oct 2015 11:24:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BOmto065980; Sat, 3 Oct 2015 11:24:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BOmgU065979; Sat, 3 Oct 2015 11:24:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031124.t93BOmgU065979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:24: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: r288592 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:24:48 -0000 Author: mav Date: Sat Oct 3 11:24:47 2015 New Revision: 288592 URL: https://svnweb.freebsd.org/changeset/base/288592 Log: MFC r287283 (by delphij): Fix a buffer overrun which may lead to data corruption, introduced in r286951 by reinstating changes in r274628. In l2arc_compress_buf(), we allocate a buffer to stash away the compressed data in 'cdata', allocated of l2hdr->b_asize bytes. We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata, which is of l2hdr->b_asize bytes, and have the compressed size (or original size, if compress didn't gain enough) stored in csize. To pad the buffer to fit the optimal write size, we round up the compressed size to L2 device's vdev_ashift. Illumos code rounds up the size by at most SPA_MINBLOCKSIZE. Because we know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE, we are guaranteed that the rounded up csize would be <= b_asize. However, this is not necessarily true when we round up to 1 << vdev_ashift, because it could be larger than SPA_MINBLOCKSIZE. So, in the worst case scenario, we are overwriting at most (1 << vdev_ashift - SPA_MINBLOCKSIZE) bytes of memory next to the compressed data buffer. Andriy's original change in r274628 reorganized the code a little bit, by moving the padding to after we determined that the compression was beneficial. At which point, we would check rounded size against the allocated buffer size, and the buffer overrun would not be possible. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:23:08 2015 (r288591) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:24:47 2015 (r288592) @@ -6532,13 +6532,6 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata, cdata, l2hdr->b_asize); - rounded = P2ROUNDUP(csize, - (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift); - if (rounded > csize) { - bzero((char *)cdata + csize, rounded - csize); - csize = rounded; - } - if (csize == 0) { /* zero block, indicate that there's nothing to write */ zio_data_buf_free(cdata, len); @@ -6547,11 +6540,19 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) hdr->b_l1hdr.b_tmp_cdata = NULL; ARCSTAT_BUMP(arcstat_l2_compress_zeros); return (B_TRUE); - } else if (csize > 0 && csize < len) { + } + + rounded = P2ROUNDUP(csize, + (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift); + if (rounded < len) { /* * Compression succeeded, we'll keep the cdata around for * writing and release it afterwards. */ + if (rounded > csize) { + bzero((char *)cdata + csize, rounded - csize); + csize = rounded; + } HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4); l2hdr->b_asize = csize; hdr->b_l1hdr.b_tmp_cdata = cdata; From owner-svn-src-all@freebsd.org Sat Oct 3 11:27:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 372DBA0F754; Sat, 3 Oct 2015 11:27:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27A9911FD; Sat, 3 Oct 2015 11:27:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BROd2066138; Sat, 3 Oct 2015 11:27:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BROI7066137; Sat, 3 Oct 2015 11:27:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031127.t93BROI7066137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:27: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: r288593 - stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:27:24 -0000 Author: mav Date: Sat Oct 3 11:27:23 2015 New Revision: 288593 URL: https://svnweb.freebsd.org/changeset/base/288593 Log: MFC r287335 (by allanjude): Remove duplicate defines introduced in initial ZFS import (r168404) This change reduces compiler warnings by removing duplicate defines Line numbers are from r168404 (and r284648) #define lbolt: lines 384 and 459 (531 and 648) (original was renamed later) #define lbolt64: lines 385 and 460 (532 and 649) (original was renamed later) #define gethrestime_sec: lines 390 and 465 (540 and 653) uint64_t physmem: lines 402 and 463 (561 and 651) Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sat Oct 3 11:24:47 2015 (r288592) +++ stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Sat Oct 3 11:27:23 2015 (r288593) @@ -655,13 +655,6 @@ extern int zfs_secpolicy_rename_perms(co extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); extern zoneid_t getzoneid(void); /* Random compatibility stuff. */ -#define lbolt (gethrtime() >> 23) -#define lbolt64 (gethrtime() >> 23) - -extern uint64_t physmem; - -#define gethrestime_sec() time(NULL) - #define pwrite64(d, p, n, o) pwrite(d, p, n, o) #define readdir64(d) readdir(d) #define SIGPENDING(td) (0) From owner-svn-src-all@freebsd.org Sat Oct 3 11:35:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A5C1A0FCD3; Sat, 3 Oct 2015 11:35:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88ECA1830; Sat, 3 Oct 2015 11:35:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BZKuR070135; Sat, 3 Oct 2015 11:35:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BZJJI070130; Sat, 3 Oct 2015 11:35:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031135.t93BZJJI070130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:35:19 +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: r288594 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:35:20 -0000 Author: mav Date: Sat Oct 3 11:35:18 2015 New Revision: 288594 URL: https://svnweb.freebsd.org/changeset/base/288594 Log: MFC r287702: 5987 zfs prefetch code needs work Rewrite the ZFS prefetch code to detect only forward, sequential streams. The following kstats have been added: kstat.zfs.misc.arcstats.sync_wait_for_async How many sync reads have waited for async read to complete. (less is better) kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch How many demand read didn't have to wait for I/O because of predictive prefetch. (more is better) zfetch kstats have been similified to hits, misses, and max_streams, with max_streams representing times when we were not able to create new stream because we already have the maximum number of sequences for a file. The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes to prefetch per stream. illumos/illumos-gate@cf6106c8a0d6598b045811f9650d66e07eb332af Illumos ZFS issues: 5987 zfs prefetch code needs work https://www.illumos.org/issues/5987 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_zfetch.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:27:23 2015 (r288593) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:35:18 2015 (r288594) @@ -213,7 +213,7 @@ static int arc_min_prefetch_lifespan; int arc_lotsfree_percent = 10; static int arc_dead; -extern int zfs_prefetch_disable; +extern boolean_t zfs_prefetch_disable; /* * The arc has filled available memory and has now warmed up. @@ -585,6 +585,8 @@ typedef struct arc_stats { kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; kstat_named_t arcstat_meta_min; + kstat_named_t arcstat_sync_wait_for_async; + kstat_named_t arcstat_demand_hit_predictive_prefetch; } arc_stats_t; static arc_stats_t arc_stats = { @@ -683,7 +685,9 @@ static arc_stats_t arc_stats = { { "arc_meta_used", KSTAT_DATA_UINT64 }, { "arc_meta_limit", KSTAT_DATA_UINT64 }, { "arc_meta_max", KSTAT_DATA_UINT64 }, - { "arc_meta_min", KSTAT_DATA_UINT64 } + { "arc_meta_min", KSTAT_DATA_UINT64 }, + { "sync_wait_for_async", KSTAT_DATA_UINT64 }, + { "demand_hit_predictive_prefetch", KSTAT_DATA_UINT64 }, }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -4253,6 +4257,36 @@ top: if (HDR_IO_IN_PROGRESS(hdr)) { + if ((hdr->b_flags & ARC_FLAG_PRIO_ASYNC_READ) && + priority == ZIO_PRIORITY_SYNC_READ) { + /* + * This sync read must wait for an + * in-progress async read (e.g. a predictive + * prefetch). Async reads are queued + * separately at the vdev_queue layer, so + * this is a form of priority inversion. + * Ideally, we would "inherit" the demand + * i/o's priority by moving the i/o from + * the async queue to the synchronous queue, + * but there is currently no mechanism to do + * so. Track this so that we can evaluate + * the magnitude of this potential performance + * problem. + * + * Note that if the prefetch i/o is already + * active (has been issued to the device), + * the prefetch improved performance, because + * we issued it sooner than we would have + * without the prefetch. + */ + DTRACE_PROBE1(arc__sync__wait__for__async, + arc_buf_hdr_t *, hdr); + ARCSTAT_BUMP(arcstat_sync_wait_for_async); + } + if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) { + hdr->b_flags &= ~ARC_FLAG_PREDICTIVE_PREFETCH; + } + if (*arc_flags & ARC_FLAG_WAIT) { cv_wait(&hdr->b_l1hdr.b_cv, hash_lock); mutex_exit(hash_lock); @@ -4261,7 +4295,7 @@ top: ASSERT(*arc_flags & ARC_FLAG_NOWAIT); if (done) { - arc_callback_t *acb = NULL; + arc_callback_t *acb = NULL; acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP); @@ -4286,6 +4320,19 @@ top: hdr->b_l1hdr.b_state == arc_mfu); if (done) { + if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) { + /* + * This is a demand read which does not have to + * wait for i/o because we did a predictive + * prefetch i/o for it, which has completed. + */ + DTRACE_PROBE1( + arc__demand__hit__predictive__prefetch, + arc_buf_hdr_t *, hdr); + ARCSTAT_BUMP( + arcstat_demand_hit_predictive_prefetch); + hdr->b_flags &= ~ARC_FLAG_PREDICTIVE_PREFETCH; + } add_reference(hdr, hash_lock, private); /* * If this block is already in use, create a new @@ -4348,12 +4395,16 @@ top: goto top; /* restart the IO request */ } - /* if this is a prefetch, we don't have a reference */ - if (*arc_flags & ARC_FLAG_PREFETCH) { + /* + * If there is a callback, we pass our reference to + * it; otherwise we remove our reference. + */ + if (done == NULL) { (void) remove_reference(hdr, hash_lock, private); - hdr->b_flags |= ARC_FLAG_PREFETCH; } + if (*arc_flags & ARC_FLAG_PREFETCH) + hdr->b_flags |= ARC_FLAG_PREFETCH; if (*arc_flags & ARC_FLAG_L2CACHE) hdr->b_flags |= ARC_FLAG_L2CACHE; if (*arc_flags & ARC_FLAG_L2COMPRESS) @@ -4376,11 +4427,13 @@ top: ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); - /* if this is a prefetch, we don't have a reference */ + /* + * If there is a callback, we pass a reference to it. + */ + if (done != NULL) + add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_FLAG_PREFETCH) hdr->b_flags |= ARC_FLAG_PREFETCH; - else - add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_FLAG_L2CACHE) hdr->b_flags |= ARC_FLAG_L2CACHE; if (*arc_flags & ARC_FLAG_L2COMPRESS) @@ -4398,6 +4451,8 @@ top: arc_access(hdr, hash_lock); } + if (*arc_flags & ARC_FLAG_PREDICTIVE_PREFETCH) + hdr->b_flags |= ARC_FLAG_PREDICTIVE_PREFETCH; ASSERT(!GHOST_STATE(hdr->b_l1hdr.b_state)); acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP); @@ -4440,6 +4495,11 @@ top: curthread->td_ru.ru_inblock++; #endif + if (priority == ZIO_PRIORITY_ASYNC_READ) + hdr->b_flags |= ARC_FLAG_PRIO_ASYNC_READ; + else + hdr->b_flags &= ~ARC_FLAG_PRIO_ASYNC_READ; + if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* * Read from the L2ARC if the following are true: Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 11:27:23 2015 (r288593) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Oct 3 11:35:18 2015 (r288594) @@ -613,7 +613,7 @@ dbuf_read_done(zio_t *zio, arc_buf_t *bu } static void -dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags) +dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) { dnode_t *dn; zbookmark_phys_t zb; @@ -659,7 +659,6 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t db->db.db_size, db, type)); bzero(db->db.db_data, db->db.db_size); db->db_state = DB_CACHED; - *flags |= DB_RF_CACHED; mutex_exit(&db->db_mtx); return; } @@ -682,10 +681,8 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t (void) arc_read(zio, db->db_objset->os_spa, db->db_blkptr, dbuf_read_done, db, ZIO_PRIORITY_SYNC_READ, - (*flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED, + (flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED, &aflags, &zb); - if (aflags & ARC_FLAG_CACHED) - *flags |= DB_RF_CACHED; } int @@ -718,8 +715,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio if (db->db_state == DB_CACHED) { mutex_exit(&db->db_mtx); if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, TRUE); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); @@ -728,13 +724,12 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); - dbuf_read_impl(db, zio, &flags); + dbuf_read_impl(db, zio, flags); /* dbuf_read_impl has dropped db_mtx for us */ if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, flags & DB_RF_CACHED); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); @@ -753,8 +748,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio */ mutex_exit(&db->db_mtx); if (prefetch) - dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, - db->db.db_size, TRUE); + dmu_zfetch(&dn->dn_zfetch, db->db_blkid, 1); if ((flags & DB_RF_HAVESTRUCT) == 0) rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); @@ -2054,6 +2048,9 @@ dbuf_prefetch(dnode_t *dn, int64_t level ASSERT(blkid != DMU_BONUS_BLKID); ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock)); + if (blkid > dn->dn_maxblkid) + return; + if (dnode_block_freed(dn, blkid)) return; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:27:23 2015 (r288593) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:35:18 2015 (r288594) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2015 by Delphix. All rights reserved. */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -390,7 +390,7 @@ dmu_spill_hold_by_bonus(dmu_buf_t *bonus */ static int dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, - int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) + boolean_t read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) { dmu_buf_t **dbp; uint64_t blkid, nblks, i; @@ -400,15 +400,19 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, ASSERT(length <= DMU_MAX_ACCESS); - dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT; - if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) - dbuf_flags |= DB_RF_NOPREFETCH; + /* + * Note: We directly notify the prefetch code of this read, so that + * we can tell it about the multi-block read. dbuf_read() only knows + * about the one block it is accessing. + */ + dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT | + DB_RF_NOPREFETCH; rw_enter(&dn->dn_struct_rwlock, RW_READER); if (dn->dn_datablkshift) { int blkshift = dn->dn_datablkshift; - nblks = (P2ROUNDUP(offset+length, 1ULL<> blkshift; + nblks = (P2ROUNDUP(offset + length, 1ULL << blkshift) - + P2ALIGN(offset, 1ULL << blkshift)) >> blkshift; } else { if (offset + length > dn->dn_datablksz) { zfs_panic_recover("zfs: accessing past end of object " @@ -427,13 +431,14 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); blkid = dbuf_whichblock(dn, 0, offset); for (i = 0; i < nblks; i++) { - dmu_buf_impl_t *db = dbuf_hold(dn, blkid+i, tag); + dmu_buf_impl_t *db = dbuf_hold(dn, blkid + i, tag); if (db == NULL) { rw_exit(&dn->dn_struct_rwlock); dmu_buf_rele_array(dbp, nblks, tag); zio_nowait(zio); return (SET_ERROR(EIO)); } + /* initiate async i/o */ if (read) (void) dbuf_read(db, zio, dbuf_flags); @@ -443,6 +448,11 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, #endif dbp[i] = &db->db; } + + if ((flags & DMU_READ_NO_PREFETCH) == 0 && read && + length < zfetch_array_rd_sz) { + dmu_zfetch(&dn->dn_zfetch, blkid, nblks); + } rw_exit(&dn->dn_struct_rwlock); /* wait for async i/o */ @@ -496,7 +506,8 @@ dmu_buf_hold_array(objset_t *os, uint64_ int dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, uint64_t offset, - uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp) + uint64_t length, boolean_t read, void *tag, int *numbufsp, + dmu_buf_t ***dbpp) { dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; dnode_t *dn; @@ -544,9 +555,6 @@ dmu_prefetch(objset_t *os, uint64_t obje uint64_t blkid; int nblks, err; - if (zfs_prefetch_disable) - return; - if (len == 0) { /* they're interested in the bonus buffer */ dn = DMU_META_DNODE(os); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sat Oct 3 11:27:23 2015 (r288593) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Sat Oct 3 11:35:18 2015 (r288594) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. */ #include @@ -36,19 +36,20 @@ #include /* - * I'm against tune-ables, but these should probably exist as tweakable globals - * until we can get this working the way we want it to. + * This tunable disables predictive prefetch. Note that it leaves "prescient" + * prefetch (e.g. prefetch for zfs send) intact. Unlike predictive prefetch, + * prescient prefetch never issues i/os that end up not being needed, + * so it can't hurt performance. */ - -int zfs_prefetch_disable = 0; +boolean_t zfs_prefetch_disable = B_FALSE; /* max # of streams per zfetch */ uint32_t zfetch_max_streams = 8; /* min time before stream reclaim */ uint32_t zfetch_min_sec_reap = 2; -/* max number of blocks to fetch at a time */ -uint32_t zfetch_block_cap = 256; -/* number of bytes in a array_read at which we stop prefetching (1Mb) */ +/* max bytes to prefetch per stream (default 8MB) */ +uint32_t zfetch_max_distance = 8 * 1024 * 1024; +/* number of bytes in a array_read at which we stop prefetching (1MB) */ uint64_t zfetch_array_rd_sz = 1024 * 1024; SYSCTL_DECL(_vfs_zfs); @@ -61,200 +62,34 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, m TUNABLE_INT("vfs.zfs.zfetch.min_sec_reap", &zfetch_min_sec_reap); SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, min_sec_reap, CTLFLAG_RWTUN, &zfetch_min_sec_reap, 0, "Min time before stream reclaim"); -TUNABLE_INT("vfs.zfs.zfetch.block_cap", &zfetch_block_cap); -SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, block_cap, CTLFLAG_RWTUN, - &zfetch_block_cap, 0, "Max number of blocks to fetch at a time"); +TUNABLE_INT("vfs.zfs.zfetch.max_distance", &zfetch_max_distance); +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_distance, CTLFLAG_RWTUN, + &zfetch_max_distance, 0, "Max bytes to prefetch per stream"); TUNABLE_QUAD("vfs.zfs.zfetch.array_rd_sz", &zfetch_array_rd_sz); SYSCTL_UQUAD(_vfs_zfs_zfetch, OID_AUTO, array_rd_sz, CTLFLAG_RWTUN, &zfetch_array_rd_sz, 0, "Number of bytes in a array_read at which we stop prefetching"); -/* forward decls for static routines */ -static boolean_t dmu_zfetch_colinear(zfetch_t *, zstream_t *); -static void dmu_zfetch_dofetch(zfetch_t *, zstream_t *); -static uint64_t dmu_zfetch_fetch(dnode_t *, uint64_t, uint64_t); -static uint64_t dmu_zfetch_fetchsz(dnode_t *, uint64_t, uint64_t); -static boolean_t dmu_zfetch_find(zfetch_t *, zstream_t *, int); -static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); -static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); -static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); -static int dmu_zfetch_streams_equal(zstream_t *, zstream_t *); - typedef struct zfetch_stats { kstat_named_t zfetchstat_hits; kstat_named_t zfetchstat_misses; - kstat_named_t zfetchstat_colinear_hits; - kstat_named_t zfetchstat_colinear_misses; - kstat_named_t zfetchstat_stride_hits; - kstat_named_t zfetchstat_stride_misses; - kstat_named_t zfetchstat_reclaim_successes; - kstat_named_t zfetchstat_reclaim_failures; - kstat_named_t zfetchstat_stream_resets; - kstat_named_t zfetchstat_stream_noresets; - kstat_named_t zfetchstat_bogus_streams; + kstat_named_t zfetchstat_max_streams; } zfetch_stats_t; static zfetch_stats_t zfetch_stats = { { "hits", KSTAT_DATA_UINT64 }, { "misses", KSTAT_DATA_UINT64 }, - { "colinear_hits", KSTAT_DATA_UINT64 }, - { "colinear_misses", KSTAT_DATA_UINT64 }, - { "stride_hits", KSTAT_DATA_UINT64 }, - { "stride_misses", KSTAT_DATA_UINT64 }, - { "reclaim_successes", KSTAT_DATA_UINT64 }, - { "reclaim_failures", KSTAT_DATA_UINT64 }, - { "streams_resets", KSTAT_DATA_UINT64 }, - { "streams_noresets", KSTAT_DATA_UINT64 }, - { "bogus_streams", KSTAT_DATA_UINT64 }, + { "max_streams", KSTAT_DATA_UINT64 }, }; -#define ZFETCHSTAT_INCR(stat, val) \ - atomic_add_64(&zfetch_stats.stat.value.ui64, (val)); - -#define ZFETCHSTAT_BUMP(stat) ZFETCHSTAT_INCR(stat, 1); +#define ZFETCHSTAT_BUMP(stat) \ + atomic_inc_64(&zfetch_stats.stat.value.ui64); kstat_t *zfetch_ksp; -/* - * Given a zfetch structure and a zstream structure, determine whether the - * blocks to be read are part of a co-linear pair of existing prefetch - * streams. If a set is found, coalesce the streams, removing one, and - * configure the prefetch so it looks for a strided access pattern. - * - * In other words: if we find two sequential access streams that are - * the same length and distance N appart, and this read is N from the - * last stream, then we are probably in a strided access pattern. So - * combine the two sequential streams into a single strided stream. - * - * Returns whether co-linear streams were found. - */ -static boolean_t -dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) -{ - zstream_t *z_walk; - zstream_t *z_comp; - - if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER)) - return (0); - - if (zh == NULL) { - rw_exit(&zf->zf_rwlock); - return (0); - } - - for (z_walk = list_head(&zf->zf_stream); z_walk; - z_walk = list_next(&zf->zf_stream, z_walk)) { - for (z_comp = list_next(&zf->zf_stream, z_walk); z_comp; - z_comp = list_next(&zf->zf_stream, z_comp)) { - int64_t diff; - - if (z_walk->zst_len != z_walk->zst_stride || - z_comp->zst_len != z_comp->zst_stride) { - continue; - } - - diff = z_comp->zst_offset - z_walk->zst_offset; - if (z_comp->zst_offset + diff == zh->zst_offset) { - z_walk->zst_offset = zh->zst_offset; - z_walk->zst_direction = diff < 0 ? -1 : 1; - z_walk->zst_stride = - diff * z_walk->zst_direction; - z_walk->zst_ph_offset = - zh->zst_offset + z_walk->zst_stride; - dmu_zfetch_stream_remove(zf, z_comp); - mutex_destroy(&z_comp->zst_lock); - kmem_free(z_comp, sizeof (zstream_t)); - - dmu_zfetch_dofetch(zf, z_walk); - - rw_exit(&zf->zf_rwlock); - return (1); - } - - diff = z_walk->zst_offset - z_comp->zst_offset; - if (z_walk->zst_offset + diff == zh->zst_offset) { - z_walk->zst_offset = zh->zst_offset; - z_walk->zst_direction = diff < 0 ? -1 : 1; - z_walk->zst_stride = - diff * z_walk->zst_direction; - z_walk->zst_ph_offset = - zh->zst_offset + z_walk->zst_stride; - dmu_zfetch_stream_remove(zf, z_comp); - mutex_destroy(&z_comp->zst_lock); - kmem_free(z_comp, sizeof (zstream_t)); - - dmu_zfetch_dofetch(zf, z_walk); - - rw_exit(&zf->zf_rwlock); - return (1); - } - } - } - - rw_exit(&zf->zf_rwlock); - return (0); -} - -/* - * Given a zstream_t, determine the bounds of the prefetch. Then call the - * routine that actually prefetches the individual blocks. - */ -static void -dmu_zfetch_dofetch(zfetch_t *zf, zstream_t *zs) -{ - uint64_t prefetch_tail; - uint64_t prefetch_limit; - uint64_t prefetch_ofst; - uint64_t prefetch_len; - uint64_t blocks_fetched; - - zs->zst_stride = MAX((int64_t)zs->zst_stride, zs->zst_len); - zs->zst_cap = MIN(zfetch_block_cap, 2 * zs->zst_cap); - - prefetch_tail = MAX((int64_t)zs->zst_ph_offset, - (int64_t)(zs->zst_offset + zs->zst_stride)); - /* - * XXX: use a faster division method? - */ - prefetch_limit = zs->zst_offset + zs->zst_len + - (zs->zst_cap * zs->zst_stride) / zs->zst_len; - - while (prefetch_tail < prefetch_limit) { - prefetch_ofst = zs->zst_offset + zs->zst_direction * - (prefetch_tail - zs->zst_offset); - - prefetch_len = zs->zst_len; - - /* - * Don't prefetch beyond the end of the file, if working - * backwards. - */ - if ((zs->zst_direction == ZFETCH_BACKWARD) && - (prefetch_ofst > prefetch_tail)) { - prefetch_len += prefetch_ofst; - prefetch_ofst = 0; - } - - /* don't prefetch more than we're supposed to */ - if (prefetch_len > zs->zst_len) - break; - - blocks_fetched = dmu_zfetch_fetch(zf->zf_dnode, - prefetch_ofst, zs->zst_len); - - prefetch_tail += zs->zst_stride; - /* stop if we've run out of stuff to prefetch */ - if (blocks_fetched < zs->zst_len) - break; - } - zs->zst_ph_offset = prefetch_tail; - zs->zst_last = ddi_get_lbolt(); -} - void zfetch_init(void) { - zfetch_ksp = kstat_create("zfs", 0, "zfetchstats", "misc", KSTAT_TYPE_NAMED, sizeof (zfetch_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); @@ -282,285 +117,41 @@ zfetch_fini(void) void dmu_zfetch_init(zfetch_t *zf, dnode_t *dno) { - if (zf == NULL) { + if (zf == NULL) return; - } zf->zf_dnode = dno; - zf->zf_stream_cnt = 0; - zf->zf_alloc_fail = 0; list_create(&zf->zf_stream, sizeof (zstream_t), - offsetof(zstream_t, zst_node)); + offsetof(zstream_t, zs_node)); rw_init(&zf->zf_rwlock, NULL, RW_DEFAULT, NULL); } -/* - * This function computes the actual size, in blocks, that can be prefetched, - * and fetches it. - */ -static uint64_t -dmu_zfetch_fetch(dnode_t *dn, uint64_t blkid, uint64_t nblks) -{ - uint64_t fetchsz; - uint64_t i; - - fetchsz = dmu_zfetch_fetchsz(dn, blkid, nblks); - - for (i = 0; i < fetchsz; i++) { - dbuf_prefetch(dn, 0, blkid + i, ZIO_PRIORITY_ASYNC_READ, - ARC_FLAG_PREFETCH); - } - - return (fetchsz); -} - -/* - * this function returns the number of blocks that would be prefetched, based - * upon the supplied dnode, blockid, and nblks. This is used so that we can - * update streams in place, and then prefetch with their old value after the - * fact. This way, we can delay the prefetch, but subsequent accesses to the - * stream won't result in the same data being prefetched multiple times. - */ -static uint64_t -dmu_zfetch_fetchsz(dnode_t *dn, uint64_t blkid, uint64_t nblks) -{ - uint64_t fetchsz; - - if (blkid > dn->dn_maxblkid) { - return (0); - } - - /* compute fetch size */ - if (blkid + nblks + 1 > dn->dn_maxblkid) { - fetchsz = (dn->dn_maxblkid - blkid) + 1; - ASSERT(blkid + fetchsz - 1 <= dn->dn_maxblkid); - } else { - fetchsz = nblks; - } - - - return (fetchsz); -} - -/* - * given a zfetch and a zstream structure, see if there is an associated zstream - * for this block read. If so, it starts a prefetch for the stream it - * located and returns true, otherwise it returns false - */ -static boolean_t -dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched) +static void +dmu_zfetch_stream_remove(zfetch_t *zf, zstream_t *zs) { - zstream_t *zs; - int64_t diff; - int reset = !prefetched; - int rc = 0; - - if (zh == NULL) - return (0); - - /* - * XXX: This locking strategy is a bit coarse; however, it's impact has - * yet to be tested. If this turns out to be an issue, it can be - * modified in a number of different ways. - */ - - rw_enter(&zf->zf_rwlock, RW_READER); -top: - - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - - /* - * XXX - should this be an assert? - */ - if (zs->zst_len == 0) { - /* bogus stream */ - ZFETCHSTAT_BUMP(zfetchstat_bogus_streams); - continue; - } - - /* - * We hit this case when we are in a strided prefetch stream: - * we will read "len" blocks before "striding". - */ - if (zh->zst_offset >= zs->zst_offset && - zh->zst_offset < zs->zst_offset + zs->zst_len) { - if (prefetched) { - /* already fetched */ - ZFETCHSTAT_BUMP(zfetchstat_stride_hits); - rc = 1; - goto out; - } else { - ZFETCHSTAT_BUMP(zfetchstat_stride_misses); - } - } - - /* - * This is the forward sequential read case: we increment - * len by one each time we hit here, so we will enter this - * case on every read. - */ - if (zh->zst_offset == zs->zst_offset + zs->zst_len) { - - reset = !prefetched && zs->zst_len > 1; - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if (zh->zst_offset != zs->zst_offset + zs->zst_len) { - mutex_exit(&zs->zst_lock); - goto top; - } - zs->zst_len += zh->zst_len; - diff = zs->zst_len - zfetch_block_cap; - if (diff > 0) { - zs->zst_offset += diff; - zs->zst_len = zs->zst_len > diff ? - zs->zst_len - diff : 0; - } - zs->zst_direction = ZFETCH_FORWARD; - - break; - - /* - * Same as above, but reading backwards through the file. - */ - } else if (zh->zst_offset == zs->zst_offset - zh->zst_len) { - /* backwards sequential access */ - - reset = !prefetched && zs->zst_len > 1; - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if (zh->zst_offset != zs->zst_offset - zh->zst_len) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset = zs->zst_offset > zh->zst_len ? - zs->zst_offset - zh->zst_len : 0; - zs->zst_ph_offset = zs->zst_ph_offset > zh->zst_len ? - zs->zst_ph_offset - zh->zst_len : 0; - zs->zst_len += zh->zst_len; - - diff = zs->zst_len - zfetch_block_cap; - if (diff > 0) { - zs->zst_ph_offset = zs->zst_ph_offset > diff ? - zs->zst_ph_offset - diff : 0; - zs->zst_len = zs->zst_len > diff ? - zs->zst_len - diff : zs->zst_len; - } - zs->zst_direction = ZFETCH_BACKWARD; - - break; - - } else if ((zh->zst_offset - zs->zst_offset - zs->zst_stride < - zs->zst_len) && (zs->zst_len != zs->zst_stride)) { - /* strided forward access */ - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if ((zh->zst_offset - zs->zst_offset - zs->zst_stride >= - zs->zst_len) || (zs->zst_len == zs->zst_stride)) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset += zs->zst_stride; - zs->zst_direction = ZFETCH_FORWARD; - - break; - - } else if ((zh->zst_offset - zs->zst_offset + zs->zst_stride < - zs->zst_len) && (zs->zst_len != zs->zst_stride)) { - /* strided reverse access */ - - if (mutex_tryenter(&zs->zst_lock) == 0) { - rc = 1; - goto out; - } - - if ((zh->zst_offset - zs->zst_offset + zs->zst_stride >= - zs->zst_len) || (zs->zst_len == zs->zst_stride)) { - mutex_exit(&zs->zst_lock); - goto top; - } - - zs->zst_offset = zs->zst_offset > zs->zst_stride ? - zs->zst_offset - zs->zst_stride : 0; - zs->zst_ph_offset = (zs->zst_ph_offset > - (2 * zs->zst_stride)) ? - (zs->zst_ph_offset - (2 * zs->zst_stride)) : 0; - zs->zst_direction = ZFETCH_BACKWARD; - - break; - } - } - - if (zs) { - if (reset) { - zstream_t *remove = zs; - - ZFETCHSTAT_BUMP(zfetchstat_stream_resets); - rc = 0; - mutex_exit(&zs->zst_lock); - rw_exit(&zf->zf_rwlock); - rw_enter(&zf->zf_rwlock, RW_WRITER); - /* - * Relocate the stream, in case someone removes - * it while we were acquiring the WRITER lock. - */ - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - if (zs == remove) { - dmu_zfetch_stream_remove(zf, zs); - mutex_destroy(&zs->zst_lock); - kmem_free(zs, sizeof (zstream_t)); - break; - } - } - } else { - ZFETCHSTAT_BUMP(zfetchstat_stream_noresets); - rc = 1; - dmu_zfetch_dofetch(zf, zs); - mutex_exit(&zs->zst_lock); - } - } -out: - rw_exit(&zf->zf_rwlock); - return (rc); + ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); + list_remove(&zf->zf_stream, zs); + mutex_destroy(&zs->zs_lock); + kmem_free(zs, sizeof (*zs)); } /* - * Clean-up state associated with a zfetch structure. This frees allocated - * structure members, empties the zf_stream tree, and generally makes things - * nice. This doesn't free the zfetch_t itself, that's left to the caller. + * Clean-up state associated with a zfetch structure (e.g. destroy the + * streams). This doesn't free the zfetch_t itself, that's left to the caller. */ void -dmu_zfetch_rele(zfetch_t *zf) +dmu_zfetch_fini(zfetch_t *zf) { - zstream_t *zs; - zstream_t *zs_next; + zstream_t *zs; ASSERT(!RW_LOCK_HELD(&zf->zf_rwlock)); - for (zs = list_head(&zf->zf_stream); zs; zs = zs_next) { - zs_next = list_next(&zf->zf_stream, zs); - - list_remove(&zf->zf_stream, zs); - mutex_destroy(&zs->zst_lock); - kmem_free(zs, sizeof (zstream_t)); - } + rw_enter(&zf->zf_rwlock, RW_WRITER); + while ((zs = list_head(&zf->zf_stream)) != NULL) + dmu_zfetch_stream_remove(zf, zs); + rw_exit(&zf->zf_rwlock); list_destroy(&zf->zf_stream); rw_destroy(&zf->zf_rwlock); @@ -568,103 +159,55 @@ dmu_zfetch_rele(zfetch_t *zf) } /* - * Given a zfetch and zstream structure, insert the zstream structure into the - * AVL tree contained within the zfetch structure. Peform the appropriate - * book-keeping. It is possible that another thread has inserted a stream which - * matches one that we are about to insert, so we must be sure to check for this - * case. If one is found, return failure, and let the caller cleanup the - * duplicates. + * If there aren't too many streams already, create a new stream. + * The "blkid" argument is the next block that we expect this stream to access. + * While we're here, clean up old streams (which haven't been + * accessed for at least zfetch_min_sec_reap seconds). */ -static int -dmu_zfetch_stream_insert(zfetch_t *zf, zstream_t *zs) +static void +dmu_zfetch_stream_create(zfetch_t *zf, uint64_t blkid) { - zstream_t *zs_walk; - zstream_t *zs_next; + zstream_t *zs_next; + int numstreams = 0; ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); - for (zs_walk = list_head(&zf->zf_stream); zs_walk; zs_walk = zs_next) { - zs_next = list_next(&zf->zf_stream, zs_walk); - - if (dmu_zfetch_streams_equal(zs_walk, zs)) { - return (0); - } - } - - list_insert_head(&zf->zf_stream, zs); - zf->zf_stream_cnt++; - return (1); -} - - -/* - * Walk the list of zstreams in the given zfetch, find an old one (by time), and - * reclaim it for use by the caller. - */ -static zstream_t * -dmu_zfetch_stream_reclaim(zfetch_t *zf) -{ - zstream_t *zs; - clock_t ticks; - - ticks = zfetch_min_sec_reap * hz; - if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER)) - return (0); - - for (zs = list_head(&zf->zf_stream); zs; - zs = list_next(&zf->zf_stream, zs)) { - - if (ddi_get_lbolt() - zs->zst_last > ticks) - break; + /* + * Clean up old streams. + */ + for (zstream_t *zs = list_head(&zf->zf_stream); + zs != NULL; zs = zs_next) { + zs_next = list_next(&zf->zf_stream, zs); + if (((gethrtime() - zs->zs_atime) / NANOSEC) > + zfetch_min_sec_reap) + dmu_zfetch_stream_remove(zf, zs); + else + numstreams++; } - if (zs) { - dmu_zfetch_stream_remove(zf, zs); - mutex_destroy(&zs->zst_lock); - bzero(zs, sizeof (zstream_t)); - } else { - zf->zf_alloc_fail++; + /* + * The maximum number of streams is normally zfetch_max_streams, + * but for small files we lower it such that it's at least possible + * for all the streams to be non-overlapping. + * + * If we are already at the maximum number of streams for this file, + * even after removing old streams, then don't create this stream. + */ + uint32_t max_streams = MAX(1, MIN(zfetch_max_streams, + zf->zf_dnode->dn_maxblkid * zf->zf_dnode->dn_datablksz / + zfetch_max_distance)); + if (numstreams >= max_streams) { + ZFETCHSTAT_BUMP(zfetchstat_max_streams); + return; } - rw_exit(&zf->zf_rwlock); - - return (zs); -} - -/* - * Given a zfetch and zstream structure, remove the zstream structure from its - * container in the zfetch structure. Perform the appropriate book-keeping. - */ -static void -dmu_zfetch_stream_remove(zfetch_t *zf, zstream_t *zs) -{ - ASSERT(RW_WRITE_HELD(&zf->zf_rwlock)); - - list_remove(&zf->zf_stream, zs); - zf->zf_stream_cnt--; -} - -static int -dmu_zfetch_streams_equal(zstream_t *zs1, zstream_t *zs2) -{ - if (zs1->zst_offset != zs2->zst_offset) - return (0); - - if (zs1->zst_len != zs2->zst_len) - return (0); - if (zs1->zst_stride != zs2->zst_stride) - return (0); + zstream_t *zs = kmem_zalloc(sizeof (*zs), KM_SLEEP); + zs->zs_blkid = blkid; + zs->zs_pf_blkid = blkid; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 3 11:37:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C906BA0FE97; Sat, 3 Oct 2015 11:37:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ECF219D6; Sat, 3 Oct 2015 11:37:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Bb1Iq070266; Sat, 3 Oct 2015 11:37:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Bb1fB070264; Sat, 3 Oct 2015 11:37:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031137.t93Bb1fB070264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:37: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: r288595 - in stable/10: cddl/contrib/opensolaris/cmd/sgs/tools/common sys/cddl/contrib/opensolaris/common/avl 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:37:01 -0000 Author: mav Date: Sat Oct 3 11:37:00 2015 New Revision: 288595 URL: https://svnweb.freebsd.org/changeset/base/288595 Log: MFV r287703, r287705 (by delphij): 6091 avl_add doesn't assert on non-debug builds Use assfail() from libuutil instead of ASSERT() in userland AVL avl_add. illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78 Illumos issues: 6091 avl_add doesn't assert on non-debug builds https://www.illumos.org/issues/6091 Modified: stable/10/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Oct 3 11:35:18 2015 (r288594) +++ stable/10/cddl/contrib/opensolaris/cmd/sgs/tools/common/sgsmsg.c Sat Oct 3 11:37:00 2015 (r288595) @@ -132,6 +132,8 @@ typedef struct msg_string { static msg_string *msg_head; static msg_string *msg_tail; +int aok; + /* * message_append() is responsible for both inserting strings into * the master Str_tbl as well as maintaining a list of the Modified: stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c Sat Oct 3 11:35:18 2015 (r288594) +++ stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c Sat Oct 3 11:37:00 2015 (r288595) @@ -25,6 +25,7 @@ /* * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -635,14 +636,17 @@ avl_add(avl_tree_t *tree, void *new_node /* * This is unfortunate. We want to call panic() here, even for * non-DEBUG kernels. In userland, however, we can't depend on anything - * in libc or else the rtld build process gets confused. So, all we can - * do in userland is resort to a normal ASSERT(). + * in libc or else the rtld build process gets confused. + * Thankfully, rtld provides us with its own assfail() so we can use + * that here. We use assfail() directly to get a nice error message + * in the core - much like what panic() does for crashdumps. */ if (avl_find(tree, new_node, &where) != NULL) #ifdef _KERNEL panic("avl_find() succeeded inside avl_add()"); #else - ASSERT(0); + (void) assfail("avl_find() succeeded inside avl_add()", + __FILE__, __LINE__); #endif avl_insert(tree, new_node, where); } From owner-svn-src-all@freebsd.org Sat Oct 3 11:38:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85AC5A0FF88; Sat, 3 Oct 2015 11:38:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 756201B5D; Sat, 3 Oct 2015 11:38:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BcB0L070366; Sat, 3 Oct 2015 11:38:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BcBEi070364; Sat, 3 Oct 2015 11:38:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031138.t93BcBEi070364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:38: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: r288596 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:38:11 -0000 Author: mav Date: Sat Oct 3 11:38:10 2015 New Revision: 288596 URL: https://svnweb.freebsd.org/changeset/base/288596 Log: MFC r287706 (by delphij): 6214 zpools going south In r286570 (MFV of r277426) an unprotected write to b_flags to set the compression mode was introduced. This would open a race window where data is partially decompressed, modified, checksummed and written to the pool, resulting in pool corruption due to the partial decompression. Prevent this by reintroducing b_compress illumos/illumos-gate@d4cd038c92c36fd0ae35945831a8fc2975b5272c Illumos issues: 6214 zpools going south https://www.illumos.org/issues/6214 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:37:00 2015 (r288595) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:38:10 2015 (r288596) @@ -851,6 +851,7 @@ typedef struct l2arc_buf_hdr { uint64_t b_daddr; /* disk address, offset byte */ /* real alloc'd buffer size depending on b_compress applied */ int32_t b_asize; + uint8_t b_compress; list_node_t b_l2node; } l2arc_buf_hdr_t; @@ -930,15 +931,6 @@ static arc_buf_hdr_t arc_eviction_hdr; #define HDR_HAS_L1HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L1HDR) #define HDR_HAS_L2HDR(hdr) ((hdr)->b_flags & ARC_FLAG_HAS_L2HDR) -/* For storing compression mode in b_flags */ -#define HDR_COMPRESS_OFFSET 24 -#define HDR_COMPRESS_NBITS 7 - -#define HDR_GET_COMPRESS(hdr) ((enum zio_compress)BF32_GET(hdr->b_flags, \ - HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS)) -#define HDR_SET_COMPRESS(hdr, cmp) BF32_SET(hdr->b_flags, \ - HDR_COMPRESS_OFFSET, HDR_COMPRESS_NBITS, (cmp)) - /* * Other sizes */ @@ -2229,7 +2221,7 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr * separately compressed buffer, so there's nothing to free (it * points to the same buffer as the arc_buf_t's b_data field). */ - if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_OFF) { + if (hdr->b_l2hdr.b_compress == ZIO_COMPRESS_OFF) { hdr->b_l1hdr.b_tmp_cdata = NULL; return; } @@ -2238,12 +2230,12 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr * There's nothing to free since the buffer was all zero's and * compressed to a zero length buffer. */ - if (HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_EMPTY) { + if (hdr->b_l2hdr.b_compress == ZIO_COMPRESS_EMPTY) { ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); return; } - ASSERT(L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr))); + ASSERT(L2ARC_IS_VALID_COMPRESS(hdr->b_l2hdr.b_compress)); arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata, hdr->b_size, zio_data_buf_free); @@ -4467,7 +4459,7 @@ top: (vd = hdr->b_l2hdr.b_dev->l2ad_vdev) != NULL) { devw = hdr->b_l2hdr.b_dev->l2ad_writing; addr = hdr->b_l2hdr.b_daddr; - b_compress = HDR_GET_COMPRESS(hdr); + b_compress = hdr->b_l2hdr.b_compress; b_asize = hdr->b_l2hdr.b_asize; /* * Lock out device removal. @@ -6028,6 +6020,8 @@ l2arc_read_done(zio_t *zio) if (cb->l2rcb_compress != ZIO_COMPRESS_OFF) l2arc_decompress_zio(zio, hdr, cb->l2rcb_compress); ASSERT(zio->io_data != NULL); + ASSERT3U(zio->io_size, ==, hdr->b_size); + ASSERT3U(BP_GET_LSIZE(&cb->l2rcb_bp), ==, hdr->b_size); /* * Check this survived the L2ARC journey. @@ -6064,7 +6058,7 @@ l2arc_read_done(zio_t *zio) ASSERT(!pio || pio->io_child_type == ZIO_CHILD_LOGICAL); zio_nowait(zio_read(pio, cb->l2rcb_spa, &cb->l2rcb_bp, - buf->b_data, zio->io_size, arc_read_done, buf, + buf->b_data, hdr->b_size, arc_read_done, buf, zio->io_priority, cb->l2rcb_flags, &cb->l2rcb_zb)); } } @@ -6381,7 +6375,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * can't access without holding the ARC list locks * (which we want to avoid during compression/writing). */ - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_OFF); + hdr->b_l2hdr.b_compress = ZIO_COMPRESS_OFF; hdr->b_l2hdr.b_asize = hdr->b_size; hdr->b_l1hdr.b_tmp_cdata = hdr->b_l1hdr.b_buf->b_data; @@ -6583,7 +6577,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(HDR_GET_COMPRESS(hdr) == ZIO_COMPRESS_OFF); + ASSERT3S(l2hdr->b_compress, ==, ZIO_COMPRESS_OFF); ASSERT(hdr->b_l1hdr.b_tmp_cdata != NULL); len = l2hdr->b_asize; @@ -6595,7 +6589,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) if (csize == 0) { /* zero block, indicate that there's nothing to write */ zio_data_buf_free(cdata, len); - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_EMPTY); + l2hdr->b_compress = ZIO_COMPRESS_EMPTY; l2hdr->b_asize = 0; hdr->b_l1hdr.b_tmp_cdata = NULL; ARCSTAT_BUMP(arcstat_l2_compress_zeros); @@ -6613,7 +6607,7 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr) bzero((char *)cdata + csize, rounded - csize); csize = rounded; } - HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4); + l2hdr->b_compress = ZIO_COMPRESS_LZ4; l2hdr->b_asize = csize; hdr->b_l1hdr.b_tmp_cdata = cdata; ARCSTAT_BUMP(arcstat_l2_compress_successes); @@ -6700,7 +6694,8 @@ l2arc_decompress_zio(zio_t *zio, arc_buf static void l2arc_release_cdata_buf(arc_buf_hdr_t *hdr) { - enum zio_compress comp = HDR_GET_COMPRESS(hdr); + ASSERT(HDR_HAS_L2HDR(hdr)); + enum zio_compress comp = hdr->b_l2hdr.b_compress; ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT(comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS(comp)); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Oct 3 11:37:00 2015 (r288595) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Oct 3 11:38:10 2015 (r288596) @@ -88,21 +88,6 @@ typedef enum arc_flags /* Flags specifying whether optional hdr struct fields are defined */ ARC_FLAG_HAS_L1HDR = 1 << 19, ARC_FLAG_HAS_L2HDR = 1 << 20, - - - /* - * The arc buffer's compression mode is stored in the top 7 bits of the - * flags field, so these dummy flags are included so that MDB can - * interpret the enum properly. - */ - ARC_FLAG_COMPRESS_0 = 1 << 24, - ARC_FLAG_COMPRESS_1 = 1 << 25, - ARC_FLAG_COMPRESS_2 = 1 << 26, - ARC_FLAG_COMPRESS_3 = 1 << 27, - ARC_FLAG_COMPRESS_4 = 1 << 28, - ARC_FLAG_COMPRESS_5 = 1 << 29, - ARC_FLAG_COMPRESS_6 = 1 << 30 - } arc_flags_t; struct arc_buf { From owner-svn-src-all@freebsd.org Sat Oct 3 11:39:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E401AA0E07D; Sat, 3 Oct 2015 11:39:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D44241CD5; Sat, 3 Oct 2015 11:39:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Bdd2Q070474; Sat, 3 Oct 2015 11:39:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Bddbu070473; Sat, 3 Oct 2015 11:39:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031139.t93Bddbu070473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:39: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: r288597 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:39:40 -0000 Author: mav Date: Sat Oct 3 11:39:39 2015 New Revision: 288597 URL: https://svnweb.freebsd.org/changeset/base/288597 Log: MFC r287744 (by delphij): Reduce diff against upstream. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 11:38:10 2015 (r288596) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Oct 3 11:39:39 2015 (r288597) @@ -1630,6 +1630,7 @@ load_nvlist(spa_t *spa, uint64_t obj, nv error = dmu_bonus_hold(spa->spa_meta_objset, obj, FTAG, &db); if (error != 0) return (error); + nvsize = *(uint64_t *)db->db_data; dmu_buf_rele(db, FTAG); From owner-svn-src-all@freebsd.org Sat Oct 3 11:41:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4F40A0E226; Sat, 3 Oct 2015 11:41:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B540E1F3B; Sat, 3 Oct 2015 11:41:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93BfSGG074200; Sat, 3 Oct 2015 11:41:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93BfSnF074199; Sat, 3 Oct 2015 11:41:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031141.t93BfSnF074199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:41:28 +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: r288598 - stable/10/cddl/contrib/opensolaris/cmd/zdb 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:41:28 -0000 Author: mav Date: Sat Oct 3 11:41:27 2015 New Revision: 288598 URL: https://svnweb.freebsd.org/changeset/base/288598 Log: MFC r287771: 5695 dmu_sync'ed holes do not retain birth time (userland portion that was not merged in r286677) Update zdb to also print ltime, type, and level information for these new style holes. Previously, only the logical birth time would be printed. Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 11:39:39 2015 (r288597) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Oct 3 11:41:27 2015 (r288598) @@ -1205,7 +1205,9 @@ snprintf_blkptr_compact(char *blkbuf, si if (BP_IS_HOLE(bp)) { (void) snprintf(blkbuf + strlen(blkbuf), - buflen - strlen(blkbuf), "B=%llu", + buflen - strlen(blkbuf), + "%llxL B=%llu", + (u_longlong_t)BP_GET_LSIZE(bp), (u_longlong_t)bp->blk_birth); } else { (void) snprintf(blkbuf + strlen(blkbuf), From owner-svn-src-all@freebsd.org Sat Oct 3 11:43:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E344A0E4F8; Sat, 3 Oct 2015 11:43:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E82811F7; Sat, 3 Oct 2015 11:43:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Bhs64074348; Sat, 3 Oct 2015 11:43:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Bhs3E074347; Sat, 3 Oct 2015 11:43:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031143.t93Bhs3E074347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:43:54 +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: r288599 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 11:43:55 -0000 Author: mav Date: Sat Oct 3 11:43:54 2015 New Revision: 288599 URL: https://svnweb.freebsd.org/changeset/base/288599 Log: MFC r288064 (by avg): 6220 memleak in l2arc on debug build illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4 https://www.illumos.org/issues/6220 5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked when an arc_hdr is realloced from full to l2only. Reviewed by: Saso Kiselkov Reviewed by: Simon Klinkert Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Arne Jansen Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:41:27 2015 (r288598) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Oct 3 11:43:54 2015 (r288599) @@ -1488,6 +1488,13 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem VERIFY(!HDR_L2_WRITING(hdr)); VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); +#ifdef ZFS_DEBUG + if (hdr->b_l1hdr.b_thawed != NULL) { + kmem_free(hdr->b_l1hdr.b_thawed, 1); + hdr->b_l1hdr.b_thawed = NULL; + } +#endif + nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR; } /* From owner-svn-src-all@freebsd.org Sat Oct 3 12:09:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE4ACA0F800; Sat, 3 Oct 2015 12:09:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2A1A1F2D; Sat, 3 Oct 2015 12:09:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93C9DGU082739; Sat, 3 Oct 2015 12:09:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93C9Dn6082736; Sat, 3 Oct 2015 12:09:13 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031209.t93C9Dn6082736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288600 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 12:09:13 -0000 Author: hrs Date: Sat Oct 3 12:09:12 2015 New Revision: 288600 URL: https://svnweb.freebsd.org/changeset/base/288600 Log: - Schedule DAD for IN6_IFF_TENTATIVE addresses in nd6_timer(). This catches cases that DAD probes cannot be sent because of IFF_UP && !IFF_DRV_RUNNING. - nd6_dad_starttimer() now calls nd6_dad_ns_output(), instead of calling it before nd6_dad_starttimer(). - Do not release an entry in dadq when a duplicate entry is being added. Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sat Oct 3 11:43:54 2015 (r288599) +++ head/sys/netinet6/nd6.c Sat Oct 3 12:09:12 2015 (r288600) @@ -810,8 +810,31 @@ nd6_timer(void *arg) goto addrloop; } } + } else if ((ia6->ia6_flags & IN6_IFF_TENTATIVE) != 0) { + /* + * Schedule DAD for a tentative address. This happens + * if the interface was down or not running + * when the address was configured. + */ + int delay; + + delay = arc4random() % + (MAX_RTR_SOLICITATION_DELAY * hz); + nd6_dad_start((struct ifaddr *)ia6, delay); } else { /* + * Check status of the interface. If it is down, + * mark the address as tentative for future DAD. + */ + if ((ia6->ia_ifp->if_flags & IFF_UP) == 0 || + (ia6->ia_ifp->if_drv_flags & IFF_DRV_RUNNING) + == 0 || + (ND_IFINFO(ia6->ia_ifp)->flags & + ND6_IFF_IFDISABLED) != 0) { + ia6->ia6_flags &= ~IN6_IFF_DUPLICATED; + ia6->ia6_flags |= IN6_IFF_TENTATIVE; + } + /* * A new RA might have made a deprecated address * preferred. */ @@ -1452,7 +1475,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* Mark all IPv6 address as tentative. */ ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED; - if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { + if (V_ip6_dad_count > 0 && + (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Oct 3 11:43:54 2015 (r288599) +++ head/sys/netinet6/nd6_nbr.c Sat Oct 3 12:09:12 2015 (r288600) @@ -85,11 +85,11 @@ static struct dadq *nd6_dad_find(struct static void nd6_dad_add(struct dadq *dp); static void nd6_dad_del(struct dadq *dp); static void nd6_dad_rele(struct dadq *); -static void nd6_dad_starttimer(struct dadq *, int); +static void nd6_dad_starttimer(struct dadq *, int, int); static void nd6_dad_stoptimer(struct dadq *); static void nd6_dad_timer(struct dadq *); static void nd6_dad_duplicated(struct ifaddr *, struct dadq *); -static void nd6_dad_ns_output(struct dadq *, struct ifaddr *); +static void nd6_dad_ns_output(struct dadq *); static void nd6_dad_ns_input(struct ifaddr *, struct nd_opt_nonce *); static void nd6_dad_na_input(struct ifaddr *); static void nd6_na_output_fib(struct ifnet *, const struct in6_addr *, @@ -1199,9 +1199,11 @@ nd6_dad_find(struct ifaddr *ifa, struct } static void -nd6_dad_starttimer(struct dadq *dp, int ticks) +nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) { + if (send_ns != 0) + nd6_dad_ns_output(dp); callout_reset(&dp->dad_timer_ch, ticks, (void (*)(void *))nd6_dad_timer, (void *)dp); } @@ -1240,6 +1242,7 @@ nd6_dad_start(struct ifaddr *ifa, int de struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; + int send_ns; /* * If we don't need DAD, don't do it. @@ -1276,8 +1279,10 @@ nd6_dad_start(struct ifaddr *ifa, int de return; } if ((dp = nd6_dad_find(ifa, NULL)) != NULL) { - /* DAD already in progress */ - nd6_dad_rele(dp); + /* + * DAD already in progress. Let the existing entry + * to finish it. + */ return; } @@ -1310,13 +1315,12 @@ nd6_dad_start(struct ifaddr *ifa, int de dp->dad_ns_lcount = dp->dad_loopbackprobe = 0; refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); + send_ns = 0; if (delay == 0) { - nd6_dad_ns_output(dp, ifa); - nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); - } else { - nd6_dad_starttimer(dp, delay); + send_ns = 1; + delay = (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000; } + nd6_dad_starttimer(dp, delay, send_ns); } /* @@ -1386,7 +1390,8 @@ nd6_dad_timer(struct dadq *dp) if ((dp->dad_ns_tcount > V_dad_maxtry) && (((ifp->if_flags & IFF_UP) == 0) || ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0))) { - nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n", + nd6log((LOG_INFO, "%s: could not run DAD " + "because the interface was down or not running.\n", if_name(ifa->ifa_ifp))); goto err; } @@ -1396,9 +1401,8 @@ nd6_dad_timer(struct dadq *dp) /* * We have more NS to go. Send NS packet for DAD. */ - nd6_dad_ns_output(dp, ifa); nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, 1); goto done; } else { /* @@ -1426,11 +1430,11 @@ nd6_dad_timer(struct dadq *dp) * Send an NS immediately and increase dad_count by * V_nd6_mmaxtries - 1. */ - nd6_dad_ns_output(dp, ifa); dp->dad_count = dp->dad_ns_ocount + V_nd6_mmaxtries - 1; nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, + 1); goto done; } else { /* @@ -1517,10 +1521,10 @@ nd6_dad_duplicated(struct ifaddr *ifa, s } static void -nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) +nd6_dad_ns_output(struct dadq *dp) { - struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; - struct ifnet *ifp = ifa->ifa_ifp; + struct in6_ifaddr *ia = (struct in6_ifaddr *)dp->dad_ifa; + struct ifnet *ifp = dp->dad_ifa->ifa_ifp; int i; dp->dad_ns_tcount++; From owner-svn-src-all@freebsd.org Sat Oct 3 12:40:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66E58A0C3A3; Sat, 3 Oct 2015 12:40:55 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 582771D26; Sat, 3 Oct 2015 12:40:55 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93CetIm097640; Sat, 3 Oct 2015 12:40:55 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93CetWn097639; Sat, 3 Oct 2015 12:40:55 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031240.t93CetWn097639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288601 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 12:40:55 -0000 Author: hrs Date: Sat Oct 3 12:40:54 2015 New Revision: 288601 URL: https://svnweb.freebsd.org/changeset/base/288601 Log: - Move PF_LOCAL at the end of the array. PF_INET{,6} is used more often. - Add SOCKTYPE_ANY to PF_LOCAL. - Apply AI_CANONNAME to only AF_INET{,6}. It is not meaningful for the other AFs. Modified: head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Sat Oct 3 12:09:12 2015 (r288600) +++ head/lib/libc/net/getaddrinfo.c Sat Oct 3 12:40:54 2015 (r288601) @@ -168,12 +168,6 @@ struct explore { }; static const struct explore explore[] = { - { PF_LOCAL, SOCK_DGRAM, ANY, - AF_ANY | PROTOCOL_ANY }, - { PF_LOCAL, SOCK_STREAM, ANY, - AF_ANY | PROTOCOL_ANY }, - { PF_LOCAL, SOCK_SEQPACKET, ANY, - AF_ANY | PROTOCOL_ANY }, #ifdef INET6 { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, @@ -200,6 +194,12 @@ static const struct explore explore[] = AF_ANY | SOCKTYPE_ANY }, { PF_INET, SOCK_RAW, ANY, AF_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_DGRAM, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_STREAM, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_SEQPACKET, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, { -1, 0, 0, 0 }, }; @@ -1245,7 +1245,9 @@ explore_numeric(const struct addrinfo *p if (pai->ai_family == afd->a_af) { GET_AI(ai, afd, p); GET_PORT(ai, servname); - if ((pai->ai_flags & AI_CANONNAME)) { + if ((pai->ai_family == AF_INET || + pai->ai_family == AF_INET6) && + (pai->ai_flags & AI_CANONNAME)) { /* * Set the numeric address itself as the canonical * name, based on a clarification in RFC3493. From owner-svn-src-all@freebsd.org Sat Oct 3 12:49:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46F17A0C691; Sat, 3 Oct 2015 12:49:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C80A111E; Sat, 3 Oct 2015 12:49:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Cn5sh099161; Sat, 3 Oct 2015 12:49:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Cn5rW099160; Sat, 3 Oct 2015 12:49:05 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031249.t93Cn5rW099160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288602 - head/bin/cat 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 12:49:06 -0000 Author: hrs Date: Sat Oct 3 12:49:05 2015 New Revision: 288602 URL: https://svnweb.freebsd.org/changeset/base/288602 Log: Use getaddrinfo() to fill struct sockaddr_un. It now supports SOCK_DGRAM and SOCK_SEQPACKET in addition to SOCK_STREAM. Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Sat Oct 3 12:40:54 2015 (r288601) +++ head/bin/cat/cat.c Sat Oct 3 12:49:05 2015 (r288602) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif #include @@ -302,31 +303,39 @@ raw_cat(int rfd) static int udom_open(const char *path, int flags) { - struct sockaddr_un sou; - int fd; - unsigned int len; - - bzero(&sou, sizeof(sou)); + struct addrinfo hints, *res, *res0; + char rpath[PATH_MAX]; + int fd, error; /* - * Construct the unix domain socket address and attempt to connect + * Construct the unix domain socket address and attempt to connect. */ - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd >= 0) { - sou.sun_family = AF_UNIX; - if ((len = strlcpy(sou.sun_path, path, - sizeof(sou.sun_path))) >= sizeof(sou.sun_path)) { - close(fd); - errno = ENAMETOOLONG; + bzero(&hints, sizeof(hints)); + hints.ai_family = AF_LOCAL; + if (realpath(path, rpath) == NULL) + return (-1); + error = getaddrinfo(rpath, NULL, &hints, &res0); + if (error) { + warn("%s", gai_strerror(error)); + errno = EINVAL; + return (-1); + } + for (res = res0; res != NULL; res = res->ai_next) { + fd = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (fd < 0) { + freeaddrinfo(res0); return (-1); } - len = offsetof(struct sockaddr_un, sun_path[len+1]); - - if (connect(fd, (void *)&sou, len) < 0) { + error = connect(fd, res->ai_addr, res->ai_addrlen); + if (error == 0) + break; + else { close(fd); fd = -1; } } + freeaddrinfo(res0); /* * handle the open flags by shutting down appropriate directions From owner-svn-src-all@freebsd.org Sat Oct 3 15:48:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33250A0E98B; Sat, 3 Oct 2015 15:48:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1751B187E; Sat, 3 Oct 2015 15:48:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93FmMiZ073052; Sat, 3 Oct 2015 15:48:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93FmMHv073050; Sat, 3 Oct 2015 15:48:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031548.t93FmMHv073050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288603 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 15:48:23 -0000 Author: adrian Date: Sat Oct 3 15:48:21 2015 New Revision: 288603 URL: https://svnweb.freebsd.org/changeset/base/288603 Log: run(4): Add initial support for IBSS merge. Submitted by: Differential Revision: https://reviews.freebsd.org/D3592 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runvar.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 12:49:05 2015 (r288602) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 15:48:21 2015 (r288603) @@ -392,6 +392,8 @@ static void run_drain_fifo(void *); static void run_iter_func(void *, struct ieee80211_node *); static void run_newassoc_cb(void *); static void run_newassoc(struct ieee80211_node *, int); +static void run_recv_mgmt(struct ieee80211_node *, struct mbuf *, int, + const struct ieee80211_rx_stats *, int, int); static void run_rx_frame(struct run_softc *, struct mbuf *, uint32_t); static void run_tx_free(struct run_endpoint_queue *pq, struct run_tx_data *, int); @@ -939,6 +941,10 @@ run_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = run_newstate; + if (opmode == IEEE80211_M_IBSS) { + rvp->recv_mgmt = vap->iv_recv_mgmt; + vap->iv_recv_mgmt = run_recv_mgmt; + } ieee80211_ratectl_init(vap); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); @@ -2725,6 +2731,34 @@ run_maxrssi_chain(struct run_softc *sc, } static void +run_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, int subtype, + const struct ieee80211_rx_stats *rxs, int rssi, int nf) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct run_softc *sc = vap->iv_ic->ic_softc; + struct run_vap *rvp = RUN_VAP(vap); + uint64_t ni_tstamp, rx_tstamp; + + rvp->recv_mgmt(ni, m, subtype, rxs, rssi, nf); + + if (vap->iv_state == IEEE80211_S_RUN && + (subtype == IEEE80211_FC0_SUBTYPE_BEACON || + subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP)) { + ni_tstamp = le64toh(ni->ni_tstamp.tsf); + RUN_LOCK(sc); + run_get_tsf(sc, &rx_tstamp); + RUN_UNLOCK(sc); + rx_tstamp = le64toh(rx_tstamp); + + if (ni_tstamp >= rx_tstamp) { + DPRINTF("ibss merge, tsf %ju tstamp %ju\n", + (uintmax_t)rx_tstamp, (uintmax_t)ni_tstamp); + (void) ieee80211_ibss_merge(ni); + } + } +} + +static void run_rx_frame(struct run_softc *sc, struct mbuf *m, uint32_t dmalen) { struct ieee80211com *ic = &sc->sc_ic; Modified: head/sys/dev/usb/wlan/if_runvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_runvar.h Sat Oct 3 12:49:05 2015 (r288602) +++ head/sys/dev/usb/wlan/if_runvar.h Sat Oct 3 15:48:21 2015 (r288603) @@ -123,6 +123,10 @@ struct run_vap { int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); + void (*recv_mgmt)(struct ieee80211_node *, + struct mbuf *, int, + const struct ieee80211_rx_stats *, + int, int); uint8_t rvp_id; }; From owner-svn-src-all@freebsd.org Sat Oct 3 15:49:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70D45A0EA90; Sat, 3 Oct 2015 15:49:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 618C219FD; Sat, 3 Oct 2015 15:49:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fnu66073197; Sat, 3 Oct 2015 15:49:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fnt9d073195; Sat, 3 Oct 2015 15:49:55 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031549.t93Fnt9d073195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288604 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 15:49:56 -0000 Author: adrian Date: Sat Oct 3 15:49:55 2015 New Revision: 288604 URL: https://svnweb.freebsd.org/changeset/base/288604 Log: rum(4): add TSF field into radiotap headers Submitted by: Differential Revision: https://reviews.freebsd.org/D3607 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:48:21 2015 (r288603) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:49:55 2015 (r288604) @@ -206,6 +206,7 @@ static void rum_set_chan(struct rum_sof static void rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); +static void rum_get_tsf(struct rum_softc *, uint64_t *); static void rum_update_slot(struct rum_softc *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -857,6 +858,7 @@ tr_setup: tap->wt_flags = 0; tap->wt_rate = data->rate; + rum_get_tsf(sc, &tap->wt_tsf); tap->wt_antenna = sc->tx_ant; ieee80211_radiotap_tx(vap, m); @@ -963,11 +965,11 @@ rum_bulk_read_callback(struct usb_xfer * if (ieee80211_radiotap_active(ic)) { struct rum_rx_radiotap_header *tap = &sc->sc_rxtap; - /* XXX read tsf */ tap->wr_flags = 0; tap->wr_rate = ieee80211_plcp2rate(sc->sc_rx_desc.rate, (flags & RT2573_RX_OFDM) ? IEEE80211_T_OFDM : IEEE80211_T_CCK); + rum_get_tsf(sc, &tap->wr_tsf); tap->wr_antsignal = RT2573_NOISE_FLOOR + rssi; tap->wr_antnoise = RT2573_NOISE_FLOOR; tap->wr_antenna = sc->rx_ant; @@ -1836,6 +1838,12 @@ rum_abort_tsf_sync(struct rum_softc *sc) } static void +rum_get_tsf(struct rum_softc *sc, uint64_t *buf) +{ + rum_read_multi(sc, RT2573_TXRX_CSR12, buf, sizeof (*buf)); +} + +static void rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 15:48:21 2015 (r288603) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 15:49:55 2015 (r288604) @@ -22,6 +22,7 @@ struct rum_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; uint8_t wr_flags; uint8_t wr_rate; uint16_t wr_chan_freq; @@ -32,7 +33,8 @@ struct rum_rx_radiotap_header { } __packed __aligned(8); #define RT2573_RX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ @@ -42,6 +44,7 @@ struct rum_rx_radiotap_header { struct rum_tx_radiotap_header { struct ieee80211_radiotap_header wt_ihdr; + uint64_t wt_tsf; uint8_t wt_flags; uint8_t wt_rate; uint16_t wt_chan_freq; @@ -50,7 +53,8 @@ struct rum_tx_radiotap_header { } __packed __aligned(8); #define RT2573_TX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_ANTENNA)) From owner-svn-src-all@freebsd.org Sat Oct 3 15:52:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD9DA0D09F; Sat, 3 Oct 2015 15:52:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BB301E77; Sat, 3 Oct 2015 15:52:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fqxwr077045; Sat, 3 Oct 2015 15:52:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fqx80077044; Sat, 3 Oct 2015 15:52:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031552.t93Fqx80077044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288605 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 15:52:59 -0000 Author: adrian Date: Sat Oct 3 15:52:58 2015 New Revision: 288605 URL: https://svnweb.freebsd.org/changeset/base/288605 Log: rum(4): check mbuf size before accessing its contents Submitted by: Differential Revision: https://reviews.freebsd.org/D3610 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:49:55 2015 (r288604) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:52:58 2015 (r288605) @@ -912,6 +912,7 @@ rum_bulk_read_callback(struct usb_xfer * { struct rum_softc *sc = usbd_xfer_softc(xfer); struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_frame_min *wh; struct ieee80211_node *ni; struct mbuf *m = NULL; struct usb_page_cache *pc; @@ -959,6 +960,8 @@ rum_bulk_read_callback(struct usb_xfer * usbd_copy_out(pc, RT2573_RX_DESC_SIZE, mtod(m, uint8_t *), len); + wh = mtod(m, struct ieee80211_frame_min *); + /* finalize mbuf */ m->m_pkthdr.len = m->m_len = (flags >> 16) & 0xfff; @@ -987,8 +990,11 @@ tr_setup: */ RUM_UNLOCK(sc); if (m) { - ni = ieee80211_find_rxnode(ic, - mtod(m, struct ieee80211_frame_min *)); + if (m->m_len >= sizeof(struct ieee80211_frame_min)) + ni = ieee80211_find_rxnode(ic, wh); + else + ni = NULL; + if (ni != NULL) { (void) ieee80211_input(ni, m, rssi, RT2573_NOISE_FLOOR); From owner-svn-src-all@freebsd.org Sat Oct 3 15:58:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5414FA0D3D0; Sat, 3 Oct 2015 15:58:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 358811088; Sat, 3 Oct 2015 15:58:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fw1lw077432; Sat, 3 Oct 2015 15:58:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fw1o2077431; Sat, 3 Oct 2015 15:58:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031558.t93Fw1o2077431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288606 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 15:58:01 -0000 Author: adrian Date: Sat Oct 3 15:58:00 2015 New Revision: 288606 URL: https://svnweb.freebsd.org/changeset/base/288606 Log: rum(4): simplify error handling rum_raw_xmit() Move the mbuf free responsibility to the caller of the hardware xmit function, not the hardware xmit function itself. Submitted by: Differential Revision: https://reviews.freebsd.org/D3621 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:52:58 2015 (r288605) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:58:00 2015 (r288606) @@ -1157,10 +1157,9 @@ rum_tx_mgt(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m0); - if (k == NULL) { - m_freem(m0); - return ENOBUFS; - } + if (k == NULL) + return (ENOBUFS); + wh = mtod(m0, struct ieee80211_frame *); } @@ -1205,13 +1204,11 @@ rum_tx_raw(struct rum_softc *sc, struct int rate, error; RUM_LOCK_ASSERT(sc); - KASSERT(params != NULL, ("no raw xmit params")); rate = params->ibp_rate0; - if (!ieee80211_isratevalid(ic->ic_rt, rate)) { - m_freem(m0); - return EINVAL; - } + if (!ieee80211_isratevalid(ic->ic_rt, rate)) + return (EINVAL); + flags = 0; if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) flags |= RT2573_TX_NEED_ACK; @@ -1220,10 +1217,9 @@ rum_tx_raw(struct rum_softc *sc, struct params->ibp_flags & IEEE80211_BPF_RTS ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_CTSONLY, rate); - if (error || sc->tx_nfree == 0) { - m_freem(m0); - return ENOBUFS; - } + if (error || sc->tx_nfree == 0) + return (ENOBUFS); + flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } @@ -2224,20 +2220,17 @@ rum_raw_xmit(struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { struct rum_softc *sc = ni->ni_ic->ic_softc; + int ret; RUM_LOCK(sc); /* prevent management frames from being sent if we're not ready */ if (!sc->sc_running) { - RUM_UNLOCK(sc); - m_freem(m); - ieee80211_free_node(ni); - return ENETDOWN; + ret = ENETDOWN; + goto bad; } if (sc->tx_nfree < RUM_TX_MINFREE) { - RUM_UNLOCK(sc); - m_freem(m); - ieee80211_free_node(ni); - return EIO; + ret = EIO; + goto bad; } if (params == NULL) { @@ -2245,14 +2238,14 @@ rum_raw_xmit(struct ieee80211_node *ni, * Legacy path; interpret frame contents to decide * precisely how to send the frame. */ - if (rum_tx_mgt(sc, m, ni) != 0) + if ((ret = rum_tx_mgt(sc, m, ni)) != 0) goto bad; } else { /* * Caller supplied explicit parameters to use in * sending the frame. */ - if (rum_tx_raw(sc, m, ni, params) != 0) + if ((ret = rum_tx_raw(sc, m, ni, params)) != 0) goto bad; } RUM_UNLOCK(sc); @@ -2260,8 +2253,9 @@ rum_raw_xmit(struct ieee80211_node *ni, return 0; bad: RUM_UNLOCK(sc); + m_freem(m); ieee80211_free_node(ni); - return EIO; + return ret; } static void From owner-svn-src-all@freebsd.org Sat Oct 3 16:01:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04DF0A0D745; Sat, 3 Oct 2015 16:01:20 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E69F113DA; Sat, 3 Oct 2015 16:01:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93G1JWj079445; Sat, 3 Oct 2015 16:01:19 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93G1G06079430; Sat, 3 Oct 2015 16:01:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031601.t93G1G06079430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:01:16 +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: r288607 - in stable/10: gnu/usr.bin/binutils/libbfd kerberos5/libexec/kdigest kerberos5/usr.bin/hxtool kerberos5/usr.bin/kadmin kerberos5/usr.bin/kcc kerberos5/usr.sbin/iprop-log kerber... 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:01:20 -0000 Author: bdrewery Date: Sat Oct 3 16:01:16 2015 New Revision: 288607 URL: https://svnweb.freebsd.org/changeset/base/288607 Log: MFC r288199,r288246: Add missing CLEANFILES. Modified: stable/10/gnu/usr.bin/binutils/libbfd/Makefile.i386 stable/10/kerberos5/libexec/kdigest/Makefile stable/10/kerberos5/usr.bin/hxtool/Makefile stable/10/kerberos5/usr.bin/kadmin/Makefile stable/10/kerberos5/usr.bin/kcc/Makefile stable/10/kerberos5/usr.sbin/iprop-log/Makefile stable/10/kerberos5/usr.sbin/ktutil/Makefile stable/10/lib/clang/include/Makefile stable/10/lib/libc/tests/gen/posix_spawn/Makefile stable/10/lib/ncurses/ncurses/Makefile stable/10/usr.bin/yacc/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/gnu/usr.bin/binutils/libbfd/Makefile.i386 ============================================================================== --- stable/10/gnu/usr.bin/binutils/libbfd/Makefile.i386 Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/gnu/usr.bin/binutils/libbfd/Makefile.i386 Sat Oct 3 16:01:16 2015 (r288607) @@ -17,3 +17,5 @@ VECS= ${DEFAULT_VECTOR} \ peigen.c: peXXigen.c sed -e s/XX/pe/g ${.ALLSRC} > ${.TARGET} + +CLEANFILES+= peigen.c Modified: stable/10/kerberos5/libexec/kdigest/Makefile ============================================================================== --- stable/10/kerberos5/libexec/kdigest/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/libexec/kdigest/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -13,6 +13,8 @@ SRCS= kdigest.c \ kdigest-commands.c \ kdigest-commands.h +CLEANFILES= kdigest-commands.h kdigest-commands.c + kdigest-commands.h: kdigest-commands.in ${SLC} ${.ALLSRC:M*.in} Modified: stable/10/kerberos5/usr.bin/hxtool/Makefile ============================================================================== --- stable/10/kerberos5/usr.bin/hxtool/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/usr.bin/hxtool/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -10,6 +10,8 @@ DPADD= ${LIBHX509} ${LIBROKEN} ${LIBASN1 LDADD= -lhx509 -lroken -lasn1 -lcrypto -lcrypt ${LIBSL} ${LIBVERS} -ledit SRCS= hxtool.c hxtool-commands.c hxtool-commands.h +CLEANFILES= hxtool-commands.h hxtool-commands.c + hxtool-commands.h: hxtool-commands.in ${SLC} ${.ALLSRC:M*.in} Modified: stable/10/kerberos5/usr.bin/kadmin/Makefile ============================================================================== --- stable/10/kerberos5/usr.bin/kadmin/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/usr.bin/kadmin/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -36,6 +36,8 @@ LDADD= -lkadm5clnt -lkadm5srv -lhdb -lkr -ledit -lncurses ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} +CLEANFILES= kadmin-commands.h kadmin-commands.c + .include kadmin-commands.h: ${KRB5DIR}/kadmin/kadmin-commands.in Modified: stable/10/kerberos5/usr.bin/kcc/Makefile ============================================================================== --- stable/10/kerberos5/usr.bin/kcc/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/usr.bin/kcc/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -19,6 +19,8 @@ SRCS= kcc.c \ kswitch.c \ copy_cred_cache.c +CLEANFILES= kcc-commands.h kcc-commands.c + kcc-commands.h: kcc-commands.in ${SLC} ${.ALLSRC:M*.in} Modified: stable/10/kerberos5/usr.sbin/iprop-log/Makefile ============================================================================== --- stable/10/kerberos5/usr.sbin/iprop-log/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/usr.sbin/iprop-log/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -14,6 +14,8 @@ LDADD= -lkadm5srv -lhdb -lkrb5 -lasn1 -l ${LIBVERS} -ledit LDFLAGS=${LDAPLDFLAGS} +CLEANFILES= iprop-commands.h iprop-commands.c + iprop-commands.h: iprop-commands.in ${SLC} ${.ALLSRC:M*.in} Modified: stable/10/kerberos5/usr.sbin/ktutil/Makefile ============================================================================== --- stable/10/kerberos5/usr.sbin/ktutil/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/kerberos5/usr.sbin/ktutil/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -22,6 +22,8 @@ DPADD= ${LIBKADM5CLNT} ${LIBKRB5} ${LIBS LDADD= -lkadm5clnt -lkrb5 ${LIBSL} -lroken ${LIBVERS} \ -lasn1 -lcrypto -lcrypt -ledit +CLEANFILES= ktutil-commands.h ktutil-commands.c + .include ktutil-commands.h: ${KRB5DIR}/admin/ktutil-commands.in Modified: stable/10/lib/clang/include/Makefile ============================================================================== --- stable/10/lib/clang/include/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/lib/clang/include/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -45,6 +45,6 @@ INCS= __wmmintrin_aes.h \ xopintrin.h \ ${GENINCS} GENINCS= arm_neon.h -CLEANFILES= ${GENINCS} +CLEANFILES= ${GENINCS} ${GENINCS:C/\.h$/.d/} .include Modified: stable/10/lib/libc/tests/gen/posix_spawn/Makefile ============================================================================== --- stable/10/lib/libc/tests/gen/posix_spawn/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/lib/libc/tests/gen/posix_spawn/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -21,6 +21,8 @@ PROGS+= h_spawnattr SCRIPTS= h_nonexec SCRIPTS+= h_zero +CLEANFILES+= h_nonexec + .include "../../Makefile.netbsd-tests" h_zero: Modified: stable/10/lib/ncurses/ncurses/Makefile ============================================================================== --- stable/10/lib/ncurses/ncurses/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/lib/ncurses/ncurses/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -282,6 +282,7 @@ CFLAGS+= -DFREEBSD_NATIVE -DTERMIOS # Installed HEADERS= curses.h term.h termcap.h unctrl.h SRCHDRS= ncurses_dll.h +CLEANFILES+= ncurses_dll.h .if defined(ENABLE_WIDEC) INCS= ${HEADERS} ${SRCHDRS} Modified: stable/10/usr.bin/yacc/tests/Makefile ============================================================================== --- stable/10/usr.bin/yacc/tests/Makefile Sat Oct 3 15:58:00 2015 (r288606) +++ stable/10/usr.bin/yacc/tests/Makefile Sat Oct 3 16:01:16 2015 (r288607) @@ -17,6 +17,8 @@ TEST_METADATA.yacc_tests+= required_user SCRIPTS= run_test SCRIPTSDIR= ${TESTSDIR} +CLEANFILES= run_test + FILESGROUPS= FILES FILEStest FILEStest_yacc FILEStestDIR= ${TESTSDIR} From owner-svn-src-all@freebsd.org Sat Oct 3 16:09:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B46A0DBAA; Sat, 3 Oct 2015 16:09:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0354317E6; Sat, 3 Oct 2015 16:09:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93G9tKM081962; Sat, 3 Oct 2015 16:09:55 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93G9ttI081961; Sat, 3 Oct 2015 16:09:55 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031609.t93G9ttI081961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288608 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:09:56 -0000 Author: bdrewery Date: Sat Oct 3 16:09:55 2015 New Revision: 288608 URL: https://svnweb.freebsd.org/changeset/base/288608 Log: Avoid make compatibility mode issues with creating cookies from r287844 and r287848. Also hide the cookie creation. Suggested by: imp, Daniel O'Connor Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sat Oct 3 16:01:16 2015 (r288607) +++ head/include/Makefile Sat Oct 3 16:09:55 2015 (r288608) @@ -166,7 +166,7 @@ compat: -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ -p ${DESTDIR}${INCLUDEDIR} > /dev/null .if ${MK_META_MODE} == "yes" - touch ${.TARGET} + @touch ${.TARGET} .endif copies: @@ -255,8 +255,7 @@ copies: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ ${DESTDIR}${INCLUDEDIR}/teken .if ${MK_META_MODE} == "yes" - cd ${.OBJDIR} - touch ${.TARGET} + @touch ${.OBJDIR}/${.TARGET} .endif symlinks: @@ -373,8 +372,7 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/rpc; \ done .if ${MK_META_MODE} == "yes" - cd ${.OBJDIR} - touch ${.TARGET} + touch ${.OBJDIR}/${.TARGET} .endif .if ${MACHINE} == "host" From owner-svn-src-all@freebsd.org Sat Oct 3 16:21:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7115A0E3CD; Sat, 3 Oct 2015 16:21:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7B481E3B; Sat, 3 Oct 2015 16:21:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GL7xT089334; Sat, 3 Oct 2015 16:21:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GL7TA089333; Sat, 3 Oct 2015 16:21:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031621.t93GL7TA089333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 16:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288609 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:21:07 -0000 Author: adrian Date: Sat Oct 3 16:21:06 2015 New Revision: 288609 URL: https://svnweb.freebsd.org/changeset/base/288609 Log: rum(4): add error handling in initialization path Tested: * Tested on WUSB54GC, STA mode. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3622 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:09:55 2015 (r288608) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:21:06 2015 (r288609) @@ -216,7 +216,7 @@ static void rum_setpromisc(struct rum_s static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); -static void rum_init(struct rum_softc *); +static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); @@ -1373,24 +1373,22 @@ static void rum_parent(struct ieee80211com *ic) { struct rum_softc *sc = ic->ic_softc; - int startall = 0; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); RUM_LOCK(sc); if (sc->sc_detached) { RUM_UNLOCK(sc); return; } + RUM_UNLOCK(sc); + if (ic->ic_nrunning > 0) { - if (!sc->sc_running) { - rum_init(sc); - startall = 1; - } else - rum_setpromisc(sc); - } else if (sc->sc_running) + if (rum_init(sc) == 0) + ieee80211_start_all(ic); + else + ieee80211_stop(vap); + } else rum_stop(sc); - RUM_UNLOCK(sc); - if (startall) - ieee80211_start_all(ic); } static void @@ -2043,18 +2041,19 @@ rum_bbp_init(struct rum_softc *sc) return 0; } -static void +static int rum_init(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); uint32_t tmp; - usb_error_t error; - int i, ntries; - - RUM_LOCK_ASSERT(sc); + int i, ntries, ret; - rum_stop(sc); + RUM_LOCK(sc); + if (sc->sc_running) { + ret = 0; + goto end; + } /* initialize MAC registers to default values */ for (i = 0; i < nitems(rum_def_mac); i++) @@ -2075,11 +2074,12 @@ rum_init(struct rum_softc *sc) if (ntries == 100) { device_printf(sc->sc_dev, "timeout waiting for BBP/RF to wakeup\n"); - goto fail; + ret = ETIMEDOUT; + goto end; } - if ((error = rum_bbp_init(sc)) != 0) - goto fail; + if ((ret = rum_bbp_init(sc)) != 0) + goto end; /* select default channel */ rum_select_band(sc, ic->ic_curchan); @@ -2116,20 +2116,25 @@ rum_init(struct rum_softc *sc) sc->sc_running = 1; usbd_xfer_set_stall(sc->sc_xfer[RUM_BULK_WR]); usbd_transfer_start(sc->sc_xfer[RUM_BULK_RD]); - return; -fail: rum_stop(sc); -#undef N +end: RUM_UNLOCK(sc); + + if (ret != 0) + rum_stop(sc); + + return ret; } static void rum_stop(struct rum_softc *sc) { - RUM_LOCK_ASSERT(sc); - + RUM_LOCK(sc); + if (!sc->sc_running) { + RUM_UNLOCK(sc); + return; + } sc->sc_running = 0; - RUM_UNLOCK(sc); /* @@ -2139,7 +2144,6 @@ rum_stop(struct rum_softc *sc) usbd_transfer_drain(sc->sc_xfer[RUM_BULK_RD]); RUM_LOCK(sc); - rum_unsetup_tx_list(sc); /* disable Rx */ @@ -2148,6 +2152,7 @@ rum_stop(struct rum_softc *sc) /* reset ASIC */ rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); + RUM_UNLOCK(sc); } static void From owner-svn-src-all@freebsd.org Sat Oct 3 16:21:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2308CA0E479; Sat, 3 Oct 2015 16:21:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED0CF1030; Sat, 3 Oct 2015 16:21:54 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GLs8Z090007; Sat, 3 Oct 2015 16:21:54 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GLsT6089577; Sat, 3 Oct 2015 16:21:54 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031621.t93GLsT6089577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:21:54 +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: r288610 - in stable/10: gnu/usr.bin/groff/src/utils/indxbib lib/libusb lib/libz 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:21:55 -0000 Author: bdrewery Date: Sat Oct 3 16:21:53 2015 New Revision: 288610 URL: https://svnweb.freebsd.org/changeset/base/288610 Log: MFC r273756,r287980: r273756: only install .pc files when we are not installing 32bit compat libs... r287980: Replace beforeinstall: handling with FILES. Modified: stable/10/gnu/usr.bin/groff/src/utils/indxbib/Makefile stable/10/lib/libusb/Makefile stable/10/lib/libz/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/gnu/usr.bin/groff/src/utils/indxbib/Makefile ============================================================================== --- stable/10/gnu/usr.bin/groff/src/utils/indxbib/Makefile Sat Oct 3 16:21:06 2015 (r288609) +++ stable/10/gnu/usr.bin/groff/src/utils/indxbib/Makefile Sat Oct 3 16:21:53 2015 (r288610) @@ -5,9 +5,7 @@ SRCS= indxbib.cpp signal.c DPADD= ${LIBBIB} ${LIBGROFF} ${LIBM} LDADD= ${LIBBIB} ${LIBGROFF} -lm CLEANFILES= ${MAN} - -beforeinstall: - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ - ${DIST_DIR}/eign ${DESTDIR}${SHAREDIR}/dict/ +FILES= ${DIST_DIR}/eign +FILESDIR= ${SHAREDIR}/dict/ .include Modified: stable/10/lib/libusb/Makefile ============================================================================== --- stable/10/lib/libusb/Makefile Sat Oct 3 16:21:06 2015 (r288609) +++ stable/10/lib/libusb/Makefile Sat Oct 3 16:21:53 2015 (r288610) @@ -36,16 +36,11 @@ SRCS+= libusb10_io.c .if defined(COMPAT_32BIT) CFLAGS+= -DCOMPAT_32BIT +.else +FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc +FILESDIR= ${LIBDATADIR}/pkgconfig .endif -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - # # Cross platform support # Modified: stable/10/lib/libz/Makefile ============================================================================== --- stable/10/lib/libz/Makefile Sat Oct 3 16:21:06 2015 (r288609) +++ stable/10/lib/libz/Makefile Sat Oct 3 16:21:53 2015 (r288610) @@ -68,9 +68,10 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${.CURDIR}/zlib.pc ${DESTDIR}${LIBDATADIR}/pkgconfig +.ifndef COMPAT_32BIT +FILES= zlib.pc +FILESDIR= ${LIBDATADIR}/pkgconfig +.endif .include From owner-svn-src-all@freebsd.org Sat Oct 3 16:24:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E0D6A0E5C6; Sat, 3 Oct 2015 16:24:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DBD511C3; Sat, 3 Oct 2015 16:24:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GOLdv090320; Sat, 3 Oct 2015 16:24:21 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GOLww090318; Sat, 3 Oct 2015 16:24:21 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031624.t93GOLww090318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:24:21 +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: r288611 - in 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:24:22 -0000 Author: bdrewery Date: Sat Oct 3 16:24:20 2015 New Revision: 288611 URL: https://svnweb.freebsd.org/changeset/base/288611 Log: MFC r287981: Replace afterinstall: hack from r111083 with 'make delete-old' functionality. Modified: stable/10/ObsoleteFiles.inc stable/10/secure/lib/libcrypto/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sat Oct 3 16:21:53 2015 (r288610) +++ stable/10/ObsoleteFiles.inc Sat Oct 3 16:24:20 2015 (r288611) @@ -6403,6 +6403,12 @@ OLD_LIBS+=usr/lib/libposix1e.so.2 OLD_LIBS+=usr/lib/libskey.so.2 OLD_LIBS+=usr/lib/libusbhid.so.0 OLD_LIBS+=usr/lib/libvgl.so.2 +# 20030218: OpenSSL 0.9.7 import +OLD_FILES+=usr/include/des.h +OLD_FILES+=usr/lib/libdes.a +OLD_FILES+=usr/lib/libdes.so +OLD_LIBS+=usr/lib/libdes.so.3 +OLD_FILES+=usr/lib/libdes_p.a # 200302XX OLD_LIBS+=usr/lib/libacl.so.3 OLD_LIBS+=usr/lib/libasn1.so.5 Modified: stable/10/secure/lib/libcrypto/Makefile ============================================================================== --- stable/10/secure/lib/libcrypto/Makefile Sat Oct 3 16:21:53 2015 (r288610) +++ stable/10/secure/lib/libcrypto/Makefile Sat Oct 3 16:24:20 2015 (r288611) @@ -402,14 +402,6 @@ opensslconf.h: opensslconf-${MACHINE_CPU .endif cp -f ${.ALLSRC} ${.TARGET} -OLDSYMLINKS+= libdes.a libdes.so libdes.so.3 libdes_p.a -afterinstall: - @${ECHO} "Removing stale symlinks." - rm -f ${DESTDIR}${INCLUDEDIR}/des.h -.for symlink in ${OLDSYMLINKS} - rm -f ${DESTDIR}${LIBDIR}/${symlink} -.endfor - .include .if ${MACHINE_CPUARCH} == "amd64" From owner-svn-src-all@freebsd.org Sat Oct 3 16:25:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2DA4A0E679; Sat, 3 Oct 2015 16:25:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 929CD1311; Sat, 3 Oct 2015 16:25:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GPms3090469; Sat, 3 Oct 2015 16:25:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GPmEI090467; Sat, 3 Oct 2015 16:25:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031625.t93GPmEI090467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:25:48 +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: r288612 - in stable/9: . secure/lib/libcrypto 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:25:48 -0000 Author: bdrewery Date: Sat Oct 3 16:25:47 2015 New Revision: 288612 URL: https://svnweb.freebsd.org/changeset/base/288612 Log: MFC r287981: Replace afterinstall: hack from r111083 with 'make delete-old' functionality. Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/secure/lib/libcrypto/Makefile Directory Properties: stable/9/secure/lib/libcrypto/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Sat Oct 3 16:24:20 2015 (r288611) +++ stable/9/ObsoleteFiles.inc Sat Oct 3 16:25:47 2015 (r288612) @@ -5770,6 +5770,12 @@ OLD_LIBS+=usr/lib/libposix1e.so.2 OLD_LIBS+=usr/lib/libskey.so.2 OLD_LIBS+=usr/lib/libusbhid.so.0 OLD_LIBS+=usr/lib/libvgl.so.2 +# 20030218: OpenSSL 0.9.7 import +OLD_FILES+=usr/include/des.h +OLD_FILES+=usr/lib/libdes.a +OLD_FILES+=usr/lib/libdes.so +OLD_LIBS+=usr/lib/libdes.so.3 +OLD_FILES+=usr/lib/libdes_p.a # 200302XX OLD_LIBS+=usr/lib/libacl.so.3 OLD_LIBS+=usr/lib/libasn1.so.5 Modified: stable/9/secure/lib/libcrypto/Makefile ============================================================================== --- stable/9/secure/lib/libcrypto/Makefile Sat Oct 3 16:24:20 2015 (r288611) +++ stable/9/secure/lib/libcrypto/Makefile Sat Oct 3 16:25:47 2015 (r288612) @@ -378,14 +378,6 @@ fips_rand.h: CLEANFILES+= fips.h fips_rand.h -OLDSYMLINKS+= libdes.a libdes.so libdes.so.3 libdes_p.a -afterinstall: - @${ECHO} "Removing stale symlinks." - rm -f ${DESTDIR}${INCLUDEDIR}/des.h -.for symlink in ${OLDSYMLINKS} - rm -f ${DESTDIR}${LIBDIR}/${symlink} -.endfor - .include .if ${MACHINE_CPUARCH} == "i386" From owner-svn-src-all@freebsd.org Sat Oct 3 16:26:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A26A0E6EA; Sat, 3 Oct 2015 16:26:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C932914A0; Sat, 3 Oct 2015 16:26:14 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GQELe090544; Sat, 3 Oct 2015 16:26:14 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GQEn9090541; Sat, 3 Oct 2015 16:26:14 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031626.t93GQEn9090541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288613 - in stable/10: . usr.sbin/ntp/ntpdc 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:26:15 -0000 Author: bdrewery Date: Sat Oct 3 16:26:13 2015 New Revision: 288613 URL: https://svnweb.freebsd.org/changeset/base/288613 Log: MFC r287982: Replace afterinstall: hack from r54681 with 'make delete-old' functionality. Modified: stable/10/ObsoleteFiles.inc stable/10/usr.sbin/ntp/ntpdc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sat Oct 3 16:25:47 2015 (r288612) +++ stable/10/ObsoleteFiles.inc Sat Oct 3 16:26:13 2015 (r288613) @@ -6467,6 +6467,8 @@ OLD_LIBS+=usr/lib/libtermcap.so.2 OLD_LIBS+=usr/lib/libutil.so.2 OLD_LIBS+=usr/lib/libvgl.so.1 OLD_LIBS+=usr/lib/libwrap.so.2 +# 19991216 +OLD_FILES+=usr/sbin/xntpdc # 199909XX OLD_LIBS+=usr/lib/libc_r.so.3 # ??? Modified: stable/10/usr.sbin/ntp/ntpdc/Makefile ============================================================================== --- stable/10/usr.sbin/ntp/ntpdc/Makefile Sat Oct 3 16:25:47 2015 (r288612) +++ stable/10/usr.sbin/ntp/ntpdc/Makefile Sat Oct 3 16:26:13 2015 (r288613) @@ -37,7 +37,4 @@ CLEANFILES+= .version version.c version.c: sh -e ${.CURDIR}/../scripts/mkver ntpdc -afterinstall: - rm -f ${DESTDIR}/usr/sbin/xntpdc - .include From owner-svn-src-all@freebsd.org Sat Oct 3 16:26:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24C8EA0E7AD; Sat, 3 Oct 2015 16:26:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 146A91628; Sat, 3 Oct 2015 16:26:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GQlvs090625; Sat, 3 Oct 2015 16:26:47 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GQlQi090622; Sat, 3 Oct 2015 16:26:47 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031626.t93GQlQi090622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:26:47 +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: r288614 - in stable/9: . usr.sbin/ntp/ntpdc 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:26:48 -0000 Author: bdrewery Date: Sat Oct 3 16:26:46 2015 New Revision: 288614 URL: https://svnweb.freebsd.org/changeset/base/288614 Log: MFC r287982: Replace afterinstall: hack from r54681 with 'make delete-old' functionality. Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/usr.sbin/ntp/ntpdc/Makefile Directory Properties: stable/9/usr.sbin/ntp/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Sat Oct 3 16:26:13 2015 (r288613) +++ stable/9/ObsoleteFiles.inc Sat Oct 3 16:26:46 2015 (r288614) @@ -5834,6 +5834,8 @@ OLD_LIBS+=usr/lib/libtermcap.so.2 OLD_LIBS+=usr/lib/libutil.so.2 OLD_LIBS+=usr/lib/libvgl.so.1 OLD_LIBS+=usr/lib/libwrap.so.2 +# 19991216 +OLD_FILES+=usr/sbin/xntpdc # 199909XX OLD_LIBS+=usr/lib/libc_r.so.3 # ??? Modified: stable/9/usr.sbin/ntp/ntpdc/Makefile ============================================================================== --- stable/9/usr.sbin/ntp/ntpdc/Makefile Sat Oct 3 16:26:13 2015 (r288613) +++ stable/9/usr.sbin/ntp/ntpdc/Makefile Sat Oct 3 16:26:46 2015 (r288614) @@ -25,7 +25,4 @@ CLEANFILES+= .version version.c version.c: sh -e ${.CURDIR}/../scripts/mkver ntpdc -afterinstall: - rm -f ${DESTDIR}/usr/sbin/xntpdc - .include From owner-svn-src-all@freebsd.org Sat Oct 3 16:34:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21FEAA0EC2F; Sat, 3 Oct 2015 16:34:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1244C1C1B; Sat, 3 Oct 2015 16:34:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GYM1F094999; Sat, 3 Oct 2015 16:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GYMG2094996; Sat, 3 Oct 2015 16:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031634.t93GYMG2094996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288615 - in head/lib: libusb libz 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:34:23 -0000 Author: bdrewery Date: Sat Oct 3 16:34:21 2015 New Revision: 288615 URL: https://svnweb.freebsd.org/changeset/base/288615 Log: Remove redundant COMPAT_32BIT guard on pkgconfig files. This is already handled by the LIBRARIES_ONLY mechanism protecting FILES. Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libusb/Makefile head/lib/libz/Makefile Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Sat Oct 3 16:26:46 2015 (r288614) +++ head/lib/libusb/Makefile Sat Oct 3 16:34:21 2015 (r288615) @@ -35,10 +35,10 @@ SRCS+= libusb10_io.c .if defined(COMPAT_32BIT) CFLAGS+= -DCOMPAT_32BIT -.else +.endif + FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc FILESDIR= ${LIBDATADIR}/pkgconfig -.endif # # Cross platform support Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Sat Oct 3 16:26:46 2015 (r288614) +++ head/lib/libz/Makefile Sat Oct 3 16:34:21 2015 (r288615) @@ -68,10 +68,8 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) -.ifndef COMPAT_32BIT FILES= zlib.pc FILESDIR= ${LIBDATADIR}/pkgconfig -.endif .include From owner-svn-src-all@freebsd.org Sat Oct 3 16:37:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B29CA0EDD7; Sat, 3 Oct 2015 16:37:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71A9D1DB2; Sat, 3 Oct 2015 16:37:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GbdYm095271; Sat, 3 Oct 2015 16:37:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GbdZn095270; Sat, 3 Oct 2015 16:37:39 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031637.t93GbdZn095270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 16:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288616 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 16:37:39 -0000 Author: adrian Date: Sat Oct 3 16:37:38 2015 New Revision: 288616 URL: https://svnweb.freebsd.org/changeset/base/288616 Log: rum(4): move some code from rum_init() into separate function. Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3623 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:34:21 2015 (r288615) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:37:38 2015 (r288616) @@ -215,6 +215,7 @@ static void rum_update_promisc(struct i static void rum_setpromisc(struct rum_softc *); static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); +static int rum_bbp_wakeup(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); @@ -2010,6 +2011,27 @@ rum_read_eeprom(struct rum_softc *sc) } static int +rum_bbp_wakeup(struct rum_softc *sc) +{ + unsigned int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (rum_read(sc, RT2573_MAC_CSR12) & 8) + break; + rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */ + if (rum_pause(sc, hz / 100)) + break; + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "timeout waiting for BBP/RF to wakeup\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int rum_bbp_init(struct rum_softc *sc) { int i, ntries; @@ -2047,7 +2069,7 @@ rum_init(struct rum_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); uint32_t tmp; - int i, ntries, ret; + int i, ret; RUM_LOCK(sc); if (sc->sc_running) { @@ -2064,19 +2086,8 @@ rum_init(struct rum_softc *sc) rum_write(sc, RT2573_MAC_CSR1, 0); /* wait for BBP/RF to wakeup */ - for (ntries = 0; ntries < 100; ntries++) { - if (rum_read(sc, RT2573_MAC_CSR12) & 8) - break; - rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */ - if (rum_pause(sc, hz / 100)) - break; - } - if (ntries == 100) { - device_printf(sc->sc_dev, - "timeout waiting for BBP/RF to wakeup\n"); - ret = ETIMEDOUT; + if ((ret = rum_bbp_wakeup(sc)) != 0) goto end; - } if ((ret = rum_bbp_init(sc)) != 0) goto end; From owner-svn-src-all@freebsd.org Sat Oct 3 17:04:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E1B8A0E057; Sat, 3 Oct 2015 17:04:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C3C41B30; Sat, 3 Oct 2015 17:04:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93H4rar007412; Sat, 3 Oct 2015 17:04:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93H4rho007411; Sat, 3 Oct 2015 17:04:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201510031704.t93H4rho007411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 3 Oct 2015 17:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288617 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:04:53 -0000 Author: alc Date: Sat Oct 3 17:04:52 2015 New Revision: 288617 URL: https://svnweb.freebsd.org/changeset/base/288617 Log: Perform a single batched update to the object's paging-in-progress count rather than updating it for each page. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat Oct 3 16:37:38 2015 (r288616) +++ head/sys/kern/vfs_bio.c Sat Oct 3 17:04:52 2015 (r288617) @@ -2050,11 +2050,10 @@ vfs_vmio_iodone(struct buf *bp) (intmax_t)foff, (uintmax_t)m->pindex)); vm_page_sunbusy(m); - vm_object_pip_subtract(obj, 1); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeupn(obj, bp->b_npages); VM_OBJECT_WUNLOCK(obj); if (bogus && buf_mapped(bp)) { BUF_CHECK_MAPPED(bp); @@ -3923,10 +3922,9 @@ vfs_unbusy_pages(struct buf *bp) } else BUF_CHECK_UNMAPPED(bp); } - vm_object_pip_subtract(obj, 1); vm_page_sunbusy(m); } - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeupn(obj, bp->b_npages); VM_OBJECT_WUNLOCK(obj); } From owner-svn-src-all@freebsd.org Sat Oct 3 17:11:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 723BFA0F108; Sat, 3 Oct 2015 17:11:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 570B21542; Sat, 3 Oct 2015 17:11:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HBMbS014979; Sat, 3 Oct 2015 17:11:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HBMKN014978; Sat, 3 Oct 2015 17:11:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031711.t93HBMKN014978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288618 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:11:22 -0000 Author: adrian Date: Sat Oct 3 17:11:21 2015 New Revision: 288618 URL: https://svnweb.freebsd.org/changeset/base/288618 Log: rum(4): add error handling for rum_enable_tsf_sync() and rum_prepare_beacon() Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Note: haven't tested AP mode yet; will do once the rest of the AP mode / power save commits are in. Submitted by: Differential Revision: https://reviews.freebsd.org/D3624 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:04:52 2015 (r288617) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:11:21 2015 (r288618) @@ -203,7 +203,7 @@ static void rum_select_band(struct rum_ struct ieee80211_channel *); static void rum_set_chan(struct rum_softc *, struct ieee80211_channel *); -static void rum_enable_tsf_sync(struct rum_softc *); +static int rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); @@ -221,7 +221,7 @@ static int rum_init(struct rum_softc *) static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); -static void rum_prepare_beacon(struct rum_softc *, +static int rum_prepare_beacon(struct rum_softc *, struct ieee80211vap *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -755,6 +755,7 @@ rum_newstate(struct ieee80211vap *vap, e const struct ieee80211_txparam *tp; enum ieee80211_state ostate; struct ieee80211_node *ni; + int ret; ostate = vap->iv_state; DPRINTF("%s -> %s\n", @@ -777,10 +778,8 @@ rum_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode != IEEE80211_M_MONITOR) { if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { - RUM_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + ret = EINVAL; + goto run_fail; } rum_update_slot(sc); rum_enable_mrr(sc); @@ -791,12 +790,15 @@ rum_newstate(struct ieee80211vap *vap, e } if (vap->iv_opmode == IEEE80211_M_HOSTAP || - vap->iv_opmode == IEEE80211_M_IBSS) - rum_prepare_beacon(sc, vap); + vap->iv_opmode == IEEE80211_M_IBSS) { + if ((ret = rum_prepare_beacon(sc, vap)) != 0) + goto run_fail; + } - if (vap->iv_opmode != IEEE80211_M_MONITOR) - rum_enable_tsf_sync(sc); - else + if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if ((ret = rum_enable_tsf_sync(sc)) != 0) + goto run_fail; + } else rum_enable_tsf(sc); /* enable automatic rate adaptation */ @@ -811,6 +813,12 @@ rum_newstate(struct ieee80211vap *vap, e RUM_UNLOCK(sc); IEEE80211_LOCK(ic); return (rvp->newstate(vap, nstate, arg)); + +run_fail: + RUM_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return ret; } static void @@ -1773,7 +1781,7 @@ rum_set_chan(struct rum_softc *sc, struc * Enable TSF synchronization and tell h/w to start sending beacons for IBSS * and HostAP operating modes. */ -static void +static int rum_enable_tsf_sync(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -1785,7 +1793,8 @@ rum_enable_tsf_sync(struct rum_softc *sc * Change default 16ms TBTT adjustment to 8ms. * Must be done before enabling beacon generation. */ - rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8); + if (rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8) != 0) + return EIO; } tmp = rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000; @@ -1819,10 +1828,13 @@ rum_enable_tsf_sync(struct rum_softc *sc device_printf(sc->sc_dev, "Enabling TSF failed. undefined opmode %d\n", vap->iv_opmode); - return; + return EINVAL; } - rum_write(sc, RT2573_TXRX_CSR9, tmp); + if (rum_write(sc, RT2573_TXRX_CSR9, tmp) != 0) + return EIO; + + return 0; } static void @@ -2200,35 +2212,43 @@ rum_load_microcode(struct rum_softc *sc, rum_pause(sc, hz / 8); } -static void +static int rum_prepare_beacon(struct rum_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; const struct ieee80211_txparam *tp; struct rum_tx_desc desc; struct mbuf *m0; + int ret = 0; if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) - return; + return EINVAL; if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) - return; + return EINVAL; m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); if (m0 == NULL) - return; + return ENOMEM; tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, m0->m_pkthdr.len, tp->mgmtrate); /* copy the first 24 bytes of Tx descriptor into NIC memory */ - rum_write_multi(sc, RT2573_HW_BEACON_BASE0, (uint8_t *)&desc, 24); + if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0, + (uint8_t *)&desc, 24)) != 0) { + ret = EIO; + goto end; + } /* copy beacon header and payload into NIC memory */ - rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), - m0->m_pkthdr.len); + if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), + m0->m_pkthdr.len)) != 0) + ret = EIO; +end: m_freem(m0); + return ret; } static int From owner-svn-src-all@freebsd.org Sat Oct 3 17:18:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA62DA0F855; Sat, 3 Oct 2015 17:18:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ADBD1BA1; Sat, 3 Oct 2015 17:18:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HIaK0019627; Sat, 3 Oct 2015 17:18:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HIa5w019625; Sat, 3 Oct 2015 17:18:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031718.t93HIa5w019625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288619 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:18:36 -0000 Author: adrian Date: Sat Oct 3 17:18:35 2015 New Revision: 288619 URL: https://svnweb.freebsd.org/changeset/base/288619 Log: rum(4): do not corrupt MAC address Don't override the NIC MAC address with an overridden MAC address for a VAP. Submitted by: Differential Revision: https://reviews.freebsd.org/D3625 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:11:21 2015 (r288618) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:18:35 2015 (r288619) @@ -785,8 +785,8 @@ rum_newstate(struct ieee80211vap *vap, e rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); - IEEE80211_ADDR_COPY(ic->ic_macaddr, ni->ni_bssid); - rum_set_bssid(sc, ic->ic_macaddr); + IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); + rum_set_bssid(sc, sc->sc_bssid); } if (vap->iv_opmode == IEEE80211_M_HOSTAP || @@ -2368,7 +2368,7 @@ rum_scan_end(struct ieee80211com *ic) RUM_LOCK(sc); rum_enable_tsf_sync(sc); - rum_set_bssid(sc, ic->ic_macaddr); + rum_set_bssid(sc, sc->sc_bssid); RUM_UNLOCK(sc); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:11:21 2015 (r288618) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:18:35 2015 (r288619) @@ -137,6 +137,8 @@ struct rum_softc { u_int sc_detached:1, sc_running:1; + uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + struct { uint8_t val; uint8_t reg; From owner-svn-src-all@freebsd.org Sat Oct 3 17:28:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D9C0A0FE92; Sat, 3 Oct 2015 17:28:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E48D10C6; Sat, 3 Oct 2015 17:28:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HSlgY023676; Sat, 3 Oct 2015 17:28:47 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HSlZ8023675; Sat, 3 Oct 2015 17:28:47 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031728.t93HSlZ8023675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 17:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288620 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:28:47 -0000 Author: bdrewery Date: Sat Oct 3 17:28:46 2015 New Revision: 288620 URL: https://svnweb.freebsd.org/changeset/base/288620 Log: Mute this cookie as well Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sat Oct 3 17:18:35 2015 (r288619) +++ head/include/Makefile Sat Oct 3 17:28:46 2015 (r288620) @@ -372,7 +372,7 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/rpc; \ done .if ${MK_META_MODE} == "yes" - touch ${.OBJDIR}/${.TARGET} + @touch ${.OBJDIR}/${.TARGET} .endif .if ${MACHINE} == "host" From owner-svn-src-all@freebsd.org Sat Oct 3 17:30:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66710A0FFD5; Sat, 3 Oct 2015 17:30:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D33912EC; Sat, 3 Oct 2015 17:30:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HUwwX026916; Sat, 3 Oct 2015 17:30:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HUvo4026914; Sat, 3 Oct 2015 17:30:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031730.t93HUvo4026914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288621 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:30:58 -0000 Author: adrian Date: Sat Oct 3 17:30:57 2015 New Revision: 288621 URL: https://svnweb.freebsd.org/changeset/base/288621 Log: rum(4): simplify rum_set_bssid(), rum_set_macaddr() and rum_update_promisc() Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3626 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:28:46 2015 (r288620) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:30:57 2015 (r288621) @@ -1872,25 +1872,21 @@ rum_update_slot(struct rum_softc *sc) static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { - uint32_t tmp; - - tmp = bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24; - rum_write(sc, RT2573_MAC_CSR4, tmp); - tmp = bssid[4] | bssid[5] << 8 | RT2573_ONE_BSSID << 16; - rum_write(sc, RT2573_MAC_CSR5, tmp); + rum_write(sc, RT2573_MAC_CSR4, + bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24); + rum_write(sc, RT2573_MAC_CSR5, + bssid[4] | bssid[5] << 8 | RT2573_NUM_BSSID_MSK(1)); } static void rum_set_macaddr(struct rum_softc *sc, const uint8_t *addr) { - uint32_t tmp; - - tmp = addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24; - rum_write(sc, RT2573_MAC_CSR2, tmp); - tmp = addr[4] | addr[5] << 8 | 0xff << 16; - rum_write(sc, RT2573_MAC_CSR3, tmp); + rum_write(sc, RT2573_MAC_CSR2, + addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24); + rum_write(sc, RT2573_MAC_CSR3, + addr[4] | addr[5] << 8 | 0xff << 16); } static void @@ -1913,11 +1909,8 @@ rum_update_promisc(struct ieee80211com * struct rum_softc *sc = ic->ic_softc; RUM_LOCK(sc); - if (!sc->sc_running) { - RUM_UNLOCK(sc); - return; - } - rum_setpromisc(sc); + if (sc->sc_running) + rum_setpromisc(sc); RUM_UNLOCK(sc); } Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:28:46 2015 (r288620) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:30:57 2015 (r288621) @@ -101,7 +101,7 @@ #define RT2573_HOST_READY (1 << 2) /* possible flags for register MAC_CSR5 */ -#define RT2573_ONE_BSSID 3 +#define RT2573_NUM_BSSID_MSK(n) (((n * 3) & 3) << 16) /* possible flags for register TXRX_CSR0 */ /* Tx filter flags are in the low 16 bits */ From owner-svn-src-all@freebsd.org Sat Oct 3 17:34:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7D83A0E283; Sat, 3 Oct 2015 17:34:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B85E01796; Sat, 3 Oct 2015 17:34:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HYCB1027613; Sat, 3 Oct 2015 17:34:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HYCQa027612; Sat, 3 Oct 2015 17:34:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031734.t93HYCQa027612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288622 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:34:12 -0000 Author: adrian Date: Sat Oct 3 17:34:11 2015 New Revision: 288622 URL: https://svnweb.freebsd.org/changeset/base/288622 Log: rum(4): add support for AHDEMO mode. Submitted by: Differential Revision: https://reviews.freebsd.org/D3627 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:30:57 2015 (r288621) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:34:11 2015 (r288622) @@ -489,6 +489,7 @@ rum_attach(device_t self) | IEEE80211_C_IBSS /* IBSS mode supported */ | IEEE80211_C_MONITOR /* monitor mode supported */ | IEEE80211_C_HOSTAP /* HostAp mode supported */ + | IEEE80211_C_AHDEMO /* adhoc demo mode */ | IEEE80211_C_TXPMGT /* tx power management */ | IEEE80211_C_SHPREAMBLE /* short preamble supported */ | IEEE80211_C_SHSLOT /* short slot time supported */ @@ -795,7 +796,8 @@ rum_newstate(struct ieee80211vap *vap, e goto run_fail; } - if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (vap->iv_opmode != IEEE80211_M_MONITOR && + vap->iv_opmode != IEEE80211_M_AHDEMO) { if ((ret = rum_enable_tsf_sync(sc)) != 0) goto run_fail; } else @@ -2360,7 +2362,10 @@ rum_scan_end(struct ieee80211com *ic) struct rum_softc *sc = ic->ic_softc; RUM_LOCK(sc); - rum_enable_tsf_sync(sc); + if (ic->ic_opmode != IEEE80211_M_AHDEMO) + rum_enable_tsf_sync(sc); + else + rum_enable_tsf(sc); rum_set_bssid(sc, sc->sc_bssid); RUM_UNLOCK(sc); From owner-svn-src-all@freebsd.org Sat Oct 3 17:49:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DC30A0ECA3; Sat, 3 Oct 2015 17:49:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5EC91D12; Sat, 3 Oct 2015 17:49:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HnCj3031882; Sat, 3 Oct 2015 17:49:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HnCqH031879; Sat, 3 Oct 2015 17:49:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031749.t93HnCqH031879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288623 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 17:49:13 -0000 Author: adrian Date: Sat Oct 3 17:49:11 2015 New Revision: 288623 URL: https://svnweb.freebsd.org/changeset/base/288623 Log: rum(4): split rum_prepare_beacon() into 'alloc' and 'set' stages Note: I manually had to merge this; I merged in the "put beacon_offsets into vap" commit before this. Submitted by: Differential Revision: https://reviews.freebsd.org/D3628 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:49:11 2015 (r288623) @@ -221,7 +221,9 @@ static int rum_init(struct rum_softc *) static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); -static int rum_prepare_beacon(struct rum_softc *, +static int rum_set_beacon(struct rum_softc *, + struct ieee80211vap *); +static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -630,6 +632,7 @@ rum_vap_delete(struct ieee80211vap *vap) struct rum_vap *rvp = RUM_VAP(vap); struct ieee80211com *ic = vap->iv_ic; + m_freem(rvp->bcn_mbuf); usb_callout_drain(&rvp->ratectl_ch); ieee80211_draintask(ic, &rvp->ratectl_task); ieee80211_ratectl_deinit(vap); @@ -792,7 +795,7 @@ rum_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { - if ((ret = rum_prepare_beacon(sc, vap)) != 0) + if ((ret = rum_alloc_beacon(sc, vap)) != 0) goto run_fail; } @@ -2208,42 +2211,58 @@ rum_load_microcode(struct rum_softc *sc, } static int -rum_prepare_beacon(struct rum_softc *sc, struct ieee80211vap *vap) +rum_set_beacon(struct rum_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; + struct rum_vap *rvp = RUM_VAP(vap); + struct mbuf *m = rvp->bcn_mbuf; const struct ieee80211_txparam *tp; struct rum_tx_desc desc; - struct mbuf *m0; - int ret = 0; - if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) + RUM_LOCK_ASSERT(sc); + + if (m == NULL) return EINVAL; if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) return EINVAL; - m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); - if (m0 == NULL) - return ENOMEM; - tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, - m0->m_pkthdr.len, tp->mgmtrate); + m->m_pkthdr.len, tp->mgmtrate); - /* copy the first 24 bytes of Tx descriptor into NIC memory */ - if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0, - (uint8_t *)&desc, 24)) != 0) { - ret = EIO; - goto end; - } + /* copy the Tx descriptor into NIC memory */ + if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, + RT2573_TX_DESC_SIZE) != 0) + return EIO; /* copy beacon header and payload into NIC memory */ - if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), - m0->m_pkthdr.len)) != 0) - ret = EIO; + if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0) + RT2573_TX_DESC_SIZE, + mtod(m, uint8_t *), m->m_pkthdr.len) != 0) + return EIO; -end: - m_freem(m0); - return ret; + return 0; +} + +static int +rum_alloc_beacon(struct rum_softc *sc, struct ieee80211vap *vap) +{ + struct rum_vap *rvp = RUM_VAP(vap); + struct ieee80211_node *ni = vap->iv_bss; + struct mbuf *m; + + if (ni->ni_chan == IEEE80211_CHAN_ANYC) + return EINVAL; + + m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + if (m == NULL) + return ENOMEM; + + if (rvp->bcn_mbuf != NULL) + m_freem(rvp->bcn_mbuf); + + rvp->bcn_mbuf = m; + + return (rum_set_beacon(sc, vap)); } static int Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:49:11 2015 (r288623) @@ -40,7 +40,7 @@ #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 #define RT2573_MCU_CODE_BASE 0x0800 -#define RT2573_HW_BEACON_BASE0 0x2400 +#define RT2573_HW_BCN_BASE(id) (0x2400 + (id) * 0x100) #define RT2573_MAC_CSR0 0x3000 #define RT2573_MAC_CSR1 0x3004 #define RT2573_MAC_CSR2 0x3008 Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:49:11 2015 (r288623) @@ -92,6 +92,7 @@ struct rum_cmdq { struct rum_vap { struct ieee80211vap vap; + struct mbuf *bcn_mbuf; struct usb_callout ratectl_ch; struct task ratectl_task; From owner-svn-src-all@freebsd.org Sat Oct 3 18:40:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DF8AA0E8F8; Sat, 3 Oct 2015 18:40:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34FC1186D; Sat, 3 Oct 2015 18:40:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93IeSiK053273; Sat, 3 Oct 2015 18:40:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93IeSME053272; Sat, 3 Oct 2015 18:40:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031840.t93IeSME053272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 18:40:28 +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: r288624 - stable/10/lib/ncurses/ncurses 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 18:40:28 -0000 Author: bdrewery Date: Sat Oct 3 18:40:27 2015 New Revision: 288624 URL: https://svnweb.freebsd.org/changeset/base/288624 Log: Partially revert r288607, stable/10 does not use ncurses_dll.h.in like head does, so this file should not be in CLEANFILES / .NOPATH. Modified: stable/10/lib/ncurses/ncurses/Makefile Modified: stable/10/lib/ncurses/ncurses/Makefile ============================================================================== --- stable/10/lib/ncurses/ncurses/Makefile Sat Oct 3 17:49:11 2015 (r288623) +++ stable/10/lib/ncurses/ncurses/Makefile Sat Oct 3 18:40:27 2015 (r288624) @@ -282,7 +282,6 @@ CFLAGS+= -DFREEBSD_NATIVE -DTERMIOS # Installed HEADERS= curses.h term.h termcap.h unctrl.h SRCHDRS= ncurses_dll.h -CLEANFILES+= ncurses_dll.h .if defined(ENABLE_WIDEC) INCS= ${HEADERS} ${SRCHDRS} From owner-svn-src-all@freebsd.org Sat Oct 3 18:57:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24C62A0F335; Sat, 3 Oct 2015 18:57:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15E2F1E8B; Sat, 3 Oct 2015 18:57:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93IvGrE061262; Sat, 3 Oct 2015 18:57:16 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93IvGQB061260; Sat, 3 Oct 2015 18:57:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031857.t93IvGQB061260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 18:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288625 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 18:57:17 -0000 Author: bdrewery Date: Sat Oct 3 18:57:15 2015 New Revision: 288625 URL: https://svnweb.freebsd.org/changeset/base/288625 Log: Add decoding for struct statfs. Reviewed by: jhb (briefly) Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Sat Oct 3 18:40:27 2015 (r288624) +++ head/usr.bin/truss/syscall.h Sat Oct 3 18:57:15 2015 (r288625) @@ -10,6 +10,7 @@ * BinString -- pointer to an array of chars, printed via strvisx(). * Ptr -- pointer to some unspecified structure. Just print as hex for now. * Stat -- a pointer to a stat buffer. Prints a couple fields. + * StatFs -- a pointer to a statfs buffer. Prints a few fields. * Ioctl -- an ioctl command. Woefully limited. * Quad -- a double-word value. e.g., lseek(int, offset_t, int) * Signal -- a signal number. Prints the signal name (SIGxxx) @@ -38,7 +39,7 @@ enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres, - Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open, + Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open, Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Oct 3 18:40:27 2015 (r288624) +++ head/usr.bin/truss/syscalls.c Sat Oct 3 18:57:15 2015 (r288625) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -182,6 +183,10 @@ static struct syscall syscalls[] = { { Atflags, 3 } } }, { .name = "stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, + { .name = "statfs", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { StatFs | OUT, 1 } } }, + { .name = "fstatfs", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { StatFs | OUT, 1 } } }, { .name = "lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "linux_newstat", .ret_type = 1, .nargs = 2, @@ -1444,6 +1449,29 @@ print_arg(struct syscall_args *sc, unsig } break; } + case StatFs: { + unsigned int i; + struct statfs buf; + if (get_struct(pid, (void *)args[sc->offset], &buf, + sizeof(buf)) != -1) { + char fsid[17]; + + bzero(fsid, sizeof(fsid)); + if (buf.f_fsid.val[0] != 0 || buf.f_fsid.val[1] != 0) { + for (i = 0; i < sizeof(buf.f_fsid); i++) + snprintf(&fsid[i*2], + sizeof(fsid) - (i*2), "%02x", + ((u_char *)&buf.f_fsid)[i]); + } + fprintf(fp, + "{ fstypename=%s,mntonname=%s,mntfromname=%s," + "fsid=%s }", buf.f_fstypename, buf.f_mntonname, + buf.f_mntfromname, fsid); + } else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + case Rusage: { struct rusage ru; From owner-svn-src-all@freebsd.org Sat Oct 3 19:08:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AD4CA0FA6B; Sat, 3 Oct 2015 19:08:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CB081367; Sat, 3 Oct 2015 19:08:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93J8bqR065396; Sat, 3 Oct 2015 19:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93J8bbS065395; Sat, 3 Oct 2015 19:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031908.t93J8bbS065395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 19:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288626 - head/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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 19:08:37 -0000 Author: bdrewery Date: Sat Oct 3 19:08:36 2015 New Revision: 288626 URL: https://svnweb.freebsd.org/changeset/base/288626 Log: Style fix. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Oct 3 18:57:15 2015 (r288625) +++ head/usr.bin/truss/syscalls.c Sat Oct 3 19:08:36 2015 (r288626) @@ -1452,6 +1452,7 @@ print_arg(struct syscall_args *sc, unsig case StatFs: { unsigned int i; struct statfs buf; + if (get_struct(pid, (void *)args[sc->offset], &buf, sizeof(buf)) != -1) { char fsid[17]; From owner-svn-src-all@freebsd.org Sat Oct 3 19:27:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 169FDA0E753; Sat, 3 Oct 2015 19:27:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0496A1EDB; Sat, 3 Oct 2015 19:27:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93JRrUM073445; Sat, 3 Oct 2015 19:27:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93JRrvt073442; Sat, 3 Oct 2015 19:27:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201510031927.t93JRrvt073442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 3 Oct 2015 19:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288627 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 19:27:54 -0000 Author: alc Date: Sat Oct 3 19:27:52 2015 New Revision: 288627 URL: https://svnweb.freebsd.org/changeset/base/288627 Log: Reduce the scope of a variable to the only file where it is used. Modified: head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pageout.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_page.c Sat Oct 3 19:27:52 2015 (r288627) @@ -149,6 +149,8 @@ static int sysctl_vm_page_blacklist(SYSC SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist pages"); +/* Is the page daemon waiting for free pages? */ +static int vm_pageout_pages_needed; static uma_zone_t fakepg_zone; Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_pageout.c Sat Oct 3 19:27:52 2015 (r288627) @@ -157,7 +157,6 @@ SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ int vm_pages_needed; /* Event on which pageout daemon sleeps */ int vm_pageout_deficit; /* Estimated number of pages deficit */ -int vm_pageout_pages_needed; /* flag saying that the pageout daemon needs pages */ int vm_pageout_wakeup_thresh; #if !defined(NO_SWAPPING) Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_pageout.h Sat Oct 3 19:27:52 2015 (r288627) @@ -73,7 +73,6 @@ extern int vm_page_max_wired; extern int vm_pages_needed; /* should be some "event" structure */ -extern int vm_pageout_pages_needed; extern int vm_pageout_deficit; extern int vm_pageout_page_count; From owner-svn-src-all@freebsd.org Sat Oct 3 19:37:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4CC6A0EE18; Sat, 3 Oct 2015 19:37:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96F9913E4; Sat, 3 Oct 2015 19:37:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93JbgkW077519; Sat, 3 Oct 2015 19:37:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Jbgkk077518; Sat, 3 Oct 2015 19:37:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510031937.t93Jbgkk077518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 3 Oct 2015 19:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288628 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 19:37:42 -0000 Author: markj Date: Sat Oct 3 19:37:41 2015 New Revision: 288628 URL: https://svnweb.freebsd.org/changeset/base/288628 Log: The return value of posix_fadvise(2) is just an error status, so sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() rather than setting a return value. MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) @@ -4663,7 +4663,6 @@ int sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) { - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, - uap->len, uap->advice); - return (0); + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice)); } From owner-svn-src-all@freebsd.org Sat Oct 3 20:06:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCEFFA0E48F; Sat, 3 Oct 2015 20:06:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF13B12C3; Sat, 3 Oct 2015 20:06:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93K6p4S089718; Sat, 3 Oct 2015 20:06:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93K6pG2089717; Sat, 3 Oct 2015 20:06:51 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510032006.t93K6pG2089717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 20:06:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288629 - head/lib/libohash 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:06:51 -0000 Author: bdrewery Date: Sat Oct 3 20:06:50 2015 New Revision: 288629 URL: https://svnweb.freebsd.org/changeset/base/288629 Log: Include stddef.h for ptrdiff_t Modified: head/lib/libohash/ohash.h Modified: head/lib/libohash/ohash.h ============================================================================== --- head/lib/libohash/ohash.h Sat Oct 3 19:37:41 2015 (r288628) +++ head/lib/libohash/ohash.h Sat Oct 3 20:06:50 2015 (r288629) @@ -20,6 +20,8 @@ #ifndef OHASH_H #define OHASH_H +#include + /* Open hashing support. * Open hashing was chosen because it is much lighter than other hash * techniques, and more efficient in most cases. From owner-svn-src-all@freebsd.org Sat Oct 3 20:24:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1627AA0F092; Sat, 3 Oct 2015 20:24:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2CB51C07; Sat, 3 Oct 2015 20:24:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KON1M097770; Sat, 3 Oct 2015 20:24:23 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KONg5097769; Sat, 3 Oct 2015 20:24:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510032024.t93KONg5097769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 20:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288630 - head/bin/cat 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:24:24 -0000 Author: bdrewery Date: Sat Oct 3 20:24:23 2015 New Revision: 288630 URL: https://svnweb.freebsd.org/changeset/base/288630 Log: Make GCC happy Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Sat Oct 3 20:06:50 2015 (r288629) +++ head/bin/cat/cat.c Sat Oct 3 20:24:23 2015 (r288630) @@ -168,6 +168,7 @@ scanfiles(char *argv[], int cooked) FILE *fp; i = 0; + fd = -1; while ((path = argv[i]) != NULL || i == 0) { if (path == NULL || strcmp(path, "-") == 0) { filename = "stdin"; From owner-svn-src-all@freebsd.org Sat Oct 3 20:44:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76E9AA0E060; Sat, 3 Oct 2015 20:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DE5A1639; Sat, 3 Oct 2015 20:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KiHgr005975; Sat, 3 Oct 2015 20:44:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KiHHX005974; Sat, 3 Oct 2015 20:44:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032044.t93KiHHX005974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288631 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:44:17 -0000 Author: adrian Date: Sat Oct 3 20:44:16 2015 New Revision: 288631 URL: https://svnweb.freebsd.org/changeset/base/288631 Log: rum(4): attach rum_update_slot to ic_updateslot. Submitted by: Differential Revision: https://reviews.freebsd.org/D3631 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:24:23 2015 (r288630) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:44:16 2015 (r288631) @@ -207,7 +207,9 @@ static int rum_enable_tsf_sync(struct r static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); -static void rum_update_slot(struct rum_softc *); +static void rum_update_slot_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_update_slot(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); static void rum_update_mcast(struct ieee80211com *); @@ -516,6 +518,7 @@ rum_attach(device_t self) ic->ic_parent = rum_parent; ic->ic_vap_create = rum_vap_create; ic->ic_vap_delete = rum_vap_delete; + ic->ic_updateslot = rum_update_slot; ic->ic_update_mcast = rum_update_mcast; ieee80211_radiotap_attach(ic, @@ -785,7 +788,7 @@ rum_newstate(struct ieee80211vap *vap, e ret = EINVAL; goto run_fail; } - rum_update_slot(sc); + rum_update_slot_cb(sc, NULL, 0, 0); rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); @@ -1862,7 +1865,8 @@ rum_get_tsf(struct rum_softc *sc, uint64 } static void -rum_update_slot(struct rum_softc *sc) +rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rv_id, + uint8_t rvp_id) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; @@ -1875,6 +1879,12 @@ rum_update_slot(struct rum_softc *sc) } static void +rum_update_slot(struct ieee80211com *ic) +{ + rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, 0, rum_update_slot_cb); +} + +static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { From owner-svn-src-all@freebsd.org Sat Oct 3 20:45:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D029A0E1F3; Sat, 3 Oct 2015 20:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 553E3190E; Sat, 3 Oct 2015 20:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Kji7b006080; Sat, 3 Oct 2015 20:45:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Kji63006079; Sat, 3 Oct 2015 20:45:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032045.t93Kji63006079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288632 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:45:44 -0000 Author: adrian Date: Sat Oct 3 20:45:43 2015 New Revision: 288632 URL: https://svnweb.freebsd.org/changeset/base/288632 Log: rum(4): implement iv_update_beacon call (fixes client power save support). Submitted by: Differential Revision: https://reviews.freebsd.org/D3632 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:44:16 2015 (r288631) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:45:43 2015 (r288632) @@ -227,6 +227,9 @@ static int rum_set_beacon(struct rum_so struct ieee80211vap *); static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); +static void rum_update_beacon_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_update_beacon(struct ieee80211vap *, int); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static void rum_scan_start(struct ieee80211com *); @@ -617,6 +620,7 @@ rum_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = rum_newstate; + vap->iv_update_beacon = rum_update_beacon; usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); @@ -2275,6 +2279,56 @@ rum_alloc_beacon(struct rum_softc *sc, s return (rum_set_beacon(sc, vap)); } +static void +rum_update_beacon_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211vap *vap = data->vap; + + rum_set_beacon(sc, vap); +} + +static void +rum_update_beacon(struct ieee80211vap *vap, int item) +{ + struct ieee80211com *ic = vap->iv_ic; + struct rum_softc *sc = ic->ic_softc; + struct rum_vap *rvp = RUM_VAP(vap); + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; + struct ieee80211_node *ni = vap->iv_bss; + struct mbuf *m = rvp->bcn_mbuf; + int mcast = 0; + + RUM_LOCK(sc); + if (m == NULL) { + m = ieee80211_beacon_alloc(ni, bo); + if (m == NULL) { + device_printf(sc->sc_dev, + "%s: could not allocate beacon frame\n", __func__); + RUM_UNLOCK(sc); + return; + } + rvp->bcn_mbuf = m; + } + + switch (item) { + case IEEE80211_BEACON_ERP: + rum_update_slot(ic); + break; + case IEEE80211_BEACON_TIM: + mcast = 1; /*TODO*/ + break; + default: + break; + } + RUM_UNLOCK(sc); + + setbit(bo->bo_flags, item); + ieee80211_beacon_update(ni, bo, m, mcast); + + rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, 0, rum_update_beacon_cb); +} + static int rum_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) From owner-svn-src-all@freebsd.org Sat Oct 3 20:49:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77887A0E46E; Sat, 3 Oct 2015 20:49:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68B571BD1; Sat, 3 Oct 2015 20:49:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Kn9PT006363; Sat, 3 Oct 2015 20:49:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Kn8cB006360; Sat, 3 Oct 2015 20:49:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032049.t93Kn8cB006360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288633 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:49:09 -0000 Author: adrian Date: Sat Oct 3 20:49:08 2015 New Revision: 288633 URL: https://svnweb.freebsd.org/changeset/base/288633 Log: rum(4): add support for hardware encryption (WEP, TKIP and CCMP). This diff includes: * Transmitter Addresses, Keys and TKIP MIC addition to the Security Key Table. * Proper SEC Control Registers initialization and maintenance. * Additional flags and values in TX descriptor, which are required for encryption support. * Error checking in RX path. Tested: * Tested on WUSB54GC, STA (WEP, TKIP, CCMP), HOSTAP (CCMP) and IBSS (CCMP, WPA-None) modes. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode (CCMP+TKIP) Submitted by: Differential Revision: https://reviews.freebsd.org/D3640 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:49:08 2015 (r288633) @@ -166,9 +166,13 @@ static void rum_setup_tx_list(struct ru static void rum_unsetup_tx_list(struct rum_softc *); static int rum_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static uint8_t rum_crypto_mode(struct rum_softc *, u_int, int); static void rum_setup_tx_desc(struct rum_softc *, - struct rum_tx_desc *, uint32_t, uint16_t, int, - int); + struct rum_tx_desc *, struct ieee80211_key *, + uint32_t, uint8_t, int, int, int); +static uint32_t rum_tx_crypto_flags(struct rum_softc *, + struct ieee80211_node *, + const struct ieee80211_key *); static int rum_tx_mgt(struct rum_softc *, struct mbuf *, struct ieee80211_node *); static int rum_tx_raw(struct rum_softc *, struct mbuf *, @@ -219,6 +223,7 @@ static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); static int rum_bbp_wakeup(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); +static void rum_clr_shkey_regs(struct rum_softc *); static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, @@ -230,6 +235,24 @@ static int rum_alloc_beacon(struct rum_ static void rum_update_beacon_cb(struct rum_softc *, union sec_param *, uint8_t, uint8_t); static void rum_update_beacon(struct ieee80211vap *, int); +static int rum_common_key_set(struct rum_softc *, + struct ieee80211_key *, uint16_t); +static void rum_group_key_set_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_group_key_del_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_pair_key_set_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_pair_key_del_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static int rum_key_alloc(struct ieee80211vap *, + struct ieee80211_key *, ieee80211_keyix *, + ieee80211_keyix *); +static int rum_key_set(struct ieee80211vap *, + const struct ieee80211_key *, + const uint8_t mac[IEEE80211_ADDR_LEN]); +static int rum_key_delete(struct ieee80211vap *, + const struct ieee80211_key *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static void rum_scan_start(struct ieee80211com *); @@ -258,9 +281,9 @@ static const struct { { RT2573_MAC_CSR10, 0x00000718 }, { RT2573_MAC_CSR12, 0x00000004 }, { RT2573_MAC_CSR13, 0x00007f00 }, - { RT2573_SEC_CSR0, 0x00000000 }, - { RT2573_SEC_CSR1, 0x00000000 }, - { RT2573_SEC_CSR5, 0x00000000 }, + { RT2573_SEC_CSR2, 0x00000000 }, + { RT2573_SEC_CSR3, 0x00000000 }, + { RT2573_SEC_CSR4, 0x00000000 }, { RT2573_PHY_CSR1, 0x000023b0 }, { RT2573_PHY_CSR5, 0x00040a06 }, { RT2573_PHY_CSR6, 0x00080606 }, @@ -504,6 +527,12 @@ rum_attach(device_t self) | IEEE80211_C_WPA /* 802.11i */ ; + ic->ic_cryptocaps = + IEEE80211_CRYPTO_WEP | + IEEE80211_CRYPTO_AES_CCM | + IEEE80211_CRYPTO_TKIPMIC | + IEEE80211_CRYPTO_TKIP; + bands = 0; setbit(&bands, IEEE80211_MODE_11B); setbit(&bands, IEEE80211_MODE_11G); @@ -620,7 +649,11 @@ rum_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = rum_newstate; + vap->iv_key_alloc = rum_key_alloc; + vap->iv_key_set = rum_key_set; + vap->iv_key_delete = rum_key_delete; vap->iv_update_beacon = rum_update_beacon; + vap->iv_max_aid = RT2573_ADDR_MAX; usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); @@ -971,6 +1004,21 @@ rum_bulk_read_callback(struct usb_xfer * counter_u64_add(ic->ic_ierrors, 1); goto tr_setup; } + if ((flags & RT2573_RX_DEC_MASK) != RT2573_RX_DEC_OK) { + switch (flags & RT2573_RX_DEC_MASK) { + case RT2573_RX_IV_ERROR: + DPRINTFN(5, "IV/EIV error\n"); + break; + case RT2573_RX_MIC_ERROR: + DPRINTFN(5, "MIC error\n"); + break; + case RT2573_RX_KEY_ERROR: + DPRINTFN(5, "Key error\n"); + break; + } + counter_u64_add(ic->ic_ierrors, 1); + goto tr_setup; + } m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { @@ -983,6 +1031,13 @@ rum_bulk_read_callback(struct usb_xfer * wh = mtod(m, struct ieee80211_frame_min *); + if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) && + (flags & RT2573_RX_CIP_MASK) != + RT2573_RX_CIP_MODE(RT2573_MODE_NOSEC)) { + wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + m->m_flags |= M_WEP; + } + /* finalize mbuf */ m->m_pkthdr.len = m->m_len = (flags >> 16) & 0xfff; @@ -1061,22 +1116,45 @@ rum_plcp_signal(int rate) return 0xff; /* XXX unsupported/unknown rate */ } +/* + * Map net80211 cipher to RT2573 security mode. + */ +static uint8_t +rum_crypto_mode(struct rum_softc *sc, u_int cipher, int keylen) +{ + switch (cipher) { + case IEEE80211_CIPHER_WEP: + return (keylen < 8 ? RT2573_MODE_WEP40 : RT2573_MODE_WEP104); + case IEEE80211_CIPHER_TKIP: + return RT2573_MODE_TKIP; + case IEEE80211_CIPHER_AES_CCM: + return RT2573_MODE_AES_CCMP; + default: + device_printf(sc->sc_dev, "unknown cipher %d\n", cipher); + return 0; + } +} + static void rum_setup_tx_desc(struct rum_softc *sc, struct rum_tx_desc *desc, - uint32_t flags, uint16_t xflags, int len, int rate) + struct ieee80211_key *k, uint32_t flags, uint8_t xflags, int hdrlen, + int len, int rate) { struct ieee80211com *ic = &sc->sc_ic; uint16_t plcp_length; int remainder; - desc->flags = htole32(flags); - desc->flags |= htole32(RT2573_TX_VALID); - desc->flags |= htole32(len << 16); + flags |= RT2573_TX_VALID; + flags |= len << 16; - desc->xflags = htole16(xflags); + if (k != NULL && !(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + const struct ieee80211_cipher *cip = k->wk_cipher; - desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | - RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); + len += cip->ic_header + cip->ic_trailer + cip->ic_miclen; + + desc->eiv = 0; /* for WEP */ + cip->ic_setiv(k, (uint8_t *)&desc->iv); + } /* setup PLCP fields */ desc->plcp_signal = rum_plcp_signal(rate); @@ -1084,7 +1162,7 @@ rum_setup_tx_desc(struct rum_softc *sc, len += IEEE80211_CRC_LEN; if (ieee80211_rate2phytype(ic->ic_rt, rate) == IEEE80211_T_OFDM) { - desc->flags |= htole32(RT2573_TX_OFDM); + flags |= RT2573_TX_OFDM; plcp_length = len & 0xfff; desc->plcp_length_hi = plcp_length >> 6; @@ -1104,6 +1182,13 @@ rum_setup_tx_desc(struct rum_softc *sc, if (rate != 2 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) desc->plcp_signal |= 0x08; } + + desc->flags = htole32(flags); + desc->hdrlen = hdrlen; + desc->xflags = xflags; + + desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | + RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); } static int @@ -1149,7 +1234,8 @@ rum_sendprot(struct rum_softc *sc, data->m = mprot; data->ni = ieee80211_ref_node(ni); data->rate = protrate; - rum_setup_tx_desc(sc, &data->desc, flags, 0, mprot->m_pkthdr.len, protrate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, + mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); usbd_transfer_start(sc->sc_xfer[RUM_BULK_WR]); @@ -1157,6 +1243,40 @@ rum_sendprot(struct rum_softc *sc, return 0; } +static uint32_t +rum_tx_crypto_flags(struct rum_softc *sc, struct ieee80211_node *ni, + const struct ieee80211_key *k) +{ + struct ieee80211vap *vap = ni->ni_vap; + u_int cipher; + uint32_t flags = 0; + uint8_t mode, pos; + + if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + cipher = k->wk_cipher->ic_cipher; + pos = k->wk_keyix; + mode = rum_crypto_mode(sc, cipher, k->wk_keylen); + if (mode == 0) + return 0; + + flags |= RT2573_TX_CIP_MODE(mode); + + /* Do not trust GROUP flag */ + if (!(k >= &vap->iv_nw_keys[0] && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) + flags |= RT2573_TX_KEY_PAIR; + else + pos += 0 * RT2573_SKEY_MAX; /* vap id */ + + flags |= RT2573_TX_KEY_ID(pos); + + if (cipher == IEEE80211_CIPHER_TKIP) + flags |= RT2573_TX_TKIPMIC; + } + + return flags; +} + static int rum_tx_mgt(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) { @@ -1165,9 +1285,10 @@ rum_tx_mgt(struct rum_softc *sc, struct struct rum_tx_data *data; struct ieee80211_frame *wh; const struct ieee80211_txparam *tp; - struct ieee80211_key *k; + struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1176,9 +1297,15 @@ rum_tx_mgt(struct rum_softc *sc, struct sc->tx_nfree--; wh = mtod(m0, struct ieee80211_frame *); + hdrlen = ieee80211_anyhdrsize(wh); + if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { - k = ieee80211_crypto_encap(ni, m0); + k = ieee80211_crypto_get_txkey(ni, m0); if (k == NULL) + return (ENOENT); + + if ((k->wk_flags & IEEE80211_KEY_SWCRYPT) && + !k->wk_cipher->ic_encap(k, m0)) return (ENOBUFS); wh = mtod(m0, struct ieee80211_frame *); @@ -1200,11 +1327,15 @@ rum_tx_mgt(struct rum_softc *sc, struct flags |= RT2573_TX_TIMESTAMP; } + if (k != NULL) + flags |= rum_tx_crypto_flags(sc, ni, k); + data->m = m0; data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, tp->mgmtrate); + rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, tp->mgmtrate); @@ -1253,7 +1384,8 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, rate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, m0->m_pkthdr.len, + rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", m0->m_pkthdr.len, rate); @@ -1272,14 +1404,15 @@ rum_tx_data(struct rum_softc *sc, struct struct rum_tx_data *data; struct ieee80211_frame *wh; const struct ieee80211_txparam *tp; - struct ieee80211_key *k; + struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - int error, rate; + int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); + hdrlen = ieee80211_anyhdrsize(wh); tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) @@ -1290,10 +1423,15 @@ rum_tx_data(struct rum_softc *sc, struct rate = ni->ni_txrate; if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { - k = ieee80211_crypto_encap(ni, m0); + k = ieee80211_crypto_get_txkey(ni, m0); if (k == NULL) { m_freem(m0); - return ENOBUFS; + return (ENOENT); + } + if ((k->wk_flags & IEEE80211_KEY_SWCRYPT) && + !k->wk_cipher->ic_encap(k, m0)) { + m_freem(m0); + return (ENOBUFS); } /* packet header may have moved, reset our local pointer */ @@ -1317,6 +1455,9 @@ rum_tx_data(struct rum_softc *sc, struct } } + if (k != NULL) + flags |= rum_tx_crypto_flags(sc, ni, k); + data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); sc->tx_nfree--; @@ -1334,7 +1475,8 @@ rum_tx_data(struct rum_softc *sc, struct USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, rate); + rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, rate); @@ -2087,6 +2229,14 @@ rum_bbp_init(struct rum_softc *sc) return 0; } +static void +rum_clr_shkey_regs(struct rum_softc *sc) +{ + rum_write(sc, RT2573_SEC_CSR0, 0); + rum_write(sc, RT2573_SEC_CSR1, 0); + rum_write(sc, RT2573_SEC_CSR5, 0); +} + static int rum_init(struct rum_softc *sc) { @@ -2124,6 +2274,12 @@ rum_init(struct rum_softc *sc) /* clear STA registers */ rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof sc->sta); + /* clear security registers (if required) */ + if (sc->sc_clr_shkeys == 0) { + rum_clr_shkey_regs(sc); + sc->sc_clr_shkeys = 1; + } + rum_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr); /* initialize ASIC */ @@ -2241,8 +2397,8 @@ rum_set_beacon(struct rum_softc *sc, str return EINVAL; tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; - rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, - m->m_pkthdr.len, tp->mgmtrate); + rum_setup_tx_desc(sc, &desc, NULL, RT2573_TX_TIMESTAMP, + RT2573_TX_HWSEQ, 0, m->m_pkthdr.len, tp->mgmtrate); /* copy the Tx descriptor into NIC memory */ if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, @@ -2330,6 +2486,216 @@ rum_update_beacon(struct ieee80211vap *v } static int +rum_common_key_set(struct rum_softc *sc, struct ieee80211_key *k, + uint16_t base) +{ + + if (rum_write_multi(sc, base, k->wk_key, k->wk_keylen)) + return EIO; + + if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) { + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE, + k->wk_txmic, 8)) + return EIO; + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE + 8, + k->wk_rxmic, 8)) + return EIO; + } + + return 0; +} + +static void +rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + uint8_t mode; + + if (sc->sc_clr_shkeys == 0) { + rum_clr_shkey_regs(sc); + sc->sc_clr_shkeys = 1; + } + + mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen); + if (mode == 0) + goto print_err; + + DPRINTFN(1, "setting group key %d for vap %d, mode %d " + "(tx %s, rx %s)\n", k->wk_keyix, rvp_id, mode, + (k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off", + (k->wk_flags & IEEE80211_KEY_RECV) ? "on" : "off"); + + /* Install the key. */ + if (rum_common_key_set(sc, k, RT2573_SKEY(rvp_id, k->wk_keyix)) != 0) + goto print_err; + + /* Set cipher mode. */ + if (rum_modbits(sc, rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, + mode << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX, + RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX) + != 0) + goto print_err; + + /* Mark this key as valid. */ + if (rum_setbits(sc, RT2573_SEC_CSR0, + 1 << (rvp_id * RT2573_SKEY_MAX + k->wk_keyix)) != 0) + goto print_err; + + return; + +print_err: + device_printf(sc->sc_dev, "%s: cannot set group key %d for vap %d\n", + __func__, k->wk_keyix, rvp_id); +} + +static void +rum_group_key_del_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + + DPRINTF("%s: removing group key %d for vap %d\n", __func__, + k->wk_keyix, rvp_id); + rum_clrbits(sc, + rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, + RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX); + rum_clrbits(sc, RT2573_SEC_CSR0, + rvp_id * RT2573_SKEY_MAX + k->wk_keyix); +} + +static void +rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, + uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + uint8_t buf[IEEE80211_ADDR_LEN + 1]; + uint8_t mode; + + mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen); + if (mode == 0) + goto print_err; + + DPRINTFN(1, "setting pairwise key %d for vap %d, mode %d " + "(tx %s, rx %s)\n", k->wk_keyix, rvp_id, mode, + (k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off", + (k->wk_flags & IEEE80211_KEY_RECV) ? "on" : "off"); + + /* Install the key. */ + if (rum_common_key_set(sc, k, RT2573_PKEY(k->wk_keyix)) != 0) + goto print_err; + + IEEE80211_ADDR_COPY(buf, k->wk_macaddr); + buf[IEEE80211_ADDR_LEN] = mode; + + /* Set transmitter address and cipher mode. */ + if (rum_write_multi(sc, RT2573_ADDR_ENTRY(k->wk_keyix), + buf, sizeof buf) != 0) + goto print_err; + + /* Enable key table lookup for this vap. */ + if (sc->vap_key_count[rvp_id]++ == 0) + if (rum_setbits(sc, RT2573_SEC_CSR4, 1 << rvp_id) != 0) + goto print_err; + + /* Mark this key as valid. */ + if (rum_setbits(sc, + k->wk_keyix < 32 ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, + 1 << (k->wk_keyix % 32)) != 0) + goto print_err; + + return; + +print_err: + device_printf(sc->sc_dev, + "%s: cannot set pairwise key %d, vap %d\n", __func__, k->wk_keyix, + rvp_id); +} + +static void +rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, + uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + + DPRINTF("%s: removing key %d\n", __func__, k->wk_keyix); + rum_clrbits(sc, (k->wk_keyix < 32) ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, + 1 << (k->wk_keyix % 32)); + sc->keys_bmap &= ~(1 << k->wk_keyix); + if (--sc->vap_key_count[rvp_id] == 0) + rum_clrbits(sc, RT2573_SEC_CSR4, 1 << rvp_id); +} + +static int +rum_key_alloc(struct ieee80211vap *vap, struct ieee80211_key *k, + ieee80211_keyix *keyix, ieee80211_keyix *rxkeyix) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + uint8_t i; + + if (!(&vap->iv_nw_keys[0] <= k && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { + if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + RUM_LOCK(sc); + for (i = 0; i < RT2573_ADDR_MAX; i++) { + if ((sc->keys_bmap & (1 << i)) == 0) { + sc->keys_bmap |= 1 << i; + *keyix = i; + break; + } + } + RUM_UNLOCK(sc); + if (i == RT2573_ADDR_MAX) { + device_printf(sc->sc_dev, + "%s: no free space in the key table\n", + __func__); + return 0; + } + } else + *keyix = 0; + } else { + *keyix = k - vap->iv_nw_keys; + } + *rxkeyix = *keyix; + return 1; +} + +static int +rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + int group; + + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + /* Not for us. */ + return 1; + } + + group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; + + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + group ? rum_group_key_set_cb : rum_pair_key_set_cb); +} + +static int +rum_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + int group; + + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + /* Not for us. */ + return 1; + } + + group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; + + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + group ? rum_group_key_del_cb : rum_pair_key_del_cb); +} + +static int rum_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) { Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 20:49:08 2015 (r288633) @@ -34,13 +34,34 @@ #define RT2573_WRITE_LED 0x0a /* - * Control and status registers. + * WME registers. */ #define RT2573_AIFSN_CSR 0x0400 #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 #define RT2573_MCU_CODE_BASE 0x0800 + +/* + * H/w encryption/decryption support + */ +#define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) +#define RT2573_ADDR_MAX 64 +#define RT2573_SKEY_MAX 4 + +#define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ + (kidx)) * KEY_SIZE) +#define RT2573_PKEY(id) (0x1200 + (id) * KEY_SIZE) + +#define RT2573_ADDR_ENTRY(id) (0x1a00 + (id) * 8) + +/* + * Shared memory area + */ #define RT2573_HW_BCN_BASE(id) (0x2400 + (id) * 0x100) + +/* + * Control and status registers. + */ #define RT2573_MAC_CSR0 0x3000 #define RT2573_MAC_CSR1 0x3004 #define RT2573_MAC_CSR2 0x3008 @@ -95,6 +116,16 @@ #define RT2573_STA_CSR5 0x30d4 +/* possible values for register RT2573_ADDR_MODE */ +#define RT2573_MODE_MASK 0x7 +#define RT2573_MODE_NOSEC 0 +#define RT2573_MODE_WEP40 1 +#define RT2573_MODE_WEP104 2 +#define RT2573_MODE_TKIP 3 +#define RT2573_MODE_AES_CCMP 4 +#define RT2573_MODE_CKIP40 5 +#define RT2573_MODE_CKIP104 6 + /* possible flags for register RT2573_MAC_CSR1 */ #define RT2573_RESET_ASIC (1 << 0) #define RT2573_RESET_BBP (1 << 1) @@ -178,6 +209,10 @@ struct rum_tx_desc { #define RT2573_TX_OFDM (1 << 5) #define RT2573_TX_IFS_SIFS (1 << 6) #define RT2573_TX_LONG_RETRY (1 << 7) +#define RT2573_TX_TKIPMIC (1 << 8) +#define RT2573_TX_KEY_PAIR (1 << 9) +#define RT2573_TX_KEY_ID(id) (((id) & 0x3f) << 10) +#define RT2573_TX_CIP_MODE(m) ((m) << 29) uint16_t wme; #define RT2573_QID(v) (v) @@ -185,8 +220,9 @@ struct rum_tx_desc { #define RT2573_LOGCWMIN(v) ((v) << 8) #define RT2573_LOGCWMAX(v) ((v) << 12) - uint16_t xflags; -#define RT2573_TX_HWSEQ (1 << 12) + uint8_t hdrlen; + uint8_t xflags; +#define RT2573_TX_HWSEQ (1 << 4) uint8_t plcp_signal; uint8_t plcp_service; @@ -210,9 +246,25 @@ struct rum_rx_desc { uint32_t flags; #define RT2573_RX_BUSY (1 << 0) #define RT2573_RX_DROP (1 << 1) +#define RT2573_RX_UC2ME (1 << 2) +#define RT2573_RX_MC (1 << 3) +#define RT2573_RX_BC (1 << 4) +#define RT2573_RX_MYBSS (1 << 5) #define RT2573_RX_CRC_ERROR (1 << 6) #define RT2573_RX_OFDM (1 << 7) +#define RT2573_RX_DEC_MASK (3 << 8) +#define RT2573_RX_DEC_OK (0 << 8) + +#define RT2573_RX_IV_ERROR (1 << 8) +#define RT2573_RX_MIC_ERROR (2 << 8) +#define RT2573_RX_KEY_ERROR (3 << 8) + +#define RT2573_RX_KEY_PAIR (1 << 28) + +#define RT2573_RX_CIP_MASK (7 << 29) +#define RT2573_RX_CIP_MODE(m) ((m) << 29) + uint8_t rate; uint8_t rssi; uint8_t reserved1; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:49:08 2015 (r288633) @@ -136,10 +136,14 @@ struct rum_softc { uint32_t rf_regs[4]; uint8_t txpow[44]; u_int sc_detached:1, - sc_running:1; + sc_running:1, + sc_clr_shkeys:1; uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + uint8_t vap_key_count[1]; + uint64_t keys_bmap; + struct { uint8_t val; uint8_t reg; From owner-svn-src-all@freebsd.org Sat Oct 3 20:53:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B089A0E978; Sat, 3 Oct 2015 20:53:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C94D10C2; Sat, 3 Oct 2015 20:53:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KrB0N010316; Sat, 3 Oct 2015 20:53:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KrBOw010314; Sat, 3 Oct 2015 20:53:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032053.t93KrBOw010314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288634 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 20:53:12 -0000 Author: adrian Date: Sat Oct 3 20:53:10 2015 New Revision: 288634 URL: https://svnweb.freebsd.org/changeset/base/288634 Log: rum(4): drop unused 'node id' parameter. Submitted by: Differential Revision: https://reviews.freebsd.org/D3655 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:49:08 2015 (r288633) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:53:10 2015 (r288634) @@ -160,7 +160,7 @@ static struct ieee80211vap *rum_vap_crea static void rum_vap_delete(struct ieee80211vap *); static void rum_cmdq_cb(void *, int); static int rum_cmd_sleepable(struct rum_softc *, const void *, - size_t, uint8_t, uint8_t, CMD_FUNC_PROTO); + size_t, uint8_t, CMD_FUNC_PROTO); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); static void rum_unsetup_tx_list(struct rum_softc *); @@ -212,7 +212,7 @@ static void rum_enable_tsf(struct rum_s static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); static void rum_update_slot_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_update_slot(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -233,18 +233,18 @@ static int rum_set_beacon(struct rum_so static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); static void rum_update_beacon_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_update_beacon(struct ieee80211vap *, int); static int rum_common_key_set(struct rum_softc *, struct ieee80211_key *, uint16_t); static void rum_group_key_set_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_group_key_del_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_pair_key_set_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_pair_key_del_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static int rum_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); @@ -692,7 +692,7 @@ rum_cmdq_cb(void *arg, int pending) RUM_CMDQ_UNLOCK(sc); RUM_LOCK(sc); - rc->func(sc, &rc->data, rc->rn_id, rc->rvp_id); + rc->func(sc, &rc->data, rc->rvp_id); RUM_UNLOCK(sc); RUM_CMDQ_LOCK(sc); @@ -704,7 +704,7 @@ rum_cmdq_cb(void *arg, int pending) static int rum_cmd_sleepable(struct rum_softc *sc, const void *ptr, size_t len, - uint8_t rn_id, uint8_t rvp_id, CMD_FUNC_PROTO) + uint8_t rvp_id, CMD_FUNC_PROTO) { struct ieee80211com *ic = &sc->sc_ic; @@ -720,7 +720,6 @@ rum_cmd_sleepable(struct rum_softc *sc, if (ptr != NULL) memcpy(&sc->cmdq[sc->cmdq_last].data, ptr, len); - sc->cmdq[sc->cmdq_last].rn_id = rn_id; sc->cmdq[sc->cmdq_last].rvp_id = rvp_id; sc->cmdq[sc->cmdq_last].func = func; sc->cmdq_last = (sc->cmdq_last + 1) % RUM_CMDQ_SIZE; @@ -825,7 +824,7 @@ rum_newstate(struct ieee80211vap *vap, e ret = EINVAL; goto run_fail; } - rum_update_slot_cb(sc, NULL, 0, 0); + rum_update_slot_cb(sc, NULL, 0); rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); @@ -2011,8 +2010,7 @@ rum_get_tsf(struct rum_softc *sc, uint64 } static void -rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rv_id, - uint8_t rvp_id) +rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; @@ -2027,7 +2025,7 @@ rum_update_slot_cb(struct rum_softc *sc, static void rum_update_slot(struct ieee80211com *ic) { - rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, 0, rum_update_slot_cb); + rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, rum_update_slot_cb); } static void @@ -2437,7 +2435,7 @@ rum_alloc_beacon(struct rum_softc *sc, s static void rum_update_beacon_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211vap *vap = data->vap; @@ -2482,7 +2480,7 @@ rum_update_beacon(struct ieee80211vap *v setbit(bo->bo_flags, item); ieee80211_beacon_update(ni, bo, m, mcast); - rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, 0, rum_update_beacon_cb); + rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, rum_update_beacon_cb); } static int @@ -2507,7 +2505,7 @@ rum_common_key_set(struct rum_softc *sc, static void rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211_key *k = &data->key; uint8_t mode; @@ -2551,7 +2549,7 @@ print_err: static void rum_group_key_del_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2565,7 +2563,7 @@ rum_group_key_del_cb(struct rum_softc *s } static void -rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, +rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2613,7 +2611,7 @@ print_err: } static void -rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, +rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2674,7 +2672,7 @@ rum_key_set(struct ieee80211vap *vap, co group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; - return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, group ? rum_group_key_set_cb : rum_pair_key_set_cb); } @@ -2691,7 +2689,7 @@ rum_key_delete(struct ieee80211vap *vap, group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; - return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, group ? rum_group_key_del_cb : rum_pair_key_del_cb); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:49:08 2015 (r288633) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:53:10 2015 (r288634) @@ -77,13 +77,10 @@ union sec_param { struct ieee80211vap *vap; }; #define CMD_FUNC_PROTO void (*func)(struct rum_softc *, \ - union sec_param *, uint8_t, \ - uint8_t) + union sec_param *, uint8_t) struct rum_cmdq { union sec_param data; - - uint8_t rn_id; uint8_t rvp_id; CMD_FUNC_PROTO; From owner-svn-src-all@freebsd.org Sat Oct 3 21:33:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5AA9A0E63B; Sat, 3 Oct 2015 21:33:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E8461781; Sat, 3 Oct 2015 21:33:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 3B516359302; Sat, 3 Oct 2015 23:33:12 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 0EE7028494; Sat, 3 Oct 2015 23:33:12 +0200 (CEST) Date: Sat, 3 Oct 2015 23:33:12 +0200 From: Jilles Tjoelker To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288628 - head/sys/kern Message-ID: <20151003213311.GB57303@stack.nl> References: <201510031937.t93Jbgkk077518@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510031937.t93Jbgkk077518@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 21:33:14 -0000 On Sat, Oct 03, 2015 at 07:37:42PM +0000, Mark Johnston wrote: > Author: markj > Date: Sat Oct 3 19:37:41 2015 > New Revision: 288628 > URL: https://svnweb.freebsd.org/changeset/base/288628 > Log: > The return value of posix_fadvise(2) is just an error status, so > sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() > rather than setting a return value. > MFC after: 1 week > Modified: > head/sys/kern/vfs_syscalls.c > > Modified: head/sys/kern/vfs_syscalls.c > ============================================================================== > --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) > +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) > @@ -4663,7 +4663,6 @@ int > sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) > { > > - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, > - uap->len, uap->advice); > - return (0); > + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, > + uap->advice)); > } This change makes the code match the man page, but in fact, the code was right and the man page is wrong. Per POSIX, posix_fadvise() shall return 0 on success and an error number on failure, and need not modify errno. Also, this kind of ABI change in general is almost always a bad idea when the function is already part of a stable branch. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Sat Oct 3 21:48:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E1D8A0F3BD; Sat, 3 Oct 2015 21:48:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 726211E49; Sat, 3 Oct 2015 21:48:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93LmUUl030991; Sat, 3 Oct 2015 21:48:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93LmRvC030979; Sat, 3 Oct 2015 21:48:27 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032148.t93LmRvC030979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 21:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288635 - in head/sys: dev/ath dev/if_ndis dev/mwl dev/usb/wlan dev/wpi 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 21:48:30 -0000 Author: adrian Date: Sat Oct 3 21:48:27 2015 New Revision: 288635 URL: https://svnweb.freebsd.org/changeset/base/288635 Log: net80211: drop redundant 3rd parameter from iv_key_set(). The MAC can be fetched from the key struct. I added the ndis updates to make it compile. Submitted by: Differential Revision: https://reviews.freebsd.org/D3657 Modified: head/sys/dev/ath/if_ath_keycache.c head/sys/dev/ath/if_ath_keycache.h head/sys/dev/if_ndis/if_ndis.c head/sys/dev/mwl/if_mwl.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/wpi/if_wpi.c head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/ath/if_ath_keycache.c ============================================================================== --- head/sys/dev/ath/if_ath_keycache.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/ath/if_ath_keycache.c Sat Oct 3 21:48:27 2015 (r288635) @@ -527,8 +527,7 @@ ath_key_delete(struct ieee80211vap *vap, * slot(s) must already have been allocated by ath_key_alloc. */ int -ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const u_int8_t mac[IEEE80211_ADDR_LEN]) +ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { struct ath_softc *sc = vap->iv_ic->ic_softc; Modified: head/sys/dev/ath/if_ath_keycache.h ============================================================================== --- head/sys/dev/ath/if_ath_keycache.h Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/ath/if_ath_keycache.h Sat Oct 3 21:48:27 2015 (r288635) @@ -35,8 +35,7 @@ extern int ath_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); extern int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *); -extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *, - const u_int8_t mac[IEEE80211_ADDR_LEN]); +extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *); extern int ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap, const struct ieee80211_key *k, struct ieee80211_node *bss); Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/if_ndis/if_ndis.c Sat Oct 3 21:48:27 2015 (r288635) @@ -194,7 +194,7 @@ static void ndis_media_status (struct if static int ndis_set_cipher (struct ndis_softc *, int); static int ndis_set_wpa (struct ndis_softc *, void *, int); static int ndis_add_key (struct ieee80211vap *, - const struct ieee80211_key *, const u_int8_t []); + const struct ieee80211_key *); static int ndis_del_key (struct ieee80211vap *, const struct ieee80211_key *); static void ndis_setmulti (struct ndis_softc *); @@ -3070,8 +3070,7 @@ ndis_del_key(struct ieee80211vap *vap, c * set after initial authentication with the AP. */ static int -ndis_add_key(struct ieee80211vap *vap, const struct ieee80211_key *key, - const uint8_t mac[IEEE80211_ADDR_LEN]) +ndis_add_key(struct ieee80211vap *vap, const struct ieee80211_key *key) { struct ndis_softc *sc = vap->iv_ic->ic_softc; ndis_80211_key rkey; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/mwl/if_mwl.c Sat Oct 3 21:48:27 2015 (r288635) @@ -111,7 +111,10 @@ static int mwl_key_alloc(struct ieee8021 ieee80211_keyix *, ieee80211_keyix *); static int mwl_key_delete(struct ieee80211vap *, const struct ieee80211_key *); -static int mwl_key_set(struct ieee80211vap *, const struct ieee80211_key *, +static int mwl_key_set(struct ieee80211vap *, + const struct ieee80211_key *); +static int _mwl_key_set(struct ieee80211vap *, + const struct ieee80211_key *, const uint8_t mac[IEEE80211_ADDR_LEN]); static int mwl_mode_init(struct mwl_softc *); static void mwl_update_mcast(struct ieee80211com *); @@ -1604,7 +1607,13 @@ addgroupflags(MWL_HAL_KEYVAL *hk, const * slot(s) must already have been allocated by mwl_key_alloc. */ static int -mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, +mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) +{ + return (_mwl_key_set(vap, k, k->wk_macaddr)); +} + +static int +_mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN]) { #define GRPXMIT (IEEE80211_KEY_XMIT | IEEE80211_KEY_GROUP) @@ -3911,7 +3920,8 @@ mwl_setanywepkey(struct ieee80211vap *va IEEE80211_F_PRIVACY && vap->iv_def_txkey != IEEE80211_KEYIX_NONE && vap->iv_nw_keys[vap->iv_def_txkey].wk_keyix != IEEE80211_KEYIX_NONE) - (void) mwl_key_set(vap, &vap->iv_nw_keys[vap->iv_def_txkey], mac); + (void) _mwl_key_set(vap, &vap->iv_nw_keys[vap->iv_def_txkey], + mac); } static int @@ -3956,7 +3966,7 @@ mwl_setglobalkeys(struct ieee80211vap *v wk = &vap->iv_nw_keys[0]; for (; wk < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; wk++) if (wk->wk_keyix != IEEE80211_KEYIX_NONE) - (void) mwl_key_set(vap, wk, vap->iv_myaddr); + (void) _mwl_key_set(vap, wk, vap->iv_myaddr); } /* Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 21:48:27 2015 (r288635) @@ -249,8 +249,7 @@ static int rum_key_alloc(struct ieee802 struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); static int rum_key_set(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); static int rum_key_delete(struct ieee80211vap *, const struct ieee80211_key *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, @@ -2659,8 +2658,7 @@ rum_key_alloc(struct ieee80211vap *vap, } static int -rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { struct rum_softc *sc = vap->iv_ic->ic_softc; int group; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 21:48:27 2015 (r288635) @@ -382,8 +382,7 @@ static int run_newstate(struct ieee80211 static int run_wme_update(struct ieee80211com *); static void run_wme_update_cb(void *); static void run_key_set_cb(void *); -static int run_key_set(struct ieee80211vap *, struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); +static int run_key_set(struct ieee80211vap *, struct ieee80211_key *); static void run_key_delete_cb(void *); static int run_key_delete(struct ieee80211vap *, struct ieee80211_key *); static void run_ratectl_to(void *); @@ -2361,8 +2360,7 @@ run_key_set_cb(void *arg) * return 0 on error */ static int -run_key_set(struct ieee80211vap *vap, struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +run_key_set(struct ieee80211vap *vap, struct ieee80211_key *k) { struct ieee80211com *ic = vap->iv_ic; struct run_softc *sc = ic->ic_softc; @@ -2374,7 +2372,7 @@ run_key_set(struct ieee80211vap *vap, st sc->cmdq[i].arg0 = NULL; sc->cmdq[i].arg1 = vap; sc->cmdq[i].k = k; - IEEE80211_ADDR_COPY(sc->cmdq[i].mac, mac); + IEEE80211_ADDR_COPY(sc->cmdq[i].mac, k->wk_macaddr); ieee80211_runtask(ic, &sc->cmdq_task); /* Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/wpi/if_wpi.c Sat Oct 3 21:48:27 2015 (r288635) @@ -254,8 +254,7 @@ static void wpi_del_key_cb(void *, struc static int wpi_process_key(struct ieee80211vap *, const struct ieee80211_key *, int); static int wpi_key_set(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); static int wpi_key_delete(struct ieee80211vap *, const struct ieee80211_key *); static int wpi_post_alive(struct wpi_softc *); @@ -4799,8 +4798,7 @@ wpi_process_key(struct ieee80211vap *vap } static int -wpi_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +wpi_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { return wpi_process_key(vap, k, 1); } Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/net80211/ieee80211_crypto.c Sat Oct 3 21:48:27 2015 (r288635) @@ -89,8 +89,7 @@ null_key_delete(struct ieee80211vap *vap return 1; } static int -null_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +null_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { return 1; } @@ -132,7 +131,7 @@ dev_key_delete(struct ieee80211vap *vap, static __inline int dev_key_set(struct ieee80211vap *vap, const struct ieee80211_key *key) { - return vap->iv_key_set(vap, key, key->wk_macaddr); + return vap->iv_key_set(vap, key); } /* Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/net80211/ieee80211_var.h Sat Oct 3 21:48:27 2015 (r288635) @@ -461,8 +461,7 @@ struct ieee80211vap { int (*iv_key_delete)(struct ieee80211vap *, const struct ieee80211_key *); int (*iv_key_set)(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); void (*iv_key_update_begin)(struct ieee80211vap *); void (*iv_key_update_end)(struct ieee80211vap *); From owner-svn-src-all@freebsd.org Sat Oct 3 22:12:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2A1BA0E370; Sat, 3 Oct 2015 22:12:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1AE01AD3; Sat, 3 Oct 2015 22:12:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MCTpY042889; Sat, 3 Oct 2015 22:12:29 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MCQiR042874; Sat, 3 Oct 2015 22:12:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032212.t93MCQiR042874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288636 - in head/sys: dev/ath dev/mwl dev/ral dev/usb/wlan dev/wpi dev/wtap 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:12:30 -0000 Author: adrian Date: Sat Oct 3 22:12:25 2015 New Revision: 288636 URL: https://svnweb.freebsd.org/changeset/base/288636 Log: net80211: drop ieee80211_beacon_offsets parameter from ieee80211_beacon_alloc() and ieee80211_beacon_update() Submitted by: Differential Revision: https://reviews.freebsd.org/D3659 Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/mwl/if_mwl.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/wpi/if_wpi.c head/sys/dev/wtap/if_wtap.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ath/if_ath_beacon.c Sat Oct 3 22:12:25 2015 (r288636) @@ -199,7 +199,7 @@ ath_beacon_alloc(struct ath_softc *sc, s * we assume the mbuf routines will return us something * with this alignment (perhaps should assert). */ - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: cannot get mbuf\n", __func__); sc->sc_stats.ast_be_nombuf++; @@ -713,7 +713,7 @@ ath_beacon_generate(struct ath_softc *sc /* XXX lock mcastq? */ nmcastq = avp->av_mcastq.axq_depth; - if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, nmcastq)) { + if (ieee80211_beacon_update(bf->bf_node, m, nmcastq)) { /* XXX too conservative? */ bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, @@ -829,7 +829,7 @@ ath_beacon_start_adhoc(struct ath_softc */ bf = avp->av_bcbuf; m = bf->bf_m; - if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, 0)) { + if (ieee80211_beacon_update(bf->bf_node, m, 0)) { /* XXX too conservative? */ bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/mwl/if_mwl.c Sat Oct 3 22:12:25 2015 (r288636) @@ -1843,10 +1843,9 @@ mwl_beacon_setup(struct ieee80211vap *va { struct mwl_hal_vap *hvap = MWL_VAP(vap)->mv_hvap; struct ieee80211_node *ni = vap->iv_bss; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct mbuf *m; - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) return ENOBUFS; mwl_hal_setbeacon(hvap, mtod(m, const void *), m->m_len); Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2560.c Sat Oct 3 22:12:25 2015 (r288636) @@ -768,7 +768,7 @@ rt2560_newstate(struct ieee80211vap *vap if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS || vap->iv_opmode == IEEE80211_M_MBSS) { - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); @@ -1286,7 +1286,6 @@ static void rt2560_beacon_expire(struct rt2560_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct rt2560_tx_data *data; if (ic->ic_opmode != IEEE80211_M_IBSS && @@ -1305,7 +1304,7 @@ rt2560_beacon_expire(struct rt2560_softc bus_dmamap_unload(sc->bcnq.data_dmat, data->map); /* XXX 1 =>'s mcast frames which means all PS sta's will wakeup! */ - ieee80211_beacon_update(data->ni, &vap->iv_bcn_off, data->m, 1); + ieee80211_beacon_update(data->ni, data->m, 1); rt2560_tx_bcn(sc, data->m, data->ni); Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2661.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2626,13 +2626,11 @@ static int rt2661_prepare_beacon(struct rt2661_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct rt2661_tx_desc desc; struct mbuf *m0; int rate; - m0 = ieee80211_beacon_alloc(vap->iv_bss, bo); - if (m0 == NULL) { + if ((m0 = ieee80211_beacon_alloc(vap->iv_bss))== NULL) { device_printf(sc->sc_dev, "could not allocate beacon frame\n"); return ENOBUFS; } Modified: head/sys/dev/ral/rt2860.c ============================================================================== --- head/sys/dev/ral/rt2860.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2860.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4268,12 +4268,11 @@ static int rt2860_setup_beacon(struct rt2860_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct rt2860_txwi txwi; struct mbuf *m; int ridx; - if ((m = ieee80211_beacon_alloc(vap->iv_bss, bo)) == NULL) + if ((m = ieee80211_beacon_alloc(vap->iv_bss)) == NULL) return ENOBUFS; memset(&txwi, 0, sizeof txwi); Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2420,7 +2420,7 @@ rum_alloc_beacon(struct rum_softc *sc, s if (ni->ni_chan == IEEE80211_CHAN_ANYC) return EINVAL; - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) return ENOMEM; @@ -2454,7 +2454,7 @@ rum_update_beacon(struct ieee80211vap *v RUM_LOCK(sc); if (m == NULL) { - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -2477,7 +2477,7 @@ rum_update_beacon(struct ieee80211vap *v RUM_UNLOCK(sc); setbit(bo->bo_flags, item); - ieee80211_beacon_update(ni, bo, m, mcast); + ieee80211_beacon_update(ni, m, mcast); rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, rum_update_beacon_cb); } Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4866,11 +4866,11 @@ run_update_beacon(struct ieee80211vap *v setbit(bo->bo_flags, item); if (rvp->beacon_mbuf == NULL) { - rvp->beacon_mbuf = ieee80211_beacon_alloc(ni, bo); + rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); if (rvp->beacon_mbuf == NULL) return; } - ieee80211_beacon_update(ni, bo, rvp->beacon_mbuf, mcast); + ieee80211_beacon_update(ni, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); DPRINTF("cmdq_store=%d\n", i); @@ -4904,8 +4904,7 @@ run_update_beacon_cb(void *arg) * is taking care of apropriate calls. */ if (rvp->beacon_mbuf == NULL) { - rvp->beacon_mbuf = ieee80211_beacon_alloc(ni, - &vap->iv_bcn_off); + rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); if (rvp->beacon_mbuf == NULL) return; } Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 22:12:25 2015 (r288636) @@ -710,7 +710,7 @@ ural_newstate(struct ieee80211vap *vap, if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/wpi/if_wpi.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4354,7 +4354,6 @@ static int wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct wpi_vap *wvp = WPI_VAP(vap); struct wpi_buf *bcn = &wvp->wv_bcbuf; struct mbuf *m; @@ -4365,7 +4364,7 @@ wpi_setup_beacon(struct wpi_softc *sc, s if (ni->ni_chan == IEEE80211_CHAN_ANYC) return EINVAL; - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -4398,7 +4397,7 @@ wpi_update_beacon(struct ieee80211vap *v WPI_VAP_LOCK(wvp); if (bcn->m == NULL) { - bcn->m = ieee80211_beacon_alloc(ni, bo); + bcn->m = ieee80211_beacon_alloc(ni); if (bcn->m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -4416,7 +4415,7 @@ wpi_update_beacon(struct ieee80211vap *v mcast = 1; /* TODO */ setbit(bo->bo_flags, item); - ieee80211_beacon_update(ni, bo, bcn->m, mcast); + ieee80211_beacon_update(ni, bcn->m, mcast); WPI_VAP_LOCK(wvp); wpi_config_beacon(wvp); Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/wtap/if_wtap.c Sat Oct 3 22:12:25 2015 (r288636) @@ -205,7 +205,7 @@ wtap_beacon_alloc(struct wtap_softc *sc, * we assume the mbuf routines will return us something * with this alignment (perhaps should assert). */ - avp->beacon = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + avp->beacon = ieee80211_beacon_alloc(ni); if (avp->beacon == NULL) { printf("%s: cannot get mbuf\n", __func__); return ENOMEM; @@ -242,7 +242,7 @@ wtap_beacon_intrp(void *arg) * of the TIM bitmap). */ m = m_dup(avp->beacon, M_NOWAIT); - if (ieee80211_beacon_update(avp->bf_node, &vap->iv_bcn_off, m, 0)) { + if (ieee80211_beacon_update(avp->bf_node, m, 0)) { printf("%s, need to remap the memory because the beacon frame" " changed size.\n",__func__); } Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/net80211/ieee80211_output.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2860,9 +2860,10 @@ ieee80211_tx_mgt_cb(struct ieee80211_nod static void ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, - struct ieee80211_beacon_offsets *bo, struct ieee80211_node *ni) + struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct ieee80211com *ic = ni->ni_ic; struct ieee80211_rateset *rs = &ni->ni_rates; uint16_t capinfo; @@ -3021,8 +3022,7 @@ ieee80211_beacon_construct(struct mbuf * * Allocate a beacon frame and fillin the appropriate bits. */ struct mbuf * -ieee80211_beacon_alloc(struct ieee80211_node *ni, - struct ieee80211_beacon_offsets *bo) +ieee80211_beacon_alloc(struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; @@ -3104,7 +3104,7 @@ ieee80211_beacon_alloc(struct ieee80211_ vap->iv_stats.is_tx_nobuf++; return NULL; } - ieee80211_beacon_construct(m, frm, bo, ni); + ieee80211_beacon_construct(m, frm, ni); M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); KASSERT(m != NULL, ("no space for 802.11 header?")); @@ -3125,10 +3125,10 @@ ieee80211_beacon_alloc(struct ieee80211_ * Update the dynamic parts of a beacon frame based on the current state. */ int -ieee80211_beacon_update(struct ieee80211_node *ni, - struct ieee80211_beacon_offsets *bo, struct mbuf *m, int mcast) +ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct ieee80211com *ic = ni->ni_ic; int len_changed = 0; uint16_t capinfo; @@ -3158,7 +3158,7 @@ ieee80211_beacon_update(struct ieee80211 * clear IEEE80211_BEACON_CSA. */ ieee80211_beacon_construct(m, - mtod(m, uint8_t*) + sizeof(struct ieee80211_frame), bo, ni); + mtod(m, uint8_t*) + sizeof(struct ieee80211_frame), ni); /* XXX do WME aggressive mode processing? */ IEEE80211_UNLOCK(ic); Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/net80211/ieee80211_proto.h Sat Oct 3 22:12:25 2015 (r288636) @@ -346,8 +346,7 @@ struct ieee80211_beacon_offsets { uint8_t *bo_meshconf; /* start of MESHCONF element */ uint8_t *bo_spare[3]; }; -struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *, - struct ieee80211_beacon_offsets *); +struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *); /* * Beacon frame updates are signaled through calls to iv_update_beacon @@ -375,7 +374,7 @@ enum { IEEE80211_BEACON_MESHCONF = 11, /* Mesh Configuration */ }; int ieee80211_beacon_update(struct ieee80211_node *, - struct ieee80211_beacon_offsets *, struct mbuf *, int mcast); + struct mbuf *, int mcast); void ieee80211_csa_startswitch(struct ieee80211com *, struct ieee80211_channel *, int mode, int count); From owner-svn-src-all@freebsd.org Sat Oct 3 22:16:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C308A0E697; Sat, 3 Oct 2015 22:16:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 103131CDA; Sat, 3 Oct 2015 22:16:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MFxu0043066; Sat, 3 Oct 2015 22:15:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MFxRH043065; Sat, 3 Oct 2015 22:15:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032215.t93MFxRH043065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288637 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:16:00 -0000 Author: adrian Date: Sat Oct 3 22:15:59 2015 New Revision: 288637 URL: https://svnweb.freebsd.org/changeset/base/288637 Log: rum(4): fix sequence number generation. * drop erroneous RT2573_TX_MORE_FRAG flag; * provide RT2573_TX_HWSEQ where needed. Submitted by: Differential Revision: https://reviews.freebsd.org/D3672 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:12:25 2015 (r288636) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:15:59 2015 (r288637) @@ -1212,7 +1212,7 @@ rum_sendprot(struct rum_softc *sc, isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0; dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) + ieee80211_ack_duration(ic->ic_rt, rate, isshort); - flags = RT2573_TX_MORE_FRAG; + flags = 0; if (prot == IEEE80211_PROT_RTSCTS) { /* NB: CTS is the same size as an ACK */ dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort); @@ -1286,6 +1286,7 @@ rum_tx_mgt(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + uint8_t type, xflags = 0; int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1295,6 +1296,7 @@ rum_tx_mgt(struct rum_softc *sc, struct sc->tx_nfree--; wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { @@ -1319,12 +1321,15 @@ rum_tx_mgt(struct rum_softc *sc, struct USETW(wh->i_dur, dur); /* tell hardware to add timestamp for probe responses */ - if ((wh->i_fc[0] & - (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == - (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP)) + if (type == IEEE80211_FC0_TYPE_MGT && + (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == + IEEE80211_FC0_SUBTYPE_PROBE_RESP) flags |= RT2573_TX_TIMESTAMP; } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + if (k != NULL) flags |= rum_tx_crypto_flags(sc, ni, k); @@ -1332,7 +1337,7 @@ rum_tx_mgt(struct rum_softc *sc, struct data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", @@ -1349,12 +1354,17 @@ rum_tx_raw(struct rum_softc *sc, struct const struct ieee80211_bpf_params *params) { struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_frame *wh; struct rum_tx_data *data; uint32_t flags; + uint8_t type, xflags = 0; int rate, error; RUM_LOCK_ASSERT(sc); + wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + rate = params->ibp_rate0; if (!ieee80211_isratevalid(ic->ic_rt, rate)) return (EINVAL); @@ -1373,6 +1383,9 @@ rum_tx_raw(struct rum_softc *sc, struct flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); sc->tx_nfree--; @@ -1382,8 +1395,8 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, m0->m_pkthdr.len, - rate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, 0, + m0->m_pkthdr.len, rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", m0->m_pkthdr.len, rate); @@ -1405,11 +1418,13 @@ rum_tx_data(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + uint8_t type, xflags = 0; int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; @@ -1436,6 +1451,9 @@ rum_tx_data(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { int prot = IEEE80211_PROT_NONE; if (m0->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) @@ -1466,14 +1484,13 @@ rum_tx_data(struct rum_softc *sc, struct if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2573_TX_NEED_ACK; - flags |= RT2573_TX_MORE_FRAG; dur = ieee80211_ack_duration(ic->ic_rt, rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", From owner-svn-src-all@freebsd.org Sat Oct 3 22:22:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 826D9A0ED38; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7010911C4; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MMR0T047139; Sat, 3 Oct 2015 22:22:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MMQTE047135; Sat, 3 Oct 2015 22:22:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032222.t93MMQTE047135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288638 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:22:27 -0000 Author: adrian Date: Sat Oct 3 22:22:26 2015 New Revision: 288638 URL: https://svnweb.freebsd.org/changeset/base/288638 Log: rum(4): set short/long retry limits Now device will use retry limit, which is set via 'ifconfig maxretry '. Tested: * Tested on WUSB54GC, STA mode. Submitted by: Differential Revision: https://reviews.freebsd.org/D3689 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:22:26 2015 (r288638) @@ -207,6 +207,8 @@ static void rum_select_band(struct rum_ struct ieee80211_channel *); static void rum_set_chan(struct rum_softc *, struct ieee80211_channel *); +static void rum_set_maxretry(struct rum_softc *, + struct ieee80211vap *); static int rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); @@ -819,7 +821,8 @@ rum_newstate(struct ieee80211vap *vap, e ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { - if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC || + ni->ni_chan == IEEE80211_CHAN_ANYC) { ret = EINVAL; goto run_fail; } @@ -827,6 +830,7 @@ rum_newstate(struct ieee80211vap *vap, e rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); + rum_set_maxretry(sc, vap); IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); rum_set_bssid(sc, sc->sc_bssid); } @@ -1946,6 +1950,21 @@ rum_set_chan(struct rum_softc *sc, struc rum_pause(sc, hz / 100); } +static void +rum_set_maxretry(struct rum_softc *sc, struct ieee80211vap *vap) +{ + const struct ieee80211_txparam *tp; + struct ieee80211_node *ni = vap->iv_bss; + struct rum_vap *rvp = RUM_VAP(vap); + + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + rvp->maxretry = tp->maxretry < 0xf ? tp->maxretry : 0xf; + + rum_modbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_RETRY(rvp->maxretry) | + RT2573_LONG_RETRY(rvp->maxretry), + RT2573_SHORT_RETRY_MASK | RT2573_LONG_RETRY_MASK); +} + /* * Enable TSF synchronization and tell h/w to start sending beacons for IBSS * and HostAP operating modes. Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:22:26 2015 (r288638) @@ -153,6 +153,10 @@ #define RT2573_SHORT_PREAMBLE (1 << 18) #define RT2573_MRR_ENABLED (1 << 19) #define RT2573_MRR_CCK_FALLBACK (1 << 22) +#define RT2573_LONG_RETRY(max) ((max) << 24) +#define RT2573_LONG_RETRY_MASK (0xf << 24) +#define RT2573_SHORT_RETRY(max) ((max) << 28) +#define RT2573_SHORT_RETRY_MASK (0xf << 28) /* possible flags for register TXRX_CSR9 */ #define RT2573_TSF_TIMER_EN (1 << 16) Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:22:26 2015 (r288638) @@ -92,6 +92,7 @@ struct rum_vap { struct mbuf *bcn_mbuf; struct usb_callout ratectl_ch; struct task ratectl_task; + uint8_t maxretry; int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); From owner-svn-src-all@freebsd.org Sat Oct 3 22:27:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EBEFA0F0B4; Sat, 3 Oct 2015 22:27:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 323E713AD; Sat, 3 Oct 2015 22:27:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MR0Ft047364; Sat, 3 Oct 2015 22:27:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MR0dQ047360; Sat, 3 Oct 2015 22:27:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032227.t93MR0dQ047360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288639 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:27:00 -0000 Author: adrian Date: Sat Oct 3 22:26:59 2015 New Revision: 288639 URL: https://svnweb.freebsd.org/changeset/base/288639 Log: rum(4): fix stats interpretation in rum_ratectl_task() Testing: * WUSB54GC, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3690 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:22:26 2015 (r288638) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:26:59 2015 (r288639) @@ -2797,29 +2797,34 @@ rum_ratectl_task(void *arg, int pending) { struct rum_vap *rvp = arg; struct ieee80211vap *vap = &rvp->vap; - struct ieee80211com *ic = vap->iv_ic; - struct rum_softc *sc = ic->ic_softc; + struct rum_softc *sc = vap->iv_ic->ic_softc; struct ieee80211_node *ni; - int ok, fail; - int sum, retrycnt; + int ok[3], fail; + int sum, success, retrycnt; RUM_LOCK(sc); - /* read and clear statistic registers (STA_CSR0 to STA_CSR10) */ + /* read and clear statistic registers (STA_CSR0 to STA_CSR5) */ rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof(sc->sta)); - ok = (le32toh(sc->sta[4]) >> 16) + /* TX ok w/o retry */ - (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ retry */ - fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ - sum = ok+fail; - retrycnt = (le32toh(sc->sta[5]) & 0xffff) + fail; - - ni = ieee80211_ref_node(vap->iv_bss); - ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); - (void) ieee80211_ratectl_rate(ni, NULL, 0); - ieee80211_free_node(ni); + ok[0] = (le32toh(sc->sta[4]) & 0xffff); /* TX ok w/o retry */ + ok[1] = (le32toh(sc->sta[4]) >> 16); /* TX ok w/ one retry */ + ok[2] = (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ multiple retries */ + fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ + + success = ok[0] + ok[1] + ok[2]; + sum = success + fail; + /* XXX at least */ + retrycnt = ok[1] + ok[2] * 2 + fail * (rvp->maxretry + 1); + + if (sum != 0) { + ni = ieee80211_ref_node(vap->iv_bss); + ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); + (void) ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_free_node(ni); + } /* count TX retry-fail as Tx errors */ - if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, fail); + if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, fail); usb_callout_reset(&rvp->ratectl_ch, hz, rum_ratectl_timeout, rvp); RUM_UNLOCK(sc); From owner-svn-src-all@freebsd.org Sat Oct 3 22:27:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E21FA0F0E8; Sat, 3 Oct 2015 22:27:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EBF11588; Sat, 3 Oct 2015 22:27:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MRF3G047421; Sat, 3 Oct 2015 22:27:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MRFGk047419; Sat, 3 Oct 2015 22:27:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510032227.t93MRFGk047419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 3 Oct 2015 22:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288640 - in head: lib/libc/sys sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:27:15 -0000 Author: markj Date: Sat Oct 3 22:27:14 2015 New Revision: 288640 URL: https://svnweb.freebsd.org/changeset/base/288640 Log: Revert r288628 and instead fix a discrepancy between the posix_fadvise(2) man page and POSIX: posix_fadvise(2) returns an error number on failure. Reported by: jilles MFC after: 1 week Modified: head/lib/libc/sys/posix_fadvise.2 head/sys/kern/vfs_syscalls.c Modified: head/lib/libc/sys/posix_fadvise.2 ============================================================================== --- head/lib/libc/sys/posix_fadvise.2 Sat Oct 3 22:26:59 2015 (r288639) +++ head/lib/libc/sys/posix_fadvise.2 Sat Oct 3 22:27:14 2015 (r288640) @@ -28,7 +28,7 @@ .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 30, 2014 +.Dd October 3, 2015 .Dt POSIX_FADVISE 2 .Os .Sh NAME @@ -89,11 +89,13 @@ read or written. Future access to this data may require a read operation. .El .Sh RETURN VALUES -.Rv -std posix_fadvise -.Sh ERRORS -The +If successful, .Fn posix_fadvise -system call returns zero on success, and an error on failure: +returns zero. +It returns an error on failure, without setting +.Va errno . +.Sh ERRORS +Possible failure conditions: .Bl -tag -width Er .It Bq Er EBADF The Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Oct 3 22:26:59 2015 (r288639) +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 22:27:14 2015 (r288640) @@ -4663,6 +4663,7 @@ int sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) { - return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, - uap->advice)); + td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, + uap->len, uap->advice); + return (0); } From owner-svn-src-all@freebsd.org Sat Oct 3 22:29:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B2D7A0F2BC; Sat, 3 Oct 2015 22:29:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36471182F; Sat, 3 Oct 2015 22:29:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by wicgb1 with SMTP id gb1so74054853wic.1; Sat, 03 Oct 2015 15:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=u817LOpDzghxfp3kWsA8KPHmqtASVrs9DslxpOzdbF0=; b=Dtx81XOXuzdy0wPAwWvLrp6JNaHmEUIHeh7RiMlhfqg4ikbN+rAbtfcP5/abpS6H6N oyUBaOtgFa3Jwfa3fsZpJOqSHsmeUoh4bcJaNpV5bAgjQUnecX9+xJtedh95KpBdCsud nEC2UwmEKiOdQcxmCqN5QYU8xHv5kgp6f3pvbGjdKHZ6ZEbR3j+99Xga/CY2F+fG2GFP rSGgTVL5cyOQyAbok7XBhR6FAkep7MhQ4CLDRDEfSuoQd9qMl805AaGfjgg8R27FeP7e +a2xKNhnpOdNTYCr2rJaJvNdvjev00/sKJM8f36dllRYszF653vdWod9aIFi6yPIKlW2 9RBg== MIME-Version: 1.0 X-Received: by 10.194.71.39 with SMTP id r7mr25858512wju.120.1443911376587; Sat, 03 Oct 2015 15:29:36 -0700 (PDT) Sender: markjdb@gmail.com Received: by 10.194.151.137 with HTTP; Sat, 3 Oct 2015 15:29:36 -0700 (PDT) In-Reply-To: <20151003213311.GB57303@stack.nl> References: <201510031937.t93Jbgkk077518@repo.freebsd.org> <20151003213311.GB57303@stack.nl> Date: Sat, 3 Oct 2015 15:29:36 -0700 X-Google-Sender-Auth: UTJQQheHZ5TTeVJEp_cW0MklZaE Message-ID: Subject: Re: svn commit: r288628 - head/sys/kern From: Mark Johnston To: Jilles Tjoelker 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:29:39 -0000 On Sat, Oct 3, 2015 at 2:33 PM, Jilles Tjoelker wrote: > On Sat, Oct 03, 2015 at 07:37:42PM +0000, Mark Johnston wrote: >> Author: markj >> Date: Sat Oct 3 19:37:41 2015 >> New Revision: 288628 >> URL: https://svnweb.freebsd.org/changeset/base/288628 > >> Log: >> The return value of posix_fadvise(2) is just an error status, so >> sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() >> rather than setting a return value. > >> MFC after: 1 week > >> Modified: >> head/sys/kern/vfs_syscalls.c >> >> Modified: head/sys/kern/vfs_syscalls.c >> ============================================================================== >> --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) >> +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) >> @@ -4663,7 +4663,6 @@ int >> sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) >> { >> >> - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, >> - uap->len, uap->advice); >> - return (0); >> + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, >> + uap->advice)); >> } > > This change makes the code match the man page, but in fact, the code was > right and the man page is wrong. Per POSIX, posix_fadvise() shall return > 0 on success and an error number on failure, and need not modify errno. Oops, thank you. This is fixed in r288640; I updated the posix_fadvise man page to use the same wording as for posix_fallocate. > > Also, this kind of ABI change in general is almost always a bad idea > when the function is already part of a stable branch. Noted, thanks. From owner-svn-src-all@freebsd.org Sat Oct 3 22:33:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD46A0F697; Sat, 3 Oct 2015 22:33:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 202001C30; Sat, 3 Oct 2015 22:33:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MXju9051370; Sat, 3 Oct 2015 22:33:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MXjjs051369; Sat, 3 Oct 2015 22:33:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032233.t93MXjjs051369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288641 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:33:46 -0000 Author: adrian Date: Sat Oct 3 22:33:45 2015 New Revision: 288641 URL: https://svnweb.freebsd.org/changeset/base/288641 Log: run(4): fix WME support (untested). Now run(4) fetches parameters from ic->ic_wme.wme_params array, which is never initialized (and can be safely removed). This patch replaces &ic->ic_wme.wme_params with &ic->ic_wme.wme_chanParams.cap_wmeParams (contains parameters for local station; used by other drivers with WME support). Tested: * me: STA: run0: MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), address 38:83:45:11:78:ae Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:27:14 2015 (r288640) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:33:45 2015 (r288641) @@ -2162,7 +2162,8 @@ run_wme_update_cb(void *arg) { struct ieee80211com *ic = arg; struct run_softc *sc = ic->ic_softc; - struct ieee80211_wme_state *wmesp = &ic->ic_wme; + const struct wmeParams (*ac)[WME_NUM_AC] = + &ic->ic_wme.wme_chanParams.cap_wmeParams; int aci, error = 0; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2170,39 +2171,39 @@ run_wme_update_cb(void *arg) /* update MAC TX configuration registers */ for (aci = 0; aci < WME_NUM_AC; aci++) { error = run_write(sc, RT2860_EDCA_AC_CFG(aci), - wmesp->wme_params[aci].wmep_logcwmax << 16 | - wmesp->wme_params[aci].wmep_logcwmin << 12 | - wmesp->wme_params[aci].wmep_aifsn << 8 | - wmesp->wme_params[aci].wmep_txopLimit); + ac[aci]->wmep_logcwmax << 16 | + ac[aci]->wmep_logcwmin << 12 | + ac[aci]->wmep_aifsn << 8 | + ac[aci]->wmep_txopLimit); if (error) goto err; } /* update SCH/DMA registers too */ error = run_write(sc, RT2860_WMM_AIFSN_CFG, - wmesp->wme_params[WME_AC_VO].wmep_aifsn << 12 | - wmesp->wme_params[WME_AC_VI].wmep_aifsn << 8 | - wmesp->wme_params[WME_AC_BK].wmep_aifsn << 4 | - wmesp->wme_params[WME_AC_BE].wmep_aifsn); + ac[WME_AC_VO]->wmep_aifsn << 12 | + ac[WME_AC_VI]->wmep_aifsn << 8 | + ac[WME_AC_BK]->wmep_aifsn << 4 | + ac[WME_AC_BE]->wmep_aifsn); if (error) goto err; error = run_write(sc, RT2860_WMM_CWMIN_CFG, - wmesp->wme_params[WME_AC_VO].wmep_logcwmin << 12 | - wmesp->wme_params[WME_AC_VI].wmep_logcwmin << 8 | - wmesp->wme_params[WME_AC_BK].wmep_logcwmin << 4 | - wmesp->wme_params[WME_AC_BE].wmep_logcwmin); + ac[WME_AC_VO]->wmep_logcwmin << 12 | + ac[WME_AC_VI]->wmep_logcwmin << 8 | + ac[WME_AC_BK]->wmep_logcwmin << 4 | + ac[WME_AC_BE]->wmep_logcwmin); if (error) goto err; error = run_write(sc, RT2860_WMM_CWMAX_CFG, - wmesp->wme_params[WME_AC_VO].wmep_logcwmax << 12 | - wmesp->wme_params[WME_AC_VI].wmep_logcwmax << 8 | - wmesp->wme_params[WME_AC_BK].wmep_logcwmax << 4 | - wmesp->wme_params[WME_AC_BE].wmep_logcwmax); + ac[WME_AC_VO]->wmep_logcwmax << 12 | + ac[WME_AC_VI]->wmep_logcwmax << 8 | + ac[WME_AC_BK]->wmep_logcwmax << 4 | + ac[WME_AC_BE]->wmep_logcwmax); if (error) goto err; error = run_write(sc, RT2860_WMM_TXOP0_CFG, - wmesp->wme_params[WME_AC_BK].wmep_txopLimit << 16 | - wmesp->wme_params[WME_AC_BE].wmep_txopLimit); + ac[WME_AC_BK]->wmep_txopLimit << 16 | + ac[WME_AC_BE]->wmep_txopLimit); if (error) goto err; error = run_write(sc, RT2860_WMM_TXOP1_CFG, - wmesp->wme_params[WME_AC_VO].wmep_txopLimit << 16 | - wmesp->wme_params[WME_AC_VI].wmep_txopLimit); + ac[WME_AC_VO]->wmep_txopLimit << 16 | + ac[WME_AC_VI]->wmep_txopLimit); err: if (error) From owner-svn-src-all@freebsd.org Sat Oct 3 22:35:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70CB9A0F7F4; Sat, 3 Oct 2015 22:35:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439FF1DD9; Sat, 3 Oct 2015 22:35:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MZdGO051506; Sat, 3 Oct 2015 22:35:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MZcB8051503; Sat, 3 Oct 2015 22:35:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032235.t93MZcB8051503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288642 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:35:39 -0000 Author: adrian Date: Sat Oct 3 22:35:37 2015 New Revision: 288642 URL: https://svnweb.freebsd.org/changeset/base/288642 Log: rum(4): add WME support. Tested: * WUSB54GC, HOSTAP and STA modes. * Me: rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3700 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:35:37 2015 (r288642) @@ -169,7 +169,7 @@ static int rum_newstate(struct ieee8021 static uint8_t rum_crypto_mode(struct rum_softc *, u_int, int); static void rum_setup_tx_desc(struct rum_softc *, struct rum_tx_desc *, struct ieee80211_key *, - uint32_t, uint8_t, int, int, int); + uint32_t, uint8_t, uint8_t, int, int, int); static uint32_t rum_tx_crypto_flags(struct rum_softc *, struct ieee80211_node *, const struct ieee80211_key *); @@ -216,6 +216,9 @@ static void rum_get_tsf(struct rum_soft static void rum_update_slot_cb(struct rum_softc *, union sec_param *, uint8_t); static void rum_update_slot(struct ieee80211com *); +static void rum_wme_update_cb(struct rum_softc *, + union sec_param *, uint8_t); +static int rum_wme_update(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); static void rum_update_mcast(struct ieee80211com *); @@ -526,6 +529,7 @@ rum_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ + | IEEE80211_C_WME /* 802.11e */ ; ic->ic_cryptocaps = @@ -552,6 +556,7 @@ rum_attach(device_t self) ic->ic_vap_create = rum_vap_create; ic->ic_vap_delete = rum_vap_delete; ic->ic_updateslot = rum_update_slot; + ic->ic_wme.wme_update = rum_wme_update; ic->ic_update_mcast = rum_update_mcast; ieee80211_radiotap_attach(ic, @@ -1139,10 +1144,11 @@ rum_crypto_mode(struct rum_softc *sc, u_ static void rum_setup_tx_desc(struct rum_softc *sc, struct rum_tx_desc *desc, - struct ieee80211_key *k, uint32_t flags, uint8_t xflags, int hdrlen, - int len, int rate) + struct ieee80211_key *k, uint32_t flags, uint8_t xflags, uint8_t qid, + int hdrlen, int len, int rate) { struct ieee80211com *ic = &sc->sc_ic; + struct wmeParams *wmep = &sc->wme_params[qid]; uint16_t plcp_length; int remainder; @@ -1189,8 +1195,10 @@ rum_setup_tx_desc(struct rum_softc *sc, desc->hdrlen = hdrlen; desc->xflags = xflags; - desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | - RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); + desc->wme = htole16(RT2573_QID(qid) | + RT2573_AIFSN(wmep->wmep_aifsn) | + RT2573_LOGCWMIN(wmep->wmep_logcwmin) | + RT2573_LOGCWMAX(wmep->wmep_logcwmax)); } static int @@ -1236,7 +1244,7 @@ rum_sendprot(struct rum_softc *sc, data->m = mprot; data->ni = ieee80211_ref_node(ni); data->rate = protrate; - rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, 0, mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); @@ -1290,7 +1298,7 @@ rum_tx_mgt(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - uint8_t type, xflags = 0; + uint8_t ac, type, xflags = 0; int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1302,6 +1310,7 @@ rum_tx_mgt(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); + ac = M_WME_GETAC(m0); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_get_txkey(ni, m0); @@ -1341,7 +1350,7 @@ rum_tx_mgt(struct rum_softc *sc, struct data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, ac, hdrlen, m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", @@ -1361,7 +1370,7 @@ rum_tx_raw(struct rum_softc *sc, struct struct ieee80211_frame *wh; struct rum_tx_data *data; uint32_t flags; - uint8_t type, xflags = 0; + uint8_t ac, type, xflags = 0; int rate, error; RUM_LOCK_ASSERT(sc); @@ -1369,6 +1378,8 @@ rum_tx_raw(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + ac = params->ibp_pri & 3; + rate = params->ibp_rate0; if (!ieee80211_isratevalid(ic->ic_rt, rate)) return (EINVAL); @@ -1399,7 +1410,7 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, 0, + rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, ac, 0, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", @@ -1422,7 +1433,7 @@ rum_tx_data(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - uint8_t type, xflags = 0; + uint8_t ac, type, qos, xflags = 0; int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); @@ -1431,6 +1442,12 @@ rum_tx_data(struct rum_softc *sc, struct type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); + if (IEEE80211_QOS_HAS_SEQ(wh)) + qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + else + qos = 0; + ac = M_WME_GETAC(m0); + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) rate = tp->mcastrate; @@ -1487,14 +1504,17 @@ rum_tx_data(struct rum_softc *sc, struct data->rate = rate; if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - flags |= RT2573_TX_NEED_ACK; + /* Unicast frame, check if an ACK is expected. */ + if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK) + flags |= RT2573_TX_NEED_ACK; - dur = ieee80211_ack_duration(ic->ic_rt, rate, + dur = ieee80211_ack_duration(ic->ic_rt, rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, ac, hdrlen, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", @@ -2064,6 +2084,65 @@ rum_update_slot(struct ieee80211com *ic) } static void +rum_wme_update_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) +{ + const struct wmeParams (*chanp)[WME_NUM_AC] = &data->wme_params; + int error = 0; + + error = rum_write(sc, RT2573_AIFSN_CSR, + chanp[WME_AC_VO]->wmep_aifsn << 12 | + chanp[WME_AC_VI]->wmep_aifsn << 8 | + chanp[WME_AC_BK]->wmep_aifsn << 4 | + chanp[WME_AC_BE]->wmep_aifsn); + if (error) + goto print_err; + error = rum_write(sc, RT2573_CWMIN_CSR, + chanp[WME_AC_VO]->wmep_logcwmin << 12 | + chanp[WME_AC_VI]->wmep_logcwmin << 8 | + chanp[WME_AC_BK]->wmep_logcwmin << 4 | + chanp[WME_AC_BE]->wmep_logcwmin); + if (error) + goto print_err; + error = rum_write(sc, RT2573_CWMAX_CSR, + chanp[WME_AC_VO]->wmep_logcwmax << 12 | + chanp[WME_AC_VI]->wmep_logcwmax << 8 | + chanp[WME_AC_BK]->wmep_logcwmax << 4 | + chanp[WME_AC_BE]->wmep_logcwmax); + if (error) + goto print_err; + error = rum_write(sc, RT2573_TXOP01_CSR, + chanp[WME_AC_BK]->wmep_txopLimit << 16 | + chanp[WME_AC_BE]->wmep_txopLimit); + if (error) + goto print_err; + error = rum_write(sc, RT2573_TXOP23_CSR, + chanp[WME_AC_VO]->wmep_txopLimit << 16 | + chanp[WME_AC_VI]->wmep_txopLimit); + if (error) + goto print_err; + + memcpy(sc->wme_params, chanp, sizeof(*chanp) * WME_NUM_AC); + + return; + +print_err: + device_printf(sc->sc_dev, "%s: WME update failed, error %d\n", + __func__, error); +} + +static int +rum_wme_update(struct ieee80211com *ic) +{ + struct rum_softc *sc = ic->ic_softc; + const struct wmeParams (*chanp)[WME_NUM_AC] = + &ic->ic_wme.wme_chanParams.cap_wmeParams; + + rum_cmd_sleepable(sc, chanp, sizeof (*chanp), 0, rum_wme_update_cb); + + return (0); +} + +static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { @@ -2288,6 +2367,11 @@ rum_init(struct rum_softc *sc) for (i = 0; i < nitems(rum_def_mac); i++) rum_write(sc, rum_def_mac[i].reg, rum_def_mac[i].val); + /* reset some WME parameters to default values */ + sc->wme_params[0].wmep_aifsn = 2; + sc->wme_params[0].wmep_logcwmin = 4; + sc->wme_params[0].wmep_logcwmax = 10; + /* set host ready */ rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); @@ -2431,7 +2515,7 @@ rum_set_beacon(struct rum_softc *sc, str tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, NULL, RT2573_TX_TIMESTAMP, - RT2573_TX_HWSEQ, 0, m->m_pkthdr.len, tp->mgmtrate); + RT2573_TX_HWSEQ, 0, 0, m->m_pkthdr.len, tp->mgmtrate); /* copy the Tx descriptor into NIC memory */ if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:35:37 2015 (r288642) @@ -39,6 +39,8 @@ #define RT2573_AIFSN_CSR 0x0400 #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 +#define RT2573_TXOP01_CSR 0x040C +#define RT2573_TXOP23_CSR 0x0410 #define RT2573_MCU_CODE_BASE 0x0800 /* Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:35:37 2015 (r288642) @@ -73,6 +73,7 @@ typedef STAILQ_HEAD(, rum_tx_data) rum_t union sec_param { struct ieee80211_key key; + struct wmeParams wme_params[WME_NUM_AC]; uint8_t macaddr[IEEE80211_ADDR_LEN]; struct ieee80211vap *vap; }; @@ -138,6 +139,7 @@ struct rum_softc { sc_clr_shkeys:1; uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + struct wmeParams wme_params[WME_NUM_AC]; uint8_t vap_key_count[1]; uint64_t keys_bmap; From owner-svn-src-all@freebsd.org Sat Oct 3 22:38:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C85CA0F99E; Sat, 3 Oct 2015 22:38:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A7AA1F70; Sat, 3 Oct 2015 22:38:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Mc9Ua051655; Sat, 3 Oct 2015 22:38:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Mc9QB051654; Sat, 3 Oct 2015 22:38:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032238.t93Mc9QB051654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288643 - 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.20 Precedence: list List-Id: "SVN commit messages 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, 03 Oct 2015 22:38:09 -0000 Author: adrian Date: Sat Oct 3 22:38:08 2015 New Revision: 288643 URL: https://svnweb.freebsd.org/changeset/base/288643 Log: net80211: reduce code duplication in the ieee80211_ioctl_setwmeparam() + fix comments. Submitted by: Differential Revision: https://reviews.freebsd.org/D3701 Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sat Oct 3 22:35:37 2015 (r288642) +++ head/sys/net80211/ieee80211_ioctl.c Sat Oct 3 22:38:08 2015 (r288643) @@ -957,7 +957,7 @@ ieee80211_ioctl_get80211(struct ieee8021 case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ - case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ + case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only) */ error = ieee80211_ioctl_getwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: @@ -1757,13 +1757,14 @@ ieee80211_ioctl_setwmeparam(struct ieee8 struct ieee80211com *ic = vap->iv_ic; struct ieee80211_wme_state *wme = &ic->ic_wme; struct wmeParams *wmep, *chanp; - int isbss, ac; + int isbss, ac, aggrmode; if ((ic->ic_caps & IEEE80211_C_WME) == 0) return EOPNOTSUPP; isbss = (ireq->i_len & IEEE80211_WMEPARAM_BSS); ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL); + aggrmode = (wme->wme_flags & WME_F_AGGRMODE); if (ac >= WME_NUM_AC) ac = WME_AC_BE; if (isbss) { @@ -1775,47 +1776,28 @@ ieee80211_ioctl_setwmeparam(struct ieee8 } switch (ireq->i_type) { case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ - if (isbss) { - wmep->wmep_logcwmin = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_logcwmin = ireq->i_val; - } else { - wmep->wmep_logcwmin = chanp->wmep_logcwmin = - ireq->i_val; - } + wmep->wmep_logcwmin = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_logcwmin = ireq->i_val; break; case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ - if (isbss) { - wmep->wmep_logcwmax = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_logcwmax = ireq->i_val; - } else { - wmep->wmep_logcwmax = chanp->wmep_logcwmax = - ireq->i_val; - } + wmep->wmep_logcwmax = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_logcwmax = ireq->i_val; break; case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ - if (isbss) { - wmep->wmep_aifsn = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_aifsn = ireq->i_val; - } else { - wmep->wmep_aifsn = chanp->wmep_aifsn = ireq->i_val; - } + wmep->wmep_aifsn = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_aifsn = ireq->i_val; break; case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ - if (isbss) { - wmep->wmep_txopLimit = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_txopLimit = ireq->i_val; - } else { - wmep->wmep_txopLimit = chanp->wmep_txopLimit = - ireq->i_val; - } + wmep->wmep_txopLimit = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_txopLimit = ireq->i_val; break; case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ wmep->wmep_acm = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) + if (!aggrmode) chanp->wmep_acm = ireq->i_val; break; case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/ @@ -2945,7 +2927,7 @@ ieee80211_ioctl_set80211(struct ieee8021 case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ - case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ + case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only) */ error = ieee80211_ioctl_setwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: