From owner-svn-src-stable@freebsd.org Sun Aug 21 04:59:28 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB1D2BB99D7; Sun, 21 Aug 2016 04:59:28 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f07:14d3:2::11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 967691C4B; Sun, 21 Aug 2016 04:59:28 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (thor.farley.org [IPv6:2001:470:1f07:14d3:1:0:0:5]) by mail.farley.org (8.15.2/8.15.2) with ESMTP id u7L4xKuS090423; Sun, 21 Aug 2016 00:59:20 -0400 (EDT) (envelope-from scf@FreeBSD.org) Date: Sun, 21 Aug 2016 00:59:54 -0400 (EDT) From: "Sean C. Farley" To: Alexander Motin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r304425 - stable/10/usr.sbin/bhyve In-Reply-To: <201608181156.u7IBu7OL054695@repo.freebsd.org> Message-ID: References: <201608181156.u7IBu7OL054695@repo.freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail.farley.org Content-Type: text/plain; format=flowed; charset=US-ASCII Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 04:59:28 -0000 On Thu, 18 Aug 2016, Alexander Motin wrote: > Author: mav > Date: Thu Aug 18 11:56:07 2016 > New Revision: 304425 > URL: https://svnweb.freebsd.org/changeset/base/304425 > > Log: > MFC r302504, r302666, r302668, r302932, r302933: > Add emulation for Intel e1000 (e82545) network adapter. > > The code was successfully tested with FreeBSD, Linux, Solaris and Windows > guests. This interface is predictably slower (about 2x) then virtio-net, > but it is very helpful for guests not supporting virtio-net by default. > > Thanks to Jeremiah Lott and Peter Grehan for doing original heavy lifting. > > Added: > stable/10/usr.sbin/bhyve/pci_e82545.c > - copied, changed from r302504, head/usr.sbin/bhyve/pci_e82545.c > Modified: > stable/10/usr.sbin/bhyve/Makefile > stable/10/usr.sbin/bhyve/bhyve.8 > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/usr.sbin/bhyve/Makefile > ============================================================================== > --- stable/10/usr.sbin/bhyve/Makefile Thu Aug 18 11:51:14 2016 (r304424) > +++ stable/10/usr.sbin/bhyve/Makefile Thu Aug 18 11:56:07 2016 (r304425) > @@ -23,6 +23,7 @@ SRCS= \ > mevent.c \ > mptbl.c \ > pci_ahci.c \ > + pci_e82545.c \ > pci_emul.c \ > pci_hostbridge.c \ > pci_irq.c \ > @@ -48,6 +49,10 @@ SRCS+= vmm_instruction_emul.c > DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} > LDADD= -lvmmapi -lmd -lutil -lpthread > > +CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/e1000 > +CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/mii > +CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/usb/controller > + > WARNS?= 2 > > .include Alexander, The MFC is a tiny bit incomplete. I cannot build stable/10 world since BHYVE_SYSDIR is not defined in the usr.sbin/bhyve/Makefile as it is in HEAD. The issue was only noticed because I do not have the source tree in /usr/src. I presume the symlink that exists for /sys to usr/src/sys masks this for most people. ------------------------------------------------ ===> usr.sbin/bhyve (depend) rm -f .depend CC='cc ' mkdep -f .depend -a -I/sys/dev/e1000 -I/sys/dev/mii -I/sys/dev/usb/controller -std=gnu99 /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/atkbdc.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/acpi.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/bhyverun.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/block_if.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/bootrom.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/consport.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/dbgport.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/fwctl.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/inout.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/ioapic.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/mem.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/mevent.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/mptbl.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_ahci.c /usr/FreeBSD/branches/stable/10/src/usr.sb! in/bhyve/pci_e82545.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_emul.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_hostbridge.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_irq.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_lpc.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_passthru.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_virtio_block.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_virtio_net.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_virtio_rnd.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_uart.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pm.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/post.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/rtc.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/smbiostbl.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/task_switch.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/uart_emul.c /usr/FreeBSD/branc! hes/stable/10/src/usr.sbin/bhyve/virtio.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/xmsr.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/spinup_ap.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/../../sys/amd64/vmm/vmm_instruction_emul.c /usr/FreeBSD/branches/stable/10/src/usr.sbin/bhyve/pci_e82545.c:51:10: fatal error: 'e1000_regs.h' file not found #include "e1000_regs.h" ^ 1 error generated. mkdep: compile failed *** [.depend] Error code 1 ------------------------------------------------ This missing line completes the build, but I do not know if anything else needs merging. The missing merge to the .PATH variable did not appear to affect the buildworld. + BHYVE_SYSDIR?=${SRCTOP} Thank you. Sean -- scf@FreeBSD.org From owner-svn-src-stable@freebsd.org Sun Aug 21 05:08:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C1BFBB9C76; Sun, 21 Aug 2016 05:08:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC8231283; Sun, 21 Aug 2016 05:08:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7L58bv8017166; Sun, 21 Aug 2016 05:08:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7L58bAF017165; Sun, 21 Aug 2016 05:08:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608210508.u7L58bAF017165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 21 Aug 2016 05:08: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: r304553 - stable/10/lib/libc/tests/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 05:08:39 -0000 Author: ngie Date: Sun Aug 21 05:08:37 2016 New Revision: 304553 URL: https://svnweb.freebsd.org/changeset/base/304553 Log: Unbreak the build when MK_TESTS != no after r304527 - src.opts.mk should be bsd.own.mk on ^/stable/10 - LIBADD should be DPADD/LDADD on ^/stable/10 Pointyhat to: kib Reported by: Olivier Pinter Sponsored by: EMC / Isilon Storage Division Modified: stable/10/lib/libc/tests/stdlib/Makefile Modified: stable/10/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/10/lib/libc/tests/stdlib/Makefile Sun Aug 21 00:48:41 2016 (r304552) +++ stable/10/lib/libc/tests/stdlib/Makefile Sun Aug 21 05:08:37 2016 (r304553) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include ATF_TESTS_C+= heapsort_test ATF_TESTS_C+= mergesort_test @@ -42,7 +42,8 @@ CFLAGS+= -I${.CURDIR} CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 -LIBADD.cxa_thread_atexit_test+= pthread +DPADD.cxa_thread_atexit_test+= ${LIBPTHREAD} +LDADD.cxa_thread_atexit_test+= -lpthread .for t in h_getopt h_getopt_long CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests From owner-svn-src-stable@freebsd.org Sun Aug 21 05:09:14 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 149A4BB9CE8; Sun, 21 Aug 2016 05:09:14 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1D2A13D3; Sun, 21 Aug 2016 05:09:13 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x242.google.com with SMTP id hh10so5907691pac.1; Sat, 20 Aug 2016 22:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=6ZbmGxsgsXtpmBfY/xgkXhKY2QbeIZFZoNyiskVje2Q=; b=Pa8mpUD4EZJi7nApq7wCEGb5FkjeCPdCYvpt6gO5Rlt9QAaxfa3GVNVFLNolClCXuF 7UEDprn7TCKbOWbL4kv0+TjcV3Hatbyav2/kmMUZSPFT3GEJDFNA3nJHhpTQS83vZHAL EBIrwO3xgg7M4E56JnPxT6ih3KCDt+F32TtgwloteXAA5BFEERhFxiVD+2vmOvvwkLhM VpkCHvxZUk4qJKAMKE9ITITvT9wl9qe88cu7NZgnCzh4U5IULqItInP92KoxICs+q+9P 8/Vozu2z1b+OlYz5BPlrKK6OZANvHTXnQFC4wF3KfnZ+rFMBvwUMmKtnU4p96qvajyoY BN8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=6ZbmGxsgsXtpmBfY/xgkXhKY2QbeIZFZoNyiskVje2Q=; b=CVE8+SYN+Ym+32xdUtB0063kdJIFiuBmJ4y/t8aC3YrL3XB5sVVU5GTpmpWumhv0kP A2Kl0IFZJ8TjzVFn+MO5gWUy0BpIznMjr0GB7uCYhhADoEWALALrMMT3bDpJgEJGALUO Y1nOot4Ty/ciMleqkV1VPj0EVkBvC7yXjSiWk/UqQXk+UgBUaVJrkWvlLaUqjAF6u23h 0GuVfDSQ9ZSmK6fARZW6oFn4Q7zE7Hig2+JopyYy4dY92LOKBall/qOb3Ni+n3OO+/FY F1LblCnRQty2DtwMSoMutN0XNE9b2VD/sVk3891PQ2jF9v1Bqy2upM+3QSvdSfozivQ7 zUQA== X-Gm-Message-State: AEkooush8Pf/syc4EAXn6qVdCL6j0ZzjxDYmd8JMo2O1pXMX8Vp48tSI/vAr1y/pZGOnkA== X-Received: by 10.66.53.234 with SMTP id e10mr29929590pap.28.1471756153516; Sat, 20 Aug 2016 22:09:13 -0700 (PDT) Received: from [192.168.20.17] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id 75sm17487120pfw.92.2016.08.20.22.09.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Aug 2016 22:09:12 -0700 (PDT) Subject: Re: svn commit: r304527 - in stable/10/lib: libc/include libc/stdlib libc/tests/stdlib libthr/thread Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_F981A297-B13D-4D57-999D-F8AE4F27D919"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Sat, 20 Aug 2016 22:09:10 -0700 Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <0FE46453-7A2A-4D5E-9C93-728651BE1799@gmail.com> References: <201608201226.u7KCQiV6044715@repo.freebsd.org> To: Oliver Pinter X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 05:09:14 -0000 --Apple-Mail=_F981A297-B13D-4D57-999D-F8AE4F27D919 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 20, 2016, at 16:50, Oliver Pinter = wrote: >=20 > And an updated version of the fix. Fixed in r304553 =E2=80=94 thanks! -Ngie --Apple-Mail=_F981A297-B13D-4D57-999D-F8AE4F27D919 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXuTd3AAoJEPWDqSZpMIYVfYUQAJaFkKiSgZc9P2+vbI8/dCgl DicXVs5wtZ+4ytGI4BSPkZaXVH4fIGrZBgKCI1pQ2srmiR3Yle+Zm9hJ8kzNcZpJ 0J6uHcyEiyYmG5v1jAWnSiiYXUKtouHsdOqHz4fxq7pWzv8ve3uqRjQEKd56+vaB 9buPbf8emhQuR1z4b/GJzmur/5bqiAkDCF4aUjCxgDQxhHwC8XeZ6lYu6maWviuo 9GJrIy2va8KatPQEPl96i/SVFQk5ObvRsinXhALvnQtTIpyUpdpOQSJDxKfzWo0h NMcX+I4LRgOdHEHvDnhbF5HqhZ96gYD0qot7Ed24YcwmfvpDfI4tRTA+XLebU4Kx awu0dq2W0eT5EXJqBF+TTbGBIVMxdhuMMyEJd4/5PL5hsQcqjF5d1IUiAhlG1Fyh df9uTTFoXGETgdkwx36u3kKJrH3MS3abeuISz99bnXB45QNDg5YDoqZTb7RtORgm kJFz+bzFXTLSxcB1AmPA8KU1VUIvL0L42oDvQvclIv7eUxDxm085Au43cOyDxwHX fJxUSpomRkwAp63eMckHGIP/uaBwRYA5iHX2vDOEItf8T6LbpRRnvEv9TyVh74Ii Z8aWTdkTROtW2qx238l4EFoWKyAPMX5GNciTGtQMN6nJU4hYC+QFdXEvR6W0Wsx3 JWYI9sH6a/pruRMIWkcO =XNb8 -----END PGP SIGNATURE----- --Apple-Mail=_F981A297-B13D-4D57-999D-F8AE4F27D919-- From owner-svn-src-stable@freebsd.org Sun Aug 21 15:45:13 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 546D0BC0DEF; Sun, 21 Aug 2016 15:45:13 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26EF61EE0; Sun, 21 Aug 2016 15:45:13 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7LFjCID056452; Sun, 21 Aug 2016 15:45:12 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7LFjCTv056451; Sun, 21 Aug 2016 15:45:12 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201608211545.u7LFjCTv056451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 21 Aug 2016 15:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304562 - stable/11/sys/arm/allwinner X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 15:45:13 -0000 Author: manu Date: Sun Aug 21 15:45:12 2016 New Revision: 304562 URL: https://svnweb.freebsd.org/changeset/base/304562 Log: MFC r304077: Correct the size of the softc in a10_ehci Reported by: andrew Modified: stable/11/sys/arm/allwinner/a10_ehci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10_ehci.c ============================================================================== --- stable/11/sys/arm/allwinner/a10_ehci.c Sun Aug 21 15:41:19 2016 (r304561) +++ stable/11/sys/arm/allwinner/a10_ehci.c Sun Aug 21 15:45:12 2016 (r304562) @@ -360,7 +360,7 @@ static device_method_t ehci_methods[] = static driver_t ehci_driver = { .name = "ehci", .methods = ehci_methods, - .size = sizeof(ehci_softc_t), + .size = sizeof(struct aw_ehci_softc), }; static devclass_t ehci_devclass; From owner-svn-src-stable@freebsd.org Sun Aug 21 17:26:17 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95B07BC09B7; Sun, 21 Aug 2016 17:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E62E1CE4; Sun, 21 Aug 2016 17:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7LHQGgN094403; Sun, 21 Aug 2016 17:26:16 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7LHQGed094401; Sun, 21 Aug 2016 17:26:16 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608211726.u7LHQGed094401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 21 Aug 2016 17:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304568 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 17:26:17 -0000 Author: ae Date: Sun Aug 21 17:26:16 2016 New Revision: 304568 URL: https://svnweb.freebsd.org/changeset/base/304568 Log: MFC r304313: Teach netisr_get_cpuid() to limit a given value to supported by netisr. Use netisr_get_cpuid() in netisr_select_cpuid() to limit cpuid value returned by protocol to be sure that it is not greather than nws_count. PR: 211836 Modified: stable/11/sys/net/if_epair.c stable/11/sys/net/netisr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_epair.c ============================================================================== --- stable/11/sys/net/if_epair.c Sun Aug 21 16:06:00 2016 (r304567) +++ stable/11/sys/net/if_epair.c Sun Aug 21 17:26:16 2016 (r304568) @@ -807,9 +807,9 @@ epair_clone_create(struct if_clone *ifc, * cache locality but we can at least allow parallelism. */ sca->cpuid = - netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount()); + netisr_get_cpuid(sca->ifp->if_index); scb->cpuid = - netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount()); + netisr_get_cpuid(scb->ifp->if_index); /* Initialise pseudo media types. */ ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status); Modified: stable/11/sys/net/netisr.c ============================================================================== --- stable/11/sys/net/netisr.c Sun Aug 21 16:06:00 2016 (r304567) +++ stable/11/sys/net/netisr.c Sun Aug 21 17:26:16 2016 (r304568) @@ -272,10 +272,7 @@ u_int netisr_get_cpuid(u_int cpunumber) { - KASSERT(cpunumber < nws_count, ("%s: %u > %u", __func__, cpunumber, - nws_count)); - - return (nws_array[cpunumber]); + return (nws_array[cpunumber % nws_count]); } /* @@ -810,10 +807,12 @@ netisr_select_cpuid(struct netisr_proto * dispatch. In the queued case, fall back on the SOURCE * policy. */ - if (*cpuidp != NETISR_CPUID_NONE) + if (*cpuidp != NETISR_CPUID_NONE) { + *cpuidp = netisr_get_cpuid(*cpuidp); return (m); + } if (dispatch_policy == NETISR_DISPATCH_HYBRID) { - *cpuidp = curcpu; + *cpuidp = netisr_get_cpuid(curcpu); return (m); } policy = NETISR_POLICY_SOURCE; From owner-svn-src-stable@freebsd.org Sun Aug 21 17:57:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7CD4BC10BB; Sun, 21 Aug 2016 17:57:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96F7219CF; Sun, 21 Aug 2016 17:57:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7LHvWIf006032; Sun, 21 Aug 2016 17:57:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7LHvWQg006031; Sun, 21 Aug 2016 17:57:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201608211757.u7LHvWQg006031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Aug 2016 17:57: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: r304569 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 17:57:33 -0000 Author: mav Date: Sun Aug 21 17:57:32 2016 New Revision: 304569 URL: https://svnweb.freebsd.org/changeset/base/304569 Log: MFC r298355: Don't use SYSDIR to avoid conflicts with existing usage. Also, use SRCTOP to locate the top of the source tree instead of a relative path. PR: 208856 Modified: stable/10/usr.sbin/bhyve/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/Makefile ============================================================================== --- stable/10/usr.sbin/bhyve/Makefile Sun Aug 21 17:26:16 2016 (r304568) +++ stable/10/usr.sbin/bhyve/Makefile Sun Aug 21 17:57:32 2016 (r304569) @@ -8,6 +8,8 @@ DEBUG_FLAGS= -g -O0 MAN= bhyve.8 +BHYVE_SYSDIR?=${SRCTOP} + SRCS= \ atkbdc.c \ acpi.c \ @@ -43,7 +45,7 @@ SRCS= \ xmsr.c \ spinup_ap.c -.PATH: ${.CURDIR}/../../sys/amd64/vmm +.PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c DPADD= ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} From owner-svn-src-stable@freebsd.org Sun Aug 21 20:25:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBA55BC1912; Sun, 21 Aug 2016 20:25:22 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f07:14d3:2::11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B1C91B88; Sun, 21 Aug 2016 20:25:22 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (thor.farley.org [IPv6:2001:470:1f07:14d3:1:0:0:5]) by mail.farley.org (8.15.2/8.15.2) with ESMTP id u7LKPFfp005172; Sun, 21 Aug 2016 16:25:15 -0400 (EDT) (envelope-from scf@FreeBSD.org) Date: Sun, 21 Aug 2016 16:25:49 -0400 (EDT) From: "Sean C. Farley" To: Alexander Motin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r304569 - stable/10/usr.sbin/bhyve In-Reply-To: <201608211757.u7LHvWQg006031@repo.freebsd.org> Message-ID: References: <201608211757.u7LHvWQg006031@repo.freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail.farley.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 20:25:23 -0000 On Sun, 21 Aug 2016, Alexander Motin wrote: > Author: mav > Date: Sun Aug 21 17:57:32 2016 > New Revision: 304569 > URL: https://svnweb.freebsd.org/changeset/base/304569 > > Log: > MFC r298355: > Don't use SYSDIR to avoid conflicts with existing usage. > Also, use SRCTOP to locate the top of the source tree > instead of a relative path. > > PR: 208856 Thanks! Sean -- scf@FreeBSD.org From owner-svn-src-stable@freebsd.org Mon Aug 22 02:11:32 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DECABC155A; Mon, 22 Aug 2016 02:11:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDE313E6; Mon, 22 Aug 2016 02:11:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M2BVHk088021; Mon, 22 Aug 2016 02:11:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M2BVBr088019; Mon, 22 Aug 2016 02:11:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608220211.u7M2BVBr088019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 22 Aug 2016 02:11: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: r304581 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 02:11:32 -0000 Author: sephe Date: Mon Aug 22 02:11:30 2016 New Revision: 304581 URL: https://svnweb.freebsd.org/changeset/base/304581 Log: MFC 304251 hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error. SRB status is set to 0x20 by the hypervisor, if the specified LUN is unaccessible, and even worse the INQUIRY response will not be set by the hypervisor at all under this situation. Additionally, SRB status is 0x20 too, for TUR on an unaccessible LUN. Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by Scott Long, other values seems improper. This commit fixes the Hyper-V disk hotplug support. Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7521 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 01:46:04 2016 (r304580) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 02:11:30 2016 (r304581) @@ -810,6 +810,7 @@ hv_storvsc_on_iocompletion(struct storvs * because the fields will be used later in storvsc_io_done(). */ request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status; + request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status; request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && @@ -1945,28 +1946,6 @@ create_storvsc_request(union ccb *ccb, s return(0); } -/* - * SCSI Inquiry checks qualifier and type. - * If qualifier is 011b, means the device server is not capable - * of supporting a peripheral device on this logical unit, and - * the type should be set to 1Fh. - * - * Return 1 if it is valid, 0 otherwise. - */ -static inline int -is_inquiry_valid(const struct scsi_inquiry_data *inq_data) -{ - uint8_t type; - if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) { - return (0); - } - type = SID_TYPE(inq_data); - if (type == T_NODEVICE) { - return (0); - } - return (1); -} - /** * @brief completion function before returning to CAM * @@ -1985,7 +1964,6 @@ storvsc_io_done(struct hv_storvsc_reques struct vmscsi_req *vm_srb = &reqp->vstor_packet.u.vm_srb; bus_dma_segment_t *ori_sglist = NULL; int ori_sg_count = 0; - /* destroy bounce buffer if it is used */ if (reqp->bounce_sgl_count) { ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; @@ -2040,88 +2018,71 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - /* - * Check whether the data for INQUIRY cmd is valid or - * not. Windows 10 and Windows 2016 send all zero - * inquiry data to VM even for unpopulated slots. - */ + + if (vm_srb->srb_status != SRB_STATUS_SUCCESS) { + if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) { + xpt_print(ccb->ccb_h.path, "invalid LUN %d\n", + vm_srb->lun); + } else { + xpt_print(ccb->ccb_h.path, "Unknown SRB flag: %d\n", + vm_srb->srb_status); + } + /* + * If there are errors, for example, invalid LUN, + * host will inform VM through SRB status. + */ + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; + } else { + ccb->ccb_h.status |= CAM_REQ_CMP; + } + cmd = (const struct scsi_generic *) ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (cmd->opcode == INQUIRY) { - /* - * The host of Windows 10 or 2016 server will response - * the inquiry request with invalid data for unexisted device: - [0x7f 0x0 0x5 0x2 0x1f ... ] - * But on windows 2012 R2, the response is: - [0x7f 0x0 0x0 0x0 0x0 ] - * That is why here wants to validate the inquiry response. - * The validation will skip the INQUIRY whose response is short, - * which is less than SHORT_INQUIRY_LENGTH (36). - * - * For more information about INQUIRY, please refer to: - * ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf - */ - struct scsi_inquiry_data *inq_data = - (struct scsi_inquiry_data *)csio->data_ptr; - uint8_t* resp_buf = (uint8_t*)csio->data_ptr; - /* Get the buffer length reported by host */ - int resp_xfer_len = vm_srb->transfer_len; - /* Get the available buffer length */ - int resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; - int data_len = (resp_buf_len < resp_xfer_len) ? resp_buf_len : resp_xfer_len; - if (data_len < SHORT_INQUIRY_LENGTH) { - ccb->ccb_h.status |= CAM_REQ_CMP; - if (bootverbose && data_len >= 5) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc skips the validation for short inquiry (%d)" - " [%x %x %x %x %x]\n", - data_len,resp_buf[0],resp_buf[1],resp_buf[2], - resp_buf[3],resp_buf[4]); - mtx_unlock(&sc->hs_lock); - } - } else if (is_inquiry_valid(inq_data) == 0) { - ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + struct scsi_inquiry_data *inq_data = + (struct scsi_inquiry_data *)csio->data_ptr; + uint8_t *resp_buf = (uint8_t *)csio->data_ptr; + int resp_xfer_len, resp_buf_len, data_len; + + /* Get the buffer length reported by host */ + resp_xfer_len = vm_srb->transfer_len; + /* Get the available buffer length */ + resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; + data_len = (resp_buf_len < resp_xfer_len) ? + resp_buf_len : resp_xfer_len; + if (bootverbose && data_len >= 5) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc uninstalled invalid device" - " [%x %x %x %x %x]\n", - resp_buf[0],resp_buf[1],resp_buf[2],resp_buf[3],resp_buf[4]); - mtx_unlock(&sc->hs_lock); + xpt_print(ccb->ccb_h.path, "storvsc inquiry " + "(%d) [%x %x %x %x %x ... ]\n", data_len, + resp_buf[0], resp_buf[1], resp_buf[2], + resp_buf[3], resp_buf[4]); } - } else { - char vendor[16]; - cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), - sizeof(vendor)); - /** - * XXX: upgrade SPC2 to SPC3 if host is WIN8 or WIN2012 R2 - * in order to support UNMAP feature - */ - if (!strncmp(vendor,"Msft",4) && - SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 && - (vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8_1 || - vmstor_proto_version== VMSTOR_PROTOCOL_VERSION_WIN8)) { - inq_data->version = SCSI_REV_SPC3; - if (bootverbose) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc upgrades SPC2 to SPC3\n"); - mtx_unlock(&sc->hs_lock); + if (vm_srb->srb_status == SRB_STATUS_SUCCESS && + data_len > SHORT_INQUIRY_LENGTH) { + char vendor[16]; + + cam_strvis(vendor, inq_data->vendor, + sizeof(inq_data->vendor), sizeof(vendor)); + + /* + * XXX: Upgrade SPC2 to SPC3 if host is WIN8 or + * WIN2012 R2 in order to support UNMAP feature. + */ + if (!strncmp(vendor, "Msft", 4) && + SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 && + (vmstor_proto_version == + VMSTOR_PROTOCOL_VERSION_WIN8_1 || + vmstor_proto_version == + VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + xpt_print(ccb->ccb_h.path, + "storvsc upgrades " + "SPC2 to SPC3\n"); + } } } - ccb->ccb_h.status |= CAM_REQ_CMP; - if (bootverbose) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc has passed inquiry response (%d) validation\n", - data_len); - mtx_unlock(&sc->hs_lock); - } - } - } else { - ccb->ccb_h.status |= CAM_REQ_CMP; } } else { mtx_lock(&sc->hs_lock); Modified: stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 22 01:46:04 2016 (r304580) +++ stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 22 02:11:30 2016 (r304581) @@ -249,9 +249,9 @@ struct vstor_packet { /** * SRB Status Masks (can be combined with above status codes) */ -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - +#define SRB_STATUS_QUEUE_FROZEN 0x40 +#define SRB_STATUS_AUTOSENSE_VALID 0x80 +#define SRB_STATUS_INVALID_LUN 0X20 /** * Packet flags From owner-svn-src-stable@freebsd.org Mon Aug 22 02:23:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EB55BC1956; Mon, 22 Aug 2016 02:23:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00CF5197B; Mon, 22 Aug 2016 02:23:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M2N6Og094639; Mon, 22 Aug 2016 02:23:06 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M2N6dx094637; Mon, 22 Aug 2016 02:23:06 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608220223.u7M2N6dx094637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 22 Aug 2016 02:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304582 - stable/11/sys/dev/hyperv/storvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 02:23:07 -0000 Author: sephe Date: Mon Aug 22 02:23:05 2016 New Revision: 304582 URL: https://svnweb.freebsd.org/changeset/base/304582 Log: MFC 304251 hyperv/storvsc: Deliver CAM_SEL_TIMEOUT upon SRB status error. SRB status is set to 0x20 by the hypervisor, if the specified LUN is unaccessible, and even worse the INQUIRY response will not be set by the hypervisor at all under this situation. Additionally, SRB status is 0x20 too, for TUR on an unaccessible LUN. Deliver CAM_SEL_TIMEOUT to CAM upon SRB status errors as suggested by Scott Long, other values seems improper. This commit fixes the Hyper-V disk hotplug support. Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7521 Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 02:11:30 2016 (r304581) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 22 02:23:05 2016 (r304582) @@ -810,6 +810,7 @@ hv_storvsc_on_iocompletion(struct storvs * because the fields will be used later in storvsc_io_done(). */ request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status; + request->vstor_packet.u.vm_srb.srb_status = vm_srb->srb_status; request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && @@ -1945,28 +1946,6 @@ create_storvsc_request(union ccb *ccb, s return(0); } -/* - * SCSI Inquiry checks qualifier and type. - * If qualifier is 011b, means the device server is not capable - * of supporting a peripheral device on this logical unit, and - * the type should be set to 1Fh. - * - * Return 1 if it is valid, 0 otherwise. - */ -static inline int -is_inquiry_valid(const struct scsi_inquiry_data *inq_data) -{ - uint8_t type; - if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) { - return (0); - } - type = SID_TYPE(inq_data); - if (type == T_NODEVICE) { - return (0); - } - return (1); -} - /** * @brief completion function before returning to CAM * @@ -1985,7 +1964,6 @@ storvsc_io_done(struct hv_storvsc_reques struct vmscsi_req *vm_srb = &reqp->vstor_packet.u.vm_srb; bus_dma_segment_t *ori_sglist = NULL; int ori_sg_count = 0; - /* destroy bounce buffer if it is used */ if (reqp->bounce_sgl_count) { ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; @@ -2040,88 +2018,71 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - /* - * Check whether the data for INQUIRY cmd is valid or - * not. Windows 10 and Windows 2016 send all zero - * inquiry data to VM even for unpopulated slots. - */ + + if (vm_srb->srb_status != SRB_STATUS_SUCCESS) { + if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) { + xpt_print(ccb->ccb_h.path, "invalid LUN %d\n", + vm_srb->lun); + } else { + xpt_print(ccb->ccb_h.path, "Unknown SRB flag: %d\n", + vm_srb->srb_status); + } + /* + * If there are errors, for example, invalid LUN, + * host will inform VM through SRB status. + */ + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; + } else { + ccb->ccb_h.status |= CAM_REQ_CMP; + } + cmd = (const struct scsi_generic *) ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (cmd->opcode == INQUIRY) { - /* - * The host of Windows 10 or 2016 server will response - * the inquiry request with invalid data for unexisted device: - [0x7f 0x0 0x5 0x2 0x1f ... ] - * But on windows 2012 R2, the response is: - [0x7f 0x0 0x0 0x0 0x0 ] - * That is why here wants to validate the inquiry response. - * The validation will skip the INQUIRY whose response is short, - * which is less than SHORT_INQUIRY_LENGTH (36). - * - * For more information about INQUIRY, please refer to: - * ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf - */ - struct scsi_inquiry_data *inq_data = - (struct scsi_inquiry_data *)csio->data_ptr; - uint8_t* resp_buf = (uint8_t*)csio->data_ptr; - /* Get the buffer length reported by host */ - int resp_xfer_len = vm_srb->transfer_len; - /* Get the available buffer length */ - int resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; - int data_len = (resp_buf_len < resp_xfer_len) ? resp_buf_len : resp_xfer_len; - if (data_len < SHORT_INQUIRY_LENGTH) { - ccb->ccb_h.status |= CAM_REQ_CMP; - if (bootverbose && data_len >= 5) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc skips the validation for short inquiry (%d)" - " [%x %x %x %x %x]\n", - data_len,resp_buf[0],resp_buf[1],resp_buf[2], - resp_buf[3],resp_buf[4]); - mtx_unlock(&sc->hs_lock); - } - } else if (is_inquiry_valid(inq_data) == 0) { - ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + struct scsi_inquiry_data *inq_data = + (struct scsi_inquiry_data *)csio->data_ptr; + uint8_t *resp_buf = (uint8_t *)csio->data_ptr; + int resp_xfer_len, resp_buf_len, data_len; + + /* Get the buffer length reported by host */ + resp_xfer_len = vm_srb->transfer_len; + /* Get the available buffer length */ + resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; + data_len = (resp_buf_len < resp_xfer_len) ? + resp_buf_len : resp_xfer_len; + if (bootverbose && data_len >= 5) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc uninstalled invalid device" - " [%x %x %x %x %x]\n", - resp_buf[0],resp_buf[1],resp_buf[2],resp_buf[3],resp_buf[4]); - mtx_unlock(&sc->hs_lock); + xpt_print(ccb->ccb_h.path, "storvsc inquiry " + "(%d) [%x %x %x %x %x ... ]\n", data_len, + resp_buf[0], resp_buf[1], resp_buf[2], + resp_buf[3], resp_buf[4]); } - } else { - char vendor[16]; - cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), - sizeof(vendor)); - /** - * XXX: upgrade SPC2 to SPC3 if host is WIN8 or WIN2012 R2 - * in order to support UNMAP feature - */ - if (!strncmp(vendor,"Msft",4) && - SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 && - (vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8_1 || - vmstor_proto_version== VMSTOR_PROTOCOL_VERSION_WIN8)) { - inq_data->version = SCSI_REV_SPC3; - if (bootverbose) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc upgrades SPC2 to SPC3\n"); - mtx_unlock(&sc->hs_lock); + if (vm_srb->srb_status == SRB_STATUS_SUCCESS && + data_len > SHORT_INQUIRY_LENGTH) { + char vendor[16]; + + cam_strvis(vendor, inq_data->vendor, + sizeof(inq_data->vendor), sizeof(vendor)); + + /* + * XXX: Upgrade SPC2 to SPC3 if host is WIN8 or + * WIN2012 R2 in order to support UNMAP feature. + */ + if (!strncmp(vendor, "Msft", 4) && + SID_ANSI_REV(inq_data) == SCSI_REV_SPC2 && + (vmstor_proto_version == + VMSTOR_PROTOCOL_VERSION_WIN8_1 || + vmstor_proto_version == + VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + xpt_print(ccb->ccb_h.path, + "storvsc upgrades " + "SPC2 to SPC3\n"); + } } } - ccb->ccb_h.status |= CAM_REQ_CMP; - if (bootverbose) { - mtx_lock(&sc->hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc has passed inquiry response (%d) validation\n", - data_len); - mtx_unlock(&sc->hs_lock); - } - } - } else { - ccb->ccb_h.status |= CAM_REQ_CMP; } } else { mtx_lock(&sc->hs_lock); Modified: stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 22 02:11:30 2016 (r304581) +++ stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 22 02:23:05 2016 (r304582) @@ -249,9 +249,9 @@ struct vstor_packet { /** * SRB Status Masks (can be combined with above status codes) */ -#define SRB_STATUS_QUEUE_FROZEN 0x40 -#define SRB_STATUS_AUTOSENSE_VALID 0x80 - +#define SRB_STATUS_QUEUE_FROZEN 0x40 +#define SRB_STATUS_AUTOSENSE_VALID 0x80 +#define SRB_STATUS_INVALID_LUN 0X20 /** * Packet flags From owner-svn-src-stable@freebsd.org Mon Aug 22 07:08:02 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29B15BC25D7; Mon, 22 Aug 2016 07:08:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF6AD1B0A; Mon, 22 Aug 2016 07:08:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M781Lw098370; Mon, 22 Aug 2016 07:08:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M780dk098361; Mon, 22 Aug 2016 07:08:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201608220708.u7M780dk098361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 22 Aug 2016 07:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304587 - in stable/11: contrib/dma libexec/dma X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 07:08:02 -0000 Author: bapt Date: Mon Aug 22 07:08:00 2016 New Revision: 304587 URL: https://svnweb.freebsd.org/changeset/base/304587 Log: Import Dragonfly Mail Agent snapshort from 20160806 aka v0.11+ Most important change being: dma - Fix security hole Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after finding out from BSDNow Episode 152. Comments following were from his commit which explains better than I. Just taking his change and putting it here as well. * dma makes an age-old mistake of not properly checking whether a file owned by a user is a symlink or not, a bug which the original mail.local also had. * Add O_NOFOLLOW to disallow symlinks. Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked about the mail.local bug. Modified: stable/11/contrib/dma/VERSION stable/11/contrib/dma/dma-mbox-create.c stable/11/contrib/dma/dma.c stable/11/contrib/dma/dma.h stable/11/contrib/dma/dns.c stable/11/contrib/dma/local.c stable/11/contrib/dma/net.c stable/11/libexec/dma/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/dma/VERSION ============================================================================== --- stable/11/contrib/dma/VERSION Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/VERSION Mon Aug 22 07:08:00 2016 (r304587) @@ -1 +1 @@ -v0.10 +v0.11 Modified: stable/11/contrib/dma/dma-mbox-create.c ============================================================================== --- stable/11/contrib/dma/dma-mbox-create.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma-mbox-create.c Mon Aug 22 07:08:00 2016 (r304587) @@ -142,7 +142,7 @@ main(int argc, char **argv) logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user); } - f = open(fn, O_RDONLY|O_CREAT, 0600); + f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600); if (f < 0) logfail(EX_NOINPUT, "cannt open mbox `%s'", fn); Modified: stable/11/contrib/dma/dma.c ============================================================================== --- stable/11/contrib/dma/dma.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma.c Mon Aug 22 07:08:00 2016 (r304587) @@ -321,7 +321,7 @@ deliver(struct qitem *it) snprintf(errmsg, sizeof(errmsg), "unknown bounce reason"); retry: - syslog(LOG_INFO, "trying delivery"); + syslog(LOG_INFO, "<%s> trying delivery", it->addr); if (it->remote) error = deliver_remote(it); @@ -331,7 +331,7 @@ retry: switch (error) { case 0: delqueue(it); - syslog(LOG_INFO, "delivery successful"); + syslog(LOG_INFO, "<%s> delivery successful", it->addr); exit(EX_OK); case 1: Modified: stable/11/contrib/dma/dma.h ============================================================================== --- stable/11/contrib/dma/dma.h Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dma.h Mon Aug 22 07:08:00 2016 (r304587) @@ -49,7 +49,7 @@ #define VERSION "DragonFly Mail Agent " DMA_VERSION #define BUF_SIZE 2048 -#define ERRMSG_SIZE 200 +#define ERRMSG_SIZE 1024 #define USERNAME_SIZE 50 #define MIN_RETRY 300 /* 5 minutes */ #define MAX_RETRY (3*60*60) /* retry at least every 3 hours */ Modified: stable/11/contrib/dma/dns.c ============================================================================== --- stable/11/contrib/dma/dns.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/dns.c Mon Aug 22 07:08:00 2016 (r304587) @@ -34,6 +34,7 @@ */ #include +#include #include #include #include Modified: stable/11/contrib/dma/local.c ============================================================================== --- stable/11/contrib/dma/local.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/local.c Mon Aug 22 07:08:00 2016 (r304587) @@ -196,7 +196,7 @@ retry: goto out; } - error = snprintf(line, sizeof(line), "%sFrom %s\t%s", newline, sender, ctime(&now)); + error = snprintf(line, sizeof(line), "%sFrom %s %s", newline, sender, ctime(&now)); if (error < 0 || (size_t)error >= sizeof(line)) { syslog(LOG_NOTICE, "local delivery deferred: can not write header: %m"); goto out; Modified: stable/11/contrib/dma/net.c ============================================================================== --- stable/11/contrib/dma/net.c Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/contrib/dma/net.c Mon Aug 22 07:08:00 2016 (r304587) @@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct host->host, host->addr, c, neterr); \ snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \ host->host, host->addr, c, neterr); \ - return (-1); \ + error = -1; \ + goto out; \ } else if (res != exp) { \ syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \ host->host, host->addr, c, neterr); \ - return (1); \ + error = 1; \ + goto out; \ } /* Check first reply from remote host */ @@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct syslog(LOG_ERR, "remote delivery failed:" " SMTP login failed: %m"); snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host); - return (-1); + error = -1; + goto out; } /* SMTP login is not available, so try without */ else if (error > 0) { Modified: stable/11/libexec/dma/Makefile.inc ============================================================================== --- stable/11/libexec/dma/Makefile.inc Mon Aug 22 05:38:44 2016 (r304586) +++ stable/11/libexec/dma/Makefile.inc Mon Aug 22 07:08:00 2016 (r304587) @@ -7,7 +7,7 @@ DMA_SOURCES= ${.CURDIR}/../../../contrib CFLAGS+= -I${DMA_SOURCES} \ -DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME \ -DCONF_PATH='"/etc/dma"' \ - -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.10"' \ + -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.11+"' \ -DDMA_ROOT_USER='"mailnull"' \ -DDMA_GROUP='"mail"' BINGRP= mail From owner-svn-src-stable@freebsd.org Mon Aug 22 07:25:10 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C23EBC2AA8; Mon, 22 Aug 2016 07:25:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C4F21896; Mon, 22 Aug 2016 07:25:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M7P9W8006033; Mon, 22 Aug 2016 07:25:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M7P9um006032; Mon, 22 Aug 2016 07:25:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608220725.u7M7P9um006032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 22 Aug 2016 07:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304589 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 07:25:10 -0000 Author: kib Date: Mon Aug 22 07:25:09 2016 New Revision: 304589 URL: https://svnweb.freebsd.org/changeset/base/304589 Log: MFC r304174: VOP_FSYNC() does not take cred as an argument. Correct comment. Modified: stable/11/sys/kern/vfs_default.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_default.c ============================================================================== --- stable/11/sys/kern/vfs_default.c Mon Aug 22 07:24:02 2016 (r304588) +++ stable/11/sys/kern/vfs_default.c Mon Aug 22 07:25:09 2016 (r304589) @@ -640,7 +640,6 @@ int vop_stdfsync(ap) struct vop_fsync_args /* { struct vnode *a_vp; - struct ucred *a_cred; int a_waitfor; struct thread *a_td; } */ *ap; From owner-svn-src-stable@freebsd.org Mon Aug 22 07:26:44 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72E56BC2B59; Mon, 22 Aug 2016 07:26:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4311D1AB0; Mon, 22 Aug 2016 07:26:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7M7QhOa006146; Mon, 22 Aug 2016 07:26:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7M7QhSb006145; Mon, 22 Aug 2016 07:26:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608220726.u7M7QhSb006145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 22 Aug 2016 07:26: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: r304590 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 07:26:44 -0000 Author: kib Date: Mon Aug 22 07:26:43 2016 New Revision: 304590 URL: https://svnweb.freebsd.org/changeset/base/304590 Log: MFC r304174: VOP_FSYNC() does not take cred as an argument. Correct comment. Modified: stable/10/sys/kern/vfs_default.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_default.c ============================================================================== --- stable/10/sys/kern/vfs_default.c Mon Aug 22 07:25:09 2016 (r304589) +++ stable/10/sys/kern/vfs_default.c Mon Aug 22 07:26:43 2016 (r304590) @@ -635,7 +635,6 @@ int vop_stdfsync(ap) struct vop_fsync_args /* { struct vnode *a_vp; - struct ucred *a_cred; int a_waitfor; struct thread *a_td; } */ *ap; From owner-svn-src-stable@freebsd.org Mon Aug 22 15:53:34 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12DAEBC2C72; Mon, 22 Aug 2016 15:53:34 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D27C31A21; Mon, 22 Aug 2016 15:53:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MFrX5p098415; Mon, 22 Aug 2016 15:53:33 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MFrXv3098414; Mon, 22 Aug 2016 15:53:33 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608221553.u7MFrXv3098414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 22 Aug 2016 15:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304609 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 15:53:34 -0000 Author: bdrewery Date: Mon Aug 22 15:53:32 2016 New Revision: 304609 URL: https://svnweb.freebsd.org/changeset/base/304609 Log: MFC r304608: Bump __FreeBSD_version for C++11 thread_local support in r303795. PR: 192320 Modified: stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Aug 22 15:52:03 2016 (r304608) +++ stable/11/sys/sys/param.h Mon Aug 22 15:53:32 2016 (r304609) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Aug 22 16:35:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF2E2BC2E79; Mon, 22 Aug 2016 16:35:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFD1914CD; Mon, 22 Aug 2016 16:35:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MGZob0014091; Mon, 22 Aug 2016 16:35:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MGZoNe014090; Mon, 22 Aug 2016 16:35:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608221635.u7MGZoNe014090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 22 Aug 2016 16:35: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: r304611 - stable/10/sys/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 16:35:52 -0000 Author: bdrewery Date: Mon Aug 22 16:35:50 2016 New Revision: 304611 URL: https://svnweb.freebsd.org/changeset/base/304611 Log: MFC r304608: Bump __FreeBSD_version for C++11 thread_local support in r303795. PR: 192320 Modified: stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Mon Aug 22 16:04:25 2016 (r304610) +++ stable/10/sys/sys/param.h Mon Aug 22 16:35:50 2016 (r304611) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003505 /* Master, propagated to newvers */ +#define __FreeBSD_version 1003506 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Aug 22 17:21:47 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87B79BC2DA4; Mon, 22 Aug 2016 17:21:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FEC516BB; Mon, 22 Aug 2016 17:21:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MHLkDP031611; Mon, 22 Aug 2016 17:21:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MHLknN031607; Mon, 22 Aug 2016 17:21:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608221721.u7MHLknN031607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 22 Aug 2016 17:21: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: r304613 - in stable/10/sys: kern 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 17:21:47 -0000 Author: markj Date: Mon Aug 22 17:21:45 2016 New Revision: 304613 URL: https://svnweb.freebsd.org/changeset/base/304613 Log: MFC r304440, r304487: Fix some handling of P2_PTRACE_FSTP. Modified: stable/10/sys/kern/kern_fork.c stable/10/sys/kern/kern_sig.c stable/10/sys/kern/sys_process.c stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_fork.c ============================================================================== --- stable/10/sys/kern/kern_fork.c Mon Aug 22 16:39:51 2016 (r304612) +++ stable/10/sys/kern/kern_fork.c Mon Aug 22 17:21:45 2016 (r304613) @@ -1064,7 +1064,7 @@ fork_return(struct thread *td, struct tr * parent's children, do it now. */ dbg = p->p_pptr->p_pptr; - proc_set_traced(p); + proc_set_traced(p, true); CTR2(KTR_PTRACE, "fork_return: attaching to new child pid %d: oppid %d", p->p_pid, p->p_oppid); Modified: stable/10/sys/kern/kern_sig.c ============================================================================== --- stable/10/sys/kern/kern_sig.c Mon Aug 22 16:39:51 2016 (r304612) +++ stable/10/sys/kern/kern_sig.c Mon Aug 22 17:21:45 2016 (r304613) @@ -2510,7 +2510,7 @@ ptracestop(struct thread *td, int sig) * a chance to report itself upon the next iteration. */ if ((td->td_dbgflags & TDB_FSTP) != 0 || - ((p->p_flag & P2_PTRACE_FSTP) == 0 && + ((p->p_flag2 & P2_PTRACE_FSTP) == 0 && p->p_xthread == NULL)) { p->p_xstat = sig; p->p_xthread = td; Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Mon Aug 22 16:39:51 2016 (r304612) +++ stable/10/sys/kern/sys_process.c Mon Aug 22 17:21:45 2016 (r304613) @@ -649,12 +649,13 @@ sys_ptrace(struct thread *td, struct ptr #endif void -proc_set_traced(struct proc *p) +proc_set_traced(struct proc *p, bool stop) { PROC_LOCK_ASSERT(p, MA_OWNED); p->p_flag |= P_TRACED; - p->p_flag2 |= P2_PTRACE_FSTP; + if (stop) + p->p_flag2 |= P2_PTRACE_FSTP; p->p_ptevents = PTRACE_DEFAULT; p->p_oppid = p->p_pptr->p_pid; } @@ -867,7 +868,7 @@ kern_ptrace(struct thread *td, int req, switch (req) { case PT_TRACE_ME: /* set my trace flag and "owner" so it can read/write me */ - proc_set_traced(p); + proc_set_traced(p, false); if (p->p_flag & P_PPWAIT) p->p_flag |= P_PPTRACE; CTR1(KTR_PTRACE, "PT_TRACE_ME: pid %d", p->p_pid); @@ -884,7 +885,7 @@ kern_ptrace(struct thread *td, int req, * The old parent is remembered so we can put things back * on a "detach". */ - proc_set_traced(p); + proc_set_traced(p, true); if (p->p_pptr != td->td_proc) { proc_reparent(p, td->td_proc); } Modified: stable/10/sys/sys/proc.h ============================================================================== --- stable/10/sys/sys/proc.h Mon Aug 22 16:39:51 2016 (r304612) +++ stable/10/sys/sys/proc.h Mon Aug 22 17:21:45 2016 (r304613) @@ -933,7 +933,7 @@ void proc_linkup(struct proc *p, struct struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent); -void proc_set_traced(struct proc *p); +void proc_set_traced(struct proc *p, bool stop); struct pstats *pstats_alloc(void); void pstats_fork(struct pstats *src, struct pstats *dst); void pstats_free(struct pstats *ps); From owner-svn-src-stable@freebsd.org Mon Aug 22 17:23:28 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7BCABC2ED4; Mon, 22 Aug 2016 17:23:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A53CB18E5; Mon, 22 Aug 2016 17:23:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MHNRc4033717; Mon, 22 Aug 2016 17:23:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MHNRF7033712; Mon, 22 Aug 2016 17:23:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608221723.u7MHNRF7033712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 22 Aug 2016 17:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304614 - in stable/11/sys: kern sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 17:23:28 -0000 Author: markj Date: Mon Aug 22 17:23:27 2016 New Revision: 304614 URL: https://svnweb.freebsd.org/changeset/base/304614 Log: MFC r304440, r304487: Fix some handling of P2_PTRACE_FSTP. Modified: stable/11/sys/kern/kern_fork.c stable/11/sys/kern/kern_sig.c stable/11/sys/kern/sys_process.c stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_fork.c ============================================================================== --- stable/11/sys/kern/kern_fork.c Mon Aug 22 17:21:45 2016 (r304613) +++ stable/11/sys/kern/kern_fork.c Mon Aug 22 17:23:27 2016 (r304614) @@ -1075,7 +1075,7 @@ fork_return(struct thread *td, struct tr * parent's children, do it now. */ dbg = p->p_pptr->p_pptr; - proc_set_traced(p); + proc_set_traced(p, true); CTR2(KTR_PTRACE, "fork_return: attaching to new child pid %d: oppid %d", p->p_pid, p->p_oppid); Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Mon Aug 22 17:21:45 2016 (r304613) +++ stable/11/sys/kern/kern_sig.c Mon Aug 22 17:23:27 2016 (r304614) @@ -2537,7 +2537,7 @@ ptracestop(struct thread *td, int sig) * a chance to report itself upon the next iteration. */ if ((td->td_dbgflags & TDB_FSTP) != 0 || - ((p->p_flag & P2_PTRACE_FSTP) == 0 && + ((p->p_flag2 & P2_PTRACE_FSTP) == 0 && p->p_xthread == NULL)) { p->p_xsig = sig; p->p_xthread = td; Modified: stable/11/sys/kern/sys_process.c ============================================================================== --- stable/11/sys/kern/sys_process.c Mon Aug 22 17:21:45 2016 (r304613) +++ stable/11/sys/kern/sys_process.c Mon Aug 22 17:23:27 2016 (r304614) @@ -693,12 +693,13 @@ sys_ptrace(struct thread *td, struct ptr #endif void -proc_set_traced(struct proc *p) +proc_set_traced(struct proc *p, bool stop) { PROC_LOCK_ASSERT(p, MA_OWNED); p->p_flag |= P_TRACED; - p->p_flag2 |= P2_PTRACE_FSTP; + if (stop) + p->p_flag2 |= P2_PTRACE_FSTP; p->p_ptevents = PTRACE_DEFAULT; p->p_oppid = p->p_pptr->p_pid; } @@ -910,7 +911,7 @@ kern_ptrace(struct thread *td, int req, switch (req) { case PT_TRACE_ME: /* set my trace flag and "owner" so it can read/write me */ - proc_set_traced(p); + proc_set_traced(p, false); if (p->p_flag & P_PPWAIT) p->p_flag |= P_PPTRACE; CTR1(KTR_PTRACE, "PT_TRACE_ME: pid %d", p->p_pid); @@ -927,7 +928,7 @@ kern_ptrace(struct thread *td, int req, * The old parent is remembered so we can put things back * on a "detach". */ - proc_set_traced(p); + proc_set_traced(p, true); if (p->p_pptr != td->td_proc) { proc_reparent(p, td->td_proc); } Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Mon Aug 22 17:21:45 2016 (r304613) +++ stable/11/sys/sys/proc.h Mon Aug 22 17:23:27 2016 (r304614) @@ -1005,7 +1005,7 @@ void proc_linkup(struct proc *p, struct struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent); -void proc_set_traced(struct proc *p); +void proc_set_traced(struct proc *p, bool stop); struct pstats *pstats_alloc(void); void pstats_fork(struct pstats *src, struct pstats *dst); void pstats_free(struct pstats *ps); From owner-svn-src-stable@freebsd.org Mon Aug 22 17:52:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0338FBC27D4; Mon, 22 Aug 2016 17:52:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC59D1BCA; Mon, 22 Aug 2016 17:52:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MHqAwR042848; Mon, 22 Aug 2016 17:52:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MHqARe042844; Mon, 22 Aug 2016 17:52:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608221752.u7MHqARe042844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 22 Aug 2016 17:52: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: r304617 - in stable: 10/lib/libc/sys 11/lib/libc/sys 9/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 17:52:12 -0000 Author: jhb Date: Mon Aug 22 17:52:10 2016 New Revision: 304617 URL: https://svnweb.freebsd.org/changeset/base/304617 Log: MFC 304476: Fix various nits in the aio operation manpages. - Avoid double use of "request" in a single sentence. Instead, describe aio_sigevent as being used to request notification of the associated operation's completion. This matches the language used to describe aio_sigevent in aio(4). - Simplify the prohibition on modifying buffers while requests are in flight. - Fix case mismatch. - Drop note about not using stack variables. C programmers should be able to figure out if a stack variable is safe based on the later warning about the life cycle requirements of control blocks. - Remove prohibition on modifying the I/O buffer for aio_fsync() since it does not use an I/O buffer. For aio_mlock(), prohibit modifications to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not prohibit modifications to the memory backing the buffer (stores into the pages backing the buffer). Modified: stable/10/lib/libc/sys/aio_fsync.2 stable/10/lib/libc/sys/aio_mlock.2 stable/10/lib/libc/sys/aio_read.2 stable/10/lib/libc/sys/aio_write.2 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/sys/aio_fsync.2 stable/11/lib/libc/sys/aio_mlock.2 stable/11/lib/libc/sys/aio_read.2 stable/11/lib/libc/sys/aio_write.2 stable/9/lib/libc/sys/aio_fsync.2 stable/9/lib/libc/sys/aio_read.2 stable/9/lib/libc/sys/aio_write.2 Directory Properties: stable/11/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/10/lib/libc/sys/aio_fsync.2 ============================================================================== --- stable/10/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/10/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -74,16 +74,14 @@ the call returns without having enqueued .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS -The asynchronous I/O Control Block structure pointed to by +The Asynchronous I/O Control Block structure pointed to by .Fa iocb must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -91,9 +89,8 @@ should be zeroed before the .Fn aio_fsync call to avoid passing bogus context information to the kernel. .Pp -Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +Modification of the Asynchronous I/O Control Block structure is not allowed +while the request is queued. .Sh RETURN VALUES .Rv -std aio_fsync .Sh ERRORS Modified: stable/10/lib/libc/sys/aio_mlock.2 ============================================================================== --- stable/10/lib/libc/sys/aio_mlock.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/10/lib/libc/sys/aio_mlock.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_MLOCK 2 .Os .Sh NAME @@ -67,7 +67,7 @@ then the call returns without having enq .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -77,8 +77,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -87,8 +85,8 @@ should be zeroed before the call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +memory mapping described by the virtual address range are not allowed +while the request is queued. .Sh RETURN VALUES .Rv -std aio_mlock .Sh ERRORS Modified: stable/10/lib/libc/sys/aio_read.2 ============================================================================== --- stable/10/lib/libc/sys/aio_read.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/10/lib/libc/sys/aio_read.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_READ 2 .Os .Sh NAME @@ -82,7 +82,7 @@ not be referenced after the request is e .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -92,8 +92,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -102,8 +100,7 @@ should be zeroed before the call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset Modified: stable/10/lib/libc/sys/aio_write.2 ============================================================================== --- stable/10/lib/libc/sys/aio_write.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/10/lib/libc/sys/aio_write.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_WRITE 2 .Os .Sh NAME @@ -88,7 +88,7 @@ be referenced after the request is enque .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -98,8 +98,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -108,8 +106,7 @@ should be zeroed before the system call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset From owner-svn-src-stable@freebsd.org Mon Aug 22 17:52:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1BFABC27E7; Mon, 22 Aug 2016 17:52:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37101BD6; Mon, 22 Aug 2016 17:52:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MHqBKX042865; Mon, 22 Aug 2016 17:52:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MHqBUc042862; Mon, 22 Aug 2016 17:52:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608221752.u7MHqBUc042862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 22 Aug 2016 17:52: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: r304617 - in stable: 10/lib/libc/sys 11/lib/libc/sys 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 17:52:13 -0000 Author: jhb Date: Mon Aug 22 17:52:10 2016 New Revision: 304617 URL: https://svnweb.freebsd.org/changeset/base/304617 Log: MFC 304476: Fix various nits in the aio operation manpages. - Avoid double use of "request" in a single sentence. Instead, describe aio_sigevent as being used to request notification of the associated operation's completion. This matches the language used to describe aio_sigevent in aio(4). - Simplify the prohibition on modifying buffers while requests are in flight. - Fix case mismatch. - Drop note about not using stack variables. C programmers should be able to figure out if a stack variable is safe based on the later warning about the life cycle requirements of control blocks. - Remove prohibition on modifying the I/O buffer for aio_fsync() since it does not use an I/O buffer. For aio_mlock(), prohibit modifications to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not prohibit modifications to the memory backing the buffer (stores into the pages backing the buffer). Modified: stable/9/lib/libc/sys/aio_fsync.2 stable/9/lib/libc/sys/aio_read.2 stable/9/lib/libc/sys/aio_write.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/sys/aio_fsync.2 stable/10/lib/libc/sys/aio_mlock.2 stable/10/lib/libc/sys/aio_read.2 stable/10/lib/libc/sys/aio_write.2 stable/11/lib/libc/sys/aio_fsync.2 stable/11/lib/libc/sys/aio_mlock.2 stable/11/lib/libc/sys/aio_read.2 stable/11/lib/libc/sys/aio_write.2 Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/lib/libc/sys/aio_fsync.2 ============================================================================== --- stable/9/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/9/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -74,16 +74,14 @@ the call returns without having enqueued .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS -The asynchronous I/O Control Block structure pointed to by +The Asynchronous I/O Control Block structure pointed to by .Fa iocb must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -91,9 +89,8 @@ should be zeroed before the .Fn aio_fsync call to avoid passing bogus context information to the kernel. .Pp -Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +Modification of the Asynchronous I/O Control Block structure is not allowed +while the request is queued. .Sh RETURN VALUES .Rv -std aio_fsync .Sh ERRORS Modified: stable/9/lib/libc/sys/aio_read.2 ============================================================================== --- stable/9/lib/libc/sys/aio_read.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/9/lib/libc/sys/aio_read.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_READ 2 .Os .Sh NAME @@ -82,7 +82,7 @@ not be referenced after the request is e .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -92,8 +92,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -102,8 +100,7 @@ should be zeroed before the call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset Modified: stable/9/lib/libc/sys/aio_write.2 ============================================================================== --- stable/9/lib/libc/sys/aio_write.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/9/lib/libc/sys/aio_write.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd August 19, 2016 .Dt AIO_WRITE 2 .Os .Sh NAME @@ -88,7 +88,7 @@ be referenced after the request is enque .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -98,8 +98,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -108,8 +106,7 @@ should be zeroed before the system call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset From owner-svn-src-stable@freebsd.org Mon Aug 22 17:52:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8148CBC27E1; Mon, 22 Aug 2016 17:52:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 598BA1BD2; Mon, 22 Aug 2016 17:52:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MHqBh2042857; Mon, 22 Aug 2016 17:52:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MHqBgF042853; Mon, 22 Aug 2016 17:52:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608221752.u7MHqBgF042853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 22 Aug 2016 17:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304617 - in stable: 10/lib/libc/sys 11/lib/libc/sys 9/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 17:52:12 -0000 Author: jhb Date: Mon Aug 22 17:52:10 2016 New Revision: 304617 URL: https://svnweb.freebsd.org/changeset/base/304617 Log: MFC 304476: Fix various nits in the aio operation manpages. - Avoid double use of "request" in a single sentence. Instead, describe aio_sigevent as being used to request notification of the associated operation's completion. This matches the language used to describe aio_sigevent in aio(4). - Simplify the prohibition on modifying buffers while requests are in flight. - Fix case mismatch. - Drop note about not using stack variables. C programmers should be able to figure out if a stack variable is safe based on the later warning about the life cycle requirements of control blocks. - Remove prohibition on modifying the I/O buffer for aio_fsync() since it does not use an I/O buffer. For aio_mlock(), prohibit modifications to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not prohibit modifications to the memory backing the buffer (stores into the pages backing the buffer). Modified: stable/11/lib/libc/sys/aio_fsync.2 stable/11/lib/libc/sys/aio_mlock.2 stable/11/lib/libc/sys/aio_read.2 stable/11/lib/libc/sys/aio_write.2 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/sys/aio_fsync.2 stable/10/lib/libc/sys/aio_mlock.2 stable/10/lib/libc/sys/aio_read.2 stable/10/lib/libc/sys/aio_write.2 stable/9/lib/libc/sys/aio_fsync.2 stable/9/lib/libc/sys/aio_read.2 stable/9/lib/libc/sys/aio_write.2 Directory Properties: stable/10/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/11/lib/libc/sys/aio_fsync.2 ============================================================================== --- stable/11/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/11/lib/libc/sys/aio_fsync.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2016 +.Dd August 19, 2016 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -74,16 +74,14 @@ the call returns without having enqueued .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS -The asynchronous I/O Control Block structure pointed to by +The Asynchronous I/O Control Block structure pointed to by .Fa iocb must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -91,9 +89,8 @@ should be zeroed before the .Fn aio_fsync call to avoid passing bogus context information to the kernel. .Pp -Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +Modification of the Asynchronous I/O Control Block structure is not allowed +while the request is queued. .Sh RETURN VALUES .Rv -std aio_fsync .Sh ERRORS Modified: stable/11/lib/libc/sys/aio_mlock.2 ============================================================================== --- stable/11/lib/libc/sys/aio_mlock.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/11/lib/libc/sys/aio_mlock.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2016 +.Dd August 19, 2016 .Dt AIO_MLOCK 2 .Os .Sh NAME @@ -67,7 +67,7 @@ then the call returns without having enq .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -77,8 +77,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -87,8 +85,8 @@ should be zeroed before the call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +memory mapping described by the virtual address range are not allowed +while the request is queued. .Sh RETURN VALUES .Rv -std aio_mlock .Sh ERRORS Modified: stable/11/lib/libc/sys/aio_read.2 ============================================================================== --- stable/11/lib/libc/sys/aio_read.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/11/lib/libc/sys/aio_read.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2016 +.Dd August 19, 2016 .Dt AIO_READ 2 .Os .Sh NAME @@ -82,7 +82,7 @@ not be referenced after the request is e .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -92,8 +92,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -102,8 +100,7 @@ should be zeroed before the call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset Modified: stable/11/lib/libc/sys/aio_write.2 ============================================================================== --- stable/11/lib/libc/sys/aio_write.2 Mon Aug 22 17:45:30 2016 (r304616) +++ stable/11/lib/libc/sys/aio_write.2 Mon Aug 22 17:52:10 2016 (r304617) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2016 +.Dd August 19, 2016 .Dt AIO_WRITE 2 .Os .Sh NAME @@ -88,7 +88,7 @@ be referenced after the request is enque .Pp The .Fa iocb->aio_sigevent -structure can be used to request notification of the request's +structure can be used to request notification of the operation's completion as described in .Xr aio 4 . .Sh RESTRICTIONS @@ -98,8 +98,6 @@ and the buffer that the .Fa iocb->aio_buf member of that structure references must remain valid until the operation has completed. -For this reason, use of auto (stack) variables -for these objects is discouraged. .Pp The asynchronous I/O control buffer .Fa iocb @@ -108,8 +106,7 @@ should be zeroed before the system call to avoid passing bogus context information to the kernel. .Pp Modifications of the Asynchronous I/O Control Block structure or the -buffer contents after the request has been enqueued, but before the -request has completed, are not allowed. +buffer contents are not allowed while the request is queued. .Pp If the file offset in .Fa iocb->aio_offset From owner-svn-src-stable@freebsd.org Mon Aug 22 18:12:25 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD1B9BC2F35; Mon, 22 Aug 2016 18:12:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DE0D1EB8; Mon, 22 Aug 2016 18:12:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MICOCJ052585; Mon, 22 Aug 2016 18:12:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MICO6B052584; Mon, 22 Aug 2016 18:12:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608221812.u7MICO6B052584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 22 Aug 2016 18:12: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: r304619 - in stable: 10/sys/sys 9/sys/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 18:12:25 -0000 Author: jhb Date: Mon Aug 22 18:12:24 2016 New Revision: 304619 URL: https://svnweb.freebsd.org/changeset/base/304619 Log: MFC 302379: Correct locking annotation for p_comm. p_comm is changed during exec, it is not read-only after fork. Modified: stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/sys/proc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/10/sys/sys/proc.h ============================================================================== --- stable/10/sys/sys/proc.h Mon Aug 22 17:53:18 2016 (r304618) +++ stable/10/sys/sys/proc.h Mon Aug 22 18:12:24 2016 (r304619) @@ -564,7 +564,7 @@ struct proc { u_int p_magic; /* (b) Magic number. */ int p_osrel; /* (x) osreldate for the binary (from ELF note, if any) */ - char p_comm[MAXCOMLEN + 1]; /* (b) Process name. */ + char p_comm[MAXCOMLEN + 1]; /* (x) Process name. */ void *p_pad0; struct sysentvec *p_sysent; /* (b) Syscall dispatch info. */ struct pargs *p_args; /* (c) Process arguments. */ From owner-svn-src-stable@freebsd.org Mon Aug 22 18:12:26 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14CDFBC2F3C; Mon, 22 Aug 2016 18:12:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D57011EBA; Mon, 22 Aug 2016 18:12:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7MICP8d052591; Mon, 22 Aug 2016 18:12:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7MICOXg052590; Mon, 22 Aug 2016 18:12:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201608221812.u7MICOXg052590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 22 Aug 2016 18:12:24 +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: r304619 - in stable: 10/sys/sys 9/sys/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 18:12:26 -0000 Author: jhb Date: Mon Aug 22 18:12:24 2016 New Revision: 304619 URL: https://svnweb.freebsd.org/changeset/base/304619 Log: MFC 302379: Correct locking annotation for p_comm. p_comm is changed during exec, it is not read-only after fork. Modified: stable/9/sys/sys/proc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/9/sys/sys/proc.h ============================================================================== --- stable/9/sys/sys/proc.h Mon Aug 22 17:53:18 2016 (r304618) +++ stable/9/sys/sys/proc.h Mon Aug 22 18:12:24 2016 (r304619) @@ -558,7 +558,7 @@ struct proc { u_int p_magic; /* (b) Magic number. */ int p_osrel; /* (x) osreldate for the binary (from ELF note, if any) */ - char p_comm[MAXCOMLEN + 1]; /* (b) Process name. */ + char p_comm[MAXCOMLEN + 1]; /* (x) Process name. */ struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */ struct sysentvec *p_sysent; /* (b) Syscall dispatch info. */ struct pargs *p_args; /* (c) Process arguments. */ From owner-svn-src-stable@freebsd.org Tue Aug 23 00:00:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5037ABC2EE6; Tue, 23 Aug 2016 00:00:07 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2282213D7; Tue, 23 Aug 2016 00:00:07 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N006Af080203; Tue, 23 Aug 2016 00:00:06 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N006pv080202; Tue, 23 Aug 2016 00:00:06 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608230000.u7N006pv080202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 23 Aug 2016 00:00: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: r304648 - stable/10/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 00:00:07 -0000 Author: ache Date: Tue Aug 23 00:00:06 2016 New Revision: 304648 URL: https://svnweb.freebsd.org/changeset/base/304648 Log: Direct commit, equal to MFC part of r295632 which is not planned for MFC at whole. Set __SERR on __slbexpand() errors. Modified: stable/10/lib/libc/stdio/fgetln.c Modified: stable/10/lib/libc/stdio/fgetln.c ============================================================================== --- stable/10/lib/libc/stdio/fgetln.c Mon Aug 22 22:51:10 2016 (r304647) +++ stable/10/lib/libc/stdio/fgetln.c Tue Aug 23 00:00:06 2016 (r304648) @@ -159,6 +159,7 @@ fgetln(FILE *fp, size_t *lenp) error: *lenp = 0; /* ??? */ + fp->_flags |= __SERR; FUNLOCKFILE(fp); return (NULL); /* ??? */ } From owner-svn-src-stable@freebsd.org Tue Aug 23 05:22:04 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA16BBC3BE0; Tue, 23 Aug 2016 05:22:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C7B612A3; Tue, 23 Aug 2016 05:22:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N5M3wE001977; Tue, 23 Aug 2016 05:22:03 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N5M3mv001973; Tue, 23 Aug 2016 05:22:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201608230522.u7N5M3mv001973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 23 Aug 2016 05:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304657 - in stable/11: contrib/llvm/lib/Target/ARM/MCTargetDesc lib/clang X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 05:22:04 -0000 Author: dim Date: Tue Aug 23 05:22:03 2016 New Revision: 304657 URL: https://svnweb.freebsd.org/changeset/base/304657 Log: MFC r304530: Pull in r265122 from upstream llvm trunk (by James Molloy): Fix for pr24346: arm asm label calculation error in sub Some ARM instructions encode 32-bit immediates as a 8-bit integer (0-255) and a 4-bit rotation (0-30, even) in its least significant 12 bits. The original fixup, FK_Data_4, patches the instruction by the value bit-to-bit, regardless of the encoding. For example, assuming the label L1 and L2 are 0x0 and 0x104 respectively, the following instruction: add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260 would be assembled to the following, which adds 1 to r0, instead of 260: e2800104 add r0, r0, #4, 2 ; equivalently 1 The new fixup kind fixup_arm_mod_imm takes care of the encoding: e2800f41 add r0, r0, #260 Patch by Ting-Yuan Huang! This fixes label calculation for ARM assembly, and is needed to enable ARM assembly sources for OpenSSL. Requested by: jkim Modified: stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMFixupKinds.h stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp stable/11/lib/clang/freebsd_cc_version.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Tue Aug 23 04:37:03 2016 (r304656) +++ stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Tue Aug 23 05:22:03 2016 (r304657) @@ -90,6 +90,7 @@ const MCFixupKindInfo &ARMAsmBackend::ge {"fixup_arm_movw_lo16", 0, 20, 0}, {"fixup_t2_movt_hi16", 0, 20, 0}, {"fixup_t2_movw_lo16", 0, 20, 0}, + {"fixup_arm_mod_imm", 0, 12, 0}, }; const static MCFixupKindInfo InfosBE[ARM::NumTargetFixupKinds] = { // This table *must* be in the order that the fixup_* kinds are defined in @@ -133,6 +134,7 @@ const MCFixupKindInfo &ARMAsmBackend::ge {"fixup_arm_movw_lo16", 12, 20, 0}, {"fixup_t2_movt_hi16", 12, 20, 0}, {"fixup_t2_movw_lo16", 12, 20, 0}, + {"fixup_arm_mod_imm", 20, 12, 0}, }; if (Kind < FirstTargetFixupKind) @@ -624,6 +626,13 @@ unsigned ARMAsmBackend::adjustFixupValue return Value; } + case ARM::fixup_arm_mod_imm: + Value = ARM_AM::getSOImmVal(Value); + if (Ctx && Value >> 12) { + Ctx->reportError(Fixup.getLoc(), "out of range immediate fixup value"); + return 0; + } + return Value; } } @@ -690,6 +699,7 @@ static unsigned getFixupKindNumBytes(uns case FK_Data_2: case ARM::fixup_arm_thumb_br: case ARM::fixup_arm_thumb_cb: + case ARM::fixup_arm_mod_imm: return 2; case ARM::fixup_arm_pcrel_10_unscaled: @@ -766,6 +776,7 @@ static unsigned getFixupKindContainerSiz case ARM::fixup_arm_movw_lo16: case ARM::fixup_t2_movt_hi16: case ARM::fixup_t2_movw_lo16: + case ARM::fixup_arm_mod_imm: // Instruction size is 4 bytes. return 4; } Modified: stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMFixupKinds.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMFixupKinds.h Tue Aug 23 04:37:03 2016 (r304656) +++ stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMFixupKinds.h Tue Aug 23 05:22:03 2016 (r304657) @@ -100,6 +100,9 @@ enum Fixups { fixup_t2_movt_hi16, // :upper16: fixup_t2_movw_lo16, // :lower16: + // fixup_arm_mod_imm - Fixup for mod_imm + fixup_arm_mod_imm, + // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind Modified: stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp Tue Aug 23 04:37:03 2016 (r304656) +++ stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp Tue Aug 23 05:22:03 2016 (r304657) @@ -312,12 +312,8 @@ public: // Support for fixups (MCFixup) if (MO.isExpr()) { const MCExpr *Expr = MO.getExpr(); - // In instruction code this value always encoded as lowest 12 bits, - // so we don't have to perform any specific adjustments. - // Due to requirements of relocatable records we have to use FK_Data_4. - // See ARMELFObjectWriter::ExplicitRelSym and - // ARMELFObjectWriter::GetRelocTypeInner for more details. - MCFixupKind Kind = MCFixupKind(FK_Data_4); + // Fixups resolve to plain values that need to be encoded. + MCFixupKind Kind = MCFixupKind(ARM::fixup_arm_mod_imm); Fixups.push_back(MCFixup::create(0, Expr, Kind, MI.getLoc())); return 0; } Modified: stable/11/lib/clang/freebsd_cc_version.h ============================================================================== --- stable/11/lib/clang/freebsd_cc_version.h Tue Aug 23 04:37:03 2016 (r304656) +++ stable/11/lib/clang/freebsd_cc_version.h Tue Aug 23 05:22:03 2016 (r304657) @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define FREEBSD_CC_VERSION 1100501 +#define FREEBSD_CC_VERSION 1100502 From owner-svn-src-stable@freebsd.org Tue Aug 23 07:02:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5D91BC3536; Tue, 23 Aug 2016 07:02:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3E811484; Tue, 23 Aug 2016 07:02:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N72oFQ040517; Tue, 23 Aug 2016 07:02:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N72oJ2040516; Tue, 23 Aug 2016 07:02:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608230702.u7N72oJ2040516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 23 Aug 2016 07:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304658 - stable/11/sys/dev/ahci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:02:52 -0000 Author: avg Date: Tue Aug 23 07:02:50 2016 New Revision: 304658 URL: https://svnweb.freebsd.org/changeset/base/304658 Log: MFC r304521: JMicron JMB361 has only a single SATA port Modified: stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Tue Aug 23 05:22:03 2016 (r304657) +++ stable/11/sys/dev/ahci/ahci_pci.c Tue Aug 23 07:02:50 2016 (r304658) @@ -187,7 +187,7 @@ static const struct { {0xa10f8086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, - {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, + {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, {0x2362197b, 0x00, "JMicron JMB362", 0}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, From owner-svn-src-stable@freebsd.org Tue Aug 23 07:03:18 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51394BC3583; Tue, 23 Aug 2016 07:03:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21375160B; Tue, 23 Aug 2016 07:03:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N73H2T040579; Tue, 23 Aug 2016 07:03:17 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N73H7J040578; Tue, 23 Aug 2016 07:03:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608230703.u7N73H7J040578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 23 Aug 2016 07:03: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: r304659 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:03:18 -0000 Author: avg Date: Tue Aug 23 07:03:17 2016 New Revision: 304659 URL: https://svnweb.freebsd.org/changeset/base/304659 Log: MFC r304521: JMicron JMB361 has only a single SATA port 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 Aug 23 07:02:50 2016 (r304658) +++ stable/10/sys/dev/ahci/ahci_pci.c Tue Aug 23 07:03:17 2016 (r304659) @@ -187,7 +187,7 @@ static const struct { {0xa10f8086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, - {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, + {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, {0x2362197b, 0x00, "JMicron JMB362", 0}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, From owner-svn-src-stable@freebsd.org Tue Aug 23 07:06:47 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E576BC3736; Tue, 23 Aug 2016 07:06:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70FF41A18; Tue, 23 Aug 2016 07:06:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N76kV3040748; Tue, 23 Aug 2016 07:06:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N76kFb040747; Tue, 23 Aug 2016 07:06:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608230706.u7N76kFb040747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 23 Aug 2016 07:06:46 +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: r304660 - stable/9/sys/dev/ahci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:06:47 -0000 Author: avg Date: Tue Aug 23 07:06:46 2016 New Revision: 304660 URL: https://svnweb.freebsd.org/changeset/base/304660 Log: MFC r304521: JMicron JMB361 has only a single SATA port Modified: stable/9/sys/dev/ahci/ahci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Tue Aug 23 07:03:17 2016 (r304659) +++ stable/9/sys/dev/ahci/ahci.c Tue Aug 23 07:06:46 2016 (r304660) @@ -255,7 +255,7 @@ static const struct { {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, - {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, + {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, {0x2362197b, 0x00, "JMicron JMB362", 0}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, From owner-svn-src-stable@freebsd.org Tue Aug 23 07:07:48 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EED8BC37CA; Tue, 23 Aug 2016 07:07:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14C061BEC; Tue, 23 Aug 2016 07:07:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N77lQT040827; Tue, 23 Aug 2016 07:07:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N77lcx040826; Tue, 23 Aug 2016 07:07:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608230707.u7N77lcx040826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 23 Aug 2016 07:07: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: r304661 - stable/9/sys/dev X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:07:48 -0000 Author: avg Date: Tue Aug 23 07:07:47 2016 New Revision: 304661 URL: https://svnweb.freebsd.org/changeset/base/304661 Log: remove stray mergeinfo from sys/dev This is a direct commit. Modified: Directory Properties: stable/9/sys/dev/ (props changed) From owner-svn-src-stable@freebsd.org Tue Aug 23 07:23:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E62E5BC3E71; Tue, 23 Aug 2016 07:23:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E81F17A8; Tue, 23 Aug 2016 07:23:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7NoGL048251; Tue, 23 Aug 2016 07:23:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7NoZV048250; Tue, 23 Aug 2016 07:23:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230723.u7N7NoZV048250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304662 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:23:52 -0000 Author: kib Date: Tue Aug 23 07:23:50 2016 New Revision: 304662 URL: https://svnweb.freebsd.org/changeset/base/304662 Log: MFC r304227: In ffs_balloc_ufs{1,2} routines, assert that unwind records do not overflow local arrays. Modified: stable/11/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:07:47 2016 (r304661) +++ stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:23:50 2016 (r304662) @@ -255,6 +255,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, gbflags); @@ -325,6 +327,8 @@ retry: } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[i].in_lbn; nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0); @@ -401,6 +405,8 @@ retry: goto fail; } nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = lbn; nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); @@ -818,6 +824,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, @@ -889,6 +897,8 @@ retry: } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[i].in_lbn; nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, @@ -966,6 +976,8 @@ retry: goto fail; } nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = lbn; nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); From owner-svn-src-stable@freebsd.org Tue Aug 23 07:25:40 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4C18BC3F97; Tue, 23 Aug 2016 07:25:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A19CA1AB1; Tue, 23 Aug 2016 07:25:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7Pdjb048372; Tue, 23 Aug 2016 07:25:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7Pdoh048371; Tue, 23 Aug 2016 07:25:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230725.u7N7Pdoh048371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304663 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:25:40 -0000 Author: kib Date: Tue Aug 23 07:25:39 2016 New Revision: 304663 URL: https://svnweb.freebsd.org/changeset/base/304663 Log: MFC r304228: When block allocation fails in UFS_BALLOC(), and the volume does not have SU enabled, there is no point in calling softdep_request_cleanup(). Modified: stable/11/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:23:50 2016 (r304662) +++ stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:25:39 2016 (r304663) @@ -311,7 +311,7 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -390,7 +390,7 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -881,7 +881,7 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -961,7 +961,7 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); From owner-svn-src-stable@freebsd.org Tue Aug 23 07:27:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43C8DBC20F4; Tue, 23 Aug 2016 07:27:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 135E31CB8; Tue, 23 Aug 2016 07:27:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7RcnX048485; Tue, 23 Aug 2016 07:27:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7RcIR048484; Tue, 23 Aug 2016 07:27:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230727.u7N7RcIR048484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304664 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:27:39 -0000 Author: kib Date: Tue Aug 23 07:27:38 2016 New Revision: 304664 URL: https://svnweb.freebsd.org/changeset/base/304664 Log: MFC r304229: When looking up dandling buffers for unwing after failing block allocation in UFS_BALLOC(), there is no need to map them. Modified: stable/11/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:25:39 2016 (r304663) +++ stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:27:38 2016 (r304664) @@ -484,7 +484,8 @@ fail: * We shall not leave the freed blocks on the vnode * buffer object lists. */ - bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; @@ -1061,7 +1062,8 @@ fail: * We shall not leave the freed blocks on the vnode * buffer object lists. */ - bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; From owner-svn-src-stable@freebsd.org Tue Aug 23 07:30:21 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B03ABC2312; Tue, 23 Aug 2016 07:30:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D62E1293; Tue, 23 Aug 2016 07:30:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7UKQm048647; Tue, 23 Aug 2016 07:30:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7UK2g048646; Tue, 23 Aug 2016 07:30:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230730.u7N7UK2g048646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304665 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:30:21 -0000 Author: kib Date: Tue Aug 23 07:30:20 2016 New Revision: 304665 URL: https://svnweb.freebsd.org/changeset/base/304665 Log: MFC r304231: On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert that recorded allocated blocks numbers match the physical block numbers of dandling buffers which are released. When finally freeing the blocks during unwind, assert that dandling buffers where not re-allocated. Modified: stable/11/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:27:38 2016 (r304664) +++ stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:30:20 2016 (r304665) @@ -487,6 +487,11 @@ fail: bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { + KASSERT(bp->b_blkno == fsbtodb(fs, *blkp), + ("mismatch1 l %jd %jd b %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, + (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp))); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -531,6 +536,18 @@ fail: * cleared, free the blocks. */ for (blkp = allociblk; blkp < allocblk; blkp++) { +#ifdef INVARIANTS + if (blkp == allociblk) + lbns_remfree = lbns; + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); + if (bp != NULL) { + panic("zombie1 %jd %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp)); + } + lbns_remfree++; +#endif ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL); } @@ -1065,6 +1082,11 @@ fail: bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { + KASSERT(bp->b_blkno == fsbtodb(fs, *blkp), + ("mismatch2 l %jd %jd b %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, + (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp))); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -1109,6 +1131,18 @@ fail: * cleared, free the blocks. */ for (blkp = allociblk; blkp < allocblk; blkp++) { +#ifdef INVARIANTS + if (blkp == allociblk) + lbns_remfree = lbns; + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); + if (bp != NULL) { + panic("zombie2 %jd %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp)); + } + lbns_remfree++; +#endif ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL); } From owner-svn-src-stable@freebsd.org Tue Aug 23 07:32:13 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7767BC25E3; Tue, 23 Aug 2016 07:32:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B68E116A0; Tue, 23 Aug 2016 07:32:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7WC0c052085; Tue, 23 Aug 2016 07:32:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7WCuP052084; Tue, 23 Aug 2016 07:32:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230732.u7N7WCuP052084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304666 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:32:14 -0000 Author: kib Date: Tue Aug 23 07:32:12 2016 New Revision: 304666 URL: https://svnweb.freebsd.org/changeset/base/304666 Log: MFC r304232: In UFS_BALLOC(), invalidate pages of indirect buffers on failed block allocation unwinding. Modified: stable/11/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:30:20 2016 (r304665) +++ stable/11/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:32:12 2016 (r304666) @@ -492,8 +492,8 @@ fail: (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, (uintmax_t)bp->b_blkno, (uintmax_t)fsbtodb(fs, *blkp))); - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; @@ -1087,8 +1087,8 @@ fail: (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, (uintmax_t)bp->b_blkno, (uintmax_t)fsbtodb(fs, *blkp))); - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; From owner-svn-src-stable@freebsd.org Tue Aug 23 07:51:02 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5936CBC2C27; Tue, 23 Aug 2016 07:51:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DBF811BC; Tue, 23 Aug 2016 07:51:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7p1Uk058206; Tue, 23 Aug 2016 07:51:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7p1ME058205; Tue, 23 Aug 2016 07:51:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230751.u7N7p1ME058205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:51: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: r304667 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:51:02 -0000 Author: kib Date: Tue Aug 23 07:51:00 2016 New Revision: 304667 URL: https://svnweb.freebsd.org/changeset/base/304667 Log: MFC r304227: In ffs_balloc_ufs{1,2} routines, assert that unwind records do not overflow local arrays. Modified: stable/10/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:32:12 2016 (r304666) +++ stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:51:00 2016 (r304667) @@ -255,6 +255,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, gbflags); @@ -325,6 +327,8 @@ retry: } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[i].in_lbn; nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0); @@ -401,6 +405,8 @@ retry: goto fail; } nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = lbn; nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); @@ -818,6 +824,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, @@ -889,6 +897,8 @@ retry: } pref = newb + fs->fs_frag; nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = indirs[i].in_lbn; nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, @@ -966,6 +976,8 @@ retry: goto fail; } nb = newb; + MPASS(allocblk < allociblk + nitems(allociblk)); + MPASS(lbns_remfree < lbns + nitems(lbns)); *allocblk++ = nb; *lbns_remfree++ = lbn; nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); From owner-svn-src-stable@freebsd.org Tue Aug 23 07:52:08 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2667BC2E99; Tue, 23 Aug 2016 07:52:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2AA31505; Tue, 23 Aug 2016 07:52:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7q76t058297; Tue, 23 Aug 2016 07:52:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7q71Y058296; Tue, 23 Aug 2016 07:52:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230752.u7N7q71Y058296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:52: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: r304668 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:52:09 -0000 Author: kib Date: Tue Aug 23 07:52:07 2016 New Revision: 304668 URL: https://svnweb.freebsd.org/changeset/base/304668 Log: MFC r304228: When block allocation fails in UFS_BALLOC(), and the volume does not have SU enabled, there is no point in calling softdep_request_cleanup(). Modified: stable/10/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:51:00 2016 (r304667) +++ stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:52:07 2016 (r304668) @@ -311,7 +311,7 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -390,7 +390,7 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -881,7 +881,7 @@ retry: if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); @@ -961,7 +961,7 @@ retry: flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); - if (++reclaimed == 1) { + if (DOINGSOFTDEP(vp) && ++reclaimed == 1) { UFS_LOCK(ump); softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); From owner-svn-src-stable@freebsd.org Tue Aug 23 07:53:10 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85DCBBC2F13; Tue, 23 Aug 2016 07:53:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 589CF16B9; Tue, 23 Aug 2016 07:53:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7r9Jm059628; Tue, 23 Aug 2016 07:53:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7r9xH059627; Tue, 23 Aug 2016 07:53:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230753.u7N7r9xH059627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:53: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: r304669 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:53:10 -0000 Author: kib Date: Tue Aug 23 07:53:09 2016 New Revision: 304669 URL: https://svnweb.freebsd.org/changeset/base/304669 Log: MFC r304229: When looking up dandling buffers for unwing after failing block allocation in UFS_BALLOC(), there is no need to map them. Modified: stable/10/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:52:07 2016 (r304668) +++ stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:53:09 2016 (r304669) @@ -484,7 +484,8 @@ fail: * We shall not leave the freed blocks on the vnode * buffer object lists. */ - bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; @@ -1061,7 +1062,8 @@ fail: * We shall not leave the freed blocks on the vnode * buffer object lists. */ - bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; From owner-svn-src-stable@freebsd.org Tue Aug 23 07:54:15 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65AA4BC2F78; Tue, 23 Aug 2016 07:54:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23EFC1835; Tue, 23 Aug 2016 07:54:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7sEim059716; Tue, 23 Aug 2016 07:54:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7sEE9059715; Tue, 23 Aug 2016 07:54:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230754.u7N7sEE9059715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:54: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: r304670 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:54:15 -0000 Author: kib Date: Tue Aug 23 07:54:14 2016 New Revision: 304670 URL: https://svnweb.freebsd.org/changeset/base/304670 Log: MFC r304231: On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert that recorded allocated blocks numbers match the physical block numbers of dandling buffers which are released. When finally freeing the blocks during unwind, assert that dandling buffers where not re-allocated. Modified: stable/10/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:53:09 2016 (r304669) +++ stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:54:14 2016 (r304670) @@ -487,6 +487,11 @@ fail: bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { + KASSERT(bp->b_blkno == fsbtodb(fs, *blkp), + ("mismatch1 l %jd %jd b %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, + (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp))); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -531,6 +536,18 @@ fail: * cleared, free the blocks. */ for (blkp = allociblk; blkp < allocblk; blkp++) { +#ifdef INVARIANTS + if (blkp == allociblk) + lbns_remfree = lbns; + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); + if (bp != NULL) { + panic("zombie1 %jd %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp)); + } + lbns_remfree++; +#endif ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL); } @@ -1065,6 +1082,11 @@ fail: bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT | GB_UNMAPPED); if (bp != NULL) { + KASSERT(bp->b_blkno == fsbtodb(fs, *blkp), + ("mismatch2 l %jd %jd b %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, + (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp))); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -1109,6 +1131,18 @@ fail: * cleared, free the blocks. */ for (blkp = allociblk; blkp < allocblk; blkp++) { +#ifdef INVARIANTS + if (blkp == allociblk) + lbns_remfree = lbns; + bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, + GB_NOCREAT | GB_UNMAPPED); + if (bp != NULL) { + panic("zombie2 %jd %ju %ju", + (intmax_t)bp->b_lblkno, (uintmax_t)bp->b_blkno, + (uintmax_t)fsbtodb(fs, *blkp)); + } + lbns_remfree++; +#endif ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL); } From owner-svn-src-stable@freebsd.org Tue Aug 23 07:55:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6F02BC2FF0; Tue, 23 Aug 2016 07:55:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D29319A1; Tue, 23 Aug 2016 07:55:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7t6Wh059844; Tue, 23 Aug 2016 07:55:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7t6Nj059837; Tue, 23 Aug 2016 07:55:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201608230755.u7N7t6Nj059837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 23 Aug 2016 07:55: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: r304671 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:55:07 -0000 Author: avg Date: Tue Aug 23 07:55:05 2016 New Revision: 304671 URL: https://svnweb.freebsd.org/changeset/base/304671 Log: MFC r303763,303791,303869: zfs: honour and make use of vfs vnode locking protocol PR: 209158 Modified: stable/10/sys/cddl/compat/opensolaris/sys/vnode.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.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/zfs_znode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/vnode.h Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/compat/opensolaris/sys/vnode.h Tue Aug 23 07:55:05 2016 (r304671) @@ -87,8 +87,6 @@ vn_is_readonly(vnode_t *vp) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) - #define vnevent_create(vp, ct) do { } while (0) #define vnevent_link(vp, ct) do { } while (0) #define vnevent_remove(vp, dvp, name, ct) do { } while (0) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h Tue Aug 23 07:55:05 2016 (r304671) @@ -48,18 +48,18 @@ extern "C" { #define IS_ROOT_NODE 0x01 /* create a root node */ #define IS_XATTR 0x02 /* create an extended attribute node */ -extern int zfs_dirent_lock(zfs_dirlock_t **, znode_t *, char *, znode_t **, - int, int *, pathname_t *); -extern void zfs_dirent_unlock(zfs_dirlock_t *); -extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int); -extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int, +extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int); +extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int); +extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int, boolean_t *); -extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *, - pathname_t *); +#if 0 +extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int); +#else +extern int zfs_dirlook(znode_t *, const char *name, znode_t **); +#endif extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *, uint_t, znode_t **, zfs_acl_ids_t *); extern void zfs_rmnode(znode_t *); -extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old); extern boolean_t zfs_dirempty(znode_t *); extern void zfs_unlinked_add(znode_t *, dmu_tx_t *); extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Tue Aug 23 07:55:05 2016 (r304671) @@ -75,6 +75,7 @@ struct zfsvfs { boolean_t z_use_fuids; /* version allows fuids */ boolean_t z_replay; /* set during ZIL replay */ boolean_t z_use_sa; /* version allow system attributes */ + boolean_t z_use_namecache;/* make use of FreeBSD name cache */ uint64_t z_version; /* ZPL version */ uint64_t z_shares_dir; /* hidden shares dir */ kmutex_t z_lock; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Aug 23 07:55:05 2016 (r304671) @@ -181,10 +181,12 @@ typedef struct znode { struct zfsvfs *z_zfsvfs; vnode_t *z_vnode; uint64_t z_id; /* object ID for this znode */ +#ifdef illumos kmutex_t z_lock; /* znode modification lock */ krwlock_t z_parent_lock; /* parent lock for directories */ krwlock_t z_name_lock; /* "master" lock for dirent locks */ zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ +#endif kmutex_t z_range_lock; /* protects changes to z_range_avl */ avl_tree_t z_range_avl; /* avl tree of file range locks */ uint8_t z_unlinked; /* file has been unlinked */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue Aug 23 07:55:05 2016 (r304671) @@ -1058,8 +1058,7 @@ zfs_mode_compute(uint64_t fmode, zfs_acl * create a new acl and leave any cached acl in place. */ static int -zfs_acl_node_read(znode_t *zp, boolean_t have_lock, zfs_acl_t **aclpp, - boolean_t will_modify) +zfs_acl_node_read(znode_t *zp, zfs_acl_t **aclpp, boolean_t will_modify) { zfs_acl_t *aclp; int aclsize; @@ -1068,26 +1067,15 @@ zfs_acl_node_read(znode_t *zp, boolean_t zfs_acl_phys_t znode_acl; int version; int error; - boolean_t drop_lock = B_FALSE; ASSERT(MUTEX_HELD(&zp->z_acl_lock)); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); if (zp->z_acl_cached && !will_modify) { *aclpp = zp->z_acl_cached; return (0); } - /* - * close race where znode could be upgrade while trying to - * read the znode attributes. - * - * But this could only happen if the file isn't already an SA - * znode - */ - if (!zp->z_is_sa && !have_lock) { - mutex_enter(&zp->z_lock); - drop_lock = B_TRUE; - } version = zfs_znode_acl_version(zp); if ((error = zfs_acl_znode_info(zp, &aclsize, @@ -1133,8 +1121,6 @@ zfs_acl_node_read(znode_t *zp, boolean_t if (!will_modify) zp->z_acl_cached = aclp; done: - if (drop_lock) - mutex_exit(&zp->z_lock); return (error); } @@ -1161,10 +1147,10 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - ASSERT(MUTEX_HELD(&zp->z_lock)); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); ASSERT(MUTEX_HELD(&zp->z_acl_lock)); - if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0) + if ((error = zfs_acl_node_read(zp, &aclp, B_FALSE)) == 0) zp->z_mode = zfs_mode_compute(zp->z_mode, aclp, &zp->z_pflags, zp->z_uid, zp->z_gid); return (error); @@ -1445,18 +1431,17 @@ zfs_acl_chmod_setattr(znode_t *zp, zfs_a int error = 0; mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_DISCARD) *aclp = zfs_acl_alloc(zfs_acl_version_zp(zp)); else - error = zfs_acl_node_read(zp, B_TRUE, aclp, B_TRUE); + error = zfs_acl_node_read(zp, aclp, B_TRUE); if (error == 0) { (*aclp)->z_hints = zp->z_pflags & V4_ACL_WIDE_FLAGS; zfs_acl_chmod(ZTOV(zp)->v_type, mode, (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK), *aclp); } - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -1627,6 +1612,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla boolean_t need_chmod = B_TRUE; boolean_t inherited = B_FALSE; + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); bzero(acl_ids, sizeof (zfs_acl_ids_t)); acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode); @@ -1710,12 +1696,10 @@ zfs_acl_ids_create(znode_t *dzp, int fla if (acl_ids->z_aclp == NULL) { mutex_enter(&dzp->z_acl_lock); - mutex_enter(&dzp->z_lock); if (!(flag & IS_ROOT_NODE) && (dzp->z_pflags & ZFS_INHERIT_ACE) && !(dzp->z_pflags & ZFS_XATTR)) { - VERIFY(0 == zfs_acl_node_read(dzp, B_TRUE, - &paclp, B_FALSE)); + VERIFY(0 == zfs_acl_node_read(dzp, &paclp, B_FALSE)); acl_ids->z_aclp = zfs_acl_inherit(zfsvfs, vap->va_type, paclp, acl_ids->z_mode, &need_chmod); inherited = B_TRUE; @@ -1724,7 +1708,6 @@ zfs_acl_ids_create(znode_t *dzp, int fla zfs_acl_alloc(zfs_acl_version_zp(dzp)); acl_ids->z_aclp->z_hints |= ZFS_ACL_TRIVIAL; } - mutex_exit(&dzp->z_lock); mutex_exit(&dzp->z_acl_lock); if (need_chmod) { acl_ids->z_aclp->z_hints |= (vap->va_type == VDIR) ? @@ -1790,7 +1773,8 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsec mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); @@ -1938,6 +1922,7 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec boolean_t fuid_dirtied; uint64_t acl_obj; + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (mask == 0) return (SET_ERROR(ENOSYS)); @@ -1962,7 +1947,6 @@ zfs_setacl(znode_t *zp, vsecattr_t *vsec } top: mutex_enter(&zp->z_acl_lock); - mutex_enter(&zp->z_lock); tx = dmu_tx_create(zfsvfs->z_os); @@ -1994,7 +1978,6 @@ top: zfs_sa_upgrade_txholds(tx, zp); error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); if (error == ERESTART) { @@ -2020,7 +2003,6 @@ top: if (fuidp) zfs_fuid_info_free(fuidp); dmu_tx_commit(tx); - mutex_exit(&zp->z_lock); mutex_exit(&zp->z_acl_lock); return (error); @@ -2124,7 +2106,8 @@ zfs_zaccess_aces_check(znode_t *zp, uint mutex_enter(&zp->z_acl_lock); - error = zfs_acl_node_read(zp, B_FALSE, &aclp, B_FALSE); + ASSERT_VOP_LOCKED(ZTOV(zp), __func__); + error = zfs_acl_node_read(zp, &aclp, B_FALSE); if (error != 0) { mutex_exit(&zp->z_acl_lock); return (error); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Aug 23 07:54:14 2016 (r304670) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Tue Aug 23 07:55:05 2016 (r304671) @@ -58,96 +58,64 @@ #include /* - * zfs_match_find() is used by zfs_dirent_lock() to peform zap lookups + * zfs_match_find() is used by zfs_dirent_lookup() to peform zap lookups * of names after deciding which is the appropriate lookup interface. */ static int -zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, boolean_t exact, - boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) +zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, + boolean_t exact, uint64_t *zoid) { int error; if (zfsvfs->z_norm) { - matchtype_t mt = MT_FIRST; - boolean_t conflict = B_FALSE; - size_t bufsz = 0; - char *buf = NULL; - - if (rpnp) { - buf = rpnp->pn_buf; - bufsz = rpnp->pn_bufsize; - } - if (exact) - mt = MT_EXACT; + matchtype_t mt = exact? MT_EXACT : MT_FIRST; + /* * In the non-mixed case we only expect there would ever * be one match, but we need to use the normalizing lookup. */ error = zap_lookup_norm(zfsvfs->z_os, dzp->z_id, name, 8, 1, - zoid, mt, buf, bufsz, &conflict); - if (!error && deflags) - *deflags = conflict ? ED_CASE_CONFLICT : 0; + zoid, mt, NULL, 0, NULL); } else { error = zap_lookup(zfsvfs->z_os, dzp->z_id, name, 8, 1, zoid); } *zoid = ZFS_DIRENT_OBJ(*zoid); - if (error == ENOENT && update) - dnlc_update(ZTOV(dzp), name, DNLC_NO_VNODE); - return (error); } /* - * Lock a directory entry. A dirlock on protects that name - * in dzp's directory zap object. As long as you hold a dirlock, you can - * assume two things: (1) dzp cannot be reaped, and (2) no other thread - * can change the zap entry for (i.e. link or unlink) this name. + * Look up a directory entry under a locked vnode. + * dvp being locked gives us a guarantee that there are no concurrent + * modification of the directory and, thus, if a node can be found in + * the directory, then it must not be unlinked. * * Input arguments: * dzp - znode for directory * name - name of entry to lock * flag - ZNEW: if the entry already exists, fail with EEXIST. * ZEXISTS: if the entry does not exist, fail with ENOENT. - * ZSHARED: allow concurrent access with other ZSHARED callers. * ZXATTR: we want dzp's xattr directory - * ZCILOOK: On a mixed sensitivity file system, - * this lookup should be case-insensitive. - * ZCIEXACT: On a purely case-insensitive file system, - * this lookup should be case-sensitive. - * ZRENAMING: we are locking for renaming, force narrow locks - * ZHAVELOCK: Don't grab the z_name_lock for this call. The - * current thread already holds it. * * Output arguments: * zpp - pointer to the znode for the entry (NULL if there isn't one) - * dlpp - pointer to the dirlock for this entry (NULL on error) - * direntflags - (case-insensitive lookup only) - * flags if multiple case-sensitive matches exist in directory - * realpnp - (case-insensitive lookup only) - * actual name matched within the directory * * Return value: 0 on success or errno on failure. * * NOTE: Always checks for, and rejects, '.' and '..'. - * NOTE: For case-insensitive file systems we take wide locks (see below), - * but return znode pointers to a single match. */ int -zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp, - int flag, int *direntflags, pathname_t *realpnp) +zfs_dirent_lookup(znode_t *dzp, const char *name, znode_t **zpp, int flag) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - zfs_dirlock_t *dl; - boolean_t update; boolean_t exact; uint64_t zoid; vnode_t *vp = NULL; int error = 0; - int cmpflags; + + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); *zpp = NULL; - *dlpp = NULL; /* * Verify that we are not trying to lock '.', '..', or '.zfs' @@ -161,280 +129,93 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn * Case sensitivity and normalization preferences are set when * the file system is created. These are stored in the * zfsvfs->z_case and zfsvfs->z_norm fields. These choices - * affect what vnodes can be cached in the DNLC, how we - * perform zap lookups, and the "width" of our dirlocks. + * affect how we perform zap lookups. * - * A normal dirlock locks a single name. Note that with - * normalization a name can be composed multiple ways, but - * when normalized, these names all compare equal. A wide - * dirlock locks multiple names. We need these when the file - * system is supporting mixed-mode access. It is sometimes - * necessary to lock all case permutations of file name at - * once so that simultaneous case-insensitive/case-sensitive - * behaves as rationally as possible. - */ - - /* * Decide if exact matches should be requested when performing * a zap lookup on file systems supporting case-insensitive * access. - */ - exact = - ((zfsvfs->z_case == ZFS_CASE_INSENSITIVE) && (flag & ZCIEXACT)) || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && !(flag & ZCILOOK)); - - /* - * Only look in or update the DNLC if we are looking for the - * name on a file system that does not require normalization - * or case folding. We can also look there if we happen to be - * on a non-normalizing, mixed sensitivity file system IF we - * are looking for the exact name. * - * Maybe can add TO-UPPERed version of name to dnlc in ci-only - * case for performance improvement? - */ - update = !zfsvfs->z_norm || - ((zfsvfs->z_case == ZFS_CASE_MIXED) && - !(zfsvfs->z_norm & ~U8_TEXTPREP_TOUPPER) && !(flag & ZCILOOK)); - - /* - * ZRENAMING indicates we are in a situation where we should - * take narrow locks regardless of the file system's - * preferences for normalizing and case folding. This will - * prevent us deadlocking trying to grab the same wide lock - * twice if the two names happen to be case-insensitive - * matches. - */ - if (flag & ZRENAMING) - cmpflags = 0; - else - cmpflags = zfsvfs->z_norm; - - /* - * Wait until there are no locks on this name. - * - * Don't grab the the lock if it is already held. However, cannot - * have both ZSHARED and ZHAVELOCK together. - */ - ASSERT(!(flag & ZSHARED) || !(flag & ZHAVELOCK)); - if (!(flag & ZHAVELOCK)) - rw_enter(&dzp->z_name_lock, RW_READER); - - mutex_enter(&dzp->z_lock); - for (;;) { - if (dzp->z_unlinked && !(flag & ZXATTR)) { - mutex_exit(&dzp->z_lock); - if (!(flag & ZHAVELOCK)) - rw_exit(&dzp->z_name_lock); - return (SET_ERROR(ENOENT)); - } - for (dl = dzp->z_dirlocks; dl != NULL; dl = dl->dl_next) { - if ((u8_strcmp(name, dl->dl_name, 0, cmpflags, - U8_UNICODE_LATEST, &error) == 0) || error != 0) - break; - } - if (error != 0) { - mutex_exit(&dzp->z_lock); - if (!(flag & ZHAVELOCK)) - rw_exit(&dzp->z_name_lock); - return (SET_ERROR(ENOENT)); - } - if (dl == NULL) { - size_t namesize; - - /* - * Allocate a new dirlock and add it to the list. - */ - namesize = strlen(name) + 1; - dl = kmem_alloc(sizeof (zfs_dirlock_t) + namesize, - KM_SLEEP); - cv_init(&dl->dl_cv, NULL, CV_DEFAULT, NULL); - dl->dl_name = (char *)(dl + 1); - bcopy(name, dl->dl_name, namesize); - dl->dl_sharecnt = 0; - dl->dl_namelock = 0; - dl->dl_namesize = namesize; - dl->dl_dzp = dzp; - dl->dl_next = dzp->z_dirlocks; - dzp->z_dirlocks = dl; - break; - } - if ((flag & ZSHARED) && dl->dl_sharecnt != 0) - break; - cv_wait(&dl->dl_cv, &dzp->z_lock); - } - - /* - * If the z_name_lock was NOT held for this dirlock record it. + * NB: we do not need to worry about this flag for ZFS_CASE_SENSITIVE + * because in that case MT_EXACT and MT_FIRST should produce exactly + * the same result. */ - if (flag & ZHAVELOCK) - dl->dl_namelock = 1; + exact = zfsvfs->z_case == ZFS_CASE_MIXED; - if (flag & ZSHARED) - dl->dl_sharecnt++; - - mutex_exit(&dzp->z_lock); - - /* - * We have a dirlock on the name. (Note that it is the dirlock, - * not the dzp's z_lock, that protects the name in the zap object.) - * See if there's an object by this name; if so, put a hold on it. - */ + if (dzp->z_unlinked && !(flag & ZXATTR)) + return (ENOENT); if (flag & ZXATTR) { error = sa_lookup(dzp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs), &zoid, sizeof (zoid)); if (error == 0) error = (zoid == 0 ? ENOENT : 0); } else { - if (update) - vp = dnlc_lookup(ZTOV(dzp), name); - if (vp == DNLC_NO_VNODE) { - VN_RELE(vp); - error = SET_ERROR(ENOENT); - } else if (vp) { - if (flag & ZNEW) { - zfs_dirent_unlock(dl); - VN_RELE(vp); - return (SET_ERROR(EEXIST)); - } - *dlpp = dl; - *zpp = VTOZ(vp); - return (0); - } else { - error = zfs_match_find(zfsvfs, dzp, name, exact, - update, direntflags, realpnp, &zoid); - } + error = zfs_match_find(zfsvfs, dzp, name, exact, &zoid); } if (error) { if (error != ENOENT || (flag & ZEXISTS)) { - zfs_dirent_unlock(dl); return (error); } } else { if (flag & ZNEW) { - zfs_dirent_unlock(dl); return (SET_ERROR(EEXIST)); } error = zfs_zget(zfsvfs, zoid, zpp); - if (error) { - zfs_dirent_unlock(dl); + if (error) return (error); - } - if (!(flag & ZXATTR) && update) - dnlc_update(ZTOV(dzp), name, ZTOV(*zpp)); + ASSERT(!(*zpp)->z_unlinked); } - *dlpp = dl; - return (0); } -/* - * Unlock this directory entry and wake anyone who was waiting for it. - */ -void -zfs_dirent_unlock(zfs_dirlock_t *dl) +static int +zfs_dd_lookup(znode_t *dzp, znode_t **zpp) { - znode_t *dzp = dl->dl_dzp; - zfs_dirlock_t **prev_dl, *cur_dl; + zfsvfs_t *zfsvfs = dzp->z_zfsvfs; + znode_t *zp; + uint64_t parent; + int error; - mutex_enter(&dzp->z_lock); + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); + ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - if (!dl->dl_namelock) - rw_exit(&dzp->z_name_lock); + if (dzp->z_unlinked) + return (ENOENT); - if (dl->dl_sharecnt > 1) { - dl->dl_sharecnt--; - mutex_exit(&dzp->z_lock); - return; - } - prev_dl = &dzp->z_dirlocks; - while ((cur_dl = *prev_dl) != dl) - prev_dl = &cur_dl->dl_next; - *prev_dl = dl->dl_next; - cv_broadcast(&dl->dl_cv); - mutex_exit(&dzp->z_lock); + if ((error = sa_lookup(dzp->z_sa_hdl, + SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) + return (error); - cv_destroy(&dl->dl_cv); - kmem_free(dl, sizeof (*dl) + dl->dl_namesize); + error = zfs_zget(zfsvfs, parent, &zp); + if (error == 0) + *zpp = zp; + return (error); } -/* - * Look up an entry in a directory. - * - * NOTE: '.' and '..' are handled as special cases because - * no directory entries are actually stored for them. If this is - * the root of a filesystem, then '.zfs' is also treated as a - * special pseudo-directory. - */ int -zfs_dirlook(znode_t *dzp, char *name, vnode_t **vpp, int flags, - int *deflg, pathname_t *rpnp) +zfs_dirlook(znode_t *dzp, const char *name, znode_t **zpp) { - zfs_dirlock_t *dl; + zfsvfs_t *zfsvfs = dzp->z_zfsvfs; znode_t *zp; int error = 0; - uint64_t parent; - int unlinked; - - if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { - mutex_enter(&dzp->z_lock); - unlinked = dzp->z_unlinked; - mutex_exit(&dzp->z_lock); - if (unlinked) - return (ENOENT); - - *vpp = ZTOV(dzp); - VN_HOLD(*vpp); - } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { - zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - /* - * If we are a snapshot mounted under .zfs, return - * the vp for the snapshot directory. - */ - if ((error = sa_lookup(dzp->z_sa_hdl, - SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0) - return (error); - if (parent == dzp->z_id && zfsvfs->z_parent != zfsvfs) { - error = zfsctl_root_lookup(zfsvfs->z_parent->z_ctldir, - "snapshot", vpp, NULL, 0, NULL, kcred, - NULL, NULL, NULL); - return (error); - } + ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); + ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - mutex_enter(&dzp->z_lock); - unlinked = dzp->z_unlinked; - mutex_exit(&dzp->z_lock); - if (unlinked) - return (ENOENT); + if (dzp->z_unlinked) + return (SET_ERROR(ENOENT)); - rw_enter(&dzp->z_parent_lock, RW_READER); - error = zfs_zget(zfsvfs, parent, &zp); - if (error == 0) - *vpp = ZTOV(zp); - rw_exit(&dzp->z_parent_lock); - } else if (zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0) { - *vpp = zfsctl_root(dzp); + if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { + *zpp = dzp; + } else if (name[0] == '.' && name[1] == '.' && name[2] == 0) { + error = zfs_dd_lookup(dzp, zpp); } else { - int zf; - - zf = ZEXISTS | ZSHARED; - if (flags & FIGNORECASE) - zf |= ZCILOOK; - - error = zfs_dirent_lock(&dl, dzp, name, &zp, zf, deflg, rpnp); + error = zfs_dirent_lookup(dzp, name, &zp, ZEXISTS); if (error == 0) { - *vpp = ZTOV(zp); - zfs_dirent_unlock(dl); dzp->z_zn_prefetch = B_TRUE; /* enable prefetching */ + *zpp = zp; } - rpnp = NULL; } - - if ((flags & FIGNORECASE) && rpnp && !error) - (void) strlcpy(rpnp->pn_buf, name, rpnp->pn_bufsize); - return (error); } @@ -510,8 +291,9 @@ zfs_unlinked_drain(zfsvfs_t *zfsvfs) if (error != 0) continue; + vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY); zp->z_unlinked = B_TRUE; - VN_RELE(ZTOV(zp)); + vput(ZTOV(zp)); } zap_cursor_fini(&zc); } @@ -535,7 +317,6 @@ zfs_purgedir(znode_t *dzp) znode_t *xzp; dmu_tx_t *tx; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; - zfs_dirlock_t dl; int skipped = 0; int error; @@ -549,6 +330,7 @@ zfs_purgedir(znode_t *dzp) continue; } + vn_lock(ZTOV(xzp), LK_EXCLUSIVE | LK_RETRY); ASSERT((ZTOV(xzp)->v_type == VREG) || (ZTOV(xzp)->v_type == VLNK)); @@ -563,20 +345,17 @@ zfs_purgedir(znode_t *dzp) error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); skipped += 1; continue; } - bzero(&dl, sizeof (dl)); - dl.dl_dzp = dzp; - dl.dl_name = zap.za_name; - error = zfs_link_destroy(&dl, xzp, tx, 0, NULL); + error = zfs_link_destroy(dzp, zap.za_name, xzp, tx, 0, NULL); if (error) skipped += 1; dmu_tx_commit(tx); - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); } zap_cursor_fini(&zc); if (error != ENOENT) @@ -596,6 +375,7 @@ zfs_rmnode(znode_t *zp) int error; ASSERT(zp->z_links == 0); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); /* * If this is an attribute directory, purge its contents. @@ -634,7 +414,8 @@ zfs_rmnode(znode_t *zp) &xattr_obj, sizeof (xattr_obj)); if (error == 0 && xattr_obj) { error = zfs_zget(zfsvfs, xattr_obj, &xzp); - ASSERT(error == 0); + ASSERT3S(error, ==, 0); + vn_lock(ZTOV(xzp), LK_EXCLUSIVE | LK_RETRY); } acl_obj = zfs_external_acl(zp); @@ -668,12 +449,10 @@ zfs_rmnode(znode_t *zp) if (xzp) { ASSERT(error == 0); - mutex_enter(&xzp->z_lock); xzp->z_unlinked = B_TRUE; /* mark xzp for deletion */ xzp->z_links = 0; /* no more links to it */ VERIFY(0 == sa_update(xzp->z_sa_hdl, SA_ZPL_LINKS(zfsvfs), &xzp->z_links, sizeof (xzp->z_links), tx)); - mutex_exit(&xzp->z_lock); zfs_unlinked_add(xzp, tx); } @@ -686,7 +465,7 @@ zfs_rmnode(znode_t *zp) dmu_tx_commit(tx); out: if (xzp) - VN_RELE(ZTOV(xzp)); + vput(ZTOV(xzp)); } static uint64_t @@ -700,12 +479,12 @@ zfs_dirent(znode_t *zp, uint64_t mode) } /* - * Link zp into dl. Can only fail if zp has been unlinked. + * Link zp into dzp. Can only fail if zp has been unlinked. */ int -zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag) +zfs_link_create(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, + int flag) { - znode_t *dzp = dl->dl_dzp; zfsvfs_t *zfsvfs = zp->z_zfsvfs; vnode_t *vp = ZTOV(zp); uint64_t value; @@ -715,18 +494,32 @@ zfs_link_create(zfs_dirlock_t *dl, znode int count = 0; int error; - mutex_enter(&zp->z_lock); - + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); +#if 0 + if (zp_is_dir) { + error = 0; + if (dzp->z_links >= LINK_MAX) + error = SET_ERROR(EMLINK); + return (error); + } +#endif if (!(flag & ZRENAMING)) { if (zp->z_unlinked) { /* no new links to unlinked zp */ ASSERT(!(flag & (ZNEW | ZEXISTS))); - mutex_exit(&zp->z_lock); return (SET_ERROR(ENOENT)); } +#if 0 + if (zp->z_links >= LINK_MAX) { + return (SET_ERROR(EMLINK)); + } +#endif zp->z_links++; SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs), NULL, &zp->z_links, sizeof (zp->z_links)); + } else { + ASSERT(zp->z_unlinked == 0); } SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zfsvfs), NULL, &dzp->z_id, sizeof (dzp->z_id)); @@ -740,11 +533,8 @@ zfs_link_create(zfs_dirlock_t *dl, znode ctime, B_TRUE); } error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); - - mutex_exit(&zp->z_lock); + ASSERT0(error); - mutex_enter(&dzp->z_lock); dzp->z_size++; dzp->z_links += zp_is_dir; count = 0; @@ -760,55 +550,48 @@ zfs_link_create(zfs_dirlock_t *dl, znode &dzp->z_pflags, sizeof (dzp->z_pflags)); zfs_tstamp_update_setup(dzp, CONTENT_MODIFIED, mtime, ctime, B_TRUE); error = sa_bulk_update(dzp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); - mutex_exit(&dzp->z_lock); + ASSERT0(error); value = zfs_dirent(zp, zp->z_mode); - error = zap_add(zp->z_zfsvfs->z_os, dzp->z_id, dl->dl_name, + error = zap_add(zp->z_zfsvfs->z_os, dzp->z_id, name, 8, 1, &value, tx); - ASSERT(error == 0); - - dnlc_update(ZTOV(dzp), dl->dl_name, vp); + VERIFY0(error); return (0); } static int -zfs_dropname(zfs_dirlock_t *dl, znode_t *zp, znode_t *dzp, dmu_tx_t *tx, +zfs_dropname(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, int flag) { int error; if (zp->z_zfsvfs->z_norm) { - if (((zp->z_zfsvfs->z_case == ZFS_CASE_INSENSITIVE) && - (flag & ZCIEXACT)) || - ((zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) && - !(flag & ZCILOOK))) + if (zp->z_zfsvfs->z_case == ZFS_CASE_MIXED) error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, MT_EXACT, tx); + dzp->z_id, name, MT_EXACT, tx); else error = zap_remove_norm(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, MT_FIRST, tx); + dzp->z_id, name, MT_FIRST, tx); } else { error = zap_remove(zp->z_zfsvfs->z_os, - dzp->z_id, dl->dl_name, tx); + dzp->z_id, name, tx); } return (error); } /* - * Unlink zp from dl, and mark zp for deletion if this was the last link. + * Unlink zp from dzp, and mark zp for deletion if this was the last link. * Can fail if zp is a mount point (EBUSY) or a non-empty directory (EEXIST). * If 'unlinkedp' is NULL, we put unlinked znodes on the unlinked list. * If it's non-NULL, we use it to indicate whether the znode needs deletion, * and it's the caller's job to do it. */ int -zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag, - boolean_t *unlinkedp) +zfs_link_destroy(znode_t *dzp, const char *name, znode_t *zp, dmu_tx_t *tx, + int flag, boolean_t *unlinkedp) { - znode_t *dzp = dl->dl_dzp; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; vnode_t *vp = ZTOV(zp); int zp_is_dir = (vp->v_type == VDIR); @@ -818,22 +601,12 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod int count = 0; int error; - dnlc_remove(ZTOV(dzp), dl->dl_name); + ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); if (!(flag & ZRENAMING)) { - if (vn_vfswlock(vp)) /* prevent new mounts on zp */ - return (SET_ERROR(EBUSY)); - - if (vn_ismntpt(vp)) { /* don't remove mount point */ - vn_vfsunlock(vp); - return (SET_ERROR(EBUSY)); - } - - mutex_enter(&zp->z_lock); if (zp_is_dir && !zfs_dirempty(zp)) { - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); #ifdef illumos return (SET_ERROR(EEXIST)); #else @@ -846,10 +619,8 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod * First try removing the name from the directory; if that * fails, return the error. */ - error = zfs_dropname(dl, zp, dzp, tx, flag); + error = zfs_dropname(dzp, name, zp, tx, flag); if (error != 0) { - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); return (error); } @@ -876,16 +647,14 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod NULL, &zp->z_links, sizeof (zp->z_links)); error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); count = 0; - ASSERT(error == 0); - mutex_exit(&zp->z_lock); - vn_vfsunlock(vp); + ASSERT0(error); } else { - error = zfs_dropname(dl, zp, dzp, tx, flag); + ASSERT(zp->z_unlinked == 0); + error = zfs_dropname(dzp, name, zp, tx, flag); if (error != 0) return (error); } - mutex_enter(&dzp->z_lock); dzp->z_size--; /* one dirent removed */ dzp->z_links -= zp_is_dir; /* ".." link from zp */ SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs), @@ -900,8 +669,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod NULL, &dzp->z_pflags, sizeof (dzp->z_pflags)); zfs_tstamp_update_setup(dzp, CONTENT_MODIFIED, mtime, ctime, B_TRUE); error = sa_bulk_update(dzp->z_sa_hdl, bulk, count, tx); - ASSERT(error == 0); - mutex_exit(&dzp->z_lock); + ASSERT0(error); if (unlinkedp != NULL) *unlinkedp = unlinked; @@ -912,14 +680,12 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod } /* - * Indicate whether the directory is empty. Works with or without z_lock - * held, but can only be consider a hint in the latter case. Returns true - * if only "." and ".." remain and there's no work in progress. + * Indicate whether the directory is empty. */ boolean_t zfs_dirempty(znode_t *dzp) { - return (dzp->z_size == 2 && dzp->z_dirlocks == 0); + return (dzp->z_size == 2); } int @@ -1013,23 +779,20 @@ zfs_get_xattrdir(znode_t *zp, vnode_t ** { zfsvfs_t *zfsvfs = zp->z_zfsvfs; znode_t *xzp; - zfs_dirlock_t *dl; vattr_t va; int error; top: - error = zfs_dirent_lock(&dl, zp, "", &xzp, ZXATTR, NULL, NULL); + error = zfs_dirent_lookup(zp, "", &xzp, ZXATTR); if (error) return (error); if (xzp != NULL) { *xvpp = ZTOV(xzp); - zfs_dirent_unlock(dl); return (0); } if (!(flags & CREATE_XATTR_DIR)) { - zfs_dirent_unlock(dl); #ifdef illumos return (SET_ERROR(ENOENT)); #else @@ -1038,7 +801,6 @@ top: } if (zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) { - zfs_dirent_unlock(dl); return (SET_ERROR(EROFS)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Aug 23 07:55:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4FA4BC3103; Tue, 23 Aug 2016 07:55:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74E901B6C; Tue, 23 Aug 2016 07:55:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N7tWwS059924; Tue, 23 Aug 2016 07:55:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N7tWFg059923; Tue, 23 Aug 2016 07:55:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230755.u7N7tWFg059923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 07:55: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: r304672 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 07:55:33 -0000 Author: kib Date: Tue Aug 23 07:55:32 2016 New Revision: 304672 URL: https://svnweb.freebsd.org/changeset/base/304672 Log: MFC r304232: In UFS_BALLOC(), invalidate pages of indirect buffers on failed block allocation unwinding. Modified: stable/10/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:55:05 2016 (r304671) +++ stable/10/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:55:32 2016 (r304672) @@ -492,8 +492,8 @@ fail: (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, (uintmax_t)bp->b_blkno, (uintmax_t)fsbtodb(fs, *blkp))); - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; @@ -1087,8 +1087,8 @@ fail: (intmax_t)bp->b_lblkno, (uintmax_t)*lbns_remfree, (uintmax_t)bp->b_blkno, (uintmax_t)fsbtodb(fs, *blkp))); - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; From owner-svn-src-stable@freebsd.org Tue Aug 23 08:13:10 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CC99BC3C16; Tue, 23 Aug 2016 08:13:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0DC51E90; Tue, 23 Aug 2016 08:13:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7N8D9xY067136; Tue, 23 Aug 2016 08:13:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7N8D9pB067135; Tue, 23 Aug 2016 08:13:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608230813.u7N8D9pB067135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 23 Aug 2016 08:13:09 +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: r304673 - stable/9/sys/ufs/ffs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 08:13:10 -0000 Author: kib Date: Tue Aug 23 08:13:08 2016 New Revision: 304673 URL: https://svnweb.freebsd.org/changeset/base/304673 Log: MFC r304232: In UFS_BALLOC(), invalidate pages of indirect buffers on failed block allocation unwinding. Modified: stable/9/sys/ufs/ffs/ffs_balloc.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 07:55:32 2016 (r304672) +++ stable/9/sys/ufs/ffs/ffs_balloc.c Tue Aug 23 08:13:08 2016 (r304673) @@ -478,8 +478,8 @@ fail: */ bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); if (bp != NULL) { - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; @@ -1047,8 +1047,8 @@ fail: */ bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0, GB_NOCREAT); if (bp != NULL) { - bp->b_flags |= (B_INVAL | B_RELBUF); - bp->b_flags &= ~B_ASYNC; + bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE; + bp->b_flags &= ~(B_ASYNC | B_CACHE); brelse(bp); } deallocated += fs->fs_bsize; From owner-svn-src-stable@freebsd.org Tue Aug 23 13:51:56 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B937EBC3DE2; Tue, 23 Aug 2016 13:51:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71C73183D; Tue, 23 Aug 2016 13:51:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NDpt5l092920; Tue, 23 Aug 2016 13:51:55 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7NDptpP092918; Tue, 23 Aug 2016 13:51:55 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201608231351.u7NDptpP092918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Tue, 23 Aug 2016 13:51: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: r304679 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 13:51:56 -0000 Author: arybchik Date: Tue Aug 23 13:51:55 2016 New Revision: 304679 URL: https://svnweb.freebsd.org/changeset/base/304679 Log: MFC r301724 sfxge(4): handle negative ticks difference correctly ticks are signed int and if statistics is not updated for a long time (more than INT_MAX ticks, but less than UINT_MAX) difference becomes negative and less than hz for a long time. Other option to repeat is simply load driver (which initializes timestamps to 0) when ticks are negative. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_ev.c stable/10/sys/dev/sfxge/sfxge_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_ev.c Tue Aug 23 13:43:43 2016 (r304678) +++ stable/10/sys/dev/sfxge/sfxge_ev.c Tue Aug 23 13:51:55 2016 (r304679) @@ -448,7 +448,7 @@ sfxge_ev_stat_update(struct sfxge_softc goto out; now = ticks; - if (now - sc->ev_stats_update_time < hz) + if ((unsigned int)(now - sc->ev_stats_update_time) < (unsigned int)hz) goto out; sc->ev_stats_update_time = now; Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Tue Aug 23 13:43:43 2016 (r304678) +++ stable/10/sys/dev/sfxge/sfxge_port.c Tue Aug 23 13:51:55 2016 (r304679) @@ -62,7 +62,7 @@ sfxge_mac_stat_update(struct sfxge_softc } now = ticks; - if (now - port->mac_stats.update_time < hz) { + if ((unsigned int)(now - port->mac_stats.update_time) < (unsigned int)hz) { rc = 0; goto out; } @@ -543,7 +543,7 @@ sfxge_phy_stat_update(struct sfxge_softc } now = ticks; - if (now - port->phy_stats.update_time < hz) { + if ((unsigned int)(now - port->phy_stats.update_time) < (unsigned int)hz) { rc = 0; goto out; } From owner-svn-src-stable@freebsd.org Tue Aug 23 21:21:58 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F9E4BC4DB5; Tue, 23 Aug 2016 21:21:58 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 111C81225; Tue, 23 Aug 2016 21:21:58 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NLLvKw072785; Tue, 23 Aug 2016 21:21:57 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7NLLvDq072781; Tue, 23 Aug 2016 21:21:57 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201608232121.u7NLLvDq072781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 23 Aug 2016 21:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304704 - in stable/11/sys: conf kern net sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 21:21:58 -0000 Author: shurd (ports committer) Date: Tue Aug 23 21:21:56 2016 New Revision: 304704 URL: https://svnweb.freebsd.org/changeset/base/304704 Log: MFC r304021: Update iflib to support more NIC designs - Move group task queue into kern/subr_gtaskqueue.c - Change intr_enable to return an int so it can be detected if it's not implemented - Allow different TX/RX queues per set to be different sizes - Don't split up TX mbufs before transmit - Allow a completion queue for TX as well as RX - Pass the RX budget to isc_rxd_available() to allow an earlier return and avoid multiple calls Approved by: sbruno Added: stable/11/sys/kern/subr_gtaskqueue.c - copied unchanged from r304021, head/sys/kern/subr_gtaskqueue.c stable/11/sys/sys/gtaskqueue.h - copied unchanged from r304021, head/sys/sys/gtaskqueue.h Modified: stable/11/sys/conf/files stable/11/sys/kern/subr_taskqueue.c stable/11/sys/net/ifdi_if.m stable/11/sys/net/iflib.c stable/11/sys/net/iflib.h stable/11/sys/sys/_task.h stable/11/sys/sys/taskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Tue Aug 23 20:33:56 2016 (r304703) +++ stable/11/sys/conf/files Tue Aug 23 21:21:56 2016 (r304704) @@ -3344,6 +3344,7 @@ kern/subr_disk.c standard kern/subr_eventhandler.c standard kern/subr_fattime.c standard kern/subr_firmware.c optional firmware +kern/subr_gtaskqueue.c standard kern/subr_hash.c standard kern/subr_hints.c standard kern/subr_kdb.c standard Copied: stable/11/sys/kern/subr_gtaskqueue.c (from r304021, head/sys/kern/subr_gtaskqueue.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/kern/subr_gtaskqueue.c Tue Aug 23 21:21:56 2016 (r304704, copy of r304021, head/sys/kern/subr_gtaskqueue.c) @@ -0,0 +1,864 @@ +/*- + * Copyright (c) 2000 Doug Rabson + * Copyright (c) 2014 Jeff Roberson + * Copyright (c) 2016 Matthew Macy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static MALLOC_DEFINE(M_GTASKQUEUE, "taskqueue", "Task Queues"); +static void gtaskqueue_thread_enqueue(void *); +static void gtaskqueue_thread_loop(void *arg); + + +struct gtaskqueue_busy { + struct gtask *tb_running; + TAILQ_ENTRY(gtaskqueue_busy) tb_link; +}; + +static struct gtask * const TB_DRAIN_WAITER = (struct gtask *)0x1; + +struct gtaskqueue { + STAILQ_HEAD(, gtask) tq_queue; + gtaskqueue_enqueue_fn tq_enqueue; + void *tq_context; + char *tq_name; + TAILQ_HEAD(, gtaskqueue_busy) tq_active; + struct mtx tq_mutex; + struct thread **tq_threads; + int tq_tcount; + int tq_spin; + int tq_flags; + int tq_callouts; + taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; + void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; +}; + +#define TQ_FLAGS_ACTIVE (1 << 0) +#define TQ_FLAGS_BLOCKED (1 << 1) +#define TQ_FLAGS_UNLOCKED_ENQUEUE (1 << 2) + +#define DT_CALLOUT_ARMED (1 << 0) + +#define TQ_LOCK(tq) \ + do { \ + if ((tq)->tq_spin) \ + mtx_lock_spin(&(tq)->tq_mutex); \ + else \ + mtx_lock(&(tq)->tq_mutex); \ + } while (0) +#define TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_OWNED) + +#define TQ_UNLOCK(tq) \ + do { \ + if ((tq)->tq_spin) \ + mtx_unlock_spin(&(tq)->tq_mutex); \ + else \ + mtx_unlock(&(tq)->tq_mutex); \ + } while (0) +#define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) + +static __inline int +TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, + int t) +{ + if (tq->tq_spin) + return (msleep_spin(p, m, wm, t)); + return (msleep(p, m, pri, wm, t)); +} + +static struct gtaskqueue * +_gtaskqueue_create(const char *name, int mflags, + taskqueue_enqueue_fn enqueue, void *context, + int mtxflags, const char *mtxname __unused) +{ + struct gtaskqueue *queue; + char *tq_name; + + tq_name = malloc(TASKQUEUE_NAMELEN, M_GTASKQUEUE, mflags | M_ZERO); + if (!tq_name) + return (NULL); + + snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue"); + + queue = malloc(sizeof(struct gtaskqueue), M_GTASKQUEUE, mflags | M_ZERO); + if (!queue) + return (NULL); + + STAILQ_INIT(&queue->tq_queue); + TAILQ_INIT(&queue->tq_active); + queue->tq_enqueue = enqueue; + queue->tq_context = context; + queue->tq_name = tq_name; + queue->tq_spin = (mtxflags & MTX_SPIN) != 0; + queue->tq_flags |= TQ_FLAGS_ACTIVE; + if (enqueue == gtaskqueue_thread_enqueue) + queue->tq_flags |= TQ_FLAGS_UNLOCKED_ENQUEUE; + mtx_init(&queue->tq_mutex, tq_name, NULL, mtxflags); + + return (queue); +} + + +/* + * Signal a taskqueue thread to terminate. + */ +static void +gtaskqueue_terminate(struct thread **pp, struct gtaskqueue *tq) +{ + + while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { + wakeup(tq); + TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + } +} + +static void +gtaskqueue_free(struct gtaskqueue *queue) +{ + + TQ_LOCK(queue); + queue->tq_flags &= ~TQ_FLAGS_ACTIVE; + gtaskqueue_terminate(queue->tq_threads, queue); + KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); + mtx_destroy(&queue->tq_mutex); + free(queue->tq_threads, M_GTASKQUEUE); + free(queue->tq_name, M_GTASKQUEUE); + free(queue, M_GTASKQUEUE); +} + +int +grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) +{ + TQ_LOCK(queue); + if (gtask->ta_flags & TASK_ENQUEUED) { + TQ_UNLOCK(queue); + return (0); + } + STAILQ_INSERT_TAIL(&queue->tq_queue, gtask, ta_link); + gtask->ta_flags |= TASK_ENQUEUED; + TQ_UNLOCK(queue); + if ((queue->tq_flags & TQ_FLAGS_BLOCKED) == 0) + queue->tq_enqueue(queue->tq_context); + return (0); +} + +static void +gtaskqueue_task_nop_fn(void *context) +{ +} + +/* + * Block until all currently queued tasks in this taskqueue + * have begun execution. Tasks queued during execution of + * this function are ignored. + */ +static void +gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) +{ + struct gtask t_barrier; + + if (STAILQ_EMPTY(&queue->tq_queue)) + return; + + /* + * Enqueue our barrier after all current tasks, but with + * the highest priority so that newly queued tasks cannot + * pass it. Because of the high priority, we can not use + * taskqueue_enqueue_locked directly (which drops the lock + * anyway) so just insert it at tail while we have the + * queue lock. + */ + GTASK_INIT(&t_barrier, 0, USHRT_MAX, gtaskqueue_task_nop_fn, &t_barrier); + STAILQ_INSERT_TAIL(&queue->tq_queue, &t_barrier, ta_link); + t_barrier.ta_flags |= TASK_ENQUEUED; + + /* + * Once the barrier has executed, all previously queued tasks + * have completed or are currently executing. + */ + while (t_barrier.ta_flags & TASK_ENQUEUED) + TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); +} + +/* + * Block until all currently executing tasks for this taskqueue + * complete. Tasks that begin execution during the execution + * of this function are ignored. + */ +static void +gtaskqueue_drain_tq_active(struct gtaskqueue *queue) +{ + struct gtaskqueue_busy tb_marker, *tb_first; + + if (TAILQ_EMPTY(&queue->tq_active)) + return; + + /* Block taskq_terminate().*/ + queue->tq_callouts++; + + /* + * Wait for all currently executing taskqueue threads + * to go idle. + */ + tb_marker.tb_running = TB_DRAIN_WAITER; + TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); + while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) + TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); + TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + + /* + * Wakeup any other drain waiter that happened to queue up + * without any intervening active thread. + */ + tb_first = TAILQ_FIRST(&queue->tq_active); + if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) + wakeup(tb_first); + + /* Release taskqueue_terminate(). */ + queue->tq_callouts--; + if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) + wakeup_one(queue->tq_threads); +} + +void +gtaskqueue_block(struct gtaskqueue *queue) +{ + + TQ_LOCK(queue); + queue->tq_flags |= TQ_FLAGS_BLOCKED; + TQ_UNLOCK(queue); +} + +void +gtaskqueue_unblock(struct gtaskqueue *queue) +{ + + TQ_LOCK(queue); + queue->tq_flags &= ~TQ_FLAGS_BLOCKED; + if (!STAILQ_EMPTY(&queue->tq_queue)) + queue->tq_enqueue(queue->tq_context); + TQ_UNLOCK(queue); +} + +static void +gtaskqueue_run_locked(struct gtaskqueue *queue) +{ + struct gtaskqueue_busy tb; + struct gtaskqueue_busy *tb_first; + struct gtask *gtask; + + KASSERT(queue != NULL, ("tq is NULL")); + TQ_ASSERT_LOCKED(queue); + tb.tb_running = NULL; + + while (STAILQ_FIRST(&queue->tq_queue)) { + TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); + + /* + * Carefully remove the first task from the queue and + * clear its TASK_ENQUEUED flag + */ + gtask = STAILQ_FIRST(&queue->tq_queue); + KASSERT(gtask != NULL, ("task is NULL")); + STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); + gtask->ta_flags &= ~TASK_ENQUEUED; + tb.tb_running = gtask; + TQ_UNLOCK(queue); + + KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL")); + gtask->ta_func(gtask->ta_context); + + TQ_LOCK(queue); + tb.tb_running = NULL; + wakeup(gtask); + + TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); + tb_first = TAILQ_FIRST(&queue->tq_active); + if (tb_first != NULL && + tb_first->tb_running == TB_DRAIN_WAITER) + wakeup(tb_first); + } +} + +static int +task_is_running(struct gtaskqueue *queue, struct gtask *gtask) +{ + struct gtaskqueue_busy *tb; + + TQ_ASSERT_LOCKED(queue); + TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + if (tb->tb_running == gtask) + return (1); + } + return (0); +} + +static int +gtaskqueue_cancel_locked(struct gtaskqueue *queue, struct gtask *gtask) +{ + + if (gtask->ta_flags & TASK_ENQUEUED) + STAILQ_REMOVE(&queue->tq_queue, gtask, gtask, ta_link); + gtask->ta_flags &= ~TASK_ENQUEUED; + return (task_is_running(queue, gtask) ? EBUSY : 0); +} + +int +gtaskqueue_cancel(struct gtaskqueue *queue, struct gtask *gtask) +{ + int error; + + TQ_LOCK(queue); + error = gtaskqueue_cancel_locked(queue, gtask); + TQ_UNLOCK(queue); + + return (error); +} + +void +gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *gtask) +{ + + if (!queue->tq_spin) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + TQ_LOCK(queue); + while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) + TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + TQ_UNLOCK(queue); +} + +void +gtaskqueue_drain_all(struct gtaskqueue *queue) +{ + + if (!queue->tq_spin) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + TQ_LOCK(queue); + gtaskqueue_drain_tq_queue(queue); + gtaskqueue_drain_tq_active(queue); + TQ_UNLOCK(queue); +} + +static int +_gtaskqueue_start_threads(struct gtaskqueue **tqp, int count, int pri, + cpuset_t *mask, const char *name, va_list ap) +{ + char ktname[MAXCOMLEN + 1]; + struct thread *td; + struct gtaskqueue *tq; + int i, error; + + if (count <= 0) + return (EINVAL); + + vsnprintf(ktname, sizeof(ktname), name, ap); + tq = *tqp; + + tq->tq_threads = malloc(sizeof(struct thread *) * count, M_GTASKQUEUE, + M_NOWAIT | M_ZERO); + if (tq->tq_threads == NULL) { + printf("%s: no memory for %s threads\n", __func__, ktname); + return (ENOMEM); + } + + for (i = 0; i < count; i++) { + if (count == 1) + error = kthread_add(gtaskqueue_thread_loop, tqp, NULL, + &tq->tq_threads[i], RFSTOPPED, 0, "%s", ktname); + else + error = kthread_add(gtaskqueue_thread_loop, tqp, NULL, + &tq->tq_threads[i], RFSTOPPED, 0, + "%s_%d", ktname, i); + if (error) { + /* should be ok to continue, taskqueue_free will dtrt */ + printf("%s: kthread_add(%s): error %d", __func__, + ktname, error); + tq->tq_threads[i] = NULL; /* paranoid */ + } else + tq->tq_tcount++; + } + for (i = 0; i < count; i++) { + if (tq->tq_threads[i] == NULL) + continue; + td = tq->tq_threads[i]; + if (mask) { + error = cpuset_setthread(td->td_tid, mask); + /* + * Failing to pin is rarely an actual fatal error; + * it'll just affect performance. + */ + if (error) + printf("%s: curthread=%llu: can't pin; " + "error=%d\n", + __func__, + (unsigned long long) td->td_tid, + error); + } + thread_lock(td); + sched_prio(td, pri); + sched_add(td, SRQ_BORING); + thread_unlock(td); + } + + return (0); +} + +static int +gtaskqueue_start_threads(struct gtaskqueue **tqp, int count, int pri, + const char *name, ...) +{ + va_list ap; + int error; + + va_start(ap, name); + error = _gtaskqueue_start_threads(tqp, count, pri, NULL, name, ap); + va_end(ap); + return (error); +} + +static inline void +gtaskqueue_run_callback(struct gtaskqueue *tq, + enum taskqueue_callback_type cb_type) +{ + taskqueue_callback_fn tq_callback; + + TQ_ASSERT_UNLOCKED(tq); + tq_callback = tq->tq_callbacks[cb_type]; + if (tq_callback != NULL) + tq_callback(tq->tq_cb_contexts[cb_type]); +} + +static void +gtaskqueue_thread_loop(void *arg) +{ + struct gtaskqueue **tqp, *tq; + + tqp = arg; + tq = *tqp; + gtaskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT); + TQ_LOCK(tq); + while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { + /* XXX ? */ + gtaskqueue_run_locked(tq); + /* + * Because taskqueue_run() can drop tq_mutex, we need to + * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the + * meantime, which means we missed a wakeup. + */ + if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) + break; + TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + } + gtaskqueue_run_locked(tq); + /* + * This thread is on its way out, so just drop the lock temporarily + * in order to call the shutdown callback. This allows the callback + * to look at the taskqueue, even just before it dies. + */ + TQ_UNLOCK(tq); + gtaskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN); + TQ_LOCK(tq); + + /* rendezvous with thread that asked us to terminate */ + tq->tq_tcount--; + wakeup_one(tq->tq_threads); + TQ_UNLOCK(tq); + kthread_exit(); +} + +static void +gtaskqueue_thread_enqueue(void *context) +{ + struct gtaskqueue **tqp, *tq; + + tqp = context; + tq = *tqp; + wakeup_one(tq); +} + + +static struct gtaskqueue * +gtaskqueue_create_fast(const char *name, int mflags, + taskqueue_enqueue_fn enqueue, void *context) +{ + return _gtaskqueue_create(name, mflags, enqueue, context, + MTX_SPIN, "fast_taskqueue"); +} + + +struct taskqgroup_cpu { + LIST_HEAD(, grouptask) tgc_tasks; + struct gtaskqueue *tgc_taskq; + int tgc_cnt; + int tgc_cpu; +}; + +struct taskqgroup { + struct taskqgroup_cpu tqg_queue[MAXCPU]; + struct mtx tqg_lock; + char * tqg_name; + int tqg_adjusting; + int tqg_stride; + int tqg_cnt; +}; + +struct taskq_bind_task { + struct gtask bt_task; + int bt_cpuid; +}; + +static void +taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx) +{ + struct taskqgroup_cpu *qcpu; + + qcpu = &qgroup->tqg_queue[idx]; + LIST_INIT(&qcpu->tgc_tasks); + qcpu->tgc_taskq = gtaskqueue_create_fast(NULL, M_WAITOK, + taskqueue_thread_enqueue, &qcpu->tgc_taskq); + gtaskqueue_start_threads(&qcpu->tgc_taskq, 1, PI_SOFT, + "%s_%d", qgroup->tqg_name, idx); + qcpu->tgc_cpu = idx * qgroup->tqg_stride; +} + +static void +taskqgroup_cpu_remove(struct taskqgroup *qgroup, int idx) +{ + + gtaskqueue_free(qgroup->tqg_queue[idx].tgc_taskq); +} + +/* + * Find the taskq with least # of tasks that doesn't currently have any + * other queues from the uniq identifier. + */ +static int +taskqgroup_find(struct taskqgroup *qgroup, void *uniq) +{ + struct grouptask *n; + int i, idx, mincnt; + int strict; + + mtx_assert(&qgroup->tqg_lock, MA_OWNED); + if (qgroup->tqg_cnt == 0) + return (0); + idx = -1; + mincnt = INT_MAX; + /* + * Two passes; First scan for a queue with the least tasks that + * does not already service this uniq id. If that fails simply find + * the queue with the least total tasks; + */ + for (strict = 1; mincnt == INT_MAX; strict = 0) { + for (i = 0; i < qgroup->tqg_cnt; i++) { + if (qgroup->tqg_queue[i].tgc_cnt > mincnt) + continue; + if (strict) { + LIST_FOREACH(n, + &qgroup->tqg_queue[i].tgc_tasks, gt_list) + if (n->gt_uniq == uniq) + break; + if (n != NULL) + continue; + } + mincnt = qgroup->tqg_queue[i].tgc_cnt; + idx = i; + } + } + if (idx == -1) + panic("taskqgroup_find: Failed to pick a qid."); + + return (idx); +} + +void +taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, + void *uniq, int irq, char *name) +{ + cpuset_t mask; + int qid; + + gtask->gt_uniq = uniq; + gtask->gt_name = name; + gtask->gt_irq = irq; + gtask->gt_cpu = -1; + mtx_lock(&qgroup->tqg_lock); + qid = taskqgroup_find(qgroup, uniq); + qgroup->tqg_queue[qid].tgc_cnt++; + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + if (irq != -1 && smp_started) { + CPU_ZERO(&mask); + CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); + mtx_unlock(&qgroup->tqg_lock); + intr_setaffinity(irq, &mask); + } else + mtx_unlock(&qgroup->tqg_lock); +} + +int +taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, + void *uniq, int cpu, int irq, char *name) +{ + cpuset_t mask; + int i, qid; + + qid = -1; + gtask->gt_uniq = uniq; + gtask->gt_name = name; + gtask->gt_irq = irq; + gtask->gt_cpu = cpu; + mtx_lock(&qgroup->tqg_lock); + if (smp_started) { + for (i = 0; i < qgroup->tqg_cnt; i++) + if (qgroup->tqg_queue[i].tgc_cpu == cpu) { + qid = i; + break; + } + if (qid == -1) { + mtx_unlock(&qgroup->tqg_lock); + return (EINVAL); + } + } else + qid = 0; + qgroup->tqg_queue[qid].tgc_cnt++; + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + if (irq != -1 && smp_started) { + CPU_ZERO(&mask); + CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); + mtx_unlock(&qgroup->tqg_lock); + intr_setaffinity(irq, &mask); + } else + mtx_unlock(&qgroup->tqg_lock); + return (0); +} + +void +taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask) +{ + int i; + + mtx_lock(&qgroup->tqg_lock); + for (i = 0; i < qgroup->tqg_cnt; i++) + if (qgroup->tqg_queue[i].tgc_taskq == gtask->gt_taskqueue) + break; + if (i == qgroup->tqg_cnt) + panic("taskqgroup_detach: task not in group\n"); + qgroup->tqg_queue[i].tgc_cnt--; + LIST_REMOVE(gtask, gt_list); + mtx_unlock(&qgroup->tqg_lock); + gtask->gt_taskqueue = NULL; +} + +static void +taskqgroup_binder(void *ctx) +{ + struct taskq_bind_task *gtask = (struct taskq_bind_task *)ctx; + cpuset_t mask; + int error; + + CPU_ZERO(&mask); + CPU_SET(gtask->bt_cpuid, &mask); + error = cpuset_setthread(curthread->td_tid, &mask); + thread_lock(curthread); + sched_bind(curthread, gtask->bt_cpuid); + thread_unlock(curthread); + + if (error) + printf("taskqgroup_binder: setaffinity failed: %d\n", + error); + free(gtask, M_DEVBUF); +} + +static void +taskqgroup_bind(struct taskqgroup *qgroup) +{ + struct taskq_bind_task *gtask; + int i; + + /* + * Bind taskqueue threads to specific CPUs, if they have been assigned + * one. + */ + for (i = 0; i < qgroup->tqg_cnt; i++) { + gtask = malloc(sizeof (*gtask), M_DEVBUF, M_NOWAIT); + GTASK_INIT(>ask->bt_task, 0, 0, taskqgroup_binder, gtask); + gtask->bt_cpuid = qgroup->tqg_queue[i].tgc_cpu; + grouptaskqueue_enqueue(qgroup->tqg_queue[i].tgc_taskq, + >ask->bt_task); + } +} + +static int +_taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) +{ + LIST_HEAD(, grouptask) gtask_head = LIST_HEAD_INITIALIZER(NULL); + cpuset_t mask; + struct grouptask *gtask; + int i, old_cnt, qid; + + mtx_assert(&qgroup->tqg_lock, MA_OWNED); + + if (cnt < 1 || cnt * stride > mp_ncpus || !smp_started) { + printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", + cnt, stride, mp_ncpus, smp_started); + return (EINVAL); + } + if (qgroup->tqg_adjusting) { + printf("taskqgroup_adjust failed: adjusting\n"); + return (EBUSY); + } + qgroup->tqg_adjusting = 1; + old_cnt = qgroup->tqg_cnt; + mtx_unlock(&qgroup->tqg_lock); + /* + * Set up queue for tasks added before boot. + */ + if (old_cnt == 0) { + LIST_SWAP(>ask_head, &qgroup->tqg_queue[0].tgc_tasks, + grouptask, gt_list); + qgroup->tqg_queue[0].tgc_cnt = 0; + } + + /* + * If new taskq threads have been added. + */ + for (i = old_cnt; i < cnt; i++) + taskqgroup_cpu_create(qgroup, i); + mtx_lock(&qgroup->tqg_lock); + qgroup->tqg_cnt = cnt; + qgroup->tqg_stride = stride; + + /* + * Adjust drivers to use new taskqs. + */ + for (i = 0; i < old_cnt; i++) { + while ((gtask = LIST_FIRST(&qgroup->tqg_queue[i].tgc_tasks))) { + LIST_REMOVE(gtask, gt_list); + qgroup->tqg_queue[i].tgc_cnt--; + LIST_INSERT_HEAD(>ask_head, gtask, gt_list); + } + } + + while ((gtask = LIST_FIRST(>ask_head))) { + LIST_REMOVE(gtask, gt_list); + if (gtask->gt_cpu == -1) + qid = taskqgroup_find(qgroup, gtask->gt_uniq); + else { + for (i = 0; i < qgroup->tqg_cnt; i++) + if (qgroup->tqg_queue[i].tgc_cpu == gtask->gt_cpu) { + qid = i; + break; + } + } + qgroup->tqg_queue[qid].tgc_cnt++; + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, + gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + } + /* + * Set new CPU and IRQ affinity + */ + for (i = 0; i < cnt; i++) { + qgroup->tqg_queue[i].tgc_cpu = i * qgroup->tqg_stride; + CPU_ZERO(&mask); + CPU_SET(qgroup->tqg_queue[i].tgc_cpu, &mask); + LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list) { + if (gtask->gt_irq == -1) + continue; + intr_setaffinity(gtask->gt_irq, &mask); + } + } + mtx_unlock(&qgroup->tqg_lock); + + /* + * If taskq thread count has been reduced. + */ + for (i = cnt; i < old_cnt; i++) + taskqgroup_cpu_remove(qgroup, i); + + mtx_lock(&qgroup->tqg_lock); + qgroup->tqg_adjusting = 0; + + taskqgroup_bind(qgroup); + + return (0); +} + +int +taskqgroup_adjust(struct taskqgroup *qgroup, int cpu, int stride) +{ + int error; + + mtx_lock(&qgroup->tqg_lock); + error = _taskqgroup_adjust(qgroup, cpu, stride); + mtx_unlock(&qgroup->tqg_lock); + + return (error); +} + +struct taskqgroup * +taskqgroup_create(char *name) +{ + struct taskqgroup *qgroup; + + qgroup = malloc(sizeof(*qgroup), M_GTASKQUEUE, M_WAITOK | M_ZERO); + mtx_init(&qgroup->tqg_lock, "taskqgroup", NULL, MTX_DEF); + qgroup->tqg_name = name; + LIST_INIT(&qgroup->tqg_queue[0].tgc_tasks); + + return (qgroup); +} + +void +taskqgroup_destroy(struct taskqgroup *qgroup) +{ + +} Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Tue Aug 23 20:33:56 2016 (r304703) +++ stable/11/sys/kern/subr_taskqueue.c Tue Aug 23 21:21:56 2016 (r304704) @@ -261,22 +261,6 @@ taskqueue_enqueue_locked(struct taskqueu } int -grouptaskqueue_enqueue(struct taskqueue *queue, struct task *task) -{ - TQ_LOCK(queue); - if (task->ta_pending) { - TQ_UNLOCK(queue); - return (0); - } - STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link); - task->ta_pending = 1; - TQ_UNLOCK(queue); - if ((queue->tq_flags & TQ_FLAGS_BLOCKED) == 0) - queue->tq_enqueue(queue->tq_context); - return (0); -} - -int taskqueue_enqueue(struct taskqueue *queue, struct task *task) { int res; @@ -806,347 +790,3 @@ taskqueue_member(struct taskqueue *queue } return (ret); } - -struct taskqgroup_cpu { - LIST_HEAD(, grouptask) tgc_tasks; - struct taskqueue *tgc_taskq; - int tgc_cnt; - int tgc_cpu; -}; - -struct taskqgroup { - struct taskqgroup_cpu tqg_queue[MAXCPU]; - struct mtx tqg_lock; - char * tqg_name; - int tqg_adjusting; - int tqg_stride; - int tqg_cnt; -}; - -struct taskq_bind_task { - struct task bt_task; - int bt_cpuid; -}; - -static void -taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx) -{ - struct taskqgroup_cpu *qcpu; - int i, j; - - qcpu = &qgroup->tqg_queue[idx]; - LIST_INIT(&qcpu->tgc_tasks); - qcpu->tgc_taskq = taskqueue_create_fast(NULL, M_WAITOK, - taskqueue_thread_enqueue, &qcpu->tgc_taskq); - taskqueue_start_threads(&qcpu->tgc_taskq, 1, PI_SOFT, - "%s_%d", qgroup->tqg_name, idx); - - for (i = CPU_FIRST(), j = 0; j < idx * qgroup->tqg_stride; - j++, i = CPU_NEXT(i)) { - /* - * Wait: evaluate the idx * qgroup->tqg_stride'th CPU, - * potentially wrapping the actual count - */ - } - qcpu->tgc_cpu = i; -} - -static void -taskqgroup_cpu_remove(struct taskqgroup *qgroup, int idx) -{ - - taskqueue_free(qgroup->tqg_queue[idx].tgc_taskq); -} - -/* - * Find the taskq with least # of tasks that doesn't currently have any - * other queues from the uniq identifier. - */ -static int -taskqgroup_find(struct taskqgroup *qgroup, void *uniq) -{ - struct grouptask *n; - int i, idx, mincnt; - int strict; - - mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (qgroup->tqg_cnt == 0) - return (0); - idx = -1; - mincnt = INT_MAX; - /* - * Two passes; First scan for a queue with the least tasks that - * does not already service this uniq id. If that fails simply find - * the queue with the least total tasks; - */ - for (strict = 1; mincnt == INT_MAX; strict = 0) { - for (i = 0; i < qgroup->tqg_cnt; i++) { - if (qgroup->tqg_queue[i].tgc_cnt > mincnt) - continue; - if (strict) { - LIST_FOREACH(n, - &qgroup->tqg_queue[i].tgc_tasks, gt_list) - if (n->gt_uniq == uniq) - break; - if (n != NULL) - continue; - } - mincnt = qgroup->tqg_queue[i].tgc_cnt; - idx = i; - } - } - if (idx == -1) - panic("taskqgroup_find: Failed to pick a qid."); - - return (idx); -} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Aug 23 22:18:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72853BC4796; Tue, 23 Aug 2016 22:18:51 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4259B1EEC; Tue, 23 Aug 2016 22:18:51 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-pa0-x22d.google.com with SMTP id hb8so33375605pac.2; Tue, 23 Aug 2016 15:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=r2Ud/vEkpSPX5EBiB0nOQpVy9XK7KxwBhXBCtre7L1M=; b=UlLplzriZZ6tGfx3vBVYsJkMf8e0SsidOv5R+YgymyT3lNdfNZKL+q3kml119L6HHl gpJGfgXDlL/ncATUzz70h1RXopXFu9iiYYLptZa1Z3zhNCIZcgwwTF+/0mj9F2wGlCMx gMPtoWoSgcna6nNHLHuursVWlDXAMDYKA2R/SXwb3BzbaXiCHgK0/tHcNi13Mt3m41tK DaF9bnEYesvR2Q8nkO1bEMOSQqnWiQRTEnQAEV7bnlnVOMGuk9dCGXcqSXzi0qcXg36d 3oKMdlF3UqZVL5fEQaasGdRGd+L4xQXIuGMLxLiNyQdrmc2f+/JYwIaRo+m7d/zkyoRj Gl9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=r2Ud/vEkpSPX5EBiB0nOQpVy9XK7KxwBhXBCtre7L1M=; b=j1gQW8HCAbRZFjoWYY3DjyWqII1fcCxO2w1KyAiXK7kXDT7ZiywtXbgG+qp/UPxgEU APaVBzkrP5LglFBBIq9ZvvWACvIsW8FLqyo+YHLROtTXlzgpH9N/nKDGi6ILaSTnwR5w MsLhMs0g5I7hW2+GsgzXxQ3yBieX52xdWmQooNb57DJFPw1D4if58JaDQipn96DHa+II UyQebavU2kNR7AVXP5o4OSCaZpsER1qG2jHt9bucyawvwpxPS62FC5PYQ+re2RSzlY1T MiwnVMCAowEvNCn/44XTfV2QFLBQ8bd/wEbvMOFXN7FGWzZAgBaQAUQbUSCeeY26j0JY kfuA== X-Gm-Message-State: AEkoouueM62Ctz6pGK/bG/aWIUHF1eh7/E/hOMuyjfrpvxcgIRn6CaBfj7VCKEoDuY233A== X-Received: by 10.66.86.170 with SMTP id q10mr56740385paz.105.1471990730462; Tue, 23 Aug 2016 15:18:50 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id ah5sm8075591pad.30.2016.08.23.15.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Aug 2016 15:18:49 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: svn commit: r304704 - in stable/11/sys: conf kern net sys To: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201608232121.u7NLLvDq072781@repo.freebsd.org> From: Navdeep Parhar Message-ID: <7723623e-67cf-0a0a-6cba-4a3f5bdb8f16@FreeBSD.org> Date: Tue, 23 Aug 2016 15:18:48 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201608232121.u7NLLvDq072781@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 22:18:51 -0000 On 08/23/2016 14:21, Stephen Hurd wrote: > Author: shurd (ports committer) > Date: Tue Aug 23 21:21:56 2016 > New Revision: 304704 > URL: https://svnweb.freebsd.org/changeset/base/304704 > > Log: > MFC r304021: Update iflib to support more NIC designs > > - Move group task queue into kern/subr_gtaskqueue.c > - Change intr_enable to return an int so it can be detected if it's not > implemented > - Allow different TX/RX queues per set to be different sizes > - Don't split up TX mbufs before transmit > - Allow a completion queue for TX as well as RX > - Pass the RX budget to isc_rxd_available() to allow an earlier return > and avoid multiple calls > > Approved by: sbruno > > Added: > stable/11/sys/kern/subr_gtaskqueue.c > - copied unchanged from r304021, head/sys/kern/subr_gtaskqueue.c > stable/11/sys/sys/gtaskqueue.h > - copied unchanged from r304021, head/sys/sys/gtaskqueue.h > Modified: > stable/11/sys/conf/files > stable/11/sys/kern/subr_taskqueue.c > stable/11/sys/net/ifdi_if.m > stable/11/sys/net/iflib.c > stable/11/sys/net/iflib.h (I'm assuming that you do not plan to merge this to releng/11.0.) It looks like the changes to iflib.h will break any external NIC driver written/compiled against the iflib.h in 11.0. Is iflib considered part of the KPI/KBI in FreeBSD 11 or is it for in-tree use only with no interface guarantees? If it's the latter then why do we even have iflib in 11.0 given that no in-tree driver in 11.0 uses it? Regards, Navdeep > stable/11/sys/sys/_task.h > stable/11/sys/sys/taskqueue.h > Directory Properties: > stable/11/ (props changed) > > ... From owner-svn-src-stable@freebsd.org Tue Aug 23 22:40:04 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D92E6BC4BEE; Tue, 23 Aug 2016 22:40:04 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail23c7.megamailservers.com (mail23c7.megamailservers.com [69.49.98.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A15F1D9C; Tue, 23 Aug 2016 22:40:04 +0000 (UTC) (envelope-from shurd@sasktel.net) Received: from mail23c7.megamailservers.com (localhost [127.0.0.1]) by mail23c7.megamailservers.com (8.14.9/8.13.1) with ESMTP id u7NMWqKC008798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Aug 2016 18:32:52 -0400 Received: (from webmail@localhost) by mail23c7.megamailservers.com (8.14.9/8.12.2/Submit) id u7NMWqii008797; Tue, 23 Aug 2016 18:32:52 -0400 Received: from 5520-maca-inet1-outside.broadcom.com (5520-maca-inet1-outside.broadcom.com [216.31.211.11]) by webmail.sasktel.net (Webmail 5.0 V.V.I.) with HTTP for ; Tue, 23 Aug 2016 16:32:52 -0600 Message-ID: <20160823163252.r0ut6a7d28kso08o@webmail.sasktel.net> From: shurd@sasktel.net Reply-to: shurd@sasktel.net To: Stephen Hurd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, Navdeep Parhar Subject: Re: svn commit: r304704 - in stable/11/sys: conf kern net sys Date: Tue, 23 Aug 2016 16:32:52 -0600 X-Priority: 3 X-Authenticated-User: shurd.sasktel.net References: <201608232121.u7NLLvDq072781@repo.freebsd.org> <7723623e-67cf-0a0a-6cba-4a3f5bdb8f16@FreeBSD.org> In-Reply-To: <7723623e-67cf-0a0a-6cba-4a3f5bdb8f16@FreeBSD.org> MIME-Version: 1.0 User-Agent: Webmail 6.0 X-CTCH-RefID: str=0001.0A020205.57BCCF14.0168, ss=1, re=2.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 2.000 X-CTCH-Rules: FREEMAIL_REPLYTO, X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.1 cv=Wag1NSRX c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=Pqgwzd+QtBWunNm/3vzkeA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=ikZSrtty1KYA:10 a=v2NWgMxlncYA:10 a=7z1cN_iqozsA:10 a=G-JvYgQUlsIBVzUhMCsA:9 a=6I5d2MoRAAAA:8 a=vmsf08cWzeK0PD7ATEgA:9 a=QEXdDO2ut3YA:10 a=_W_S_7VecoQA:10 a=IjZwj45LgO3ly-622nXo:22 Content-Type: text/plain; charset=UTF-8; format="flowed" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: Plaintext Version of Message X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 22:40:05 -0000 Hopefully the formatting is OK, I used webmail for this. =C2=A0 On Tue, 23 Aug 2016 15:18:48 -0700, Navdeep Parhar wrote: (I'm assuming that you do not plan to merge this to releng/11.0.) =C2=A0 I'm=C2=A0working to get this into releng/11.0. =C2=A0The merge to stable/11=C2=A0had to be done before a merge request can be sent to re@. =C2=A0 It looks like the changes to iflib.h will break any external NIC dri= ver written/compiled against the iflib.h in 11.0. =C2=A0 That is correct. =C2=A0All the currently known drivers (all of which are presently external) which use iflib have been converted to the new header already. =C2=A0Therre are at present no iflib.h consumers in the tree or in ports. =C2=A0 Is iflib considered part of the KPI/KBI in FreeBSD 11 or is it for in-tree use only with no interface guarantees? If it's the latter then why do we even have iflib in 11.0 given that no in-tree driver in 11.0 uses it? =C2=A0 There was hope to get one or two drivers in-tree for 11.0 (see the review here: https://reviews.freebsd.org/D7551), but given the timing and the API changes, it seems unlikely. =C2=A0 =C2=A0 Thanks, Stephen Hurd =C2=A0 From owner-svn-src-stable@freebsd.org Wed Aug 24 01:34:24 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062EDBC186C; Wed, 24 Aug 2016 01:34:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C65EA15C3; Wed, 24 Aug 2016 01:34:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O1YMsJ066666; Wed, 24 Aug 2016 01:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O1YMpl066665; Wed, 24 Aug 2016 01:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608240134.u7O1YMpl066665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 24 Aug 2016 01:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304714 - stable/11/share/i18n/esdb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 01:34:24 -0000 Author: bdrewery Date: Wed Aug 24 01:34:22 2016 New Revision: 304714 URL: https://svnweb.freebsd.org/changeset/base/304714 Log: MFC r304643: Fix building on read-only source trees. PR: 211952 Modified: stable/11/share/i18n/esdb/Makefile.part Directory Properties: stable/11/ (props changed) Modified: stable/11/share/i18n/esdb/Makefile.part ============================================================================== --- stable/11/share/i18n/esdb/Makefile.part Wed Aug 24 00:52:30 2016 (r304713) +++ stable/11/share/i18n/esdb/Makefile.part Wed Aug 24 01:34:22 2016 (r304714) @@ -67,9 +67,11 @@ codesets: ${ESDB} .if !defined(NO_PREPROC) .for i in ${PART} +.if !exists(${.CURDIR}/${EPREFIX}${i:S/:/@/}.src) ${EPREFIX}${i:S/:/@/}.src: ${CODE}.src sed ${SED_EXP:S@%%PART%%@${i}@} ${.ALLSRC} > ${.TARGET} @echo ${.TARGET} >>.tmpfiles +.endif .endfor .endif From owner-svn-src-stable@freebsd.org Wed Aug 24 01:44:54 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCA02BC1A89; Wed, 24 Aug 2016 01:44:54 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF0951AC4; Wed, 24 Aug 2016 01:44:54 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O1ir3F070518; Wed, 24 Aug 2016 01:44:53 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O1irAi070517; Wed, 24 Aug 2016 01:44:53 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608240144.u7O1irAi070517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 24 Aug 2016 01:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304715 - stable/11/sys/net80211 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 01:44:55 -0000 Author: bdrewery Date: Wed Aug 24 01:44:53 2016 New Revision: 304715 URL: https://svnweb.freebsd.org/changeset/base/304715 Log: MFC r304322: [net80211] correctly lock the ifp before accessing the lladdr. Modified: stable/11/sys/net80211/ieee80211_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_ioctl.c ============================================================================== --- stable/11/sys/net80211/ieee80211_ioctl.c Wed Aug 24 01:34:22 2016 (r304714) +++ stable/11/sys/net80211/ieee80211_ioctl.c Wed Aug 24 01:44:53 2016 (r304715) @@ -3394,10 +3394,12 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon * Check if the MAC address was changed * via SIOCSIFLLADDR ioctl. */ + if_addr_rlock(ifp); if ((ifp->if_flags & IFF_UP) == 0 && !IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp))) IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); + if_addr_runlock(ifp); } break; case SIOCADDMULTI: From owner-svn-src-stable@freebsd.org Wed Aug 24 02:23:05 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 774FABC3289; Wed, 24 Aug 2016 02:23:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29E6E1CF1; Wed, 24 Aug 2016 02:23:05 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O2N4lM085208; Wed, 24 Aug 2016 02:23:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O2N41C085206; Wed, 24 Aug 2016 02:23:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608240223.u7O2N41C085206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 24 Aug 2016 02:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304717 - in stable/11: share/mk sys/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 02:23:05 -0000 Author: bdrewery Date: Wed Aug 24 02:23:03 2016 New Revision: 304717 URL: https://svnweb.freebsd.org/changeset/base/304717 Log: MFC r304697: FAST_DEPEND: Fix 'make all install' not properly rebuilding based on .depend.* files. Modified: stable/11/share/mk/bsd.dep.mk stable/11/sys/conf/kern.post.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.dep.mk ============================================================================== --- stable/11/share/mk/bsd.dep.mk Wed Aug 24 01:56:30 2016 (r304716) +++ stable/11/share/mk/bsd.dep.mk Wed Aug 24 02:23:03 2016 (r304717) @@ -76,12 +76,13 @@ tags: ${SRCS} _meta_filemon= 1 .endif -# Skip reading .depend when not needed to speed up tree-walks -# and simple lookups. +# Skip reading .depend when not needed to speed up tree-walks and simple +# lookups. For install, only do this if no other targets are specified. # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ - make(install*) || make(analyze) || defined(_meta_filemon) + ${.TARGETS:M*install*} == ${.TARGETS} || \ + make(analyze) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 .if ${MK_DIRDEPS_BUILD} == "no" .MAKE.DEPENDFILE= /dev/null Modified: stable/11/sys/conf/kern.post.mk ============================================================================== --- stable/11/sys/conf/kern.post.mk Wed Aug 24 01:56:30 2016 (r304716) +++ stable/11/sys/conf/kern.post.mk Wed Aug 24 02:23:03 2016 (r304717) @@ -196,12 +196,13 @@ ${SYSTEM_OBJS} genassym.o vers.o: opt_gl .if !empty(.MAKE.MODE:Unormal:Mmeta) && empty(.MAKE.MODE:Unormal:Mnofilemon) _meta_filemon= 1 .endif -# Skip reading .depend when not needed to speed up tree-walks -# and simple lookups. +# Skip reading .depend when not needed to speed up tree-walks and simple +# lookups. For install, only do this if no other targets are specified. # Also skip generating or including .depend.* files if in meta+filemon mode # since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ - make(install*) || make(kernel-obj) || make(kernel-clean*) || \ + ${.TARGETS:M*install*} == ${.TARGETS} || \ + make(kernel-obj) || make(kernel-clean*) || \ make(kernel-install*) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 .MAKE.DEPENDFILE= /dev/null From owner-svn-src-stable@freebsd.org Wed Aug 24 07:50:29 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6353BC4F2D; Wed, 24 Aug 2016 07:50:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8623A15BD; Wed, 24 Aug 2016 07:50:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O7oSnv007503; Wed, 24 Aug 2016 07:50:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O7oSp2007502; Wed, 24 Aug 2016 07:50:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201608240750.u7O7oSp2007502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 24 Aug 2016 07:50: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: r304737 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 07:50:29 -0000 Author: mav Date: Wed Aug 24 07:50:28 2016 New Revision: 304737 URL: https://svnweb.freebsd.org/changeset/base/304737 Log: Fix HA mode configuration on FreeBSD 10.x. This is direct commit, compensating CTLFLAG_RDTUN difference between FreeBSD 10.x and 11.x branches. Modified: stable/10/sys/cam/ctl/ctl.c Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Aug 24 06:22:53 2016 (r304736) +++ stable/10/sys/cam/ctl/ctl.c Wed Aug 24 07:50:28 2016 (r304737) @@ -1818,6 +1818,7 @@ ctl_init(void) NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); softc->flags = 0; + TUNABLE_INT_FETCH("kern.cam.ctl.ha_mode", (int *)&softc->ha_mode); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "ha_mode", CTLFLAG_RDTUN, (int *)&softc->ha_mode, 0, "HA mode (0 - act/stby, 1 - serialize only, 2 - xfer)"); @@ -1827,6 +1828,7 @@ ctl_init(void) * figured out through the slot the controller is in. Although it * is an active/active system, someone has to be in charge. */ + TUNABLE_INT_FETCH("kern.cam.ctl.ha_id", &softc->ha_id); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "ha_id", CTLFLAG_RDTUN, &softc->ha_id, 0, "HA head ID (0 - no HA)"); From owner-svn-src-stable@freebsd.org Wed Aug 24 08:43:00 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 150A8BC01D6; Wed, 24 Aug 2016 08:43:00 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6D26183C; Wed, 24 Aug 2016 08:42:59 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id u7O8guMa058472; Wed, 24 Aug 2016 10:42:56 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id AE4D328D; Wed, 24 Aug 2016 10:42:55 +0200 (CEST) Message-ID: <57BD5E0F.8000205@omnilan.de> Date: Wed, 24 Aug 2016 10:42:55 +0200 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Alexander Motin CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r304426 - stable/11/sys/net References: <201608181208.u7IC8dYZ058543@repo.freebsd.org> In-Reply-To: <201608181208.u7IC8dYZ058543@repo.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Wed, 24 Aug 2016 10:42:56 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 08:43:00 -0000 Bezüglich Alexander Motin's Nachricht vom 18.08.2016 14:08 (localtime): > Author: mav > Date: Thu Aug 18 12:08:39 2016 > New Revision: 304426 > URL: https://svnweb.freebsd.org/changeset/base/304426 > > Log: > MFC r303009: Negotiate/disable TXCSUM_IPV6 same as TXCSUM. Have you asked for RE-approval to get this into 11.0? If I understand it correctly it's a essential fix for jail+epair+IPv6 useres, solving nasty hard to track oddities? Thanks, -Harry From owner-svn-src-stable@freebsd.org Wed Aug 24 09:02:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F0B6BC0C1D; Wed, 24 Aug 2016 09:02:39 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com [IPv6:2a00:1450:4010:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C42BE1612; Wed, 24 Aug 2016 09:02:38 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x229.google.com with SMTP id f93so7197400lfi.2; Wed, 24 Aug 2016 02:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=mUW1u28MmPc0a1RqghgLjdjGJTukFMMVJQdQgslXNAw=; b=QVkTSQ5zCLj+BloJkg47d4E9ZZITWPCZEe8ZiA6gagewkp+kkDPFz6qoJ3bnzzI471 TFi7Dv+/CPi/FzBMLRw+vptIzNDYvjSlK5y/N81mMAQ0QaJdl4OD+bm/Tz1/XzLAfoKI wdv/QcL4QqjBnBAYAeALxjij57lO/RjQC35sW7qRBLH1HUVrURnvnzb5SW1s1LukkwPv CMA6YIl0M0neSUn0lgW7J1UB8xxd9DIYcht9HxtVfo8rPET5+E1pSBDdx3T2KnPSl/V6 4dyHH1sSJNbrH7TV7CC/M2E39lgKyiew2rOujxrBMAS6ptLdohij6Vr94JxyHJjhBe6T DplA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=mUW1u28MmPc0a1RqghgLjdjGJTukFMMVJQdQgslXNAw=; b=BEcD2Qx2DDr+lniL8EbWUTW+IMkMdqCARBgpJNmo6+/yic+0NbISZN5QOVETGXDfdd Uw9akHFHnr4ZDD3BGje78gwJJ+4IykAkSGKlV9yOeXuGp5p+klG0T0iqdTA2gldJwuN8 6/I3a4vzaU4u3KUdPgQYqE6348sqHmoBYOMYnMsN8/+ouUbR9tTbz0vPse7YpdRkZRxk btU3LFCgojS2VtyVbv6wkD6cjNiz5p1CViETr8OhVw4NLAShUgAcpLD83TxZjUpiDQpH Q+ZMjPWpodTwsB5z/AxjOGVCEWk8ymB8dGxHwbU5C3yG3vjpXiGCg4tp5y0nSv+EycYR 74eA== X-Gm-Message-State: AE9vXwP+uhR03dYjUlhTqaujWj5NtaXCi970zrOVaypavQyOSWwMgTJJkV1BKB3SZd/31A== X-Received: by 10.25.44.84 with SMTP id s81mr468786lfs.156.1472029356292; Wed, 24 Aug 2016 02:02:36 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id g40sm1741877ljg.22.2016.08.24.02.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 02:02:35 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r304426 - stable/11/sys/net To: Harry Schmalzbauer References: <201608181208.u7IC8dYZ058543@repo.freebsd.org> <57BD5E0F.8000205@omnilan.de> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Alexander Motin Message-ID: Date: Wed, 24 Aug 2016 12:02:34 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <57BD5E0F.8000205@omnilan.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:02:39 -0000 On 24.08.16 11:42, Harry Schmalzbauer wrote: > Bezüglich Alexander Motin's Nachricht vom 18.08.2016 14:08 (localtime): >> Author: mav >> Date: Thu Aug 18 12:08:39 2016 >> New Revision: 304426 >> URL: https://svnweb.freebsd.org/changeset/base/304426 >> >> Log: >> MFC r303009: Negotiate/disable TXCSUM_IPV6 same as TXCSUM. > > Have you asked for RE-approval to get this into 11.0? > If I understand it correctly it's a essential fix for jail+epair+IPv6 > useres, solving nasty hard to track oddities? No, I haven't asked, because I haven't seen related bug reports and found this accidentally. But if anybody wants it -- be my guest. -- Alexander Motin From owner-svn-src-stable@freebsd.org Wed Aug 24 09:18:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39720BC10FC; Wed, 24 Aug 2016 09:18:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 097FC1E5D; Wed, 24 Aug 2016 09:18:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O9IcHT046310; Wed, 24 Aug 2016 09:18:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O9Ic7p046309; Wed, 24 Aug 2016 09:18:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608240918.u7O9Ic7p046309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 24 Aug 2016 09:18:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304738 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:18:39 -0000 Author: kib Date: Wed Aug 24 09:18:38 2016 New Revision: 304738 URL: https://svnweb.freebsd.org/changeset/base/304738 Log: MFC r304286: Remove duplicated code. Modified: stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Wed Aug 24 07:50:28 2016 (r304737) +++ stable/11/sys/kern/vfs_aio.c Wed Aug 24 09:18:38 2016 (r304738) @@ -1441,7 +1441,7 @@ static struct aiocb_ops aiocb_ops_osigev */ int aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, - int type, struct aiocb_ops *ops) + int type, struct aiocb_ops *ops) { struct proc *p = td->td_proc; cap_rights_t rights; @@ -2476,14 +2476,9 @@ static int kern_aio_fsync(struct thread *td, int op, struct aiocb *ujob, struct aiocb_ops *ops) { - struct proc *p = td->td_proc; - struct kaioinfo *ki; if (op != O_SYNC) /* XXX lack of O_DSYNC */ return (EINVAL); - ki = p->p_aioinfo; - if (ki == NULL) - aio_init_aioinfo(p); return (aio_aqueue(td, ujob, NULL, LIO_SYNC, ops)); } From owner-svn-src-stable@freebsd.org Wed Aug 24 09:20:28 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C8C3BC1190; Wed, 24 Aug 2016 09:20:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 495761152; Wed, 24 Aug 2016 09:20:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7O9KRaj046449; Wed, 24 Aug 2016 09:20:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7O9KRiE046448; Wed, 24 Aug 2016 09:20:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608240920.u7O9KRiE046448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 24 Aug 2016 09: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: r304739 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:20:28 -0000 Author: kib Date: Wed Aug 24 09:20:27 2016 New Revision: 304739 URL: https://svnweb.freebsd.org/changeset/base/304739 Log: MFC r304286: Remove duplicated code. Modified: stable/10/sys/kern/vfs_aio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_aio.c ============================================================================== --- stable/10/sys/kern/vfs_aio.c Wed Aug 24 09:18:38 2016 (r304738) +++ stable/10/sys/kern/vfs_aio.c Wed Aug 24 09:20:27 2016 (r304739) @@ -1582,7 +1582,7 @@ static struct aiocb_ops aiocb_ops_osigev */ int aio_aqueue(struct thread *td, struct aiocb *job, struct aioliojob *lj, - int type, struct aiocb_ops *ops) + int type, struct aiocb_ops *ops) { struct proc *p = td->td_proc; cap_rights_t rights; @@ -2568,14 +2568,9 @@ static int kern_aio_fsync(struct thread *td, int op, struct aiocb *aiocbp, struct aiocb_ops *ops) { - struct proc *p = td->td_proc; - struct kaioinfo *ki; if (op != O_SYNC) /* XXX lack of O_DSYNC */ return (EINVAL); - ki = p->p_aioinfo; - if (ki == NULL) - aio_init_aioinfo(p); return (aio_aqueue(td, aiocbp, NULL, LIO_SYNC, ops)); } From owner-svn-src-stable@freebsd.org Wed Aug 24 09:21:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FA2FBC13ED; Wed, 24 Aug 2016 09:21:51 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C43701520; Wed, 24 Aug 2016 09:21:50 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id u7O9LnJk060138; Wed, 24 Aug 2016 11:21:49 +0200 (CEST) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 9EE94299; Wed, 24 Aug 2016 11:21:48 +0200 (CEST) Message-ID: <57BD672C.5010108@omnilan.de> Date: Wed, 24 Aug 2016 11:21:48 +0200 From: Harry Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Alexander Motin CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r304426 - stable/11/sys/net References: <201608181208.u7IC8dYZ058543@repo.freebsd.org> <57BD5E0F.8000205@omnilan.de> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Greylist: ACL 119 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Wed, 24 Aug 2016 11:21:49 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 09:21:51 -0000 Bezüglich Alexander Motin's Nachricht vom 24.08.2016 11:02 (localtime): > On 24.08.16 11:42, Harry Schmalzbauer wrote: >> Bezüglich Alexander Motin's Nachricht vom 18.08.2016 14:08 (localtime): >>> Author: mav >>> Date: Thu Aug 18 12:08:39 2016 >>> New Revision: 304426 >>> URL: https://svnweb.freebsd.org/changeset/base/304426 >>> >>> Log: >>> MFC r303009: Negotiate/disable TXCSUM_IPV6 same as TXCSUM. >> >> Have you asked for RE-approval to get this into 11.0? >> If I understand it correctly it's a essential fix for jail+epair+IPv6 >> useres, solving nasty hard to track oddities? > > No, I haven't asked, because I haven't seen related bug reports and > found this accidentally. But if anybody wants it -- be my guest. I haven't filed a PR because I ran out of time tracking my bridge(4) oddities, since so many exotics are involved: VT-d PCIe-passthrough of two igb(4) = lagg(4) - bridge(4) - epair(4). At some point I clearly found bridge(4) misbehaving, and I did some(tm) workarround and went on. This was with stable/10 between 10.0 and 10.1 (currently running 10.1 on that setup). Can't tell if igb(4) in 10.1 is even TXCSUM_IPV6 capable (this was added quiet lately in igb(4)'s live, afair), but the symptoms match very well this missing TXCSUM_IPV6 disabling. Even if not in my case, as far as I understand, everybody else using 11.0-RC2 with TXCSUM_IPV6-enabledNic(4)+bridge(4) would suffer from network failures. You found + fixed it, so 11.0 should get this :-) Thanks, -harry From owner-svn-src-stable@freebsd.org Thu Aug 25 09:16:26 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4E36BC5B55; Thu, 25 Aug 2016 09:16:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 906C31A0C; Thu, 25 Aug 2016 09:16:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7P9GPVR089157; Thu, 25 Aug 2016 09:16:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7P9GPHJ089154; Thu, 25 Aug 2016 09:16:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201608250916.u7P9GPHJ089154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 25 Aug 2016 09:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304792 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 09:16:26 -0000 Author: tuexen Date: Thu Aug 25 09:16:25 2016 New Revision: 304792 URL: https://svnweb.freebsd.org/changeset/base/304792 Log: MFC r304543: Unbreak sctp_connectx(). MFC r304573: Remove duplicate code, which is not protected by the appropriate locks. MFC r304579: Improve the locking when sending user messages. First, keep a ref count on the stcb after looking it up, as done in the other lookup cases. Second, before looking again at sp, ensure that it is not freed, because the assoc is about to be freed. Modified: stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Thu Aug 25 05:50:19 2016 (r304791) +++ stable/11/sys/netinet/sctp_output.c Thu Aug 25 09:16:25 2016 (r304792) @@ -12639,7 +12639,10 @@ sctp_lower_sosend(struct socket *so, } SCTP_INP_RUNLOCK(inp); } else if (sinfo_assoc_id) { - stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 0); + stcb = sctp_findassociation_ep_asocid(inp, sinfo_assoc_id, 1); + if (stcb != NULL) { + hold_tcblock = 1; + } } else if (addr) { /*- * Since we did not use findep we must @@ -13404,6 +13407,10 @@ skip_preblock: } } SCTP_TCB_SEND_LOCK(stcb); + if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + SCTP_TCB_SEND_UNLOCK(stcb); + goto out_unlocked; + } if (sp) { if (sp->msg_is_complete == 0) { strm->last_msg_incomplete = 1; Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu Aug 25 05:50:19 2016 (r304791) +++ stable/11/sys/netinet/sctp_usrreq.c Thu Aug 25 09:16:25 2016 (r304792) @@ -1506,11 +1506,6 @@ sctp_do_connect_x(struct socket *so, str sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); } SCTP_TCB_UNLOCK(stcb); - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { - stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue data */ - soisconnecting(so); - } out_now: if (creat_lock_on) { SCTP_ASOC_CREATE_UNLOCK(inp); Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu Aug 25 05:50:19 2016 (r304791) +++ stable/11/sys/netinet/sctputil.c Thu Aug 25 09:16:25 2016 (r304792) @@ -6356,7 +6356,7 @@ sctp_connectx_helper_find(struct sctp_in struct sctp_tcb *stcb = NULL; unsigned int incr, at, i; - at = incr = 0; + at = 0; sa = addr; *error = *num_v6 = *num_v4 = 0; /* account and validate addresses */ @@ -6364,6 +6364,7 @@ sctp_connectx_helper_find(struct sctp_in switch (sa->sa_family) { #ifdef INET case AF_INET: + incr = (unsigned int)sizeof(struct sockaddr_in); if (sa->sa_len != incr) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6371,7 +6372,6 @@ sctp_connectx_helper_find(struct sctp_in return (NULL); } (*num_v4) += 1; - incr = (unsigned int)sizeof(struct sockaddr_in); break; #endif #ifdef INET6 @@ -6387,6 +6387,7 @@ sctp_connectx_helper_find(struct sctp_in *bad_addr = 1; return (NULL); } + incr = (unsigned int)sizeof(struct sockaddr_in6); if (sa->sa_len != incr) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6394,7 +6395,6 @@ sctp_connectx_helper_find(struct sctp_in return (NULL); } (*num_v6) += 1; - incr = (unsigned int)sizeof(struct sockaddr_in6); break; } #endif From owner-svn-src-stable@freebsd.org Thu Aug 25 19:55:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5025FBC6B30; Thu, 25 Aug 2016 19:55:33 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04DFF1858; Thu, 25 Aug 2016 19:55:32 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7PJtWb7030507; Thu, 25 Aug 2016 19:55:32 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7PJtWlB030505; Thu, 25 Aug 2016 19:55:32 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608251955.u7PJtWlB030505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 25 Aug 2016 19:55: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: r304816 - stable/10/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 19:55:33 -0000 Author: ache Date: Thu Aug 25 19:55:31 2016 New Revision: 304816 URL: https://svnweb.freebsd.org/changeset/base/304816 Log: MFC r295632 getln: We cannot expand the buffer beyond INT_MAX (_size overflows). In such cases return ENOMEM. This is a limitation of our implementation, alternatively you may consider getline(3). Differential Revision: https://reviews.freebsd.org/D442 (Partial) Obtained from: Apple Inc. (Libc 997.90.3) Modified: stable/10/lib/libc/stdio/fgetln.3 stable/10/lib/libc/stdio/fgetln.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fgetln.3 ============================================================================== --- stable/10/lib/libc/stdio/fgetln.3 Thu Aug 25 19:40:25 2016 (r304815) +++ stable/10/lib/libc/stdio/fgetln.3 Thu Aug 25 19:55:31 2016 (r304816) @@ -28,7 +28,7 @@ .\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 19, 1994 +.Dd February 15, 2016 .Dt FGETLN 3 .Os .Sh NAME @@ -97,6 +97,9 @@ These changes are lost as soon as the po The argument .Fa stream is not a stream open for reading. +.It Bq Er ENOMEM +The internal line buffer could not be expanded due to lack of available memory, +or because it would need to expand beyond INT_MAX in size. .El .Pp The Modified: stable/10/lib/libc/stdio/fgetln.c ============================================================================== --- stable/10/lib/libc/stdio/fgetln.c Thu Aug 25 19:40:25 2016 (r304815) +++ stable/10/lib/libc/stdio/fgetln.c Thu Aug 25 19:55:31 2016 (r304816) @@ -37,6 +37,8 @@ static char sccsid[] = "@(#)fgetln.c 8.2 __FBSDID("$FreeBSD$"); #include "namespace.h" +#include +#include #include #include #include @@ -61,6 +63,10 @@ __slbexpand(FILE *fp, size_t newsize) #endif if (fp->_lb._size >= newsize) return (0); + if (newsize > INT_MAX) { + errno = ENOMEM; + return (-1); + } if ((p = realloc(fp->_lb._base, newsize)) == NULL) return (-1); fp->_lb._base = p; @@ -152,7 +158,7 @@ fgetln(FILE *fp, size_t *lenp) } *lenp = len; #ifdef notdef - fp->_lb._base[len] = 0; + fp->_lb._base[len] = '\0'; #endif FUNLOCKFILE(fp); return ((char *)fp->_lb._base); From owner-svn-src-stable@freebsd.org Fri Aug 26 05:37:45 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96E31BC5F63; Fri, 26 Aug 2016 05:37:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 576C215B1; Fri, 26 Aug 2016 05:37:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q5bi1N046512; Fri, 26 Aug 2016 05:37:44 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q5biok046511; Fri, 26 Aug 2016 05:37:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608260537.u7Q5biok046511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 26 Aug 2016 05:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304835 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 05:37:45 -0000 Author: sephe Date: Fri Aug 26 05:37:44 2016 New Revision: 304835 URL: https://svnweb.freebsd.org/changeset/base/304835 Log: MFC 303766 tcp/lro: If timestamps mismatch or it's a FIN, force flush. This keeps the segments/ACK/FIN delivery order. Before this patch, it was observed: if A sent FIN immediately after an ACK, B would deliver FIN first to the TCP stack, then the ACK. This out-of-order delivery causes one unnecessary ACK sent from B. Reviewed by: gallatin, hps Obtained from: rrs, gallatin Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe) Differential Revision: https://reviews.freebsd.org/D7415 Modified: stable/11/sys/netinet/tcp_lro.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_lro.c ============================================================================== --- stable/11/sys/netinet/tcp_lro.c Fri Aug 26 05:18:27 2016 (r304834) +++ stable/11/sys/netinet/tcp_lro.c Fri Aug 26 05:37:44 2016 (r304835) @@ -578,6 +578,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m tcp_seq seq; int error, ip_len, l; uint16_t eh_type, tcp_data_len; + int force_flush = 0; /* We expect a contiguous header [eh, ip, tcp]. */ @@ -644,8 +645,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m * Check TCP header constraints. */ /* Ensure no bits set besides ACK or PSH. */ - if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) - return (TCP_LRO_CANNOT); + if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { + if (th->th_flags & TH_SYN) + return (TCP_LRO_CANNOT); + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement, e.g. FIN. + */ + force_flush = 1; + } /* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */ /* XXX-BZ Ideally we'd flush on PUSH? */ @@ -661,8 +669,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m ts_ptr = (uint32_t *)(th + 1); if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) || (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| - TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) - return (TCP_LRO_CANNOT); + TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) { + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement. + */ + force_flush = 1; + } /* If the driver did not pass in the checksum, set it now. */ if (csum == 0x0000) @@ -696,6 +709,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m #endif } + if (force_flush) { + /* Timestamps mismatch; this is a FIN, etc */ + tcp_lro_active_remove(le); + tcp_lro_flush(lc, le); + return (TCP_LRO_CANNOT); + } + /* Flush now if appending will result in overflow. */ if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { tcp_lro_active_remove(le); @@ -772,6 +792,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m return (0); } + if (force_flush) { + /* + * Nothing to flush, but this segment can not be further + * aggregated/delayed. + */ + return (TCP_LRO_CANNOT); + } + /* Try to find an empty slot. */ if (LIST_EMPTY(&lc->lro_free)) return (TCP_LRO_NO_ENTRIES); From owner-svn-src-stable@freebsd.org Fri Aug 26 06:17:32 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D05A4BC6AAF; Fri, 26 Aug 2016 06:17:32 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id C0D1C1D48; Fri, 26 Aug 2016 06:17:32 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 2FA2417AD0; Thu, 25 Aug 2016 23:17:32 -0700 (PDT) Date: Thu, 25 Aug 2016 23:17:32 -0700 From: hiren panchasara To: Sepherosa Ziehau Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r304835 - stable/11/sys/netinet Message-ID: <20160826061732.GN41576@strugglingcoder.info> References: <201608260537.u7Q5biok046511@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LwbuP8dfxhLLLUfV" Content-Disposition: inline In-Reply-To: <201608260537.u7Q5biok046511@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 06:17:32 -0000 --LwbuP8dfxhLLLUfV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 08/26/16 at 05:37P, Sepherosa Ziehau wrote: > Author: sephe > Date: Fri Aug 26 05:37:44 2016 > New Revision: 304835 > URL: https://svnweb.freebsd.org/changeset/base/304835 >=20 > Log: > MFC 303766 Thanks! Cheers, Hiren --LwbuP8dfxhLLLUfV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJXv978XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/ltjIH/3Et8+kheAInsldEp+XHi8Gn Q/BwjrWYd8dNVKQ8DO7UuffA8Md7O9F/jRIdAwoec+mcDiD16Ej/CIk2ex6IkDmU RoActqq+xV6eNy0IBPijJ6MSyQo65dytHXKHf7OggQA1y/Mhf+z+SLugCrC0mxef LkOavneKVurY3RVo0y2Ib9zC0Zp1XOTxKvdpdFTUk3j3mJ3bFUiuIWgb94elVol/ U2Z+36LkPqaICVB8u/jA0Vv7ieYEqw0ojgm08AJIo1MR65VJMO2HTfQdKB5gZJjE PcLQKgzhim08vY5ZtSRhMvlkMPgl2J6/APXmgm+vHnQqa3GJr/dRtrbBS6BFc9E= =ems/ -----END PGP SIGNATURE----- --LwbuP8dfxhLLLUfV-- From owner-svn-src-stable@freebsd.org Fri Aug 26 06:19:13 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC981BC6B8B; Fri, 26 Aug 2016 06:19:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F7661FAE; Fri, 26 Aug 2016 06:19:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q6JCh3064046; Fri, 26 Aug 2016 06:19:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q6JCWs064045; Fri, 26 Aug 2016 06:19:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608260619.u7Q6JCWs064045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 26 Aug 2016 06:19: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: r304836 - 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 06:19:13 -0000 Author: sephe Date: Fri Aug 26 06:19:12 2016 New Revision: 304836 URL: https://svnweb.freebsd.org/changeset/base/304836 Log: MFC 303766 tcp/lro: If timestamps mismatch or it's a FIN, force flush. This keeps the segments/ACK/FIN delivery order. Before this patch, it was observed: if A sent FIN immediately after an ACK, B would deliver FIN first to the TCP stack, then the ACK. This out-of-order delivery causes one unnecessary ACK sent from B. Reviewed by: gallatin, hps Obtained from: rrs, gallatin Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe) Differential Revision: https://reviews.freebsd.org/D7415 Modified: stable/10/sys/netinet/tcp_lro.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_lro.c ============================================================================== --- stable/10/sys/netinet/tcp_lro.c Fri Aug 26 05:37:44 2016 (r304835) +++ stable/10/sys/netinet/tcp_lro.c Fri Aug 26 06:19:12 2016 (r304836) @@ -382,6 +382,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m tcp_seq seq; int error, ip_len, l; uint16_t eh_type, tcp_data_len; + int force_flush = 0; /* We expect a contiguous header [eh, ip, tcp]. */ @@ -448,8 +449,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m * Check TCP header constraints. */ /* Ensure no bits set besides ACK or PSH. */ - if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) - return (TCP_LRO_CANNOT); + if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { + if (th->th_flags & TH_SYN) + return (TCP_LRO_CANNOT); + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement, e.g. FIN. + */ + force_flush = 1; + } /* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */ /* XXX-BZ Ideally we'd flush on PUSH? */ @@ -465,8 +473,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m ts_ptr = (uint32_t *)(th + 1); if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) || (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| - TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) - return (TCP_LRO_CANNOT); + TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) { + /* + * Make sure that previously seen segements/ACKs are delivered + * before this segement. + */ + force_flush = 1; + } /* If the driver did not pass in the checksum, set it now. */ if (csum == 0x0000) @@ -500,6 +513,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m #endif } + if (force_flush) { + /* Timestamps mismatch; this is a FIN, etc */ + SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); + tcp_lro_flush(lc, le); + return (TCP_LRO_CANNOT); + } + /* Flush now if appending will result in overflow. */ if (le->p_len > (65535 - tcp_data_len)) { SLIST_REMOVE(&lc->lro_active, le, lro_entry, next); @@ -568,6 +588,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m return (0); } + if (force_flush) { + /* + * Nothing to flush, but this segment can not be further + * aggregated/delayed. + */ + return (TCP_LRO_CANNOT); + } + /* Try to find an empty slot. */ if (SLIST_EMPTY(&lc->lro_free)) return (TCP_LRO_NO_ENTRIES); From owner-svn-src-stable@freebsd.org Fri Aug 26 09:36:47 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08C89A94CF8; Fri, 26 Aug 2016 09:36:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD00799A; Fri, 26 Aug 2016 09:36:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q9akET037887; Fri, 26 Aug 2016 09:36:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q9akVt037886; Fri, 26 Aug 2016 09:36:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608260936.u7Q9akVt037886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 09:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304839 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 09:36:47 -0000 Author: kib Date: Fri Aug 26 09:36:45 2016 New Revision: 304839 URL: https://svnweb.freebsd.org/changeset/base/304839 Log: MFC r303383: Reduce number of timehands to just two. Modified: stable/11/sys/kern/kern_tc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Fri Aug 26 08:25:28 2016 (r304838) +++ stable/11/sys/kern/kern_tc.c Fri Aug 26 09:36:45 2016 (r304839) @@ -76,25 +76,15 @@ struct timehands { }; static struct timehands th0; -static struct timehands th9 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th0}; -static struct timehands th8 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th9}; -static struct timehands th7 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th8}; -static struct timehands th6 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th7}; -static struct timehands th5 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th6}; -static struct timehands th4 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th5}; -static struct timehands th3 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th4}; -static struct timehands th2 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th3}; -static struct timehands th1 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, &th2}; +static struct timehands th1 = { + .th_next = &th0 +}; static struct timehands th0 = { - &dummy_timecounter, - 0, - (uint64_t)-1 / 1000000, - 0, - {1, 0}, - {0, 0}, - {0, 0}, - 1, - &th1 + .th_counter = &dummy_timecounter, + .th_scale = (uint64_t)-1 / 1000000, + .th_offset = { .sec = 1 }, + .th_generation = 1, + .th_next = &th1 }; static struct timehands *volatile timehands = &th0; From owner-svn-src-stable@freebsd.org Fri Aug 26 09:38:27 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B977A94DA9; Fri, 26 Aug 2016 09:38:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED422B1B; Fri, 26 Aug 2016 09:38:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q9cQNQ037993; Fri, 26 Aug 2016 09:38:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q9cQap037992; Fri, 26 Aug 2016 09:38:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608260938.u7Q9cQap037992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 09:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304840 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 09:38:27 -0000 Author: kib Date: Fri Aug 26 09:38:25 2016 New Revision: 304840 URL: https://svnweb.freebsd.org/changeset/base/304840 Log: MFC r303384: Style. Modified: stable/11/sys/kern/kern_tc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Fri Aug 26 09:36:45 2016 (r304839) +++ stable/11/sys/kern/kern_tc.c Fri Aug 26 09:38:25 2016 (r304840) @@ -154,7 +154,7 @@ sysctl_kern_timecounter_get(SYSCTL_HANDL struct timecounter *tc = arg1; ncount = tc->tc_get_timecount(tc); - return sysctl_handle_int(oidp, &ncount, 0, req); + return (sysctl_handle_int(oidp, &ncount, 0, req)); } static int @@ -164,7 +164,7 @@ sysctl_kern_timecounter_freq(SYSCTL_HAND struct timecounter *tc = arg1; freq = tc->tc_frequency; - return sysctl_handle_64(oidp, &freq, 0, req); + return (sysctl_handle_64(oidp, &freq, 0, req)); } /* From owner-svn-src-stable@freebsd.org Fri Aug 26 09:40:35 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFD43A94E86; Fri, 26 Aug 2016 09:40:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD558DA3; Fri, 26 Aug 2016 09:40:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q9eYZO038131; Fri, 26 Aug 2016 09:40:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q9eYHc038130; Fri, 26 Aug 2016 09:40:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608260940.u7Q9eYHc038130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 09:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304841 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 09:40:36 -0000 Author: kib Date: Fri Aug 26 09:40:34 2016 New Revision: 304841 URL: https://svnweb.freebsd.org/changeset/base/304841 Log: MFC r303385: Reduce the resettodr_lock scope to only CLOCK_SETTIME() call. Modified: stable/11/sys/kern/subr_rtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_rtc.c ============================================================================== --- stable/11/sys/kern/subr_rtc.c Fri Aug 26 09:38:25 2016 (r304840) +++ stable/11/sys/kern/subr_rtc.c Fri Aug 26 09:40:34 2016 (r304841) @@ -172,11 +172,11 @@ resettodr(void) if (disable_rtc_set || clock_dev == NULL) return; - mtx_lock(&resettodr_lock); getnanotime(&ts); timespecadd(&ts, &clock_adj); ts.tv_sec -= utc_offset(); /* XXX: We should really set all registered RTCs */ + mtx_lock(&resettodr_lock); error = CLOCK_SETTIME(clock_dev, &ts); mtx_unlock(&resettodr_lock); if (error != 0) From owner-svn-src-stable@freebsd.org Fri Aug 26 09:42:52 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 331D0A94FF7; Fri, 26 Aug 2016 09:42:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D60B168; Fri, 26 Aug 2016 09:42:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7Q9gp1V041471; Fri, 26 Aug 2016 09:42:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7Q9gpUu041470; Fri, 26 Aug 2016 09:42:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608260942.u7Q9gpUu041470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 09:42:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304842 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 09:42:52 -0000 Author: kib Date: Fri Aug 26 09:42:51 2016 New Revision: 304842 URL: https://svnweb.freebsd.org/changeset/base/304842 Log: MFC r303386: Change ntpadj_lock to spinlock always. Add missed lock to ntp_update_second(). Modified: stable/11/sys/kern/kern_ntptime.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_ntptime.c ============================================================================== --- stable/11/sys/kern/kern_ntptime.c Fri Aug 26 09:40:34 2016 (r304841) +++ stable/11/sys/kern/kern_ntptime.c Fri Aug 26 09:42:51 2016 (r304842) @@ -162,29 +162,12 @@ static l_fp time_adj; /* tick adjust ( static int64_t time_adjtime; /* correction from adjtime(2) (usec) */ -static struct mtx ntpadj_lock; -MTX_SYSINIT(ntpadj, &ntpadj_lock, "ntpadj", -#ifdef PPS_SYNC - MTX_SPIN -#else - MTX_DEF -#endif -); +static struct mtx ntp_lock; +MTX_SYSINIT(ntp, &ntp_lock, "ntp", MTX_SPIN); -/* - * When PPS_SYNC is defined, hardpps() function is provided which can - * be legitimately called from interrupt filters. Due to this, use - * spinlock for ntptime state protection, otherwise sleepable mutex is - * adequate. - */ -#ifdef PPS_SYNC -#define NTPADJ_LOCK() mtx_lock_spin(&ntpadj_lock) -#define NTPADJ_UNLOCK() mtx_unlock_spin(&ntpadj_lock) -#else -#define NTPADJ_LOCK() mtx_lock(&ntpadj_lock) -#define NTPADJ_UNLOCK() mtx_unlock(&ntpadj_lock) -#endif -#define NTPADJ_ASSERT_LOCKED() mtx_assert(&ntpadj_lock, MA_OWNED) +#define NTP_LOCK() mtx_lock_spin(&ntp_lock) +#define NTP_UNLOCK() mtx_unlock_spin(&ntp_lock) +#define NTP_ASSERT_LOCKED() mtx_assert(&ntp_lock, MA_OWNED) #ifdef PPS_SYNC /* @@ -271,7 +254,7 @@ ntp_gettime1(struct ntptimeval *ntvp) { struct timespec atv; /* nanosecond time */ - NTPADJ_ASSERT_LOCKED(); + NTP_ASSERT_LOCKED(); nanotime(&atv); ntvp->time.tv_sec = atv.tv_sec; @@ -302,9 +285,9 @@ sys_ntp_gettime(struct thread *td, struc { struct ntptimeval ntv; - NTPADJ_LOCK(); + NTP_LOCK(); ntp_gettime1(&ntv); - NTPADJ_UNLOCK(); + NTP_UNLOCK(); td->td_retval[0] = ntv.time_state; return (copyout(&ntv, uap->ntvp, sizeof(ntv))); @@ -315,9 +298,9 @@ ntp_sysctl(SYSCTL_HANDLER_ARGS) { struct ntptimeval ntv; /* temporary structure */ - NTPADJ_LOCK(); + NTP_LOCK(); ntp_gettime1(&ntv); - NTPADJ_UNLOCK(); + NTP_UNLOCK(); return (sysctl_handle_opaque(oidp, &ntv, sizeof(ntv), req)); } @@ -382,7 +365,7 @@ sys_ntp_adjtime(struct thread *td, struc error = priv_check(td, PRIV_NTP_ADJTIME); if (error != 0) return (error); - NTPADJ_LOCK(); + NTP_LOCK(); if (modes & MOD_MAXERROR) time_maxerror = ntv.maxerror; if (modes & MOD_ESTERROR) @@ -484,7 +467,7 @@ sys_ntp_adjtime(struct thread *td, struc ntv.stbcnt = pps_stbcnt; #endif /* PPS_SYNC */ retval = ntp_is_time_error(time_status) ? TIME_ERROR : time_state; - NTPADJ_UNLOCK(); + NTP_UNLOCK(); error = copyout((caddr_t)&ntv, (caddr_t)uap->tp, sizeof(ntv)); if (error == 0) @@ -506,6 +489,8 @@ ntp_update_second(int64_t *adjustment, t int tickrate; l_fp ftemp; /* 32/64-bit temporary */ + NTP_LOCK(); + /* * On rollover of the second both the nanosecond and microsecond * clocks are updated and the state machine cranked as @@ -627,6 +612,8 @@ ntp_update_second(int64_t *adjustment, t else time_status &= ~STA_PPSSIGNAL; #endif /* PPS_SYNC */ + + NTP_UNLOCK(); } /* @@ -690,7 +677,7 @@ hardupdate(offset) long mtemp; l_fp ftemp; - NTPADJ_ASSERT_LOCKED(); + NTP_ASSERT_LOCKED(); /* * Select how the phase is to be controlled and from which @@ -772,7 +759,7 @@ hardpps(tsp, nsec) long u_sec, u_nsec, v_nsec; /* temps */ l_fp ftemp; - NTPADJ_LOCK(); + NTP_LOCK(); /* * The signal is first processed by a range gate and frequency @@ -956,7 +943,7 @@ hardpps(tsp, nsec) time_freq = pps_freq; out: - NTPADJ_UNLOCK(); + NTP_UNLOCK(); } #endif /* PPS_SYNC */ @@ -999,11 +986,11 @@ kern_adjtime(struct thread *td, struct t return (error); ltw = (int64_t)delta->tv_sec * 1000000 + delta->tv_usec; } - NTPADJ_LOCK(); + NTP_LOCK(); ltr = time_adjtime; if (delta != NULL) time_adjtime = ltw; - NTPADJ_UNLOCK(); + NTP_UNLOCK(); if (olddelta != NULL) { atv.tv_sec = ltr / 1000000; atv.tv_usec = ltr % 1000000; From owner-svn-src-stable@freebsd.org Fri Aug 26 10:04:13 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10740A94530; Fri, 26 Aug 2016 10:04:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1EB6C76; Fri, 26 Aug 2016 10:04:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QA4CcO048820; Fri, 26 Aug 2016 10:04:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QA4ATm048803; Fri, 26 Aug 2016 10:04:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608261004.u7QA4ATm048803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 10:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304843 - in stable/11/sys: compat/linprocfs fs/devfs fs/fdescfs fs/nfs fs/procfs kern net net/altq netpfil/ipfw nfs rpc/rpcsec_gss sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 10:04:13 -0000 Author: kib Date: Fri Aug 26 10:04:10 2016 New Revision: 304843 URL: https://svnweb.freebsd.org/changeset/base/304843 Log: MFC r303382: Provide the getboottime(9) and getboottimebin(9) KPI. MFC r303387: Prevent parallel tc_windup() calls. Keep boottime in timehands, and adjust it from tc_windup(). MFC notes: The boottime and boottimebin globals are still exported from the kernel dyn symbol table in stable/11, but their declarations are removed from sys/time.h. This preserves KBI but not KPI, while all in-tree consumers are converted to getboottime(). The variables are updated after tc_setclock_mtx is dropped, which gives approximately same unlocked bugs as before. The boottime and boottimebin locals in several sys/kern_tc.c functions were renamed by adding the '_x' suffix to avoid name conficts. Modified: stable/11/sys/compat/linprocfs/linprocfs.c stable/11/sys/fs/devfs/devfs_vnops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c stable/11/sys/fs/nfs/nfsport.h stable/11/sys/fs/procfs/procfs_status.c stable/11/sys/kern/kern_acct.c stable/11/sys/kern/kern_clock.c stable/11/sys/kern/kern_proc.c stable/11/sys/kern/kern_tc.c stable/11/sys/kern/sys_procdesc.c stable/11/sys/net/altq/altq_subr.c stable/11/sys/net/bpf.c stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c stable/11/sys/nfs/nfs_lock.c stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c stable/11/sys/sys/time.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/11/sys/compat/linprocfs/linprocfs.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/compat/linprocfs/linprocfs.c Fri Aug 26 10:04:10 2016 (r304843) @@ -447,9 +447,11 @@ linprocfs_dostat(PFS_FILL_ARGS) struct pcpu *pcpu; long cp_time[CPUSTATES]; long *cp; + struct timeval boottime; int i; read_cpu_time(cp_time); + getboottime(&boottime); sbuf_printf(sb, "cpu %ld %ld %ld %ld\n", T2J(cp_time[CP_USER]), T2J(cp_time[CP_NICE]), @@ -624,10 +626,12 @@ static int linprocfs_doprocstat(PFS_FILL_ARGS) { struct kinfo_proc kp; + struct timeval boottime; char state; static int ratelimit = 0; vm_offset_t startcode, startdata; + getboottime(&boottime); sx_slock(&proctree_lock); PROC_LOCK(p); fill_kinfo_proc(p, &kp); Modified: stable/11/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/11/sys/fs/devfs/devfs_vnops.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/fs/devfs/devfs_vnops.c Fri Aug 26 10:04:10 2016 (r304843) @@ -707,10 +707,11 @@ devfs_getattr(struct vop_getattr_args *a { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; - int error; struct devfs_dirent *de; struct devfs_mount *dmp; struct cdev *dev; + struct timeval boottime; + int error; error = devfs_populate_vp(vp); if (error != 0) @@ -740,6 +741,7 @@ devfs_getattr(struct vop_getattr_args *a vap->va_blocksize = DEV_BSIZE; vap->va_type = vp->v_type; + getboottime(&boottime); #define fix(aa) \ do { \ if ((aa).tv_sec <= 3600) { \ Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Fri Aug 26 10:04:10 2016 (r304843) @@ -394,7 +394,9 @@ fdesc_getattr(struct vop_getattr_args *a { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; + struct timeval boottime; + getboottime(&boottime); vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vap->va_fileid = VTOFDESC(vp)->fd_ix; vap->va_uid = 0; Modified: stable/11/sys/fs/nfs/nfsport.h ============================================================================== --- stable/11/sys/fs/nfs/nfsport.h Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/fs/nfs/nfsport.h Fri Aug 26 10:04:10 2016 (r304843) @@ -872,7 +872,7 @@ int newnfs_realign(struct mbuf **, int); /* * Set boottime. */ -#define NFSSETBOOTTIME(b) ((b) = boottime) +#define NFSSETBOOTTIME(b) (getboottime(&b)) /* * The size of directory blocks in the buffer cache. Modified: stable/11/sys/fs/procfs/procfs_status.c ============================================================================== --- stable/11/sys/fs/procfs/procfs_status.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/fs/procfs/procfs_status.c Fri Aug 26 10:04:10 2016 (r304843) @@ -70,6 +70,7 @@ procfs_doprocstatus(PFS_FILL_ARGS) const char *wmesg; char *pc; char *sep; + struct timeval boottime; int pid, ppid, pgid, sid; int i; @@ -129,6 +130,7 @@ procfs_doprocstatus(PFS_FILL_ARGS) calcru(p, &ut, &st); PROC_STATUNLOCK(p); start = p->p_stats->p_start; + getboottime(&boottime); timevaladd(&start, &boottime); sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld", (intmax_t)start.tv_sec, start.tv_usec, Modified: stable/11/sys/kern/kern_acct.c ============================================================================== --- stable/11/sys/kern/kern_acct.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/kern/kern_acct.c Fri Aug 26 10:04:10 2016 (r304843) @@ -389,7 +389,7 @@ acct_process(struct thread *td) acct.ac_stime = encode_timeval(st); /* (4) The elapsed time the command ran (and its starting time) */ - tmp = boottime; + getboottime(&tmp); timevaladd(&tmp, &p->p_stats->p_start); acct.ac_btime = tmp.tv_sec; microuptime(&tmp); Modified: stable/11/sys/kern/kern_clock.c ============================================================================== --- stable/11/sys/kern/kern_clock.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/kern/kern_clock.c Fri Aug 26 10:04:10 2016 (r304843) @@ -381,7 +381,9 @@ volatile int ticks; int psratio; static DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */ -static int global_hardclock_run = 0; +#ifdef DEVICE_POLLING +static int devpoll_run = 0; +#endif /* * Initialize clock frequencies and start both clocks running. @@ -584,15 +586,15 @@ hardclock_cnt(int cnt, int usermode) #endif /* We are in charge to handle this tick duty. */ if (newticks > 0) { - /* Dangerous and no need to call these things concurrently. */ - if (atomic_cmpset_acq_int(&global_hardclock_run, 0, 1)) { - tc_ticktock(newticks); + tc_ticktock(newticks); #ifdef DEVICE_POLLING + /* Dangerous and no need to call these things concurrently. */ + if (atomic_cmpset_acq_int(&devpoll_run, 0, 1)) { /* This is very short and quick. */ hardclock_device_poll(); -#endif /* DEVICE_POLLING */ - atomic_store_rel_int(&global_hardclock_run, 0); + atomic_store_rel_int(&devpoll_run, 0); } +#endif /* DEVICE_POLLING */ #ifdef SW_WATCHDOG if (watchdog_enabled > 0) { i = atomic_fetchadd_int(&watchdog_ticks, -newticks); Modified: stable/11/sys/kern/kern_proc.c ============================================================================== --- stable/11/sys/kern/kern_proc.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/kern/kern_proc.c Fri Aug 26 10:04:10 2016 (r304843) @@ -872,6 +872,7 @@ fill_kinfo_proc_only(struct proc *p, str struct session *sp; struct ucred *cred; struct sigacts *ps; + struct timeval boottime; /* For proc_realparent. */ sx_assert(&proctree_lock, SX_LOCKED); @@ -953,6 +954,7 @@ fill_kinfo_proc_only(struct proc *p, str kp->ki_nice = p->p_nice; kp->ki_fibnum = p->p_fibnum; kp->ki_start = p->p_stats->p_start; + getboottime(&boottime); timevaladd(&kp->ki_start, &boottime); PROC_STATLOCK(p); rufetch(p, &kp->ki_rusage); Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/kern/kern_tc.c Fri Aug 26 10:04:10 2016 (r304843) @@ -70,6 +70,7 @@ struct timehands { struct bintime th_offset; struct timeval th_microtime; struct timespec th_nanotime; + struct bintime th_boottime; /* Fields not to be copied in tc_windup start with th_generation. */ u_int th_generation; struct timehands *th_next; @@ -125,7 +126,7 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */ -static void tc_windup(void); +static void tc_windup(struct bintime *new_boottimebin); static void cpu_tick_calibrate(int); void dtrace_getnanotime(struct timespec *tsp); @@ -133,18 +134,22 @@ void dtrace_getnanotime(struct timespec static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { + struct timeval boottime_x; + + getboottime(&boottime_x); + #ifndef __mips__ #ifdef SCTL_MASK32 int tv[2]; if (req->flags & SCTL_MASK32) { - tv[0] = boottime.tv_sec; - tv[1] = boottime.tv_usec; - return SYSCTL_OUT(req, tv, sizeof(tv)); - } else + tv[0] = boottime_x.tv_sec; + tv[1] = boottime_x.tv_usec; + return (SYSCTL_OUT(req, tv, sizeof(tv))); + } #endif #endif - return SYSCTL_OUT(req, &boottime, sizeof(boottime)); + return (SYSCTL_OUT(req, &boottime_x, sizeof(boottime_x))); } static int @@ -224,9 +229,17 @@ fbclock_microuptime(struct timeval *tvp) void fbclock_bintime(struct bintime *bt) { + struct timehands *th; + unsigned int gen; - fbclock_binuptime(bt); - bintime_add(bt, &boottimebin); + do { + th = timehands; + gen = atomic_load_acq_int(&th->th_generation); + *bt = th->th_offset; + bintime_addx(bt, th->th_scale * tc_delta(th)); + bintime_add(bt, &th->th_boottime); + atomic_thread_fence_acq(); + } while (gen == 0 || gen != th->th_generation); } void @@ -299,9 +312,9 @@ fbclock_getbintime(struct bintime *bt) th = timehands; gen = atomic_load_acq_int(&th->th_generation); *bt = th->th_offset; + bintime_add(bt, &th->th_boottime); atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); - bintime_add(bt, &boottimebin); } void @@ -368,9 +381,17 @@ microuptime(struct timeval *tvp) void bintime(struct bintime *bt) { + struct timehands *th; + u_int gen; - binuptime(bt); - bintime_add(bt, &boottimebin); + do { + th = timehands; + gen = atomic_load_acq_int(&th->th_generation); + *bt = th->th_offset; + bintime_addx(bt, th->th_scale * tc_delta(th)); + bintime_add(bt, &th->th_boottime); + atomic_thread_fence_acq(); + } while (gen == 0 || gen != th->th_generation); } void @@ -443,9 +464,9 @@ getbintime(struct bintime *bt) th = timehands; gen = atomic_load_acq_int(&th->th_generation); *bt = th->th_offset; + bintime_add(bt, &th->th_boottime); atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); - bintime_add(bt, &boottimebin); } void @@ -477,6 +498,29 @@ getmicrotime(struct timeval *tvp) } #endif /* FFCLOCK */ +void +getboottime(struct timeval *boottime_x) +{ + struct bintime boottimebin_x; + + getboottimebin(&boottimebin_x); + bintime2timeval(&boottimebin_x, boottime_x); +} + +void +getboottimebin(struct bintime *boottimebin_x) +{ + struct timehands *th; + u_int gen; + + do { + th = timehands; + gen = atomic_load_acq_int(&th->th_generation); + *boottimebin_x = th->th_boottime; + atomic_thread_fence_acq(); + } while (gen == 0 || gen != th->th_generation); +} + #ifdef FFCLOCK /* * Support for feed-forward synchronization algorithms. This is heavily inspired @@ -1093,6 +1137,7 @@ int sysclock_snap2bintime(struct sysclock_snap *cs, struct bintime *bt, int whichclock, uint32_t flags) { + struct bintime boottimebin_x; #ifdef FFCLOCK struct bintime bt2; uint64_t period; @@ -1106,8 +1151,10 @@ sysclock_snap2bintime(struct sysclock_sn if (cs->delta > 0) bintime_addx(bt, cs->fb_info.th_scale * cs->delta); - if ((flags & FBCLOCK_UPTIME) == 0) - bintime_add(bt, &boottimebin); + if ((flags & FBCLOCK_UPTIME) == 0) { + getboottimebin(&boottimebin_x); + bintime_add(bt, &boottimebin_x); + } break; #ifdef FFCLOCK case SYSCLOCK_FFWD: @@ -1216,10 +1263,12 @@ tc_getfrequency(void) return (timehands->th_counter->tc_frequency); } +static struct mtx tc_setclock_mtx; +MTX_SYSINIT(tc_setclock_init, &tc_setclock_mtx, "tcsetc", MTX_SPIN); + /* * Step our concept of UTC. This is done by modifying our estimate of * when we booted. - * XXX: not locked. */ void tc_setclock(struct timespec *ts) @@ -1227,26 +1276,26 @@ tc_setclock(struct timespec *ts) struct timespec tbef, taft; struct bintime bt, bt2; - cpu_tick_calibrate(1); - nanotime(&tbef); timespec2bintime(ts, &bt); + nanotime(&tbef); + mtx_lock_spin(&tc_setclock_mtx); + cpu_tick_calibrate(1); binuptime(&bt2); bintime_sub(&bt, &bt2); - bintime_add(&bt2, &boottimebin); - boottimebin = bt; - bintime2timeval(&bt, &boottime); /* XXX fiddle all the little crinkly bits around the fiords... */ - tc_windup(); - nanotime(&taft); + tc_windup(&bt); + mtx_unlock_spin(&tc_setclock_mtx); + getboottimebin(&boottimebin); + bintime2timeval(&boottimebin, &boottime); if (timestepwarnings) { + nanotime(&taft); log(LOG_INFO, "Time stepped from %jd.%09ld to %jd.%09ld (%jd.%09ld)\n", (intmax_t)tbef.tv_sec, tbef.tv_nsec, (intmax_t)taft.tv_sec, taft.tv_nsec, (intmax_t)ts->tv_sec, ts->tv_nsec); } - cpu_tick_calibrate(1); } /* @@ -1255,7 +1304,7 @@ tc_setclock(struct timespec *ts) * timecounter and/or do seconds processing in NTP. Slightly magic. */ static void -tc_windup(void) +tc_windup(struct bintime *new_boottimebin) { struct bintime bt; struct timehands *th, *tho; @@ -1279,6 +1328,8 @@ tc_windup(void) th->th_generation = 0; atomic_thread_fence_rel(); bcopy(tho, th, offsetof(struct timehands, th_generation)); + if (new_boottimebin != NULL) + th->th_boottime = *new_boottimebin; /* * Capture a timecounter delta on the current timecounter and if @@ -1328,7 +1379,7 @@ tc_windup(void) * case we missed a leap second. */ bt = th->th_offset; - bintime_add(&bt, &boottimebin); + bintime_add(&bt, &th->th_boottime); i = bt.sec - tho->th_microtime.tv_sec; if (i > LARGE_STEP) i = 2; @@ -1336,7 +1387,7 @@ tc_windup(void) t = bt.sec; ntp_update_second(&th->th_adjustment, &bt.sec); if (bt.sec != t) - boottimebin.sec += bt.sec - t; + th->th_boottime.sec += bt.sec - t; } /* Update the UTC timestamps used by the get*() functions. */ /* XXX shouldn't do this here. Should force non-`get' versions. */ @@ -1759,7 +1810,7 @@ pps_event(struct pps_state *pps, int eve tcount &= pps->capth->th_counter->tc_counter_mask; bt = pps->capth->th_offset; bintime_addx(&bt, pps->capth->th_scale * tcount); - bintime_add(&bt, &boottimebin); + bintime_add(&bt, &pps->capth->th_boottime); bintime2timespec(&bt, &ts); /* If the timecounter was wound up underneath us, bail out. */ @@ -1832,11 +1883,14 @@ tc_ticktock(int cnt) { static int count; - count += cnt; - if (count < tc_tick) - return; - count = 0; - tc_windup(); + if (mtx_trylock_spin(&tc_setclock_mtx)) { + count += cnt; + if (count >= tc_tick) { + count = 0; + tc_windup(NULL); + } + mtx_unlock_spin(&tc_setclock_mtx); + } } static void __inline @@ -1911,7 +1965,9 @@ inittimecounter(void *dummy) /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); - tc_windup(); + mtx_lock_spin(&tc_setclock_mtx); + tc_windup(NULL); + mtx_unlock_spin(&tc_setclock_mtx); } SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL); @@ -2085,7 +2141,7 @@ tc_fill_vdso_timehands(struct vdso_timeh vdso_th->th_offset_count = th->th_offset_count; vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; vdso_th->th_offset = th->th_offset; - vdso_th->th_boottime = boottimebin; + vdso_th->th_boottime = th->th_boottime; enabled = cpu_fill_vdso_timehands(vdso_th, th->th_counter); if (!vdso_th_enable) enabled = 0; @@ -2106,8 +2162,8 @@ tc_fill_vdso_timehands32(struct vdso_tim vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; vdso_th32->th_offset.sec = th->th_offset.sec; *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; - vdso_th32->th_boottime.sec = boottimebin.sec; - *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; + vdso_th32->th_boottime.sec = th->th_boottime.sec; + *(uint64_t *)&vdso_th32->th_boottime.frac[0] = th->th_boottime.frac; enabled = cpu_fill_vdso_timehands32(vdso_th32, th->th_counter); if (!vdso_th_enable) enabled = 0; Modified: stable/11/sys/kern/sys_procdesc.c ============================================================================== --- stable/11/sys/kern/sys_procdesc.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/kern/sys_procdesc.c Fri Aug 26 10:04:10 2016 (r304843) @@ -517,7 +517,7 @@ procdesc_stat(struct file *fp, struct st struct thread *td) { struct procdesc *pd; - struct timeval pstart; + struct timeval pstart, boottime; /* * XXXRW: Perhaps we should cache some more information from the @@ -532,6 +532,7 @@ procdesc_stat(struct file *fp, struct st /* Set birth and [acm] times to process start time. */ pstart = pd->pd_proc->p_stats->p_start; + getboottime(&boottime); timevaladd(&pstart, &boottime); TIMEVAL_TO_TIMESPEC(&pstart, &sb->st_birthtim); sb->st_atim = sb->st_birthtim; Modified: stable/11/sys/net/altq/altq_subr.c ============================================================================== --- stable/11/sys/net/altq/altq_subr.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/net/altq/altq_subr.c Fri Aug 26 10:04:10 2016 (r304843) @@ -1027,9 +1027,10 @@ read_machclk(void) panic("read_machclk"); #endif } else { - struct timeval tv; + struct timeval tv, boottime; microtime(&tv); + getboottime(&boottime); val = (((u_int64_t)(tv.tv_sec - boottime.tv_sec) * 1000000 + tv.tv_usec) << MACHCLK_SHIFT); } Modified: stable/11/sys/net/bpf.c ============================================================================== --- stable/11/sys/net/bpf.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/net/bpf.c Fri Aug 26 10:04:10 2016 (r304843) @@ -2328,12 +2328,13 @@ bpf_hdrlen(struct bpf_d *d) static void bpf_bintime2ts(struct bintime *bt, struct bpf_ts *ts, int tstype) { - struct bintime bt2; + struct bintime bt2, boottimebin; struct timeval tsm; struct timespec tsn; if ((tstype & BPF_T_MONOTONIC) == 0) { bt2 = *bt; + getboottimebin(&boottimebin); bintime_add(&bt2, &boottimebin); bt = &bt2; } Modified: stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Aug 26 10:04:10 2016 (r304843) @@ -395,6 +395,7 @@ swap_map(struct ip_fw_chain *chain, stru static void export_cntr1_base(struct ip_fw *krule, struct ip_fw_bcounter *cntr) { + struct timeval boottime; cntr->size = sizeof(*cntr); @@ -403,21 +404,26 @@ export_cntr1_base(struct ip_fw *krule, s cntr->bcnt = counter_u64_fetch(krule->cntr + 1); cntr->timestamp = krule->timestamp; } - if (cntr->timestamp > 0) + if (cntr->timestamp > 0) { + getboottime(&boottime); cntr->timestamp += boottime.tv_sec; + } } static void export_cntr0_base(struct ip_fw *krule, struct ip_fw_bcounter0 *cntr) { + struct timeval boottime; if (krule->cntr != NULL) { cntr->pcnt = counter_u64_fetch(krule->cntr); cntr->bcnt = counter_u64_fetch(krule->cntr + 1); cntr->timestamp = krule->timestamp; } - if (cntr->timestamp > 0) + if (cntr->timestamp > 0) { + getboottime(&boottime); cntr->timestamp += boottime.tv_sec; + } } /* @@ -2056,11 +2062,13 @@ ipfw_getrules(struct ip_fw_chain *chain, char *ep = bp + space; struct ip_fw *rule; struct ip_fw_rule0 *dst; + struct timeval boottime; int error, i, l, warnflag; time_t boot_seconds; warnflag = 0; + getboottime(&boottime); boot_seconds = boottime.tv_sec; for (i = 0; i < chain->n_rules; i++) { rule = chain->map[i]; Modified: stable/11/sys/nfs/nfs_lock.c ============================================================================== --- stable/11/sys/nfs/nfs_lock.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/nfs/nfs_lock.c Fri Aug 26 10:04:10 2016 (r304843) @@ -241,6 +241,7 @@ nfs_dolock(struct vop_advlock_args *ap) struct flock *fl; struct proc *p; struct nfsmount *nmp; + struct timeval boottime; td = curthread; p = td->td_proc; @@ -284,6 +285,7 @@ nfs_dolock(struct vop_advlock_args *ap) p->p_nlminfo = malloc(sizeof(struct nlminfo), M_NLMINFO, M_WAITOK | M_ZERO); p->p_nlminfo->pid_start = p->p_stats->p_start; + getboottime(&boottime); timevaladd(&p->p_nlminfo->pid_start, &boottime); } msg.lm_msg_ident.pid_start = p->p_nlminfo->pid_start; Modified: stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c ============================================================================== --- stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Fri Aug 26 10:04:10 2016 (r304843) @@ -504,11 +504,13 @@ svc_rpc_gss_find_client(struct svc_rpc_g { struct svc_rpc_gss_client *client; struct svc_rpc_gss_client_list *list; + struct timeval boottime; unsigned long hostid; rpc_gss_log_debug("in svc_rpc_gss_find_client(%d)", id->ci_id); getcredhostid(curthread->td_ucred, &hostid); + getboottime(&boottime); if (id->ci_hostid != hostid || id->ci_boottime != boottime.tv_sec) return (NULL); @@ -537,6 +539,7 @@ svc_rpc_gss_create_client(void) { struct svc_rpc_gss_client *client; struct svc_rpc_gss_client_list *list; + struct timeval boottime; unsigned long hostid; rpc_gss_log_debug("in svc_rpc_gss_create_client()"); @@ -547,6 +550,7 @@ svc_rpc_gss_create_client(void) sx_init(&client->cl_lock, "GSS-client"); getcredhostid(curthread->td_ucred, &hostid); client->cl_id.ci_hostid = hostid; + getboottime(&boottime); client->cl_id.ci_boottime = boottime.tv_sec; client->cl_id.ci_id = svc_rpc_gss_next_clientid++; list = &svc_rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE]; Modified: stable/11/sys/sys/time.h ============================================================================== --- stable/11/sys/sys/time.h Fri Aug 26 09:42:51 2016 (r304842) +++ stable/11/sys/sys/time.h Fri Aug 26 10:04:10 2016 (r304843) @@ -372,8 +372,6 @@ void resettodr(void); extern volatile time_t time_second; extern volatile time_t time_uptime; -extern struct bintime boottimebin; -extern struct timeval boottime; extern struct bintime tc_tick_bt; extern sbintime_t tc_tick_sbt; extern struct bintime tick_bt; @@ -440,6 +438,9 @@ void getbintime(struct bintime *bt); void getnanotime(struct timespec *tsp); void getmicrotime(struct timeval *tvp); +void getboottime(struct timeval *boottime); +void getboottimebin(struct bintime *boottimebin); + /* Other functions */ int itimerdecr(struct itimerval *itp, int usec); int itimerfix(struct timeval *tv); From owner-svn-src-stable@freebsd.org Fri Aug 26 10:06:25 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49F23A945AE; Fri, 26 Aug 2016 10:06:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17904E02; Fri, 26 Aug 2016 10:06:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QA6Ovp048956; Fri, 26 Aug 2016 10:06:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QA6OfX048955; Fri, 26 Aug 2016 10:06:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608261006.u7QA6OfX048955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 26 Aug 2016 10:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304844 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 10:06:25 -0000 Author: kib Date: Fri Aug 26 10:06:24 2016 New Revision: 304844 URL: https://svnweb.freebsd.org/changeset/base/304844 Log: MFC r303388: Remove Giant from settime(). Modified: stable/11/sys/kern/kern_time.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_time.c ============================================================================== --- stable/11/sys/kern/kern_time.c Fri Aug 26 10:04:10 2016 (r304843) +++ stable/11/sys/kern/kern_time.c Fri Aug 26 10:06:24 2016 (r304844) @@ -120,9 +120,7 @@ settime(struct thread *td, struct timeva struct timeval delta, tv1, tv2; static struct timeval maxtime, laststep; struct timespec ts; - int s; - s = splclock(); microtime(&tv1); delta = *tv; timevalsub(&delta, &tv1); @@ -152,10 +150,8 @@ settime(struct thread *td, struct timeva printf("Time adjustment clamped to -1 second\n"); } } else { - if (tv1.tv_sec == laststep.tv_sec) { - splx(s); + if (tv1.tv_sec == laststep.tv_sec) return (EPERM); - } if (delta.tv_sec > 1) { tv->tv_sec = tv1.tv_sec + 1; printf("Time adjustment clamped to +1 second\n"); @@ -166,10 +162,8 @@ settime(struct thread *td, struct timeva ts.tv_sec = tv->tv_sec; ts.tv_nsec = tv->tv_usec * 1000; - mtx_lock(&Giant); tc_setclock(&ts); resettodr(); - mtx_unlock(&Giant); return (0); } From owner-svn-src-stable@freebsd.org Fri Aug 26 12:04:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12457A93B15; Fri, 26 Aug 2016 12:04:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D79D3C8D; Fri, 26 Aug 2016 12:04:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QC4WE8093244; Fri, 26 Aug 2016 12:04:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QC4WnF093243; Fri, 26 Aug 2016 12:04:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201608261204.u7QC4WnF093243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 26 Aug 2016 12:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304845 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 12:04:33 -0000 Author: hselasky Date: Fri Aug 26 12:04:31 2016 New Revision: 304845 URL: https://svnweb.freebsd.org/changeset/base/304845 Log: MFC r304342: Add support for setting blocking and non-blocking mode on /dev/rdma_cm by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags handling is done by the kern_ioctl() function. Reported by: Alex Bowden Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ucma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 10:06:24 2016 (r304844) +++ stable/11/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 12:04:31 2016 (r304845) @@ -42,6 +42,8 @@ #include #include +#include + #include #include #include @@ -1345,11 +1347,25 @@ static int ucma_close(struct inode *inod return 0; } +static long +ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + + switch (cmd) { + case FIONBIO: + case FIOASYNC: + return (0); + default: + return (-ENOTTY); + } +} + static const struct file_operations ucma_fops = { .owner = THIS_MODULE, .open = ucma_open, .release = ucma_close, .write = ucma_write, + .unlocked_ioctl = ucma_ioctl, .poll = ucma_poll, .llseek = no_llseek, }; From owner-svn-src-stable@freebsd.org Fri Aug 26 12:06:45 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3829A93C0F; Fri, 26 Aug 2016 12:06:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C31AEE64; Fri, 26 Aug 2016 12:06:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QC6hx5093378; Fri, 26 Aug 2016 12:06:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QC6hku093377; Fri, 26 Aug 2016 12:06:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201608261206.u7QC6hku093377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 26 Aug 2016 12:06: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: r304846 - stable/10/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 12:06:45 -0000 Author: hselasky Date: Fri Aug 26 12:06:43 2016 New Revision: 304846 URL: https://svnweb.freebsd.org/changeset/base/304846 Log: MFC r304342: Add support for setting blocking and non-blocking mode on /dev/rdma_cm by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags handling is done by the kern_ioctl() function. Reported by: Alex Bowden Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/ucma.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/core/ucma.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 12:04:31 2016 (r304845) +++ stable/10/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 12:06:43 2016 (r304846) @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -1285,11 +1287,25 @@ static int ucma_close(struct inode *inod return 0; } +static long +ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + + switch (cmd) { + case FIONBIO: + case FIOASYNC: + return (0); + default: + return (-ENOTTY); + } +} + static const struct file_operations ucma_fops = { .owner = THIS_MODULE, .open = ucma_open, .release = ucma_close, .write = ucma_write, + .unlocked_ioctl = ucma_ioctl, .poll = ucma_poll, }; From owner-svn-src-stable@freebsd.org Fri Aug 26 12:08:28 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B590BA93D9F; Fri, 26 Aug 2016 12:08:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84FCE15E; Fri, 26 Aug 2016 12:08:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QC8RHI093486; Fri, 26 Aug 2016 12:08:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QC8Rs2093485; Fri, 26 Aug 2016 12:08:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201608261208.u7QC8Rs2093485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 26 Aug 2016 12:08:27 +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: r304847 - stable/9/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 12:08:28 -0000 Author: hselasky Date: Fri Aug 26 12:08:27 2016 New Revision: 304847 URL: https://svnweb.freebsd.org/changeset/base/304847 Log: MFC r304342: Add support for setting blocking and non-blocking mode on /dev/rdma_cm by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags handling is done by the kern_ioctl() function. Reported by: Alex Bowden Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/infiniband/core/ucma.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/core/ucma.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 12:06:43 2016 (r304846) +++ stable/9/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 26 12:08:27 2016 (r304847) @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -1285,11 +1287,25 @@ static int ucma_close(struct inode *inod return 0; } +static long +ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + + switch (cmd) { + case FIONBIO: + case FIOASYNC: + return (0); + default: + return (-ENOTTY); + } +} + static const struct file_operations ucma_fops = { .owner = THIS_MODULE, .open = ucma_open, .release = ucma_close, .write = ucma_write, + .unlocked_ioctl = ucma_ioctl, .poll = ucma_poll, }; From owner-svn-src-stable@freebsd.org Fri Aug 26 21:19:25 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23438B7643E; Fri, 26 Aug 2016 21:19:25 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00E201C3; Fri, 26 Aug 2016 21:19:24 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QLJOMP000652; Fri, 26 Aug 2016 21:19:24 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QLJOMF000650; Fri, 26 Aug 2016 21:19:24 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608262119.u7QLJOMF000650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Fri, 26 Aug 2016 21:19: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: r304862 - in stable/10: include/xlocale lib/libc/nls X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 21:19:25 -0000 Author: ache Date: Fri Aug 26 21:19:23 2016 New Revision: 304862 URL: https://svnweb.freebsd.org/changeset/base/304862 Log: MFC r304703, r304755 1) _locale.h LC_*_MASK bit shifting order was partially broken from the initial commit time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the right order. The order here should match XLC_* from "xlocale_private.h" which, in turn, match LC_* publicly visible order from which determines how locale components are stored in the structure. LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale() and equivalent shift loop in the newlocale(), so mapped to some wrong components (excluding two mentioned above). Formally the fix is ABI breakage, but old code using those masks never works properly in any case. Only newlocale() and querylocale() are affected. 2) msgcat.c Use current locale (f.e. set by thread). It was global locale always previously. PR: 211743 Modified: stable/10/include/xlocale/_locale.h stable/10/lib/libc/nls/msgcat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/include/xlocale/_locale.h ============================================================================== --- stable/10/include/xlocale/_locale.h Fri Aug 26 20:51:09 2016 (r304861) +++ stable/10/include/xlocale/_locale.h Fri Aug 26 21:19:23 2016 (r304862) @@ -32,12 +32,13 @@ #ifndef _XLOCALE_LOCALE_H #define _XLOCALE_LOCALE_H +/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */ #define LC_COLLATE_MASK (1<<0) #define LC_CTYPE_MASK (1<<1) -#define LC_MESSAGES_MASK (1<<2) -#define LC_MONETARY_MASK (1<<3) -#define LC_NUMERIC_MASK (1<<4) -#define LC_TIME_MASK (1<<5) +#define LC_MONETARY_MASK (1<<2) +#define LC_NUMERIC_MASK (1<<3) +#define LC_TIME_MASK (1<<4) +#define LC_MESSAGES_MASK (1<<5) #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) #define LC_GLOBAL_LOCALE ((locale_t)-1) Modified: stable/10/lib/libc/nls/msgcat.c ============================================================================== --- stable/10/lib/libc/nls/msgcat.c Fri Aug 26 20:51:09 2016 (r304861) +++ stable/10/lib/libc/nls/msgcat.c Fri Aug 26 21:19:23 2016 (r304862) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -56,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" -#include "../locale/setlocale.h" /* for ENCODING_LEN */ +#include "../locale/xlocale_private.h" #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" @@ -115,9 +114,10 @@ catopen(const char *name, int type) { struct stat sbuf; struct catentry *np; - char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode; - char *plang, *pter, *tmpptr; + char *base, *cptr, *cptr1, *nlspath, *pathP, *pcode; + char *plang, *pter; int saverr, spcleft; + const char *lang, *tmpptr; char path[PATH_MAX]; /* sanity checking */ @@ -129,7 +129,7 @@ catopen(const char *name, int type) lang = NULL; else { if (type == NL_CAT_LOCALE) - lang = setlocale(LC_MESSAGES, NULL); + lang = querylocale(LC_MESSAGES_MASK, __get_locale()); else lang = getenv("LANG"); From owner-svn-src-stable@freebsd.org Fri Aug 26 21:23:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5AC0B765AF; Fri, 26 Aug 2016 21:23:39 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 810E1839; Fri, 26 Aug 2016 21:23:39 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QLNceE004126; Fri, 26 Aug 2016 21:23:38 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QLNc6W004124; Fri, 26 Aug 2016 21:23:38 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608262123.u7QLNc6W004124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Fri, 26 Aug 2016 21:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304863 - in stable/11: include/xlocale lib/libc/nls X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 21:23:39 -0000 Author: ache Date: Fri Aug 26 21:23:38 2016 New Revision: 304863 URL: https://svnweb.freebsd.org/changeset/base/304863 Log: MFC r304703, r304755 1) _locale.h LC_*_MASK bit shifting order was partially broken from the initial commit time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the right order. The order here should match XLC_* from "xlocale_private.h" which, in turn, match LC_* publicly visible order from which determines how locale components are stored in the structure. LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale() and equivalent shift loop in the newlocale(), so mapped to some wrong components (excluding two mentioned above). Formally the fix is ABI breakage, but old code using those masks never works properly in any case. Only newlocale() and querylocale() are affected. 2) msgcat.c Use current locale (f.e. set by thread). It was global locale always previously. PR: 211743 Modified: stable/11/include/xlocale/_locale.h stable/11/lib/libc/nls/msgcat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/include/xlocale/_locale.h ============================================================================== --- stable/11/include/xlocale/_locale.h Fri Aug 26 21:19:23 2016 (r304862) +++ stable/11/include/xlocale/_locale.h Fri Aug 26 21:23:38 2016 (r304863) @@ -32,12 +32,13 @@ #ifndef _XLOCALE_LOCALE_H #define _XLOCALE_LOCALE_H +/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */ #define LC_COLLATE_MASK (1<<0) #define LC_CTYPE_MASK (1<<1) -#define LC_MESSAGES_MASK (1<<2) -#define LC_MONETARY_MASK (1<<3) -#define LC_NUMERIC_MASK (1<<4) -#define LC_TIME_MASK (1<<5) +#define LC_MONETARY_MASK (1<<2) +#define LC_NUMERIC_MASK (1<<3) +#define LC_TIME_MASK (1<<4) +#define LC_MESSAGES_MASK (1<<5) #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) #define LC_GLOBAL_LOCALE ((locale_t)-1) Modified: stable/11/lib/libc/nls/msgcat.c ============================================================================== --- stable/11/lib/libc/nls/msgcat.c Fri Aug 26 21:19:23 2016 (r304862) +++ stable/11/lib/libc/nls/msgcat.c Fri Aug 26 21:23:38 2016 (r304863) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -56,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" -#include "../locale/setlocale.h" /* for ENCODING_LEN */ +#include "../locale/xlocale_private.h" #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" @@ -115,9 +114,10 @@ catopen(const char *name, int type) { struct stat sbuf; struct catentry *np; - char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode; - char *plang, *pter, *tmpptr; + char *base, *cptr, *cptr1, *nlspath, *pathP, *pcode; + char *plang, *pter; int saverr, spcleft; + const char *lang, *tmpptr; char path[PATH_MAX]; /* sanity checking */ @@ -129,7 +129,7 @@ catopen(const char *name, int type) lang = NULL; else { if (type == NL_CAT_LOCALE) - lang = setlocale(LC_MESSAGES, NULL); + lang = querylocale(LC_MESSAGES_MASK, __get_locale()); else lang = getenv("LANG"); From owner-svn-src-stable@freebsd.org Fri Aug 26 21:26:34 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EEC3B7663B; Fri, 26 Aug 2016 21:26:34 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FB369D4; Fri, 26 Aug 2016 21:26:34 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QLQX5q004374; Fri, 26 Aug 2016 21:26:33 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QLQXmg004373; Fri, 26 Aug 2016 21:26:33 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608262126.u7QLQXmg004373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Fri, 26 Aug 2016 21:26: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: r304864 - stable/10/sys/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 21:26:34 -0000 Author: ache Date: Fri Aug 26 21:26:33 2016 New Revision: 304864 URL: https://svnweb.freebsd.org/changeset/base/304864 Log: Bump __FreeBSD_version after LC_*_MASK fix Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Fri Aug 26 21:23:38 2016 (r304863) +++ stable/10/sys/sys/param.h Fri Aug 26 21:26:33 2016 (r304864) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1003507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Fri Aug 26 21:28:25 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB3D8B766A0; Fri, 26 Aug 2016 21:28:25 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB1B5CEE; Fri, 26 Aug 2016 21:28:25 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7QLSOBG004520; Fri, 26 Aug 2016 21:28:24 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7QLSOlp004519; Fri, 26 Aug 2016 21:28:24 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608262128.u7QLSOlp004519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Fri, 26 Aug 2016 21:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304865 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 21:28:26 -0000 Author: ache Date: Fri Aug 26 21:28:24 2016 New Revision: 304865 URL: https://svnweb.freebsd.org/changeset/base/304865 Log: Bump __FreeBSD_version after LC_*_MASK fix Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Fri Aug 26 21:26:33 2016 (r304864) +++ stable/11/sys/sys/param.h Fri Aug 26 21:28:24 2016 (r304865) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100501 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100502 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Sat Aug 27 02:27:31 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33BE5B760A1; Sat, 27 Aug 2016 02:27:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05E19FA5; Sat, 27 Aug 2016 02:27:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2RU9k015438; Sat, 27 Aug 2016 02:27:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2RUTk015437; Sat, 27 Aug 2016 02:27:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270227.u7R2RUTk015437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:27: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: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:27:31 -0000 Author: cy Date: Sat Aug 27 02:27:29 2016 New Revision: 304878 URL: https://svnweb.freebsd.org/changeset/base/304878 Log: MFC r304721: Fixup man page formatting. Submitted by: Steve Kargl Discussed with: bjk@ Modified: stable/9/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/ntp/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/ntp/doc/sntp.8 stable/11/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/usr.sbin/ntp/doc/sntp.8 ============================================================================== --- stable/9/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 01:28:00 2016 (r304877) +++ stable/9/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 02:27:29 2016 (r304878) @@ -213,7 +213,7 @@ of seconds specified before giving up. more than enough for a unicast response. If \fBsntp\fP is only waiting for a broadcast response a longer timeout is likely needed. -.It Fl \-wait , " Fl \-no\-wait" +.It Fl \-wait , Fl \-no\-wait Wait for pending replies (if not setting the time). The \fIno\-wait\fP form will disable the option. This option is enabled by default. From owner-svn-src-stable@freebsd.org Sat Aug 27 02:27:30 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB72FB7609C; Sat, 27 Aug 2016 02:27:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D66AFA3; Sat, 27 Aug 2016 02:27:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2RTWl015426; Sat, 27 Aug 2016 02:27:29 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2RTRS015425; Sat, 27 Aug 2016 02:27:29 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270227.u7R2RTRS015425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:27:30 -0000 Author: cy Date: Sat Aug 27 02:27:29 2016 New Revision: 304878 URL: https://svnweb.freebsd.org/changeset/base/304878 Log: MFC r304721: Fixup man page formatting. Submitted by: Steve Kargl Discussed with: bjk@ Modified: stable/11/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/ntp/doc/sntp.8 stable/9/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/10/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/ntp/ (props changed) Modified: stable/11/usr.sbin/ntp/doc/sntp.8 ============================================================================== --- stable/11/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 01:28:00 2016 (r304877) +++ stable/11/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 02:27:29 2016 (r304878) @@ -213,7 +213,7 @@ of seconds specified before giving up. more than enough for a unicast response. If \fBsntp\fP is only waiting for a broadcast response a longer timeout is likely needed. -.It Fl \-wait , " Fl \-no\-wait" +.It Fl \-wait , Fl \-no\-wait Wait for pending replies (if not setting the time). The \fIno\-wait\fP form will disable the option. This option is enabled by default. From owner-svn-src-stable@freebsd.org Sat Aug 27 02:27:31 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A2CCB760A0; Sat, 27 Aug 2016 02:27:31 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB381FA4; Sat, 27 Aug 2016 02:27:30 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2RUFF015432; Sat, 27 Aug 2016 02:27:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2RUxA015431; Sat, 27 Aug 2016 02:27:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270227.u7R2RUxA015431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:27: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: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:27:31 -0000 Author: cy Date: Sat Aug 27 02:27:29 2016 New Revision: 304878 URL: https://svnweb.freebsd.org/changeset/base/304878 Log: MFC r304721: Fixup man page formatting. Submitted by: Steve Kargl Discussed with: bjk@ Modified: stable/10/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/ntp/doc/sntp.8 stable/9/usr.sbin/ntp/doc/sntp.8 Directory Properties: stable/11/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/ntp/ (props changed) Modified: stable/10/usr.sbin/ntp/doc/sntp.8 ============================================================================== --- stable/10/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 01:28:00 2016 (r304877) +++ stable/10/usr.sbin/ntp/doc/sntp.8 Sat Aug 27 02:27:29 2016 (r304878) @@ -213,7 +213,7 @@ of seconds specified before giving up. more than enough for a unicast response. If \fBsntp\fP is only waiting for a broadcast response a longer timeout is likely needed. -.It Fl \-wait , " Fl \-no\-wait" +.It Fl \-wait , Fl \-no\-wait Wait for pending replies (if not setting the time). The \fIno\-wait\fP form will disable the option. This option is enabled by default. From owner-svn-src-stable@freebsd.org Sat Aug 27 02:53:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6917CB76D07; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29A6D18A; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2rLKK026543; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2rLmB026541; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270253.u7R2rLmB026541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:53:22 -0000 Author: cy Date: Sat Aug 27 02:53:21 2016 New Revision: 304879 URL: https://svnweb.freebsd.org/changeset/base/304879 Log: MFC r304779, r304780, r304781, r304782, r304802 r304779: Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes to leap-seconds invaldidates validation hash at the end of the file. Remove svn:keywords and replace with fbsd:nokeywords=yes to support this change. r304780: Change the algorithm by which /var/db/leap-seconds is updated. 1. Use the leap-seconds version number (update time) to determine whether to update the file or not. 2. If the version numbers of the files is the same, use the later expiry date to determine which file to use. Suggested by: ian@ r304781: Add logic to replace the working ntp leap-seconds file in /var/db if it contains a $FreeBSD$ header. The header will cause the file to fail checksum of the hash causing ntpd to ignore the file. r304782: Make validation of the leap-seconds file unconditional. r304802: Remove the gratuitous check for $FreeBSD$ and rename the function to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy isn't already there. Reported by: ache@ Modified: stable/11/etc/ntp/leap-seconds (contents, props changed) stable/11/etc/rc.d/ntpd Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/etc/ntp/leap-seconds (contents, props changed) stable/10/etc/rc.d/ntpd stable/9/etc/ntp/leap-seconds (contents, props changed) stable/9/etc/rc.d/ntpd Directory Properties: stable/10/ (props changed) stable/9/etc/ (props changed) stable/9/etc/rc.d/ (props changed) Modified: stable/11/etc/ntp/leap-seconds ============================================================================== --- stable/11/etc/ntp/leap-seconds Sat Aug 27 02:27:29 2016 (r304878) +++ stable/11/etc/ntp/leap-seconds Sat Aug 27 02:53:21 2016 (r304879) @@ -1,6 +1,4 @@ # -# $FreeBSD$ -# # In the following text, the symbol '#' introduces # a comment, which continues from that symbol until # the end of the line. A plain comment line has a @@ -46,7 +44,7 @@ # by the International Bureau of Weights and Measures # (BIPM). See www.bipm.fr for more information. # -# 3. The current definition of the relationship between UTC +# 3. The current defintion of the relationship between UTC # and TAI dates from 1 January 1972. A number of different # time scales were in use before than epoch, and it can be # quite difficult to compute precise timestamps and time Modified: stable/11/etc/rc.d/ntpd ============================================================================== --- stable/11/etc/rc.d/ntpd Sat Aug 27 02:27:29 2016 (r304878) +++ stable/11/etc/rc.d/ntpd Sat Aug 27 02:53:21 2016 (r304879) @@ -29,6 +29,8 @@ ntpd_precmd() rc_flags="-g $rc_flags" fi + ntpd_init_leapfile + if [ ! -f $ntp_db_leapfile ]; then ntpd_fetch_leapfile fi @@ -67,15 +69,27 @@ current_ntp_ts() { } get_ntp_leapfile_ver() { + # Leapfile update date (version number). expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } get_ntp_leapfile_expiry() { + # Leapfile expiry date. expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } +ntpd_init_leapfile() { + # Refresh working leapfile with an invalid hash due to + # FreeBSD id header. Ntpd will ignore leapfiles with a + # mismatch hash. The file must be the virgin file from + # the source. + if [ ! -f $ntp_db_leapfile ]; then + cp -p $ntp_src_leapfile $ntp_db_leapfile + fi +} + ntpd_fetch_leapfile() { local ntp_tmp_leapfile rc verbose @@ -88,19 +102,23 @@ ntpd_fetch_leapfile() { ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile) + ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile) ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile) + ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile) $verbose ntp_src_leapfile version is $ntp_ver_no_src $verbose ntp_db_leapfile version is $ntp_ver_no_db - if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then + if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then $verbose replacing $ntp_db_leapfile with $ntp_src_leapfile cp -p $ntp_src_leapfile $ntp_db_leapfile ntp_ver_no_db=$ntp_ver_no_src else $verbose not replacing $ntp_db_leapfile with $ntp_src_leapfile fi - ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leapfile_expiry_seconds=$((ntp_leapfile_expiry_days*86400)) + ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leap_fetch_date=$((ntp_leap_expiry-ntp_leapfile_expiry_seconds)) if [ $(current_ntp_ts) -ge $ntp_leap_fetch_date ]; then $verbose Within ntp leapfile expiry limit, initiating fetch @@ -108,8 +126,11 @@ ntpd_fetch_leapfile() { $verbose fetching $url fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break done + ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) - if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then + if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_tmp" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_tmp" -gt "$ntp_expiry_db" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-stable@freebsd.org Sat Aug 27 02:53:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3063B76D11; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B779118D; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2rLQI026557; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2rLvg026555; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270253.u7R2rLvg026555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:53:21 +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: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:53:23 -0000 Author: cy Date: Sat Aug 27 02:53:21 2016 New Revision: 304879 URL: https://svnweb.freebsd.org/changeset/base/304879 Log: MFC r304779, r304780, r304781, r304782, r304802 r304779: Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes to leap-seconds invaldidates validation hash at the end of the file. Remove svn:keywords and replace with fbsd:nokeywords=yes to support this change. r304780: Change the algorithm by which /var/db/leap-seconds is updated. 1. Use the leap-seconds version number (update time) to determine whether to update the file or not. 2. If the version numbers of the files is the same, use the later expiry date to determine which file to use. Suggested by: ian@ r304781: Add logic to replace the working ntp leap-seconds file in /var/db if it contains a $FreeBSD$ header. The header will cause the file to fail checksum of the hash causing ntpd to ignore the file. r304782: Make validation of the leap-seconds file unconditional. r304802: Remove the gratuitous check for $FreeBSD$ and rename the function to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy isn't already there. Reported by: ache@ Modified: stable/9/etc/ntp/leap-seconds (contents, props changed) stable/9/etc/rc.d/ntpd Directory Properties: stable/9/etc/ (props changed) stable/9/etc/rc.d/ (props changed) Changes in other areas also in this revision: Modified: stable/10/etc/ntp/leap-seconds (contents, props changed) stable/10/etc/rc.d/ntpd stable/11/etc/ntp/leap-seconds (contents, props changed) stable/11/etc/rc.d/ntpd Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/etc/ntp/leap-seconds ============================================================================== --- stable/9/etc/ntp/leap-seconds Sat Aug 27 02:27:29 2016 (r304878) +++ stable/9/etc/ntp/leap-seconds Sat Aug 27 02:53:21 2016 (r304879) @@ -1,6 +1,4 @@ # -# $FreeBSD$ -# # In the following text, the symbol '#' introduces # a comment, which continues from that symbol until # the end of the line. A plain comment line has a Modified: stable/9/etc/rc.d/ntpd ============================================================================== --- stable/9/etc/rc.d/ntpd Sat Aug 27 02:27:29 2016 (r304878) +++ stable/9/etc/rc.d/ntpd Sat Aug 27 02:53:21 2016 (r304879) @@ -28,6 +28,8 @@ ntpd_precmd() rc_flags="-g $rc_flags" fi + ntpd_init_leapfile + if [ ! -f $ntp_db_leapfile ]; then ntpd_fetch_leapfile fi @@ -66,15 +68,27 @@ current_ntp_ts() { } get_ntp_leapfile_ver() { + # Leapfile update date (version number). expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } get_ntp_leapfile_expiry() { + # Leapfile expiry date. expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } +ntpd_init_leapfile() { + # Refresh working leapfile with an invalid hash due to + # FreeBSD id header. Ntpd will ignore leapfiles with a + # mismatch hash. The file must be the virgin file from + # the source. + if [ ! -f $ntp_db_leapfile ]; then + cp -p $ntp_src_leapfile $ntp_db_leapfile + fi +} + ntpd_fetch_leapfile() { local ntp_tmp_leapfile rc verbose @@ -87,19 +101,23 @@ ntpd_fetch_leapfile() { ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile) + ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile) ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile) + ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile) $verbose ntp_src_leapfile version is $ntp_ver_no_src $verbose ntp_db_leapfile version is $ntp_ver_no_db - if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then + if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then $verbose replacing $ntp_db_leapfile with $ntp_src_leapfile cp -p $ntp_src_leapfile $ntp_db_leapfile ntp_ver_no_db=$ntp_ver_no_src else $verbose not replacing $ntp_db_leapfile with $ntp_src_leapfile fi - ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leapfile_expiry_seconds=$((ntp_leapfile_expiry_days*86400)) + ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leap_fetch_date=$((ntp_leap_expiry-ntp_leapfile_expiry_seconds)) if [ $(current_ntp_ts) -ge $ntp_leap_fetch_date ]; then $verbose Within ntp leapfile expiry limit, initiating fetch @@ -107,8 +125,11 @@ ntpd_fetch_leapfile() { $verbose fetching $url fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break done + ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) - if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then + if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_tmp" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_tmp" -gt "$ntp_expiry_db" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-stable@freebsd.org Sat Aug 27 02:53:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A31CDB76D0B; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6844118C; Sat, 27 Aug 2016 02:53:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R2rLNA026550; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R2rLA2026548; Sat, 27 Aug 2016 02:53:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201608270253.u7R2rLA2026548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 27 Aug 2016 02:53: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: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 02:53:22 -0000 Author: cy Date: Sat Aug 27 02:53:21 2016 New Revision: 304879 URL: https://svnweb.freebsd.org/changeset/base/304879 Log: MFC r304779, r304780, r304781, r304782, r304802 r304779: Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes to leap-seconds invaldidates validation hash at the end of the file. Remove svn:keywords and replace with fbsd:nokeywords=yes to support this change. r304780: Change the algorithm by which /var/db/leap-seconds is updated. 1. Use the leap-seconds version number (update time) to determine whether to update the file or not. 2. If the version numbers of the files is the same, use the later expiry date to determine which file to use. Suggested by: ian@ r304781: Add logic to replace the working ntp leap-seconds file in /var/db if it contains a $FreeBSD$ header. The header will cause the file to fail checksum of the hash causing ntpd to ignore the file. r304782: Make validation of the leap-seconds file unconditional. r304802: Remove the gratuitous check for $FreeBSD$ and rename the function to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy isn't already there. Reported by: ache@ Modified: stable/10/etc/ntp/leap-seconds (contents, props changed) stable/10/etc/rc.d/ntpd Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/etc/ntp/leap-seconds (contents, props changed) stable/11/etc/rc.d/ntpd stable/9/etc/ntp/leap-seconds (contents, props changed) stable/9/etc/rc.d/ntpd Directory Properties: stable/11/ (props changed) stable/9/etc/ (props changed) stable/9/etc/rc.d/ (props changed) Modified: stable/10/etc/ntp/leap-seconds ============================================================================== --- stable/10/etc/ntp/leap-seconds Sat Aug 27 02:27:29 2016 (r304878) +++ stable/10/etc/ntp/leap-seconds Sat Aug 27 02:53:21 2016 (r304879) @@ -1,6 +1,4 @@ # -# $FreeBSD$ -# # In the following text, the symbol '#' introduces # a comment, which continues from that symbol until # the end of the line. A plain comment line has a @@ -46,7 +44,7 @@ # by the International Bureau of Weights and Measures # (BIPM). See www.bipm.fr for more information. # -# 3. The current definition of the relationship between UTC +# 3. The current defintion of the relationship between UTC # and TAI dates from 1 January 1972. A number of different # time scales were in use before than epoch, and it can be # quite difficult to compute precise timestamps and time Modified: stable/10/etc/rc.d/ntpd ============================================================================== --- stable/10/etc/rc.d/ntpd Sat Aug 27 02:27:29 2016 (r304878) +++ stable/10/etc/rc.d/ntpd Sat Aug 27 02:53:21 2016 (r304879) @@ -28,6 +28,8 @@ ntpd_precmd() rc_flags="-g $rc_flags" fi + ntpd_init_leapfile + if [ ! -f $ntp_db_leapfile ]; then ntpd_fetch_leapfile fi @@ -66,15 +68,27 @@ current_ntp_ts() { } get_ntp_leapfile_ver() { + # Leapfile update date (version number). expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } get_ntp_leapfile_expiry() { + # Leapfile expiry date. expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \ '^\([1-9][0-9]*\)$' \| 0 } +ntpd_init_leapfile() { + # Refresh working leapfile with an invalid hash due to + # FreeBSD id header. Ntpd will ignore leapfiles with a + # mismatch hash. The file must be the virgin file from + # the source. + if [ ! -f $ntp_db_leapfile ]; then + cp -p $ntp_src_leapfile $ntp_db_leapfile + fi +} + ntpd_fetch_leapfile() { local ntp_tmp_leapfile rc verbose @@ -87,19 +101,23 @@ ntpd_fetch_leapfile() { ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list" ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile) + ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile) ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile) + ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile) $verbose ntp_src_leapfile version is $ntp_ver_no_src $verbose ntp_db_leapfile version is $ntp_ver_no_db - if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then + if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then $verbose replacing $ntp_db_leapfile with $ntp_src_leapfile cp -p $ntp_src_leapfile $ntp_db_leapfile ntp_ver_no_db=$ntp_ver_no_src else $verbose not replacing $ntp_db_leapfile with $ntp_src_leapfile fi - ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leapfile_expiry_seconds=$((ntp_leapfile_expiry_days*86400)) + ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile) ntp_leap_fetch_date=$((ntp_leap_expiry-ntp_leapfile_expiry_seconds)) if [ $(current_ntp_ts) -ge $ntp_leap_fetch_date ]; then $verbose Within ntp leapfile expiry limit, initiating fetch @@ -107,8 +125,11 @@ ntpd_fetch_leapfile() { $verbose fetching $url fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break done + ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile) ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile) - if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then + if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" -o \ + "$ntp_ver_no_tmp" -eq "$ntp_ver_no_db" -a \ + "$ntp_expiry_tmp" -gt "$ntp_expiry_db" ]; then $verbose using $url as $ntp_db_leapfile mv $ntp_tmp_leapfile $ntp_db_leapfile else From owner-svn-src-stable@freebsd.org Sat Aug 27 09:11:59 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D6F1B7782A; Sat, 27 Aug 2016 09:11:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49FE5DB0; Sat, 27 Aug 2016 09:11:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R9Bw8I066799; Sat, 27 Aug 2016 09:11:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R9Bwtf066795; Sat, 27 Aug 2016 09:11:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608270911.u7R9Bwtf066795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Aug 2016 09:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304882 - in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 09:11:59 -0000 Author: kib Date: Sat Aug 27 09:11:57 2016 New Revision: 304882 URL: https://svnweb.freebsd.org/changeset/base/304882 Log: MFC r303425: Add callout_when(9). MFC r303919: Fix indentation. Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/timeout.9 stable/11/sys/kern/kern_timeout.c stable/11/sys/sys/callout.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sat Aug 27 08:51:34 2016 (r304881) +++ stable/11/share/man/man9/Makefile Sat Aug 27 09:11:57 2016 (r304882) @@ -1766,6 +1766,7 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_schedule_sbt_curcpu.9 \ timeout.9 callout_schedule_sbt_on.9 \ timeout.9 callout_stop.9 \ + timeout.9 callout_when.9 \ timeout.9 untimeout.9 MLINKS+=ucred.9 cred_update_thread.9 \ ucred.9 crcopy.9 \ Modified: stable/11/share/man/man9/timeout.9 ============================================================================== --- stable/11/share/man/man9/timeout.9 Sat Aug 27 08:51:34 2016 (r304881) +++ stable/11/share/man/man9/timeout.9 Sat Aug 27 09:11:57 2016 (r304882) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2016 +.Dd July 27, 2016 .Dt TIMEOUT 9 .Os .Sh NAME @@ -56,6 +56,7 @@ .Nm callout_schedule_sbt_curcpu , .Nm callout_schedule_sbt_on , .Nm callout_stop , +.Nm callout_when , .Nm timeout , .Nm untimeout .Nd execute a function after a specified length of time @@ -91,20 +92,48 @@ struct callout_handle handle = CALLOUT_H .Ft int .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg" .Ft int -.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \ -"void *arg" -.Ft int -.Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \ -"void *arg" "int cpu" -.Ft int -.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" -.Ft int -.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" -.Ft int -.Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags" +.Fo callout_reset_curcpu +.Fa "struct callout *c" +.Fa "int ticks" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fc +.Ft int +.Fo callout_reset_on +.Fa "struct callout *c" +.Fa "int ticks" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int cpu" +.Fc +.Ft int +.Fo callout_reset_sbt +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_reset_sbt_curcpu +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_reset_sbt_on +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int cpu" +.Fa "int flags" +.Fc .Ft int .Fn callout_schedule "struct callout *c" "int ticks" .Ft int @@ -112,16 +141,37 @@ struct callout_handle handle = CALLOUT_H .Ft int .Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu" .Ft int -.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int flags" -.Ft int -.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int flags" -.Ft int -.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int cpu" "int flags" +.Fo callout_schedule_sbt +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_schedule_sbt_curcpu +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_schedule_sbt_on +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int cpu" +.Fa "int flags" +.Fc .Ft int .Fn callout_stop "struct callout *c" +.Ft sbintime_t +.Fo callout_when +.Fa "sbintime_t sbt" +.Fa "sbintime_t precision" +.Fa "int flags" +.Fa "sbintime_t *sbt_res" +.Fa "sbintime_t *precision_res" +.Fc .Ft struct callout_handle .Fn timeout "timeout_t *func" "void *arg" "int ticks" .Ft void @@ -387,6 +437,26 @@ or this value is used as the length of t Smaller values .Pq which result in larger time intervals allow the callout subsystem to aggregate more events in one timer interrupt. +.It Dv C_PRECALC +The +.Fa sbt +argument specifies the absolute time at which the callout should be run, +and the +.Fa pr +argument specifies the requested precision, which will not be +adjusted during the scheduling process. +The +.Fa sbt +and +.Fa pr +values should be calculated by an earlier call to +.Fn callout_when +which uses the user-supplied +.Fa sbt , +.Fa pr , +and +.Fa flags +values. .It Dv C_HARDCLOCK Align the timeouts to .Fn hardclock @@ -503,6 +573,39 @@ but it .Em does not clear it when a callout expires normally via the execution of the callout function. +.Pp +The +.Fn callout_when +function may be used to pre-calculate the absolute time at which the +timeout should be run and the precision of the scheduled run time +according to the required time +.Fa sbt , +precision +.Fa precision , +and additional adjustments requested by the +.Fa flags +argument. +Flags accepted by the +.Fn callout_when +function are the same as flags for the +.Fn callout_reset +function. +The resulting time is assigned to the variable pointed to by the +.Fa sbt_res +argument, and the resulting precision is assigned to +.Fa *precision_res . +When passing the results to +.Fa callout_reset , +add the +.Va C_PRECALC +flag to +.Fa flags , +to avoid incorrect re-adjustment. +The function is intended for situations where precise time of the callout +run should be known in advance, since +trying to read this time from the callout structure itself after a +.Fn callout_reset +call is racy. .Ss "Avoiding Race Conditions" The callout subsystem invokes callout functions from its own thread context. Modified: stable/11/sys/kern/kern_timeout.c ============================================================================== --- stable/11/sys/kern/kern_timeout.c Sat Aug 27 08:51:34 2016 (r304881) +++ stable/11/sys/kern/kern_timeout.c Sat Aug 27 09:11:57 2016 (r304882) @@ -945,6 +945,56 @@ callout_handle_init(struct callout_handl handle->callout = NULL; } +void +callout_when(sbintime_t sbt, sbintime_t precision, int flags, + sbintime_t *res, sbintime_t *prec_res) +{ + sbintime_t to_sbt, to_pr; + + if ((flags & (C_ABSOLUTE | C_PRECALC)) != 0) { + *res = sbt; + *prec_res = precision; + return; + } + if ((flags & C_HARDCLOCK) != 0 && sbt < tick_sbt) + sbt = tick_sbt; + if ((flags & C_HARDCLOCK) != 0 || +#ifdef NO_EVENTTIMERS + sbt >= sbt_timethreshold) { + to_sbt = getsbinuptime(); + + /* Add safety belt for the case of hz > 1000. */ + to_sbt += tc_tick_sbt - tick_sbt; +#else + sbt >= sbt_tickthreshold) { + /* + * Obtain the time of the last hardclock() call on + * this CPU directly from the kern_clocksource.c. + * This value is per-CPU, but it is equal for all + * active ones. + */ +#ifdef __LP64__ + to_sbt = DPCPU_GET(hardclocktime); +#else + spinlock_enter(); + to_sbt = DPCPU_GET(hardclocktime); + spinlock_exit(); +#endif +#endif + if ((flags & C_HARDCLOCK) == 0) + to_sbt += tick_sbt; + } else + to_sbt = sbinuptime(); + if (SBT_MAX - to_sbt < sbt) + to_sbt = SBT_MAX; + else + to_sbt += sbt; + *res = to_sbt; + to_pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp : + sbt >> C_PRELGET(flags)); + *prec_res = to_pr > precision ? to_pr : precision; +} + /* * New interface; clients allocate their own callout structures. * @@ -962,10 +1012,10 @@ callout_handle_init(struct callout_handl * callout_deactivate() - marks the callout as having been serviced */ int -callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t precision, +callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t prec, void (*ftn)(void *), void *arg, int cpu, int flags) { - sbintime_t to_sbt, pr; + sbintime_t to_sbt, precision; struct callout_cpu *cc; int cancelled, direct; int ignore_cpu=0; @@ -978,47 +1028,8 @@ callout_reset_sbt_on(struct callout *c, /* Invalid CPU spec */ panic("Invalid CPU in callout %d", cpu); } - if (flags & C_ABSOLUTE) { - to_sbt = sbt; - } else { - if ((flags & C_HARDCLOCK) && (sbt < tick_sbt)) - sbt = tick_sbt; - if ((flags & C_HARDCLOCK) || -#ifdef NO_EVENTTIMERS - sbt >= sbt_timethreshold) { - to_sbt = getsbinuptime(); + callout_when(sbt, prec, flags, &to_sbt, &precision); - /* Add safety belt for the case of hz > 1000. */ - to_sbt += tc_tick_sbt - tick_sbt; -#else - sbt >= sbt_tickthreshold) { - /* - * Obtain the time of the last hardclock() call on - * this CPU directly from the kern_clocksource.c. - * This value is per-CPU, but it is equal for all - * active ones. - */ -#ifdef __LP64__ - to_sbt = DPCPU_GET(hardclocktime); -#else - spinlock_enter(); - to_sbt = DPCPU_GET(hardclocktime); - spinlock_exit(); -#endif -#endif - if ((flags & C_HARDCLOCK) == 0) - to_sbt += tick_sbt; - } else - to_sbt = sbinuptime(); - if (SBT_MAX - to_sbt < sbt) - to_sbt = SBT_MAX; - else - to_sbt += sbt; - pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp : - sbt >> C_PRELGET(flags)); - if (pr > precision) - precision = pr; - } /* * This flag used to be added by callout_cc_add, but the * first time you call this we could end up with the Modified: stable/11/sys/sys/callout.h ============================================================================== --- stable/11/sys/sys/callout.h Sat Aug 27 08:51:34 2016 (r304881) +++ stable/11/sys/sys/callout.h Sat Aug 27 09:11:57 2016 (r304882) @@ -57,6 +57,7 @@ #define C_PRELGET(x) (int)((((x) >> 1) & C_PRELRANGE) - 1) #define C_HARDCLOCK 0x0100 /* align to hardclock() calls */ #define C_ABSOLUTE 0x0200 /* event time is absolute. */ +#define C_PRECALC 0x0400 /* event time is pre-calculated. */ struct callout_handle { struct callout *callout; @@ -129,6 +130,8 @@ int _callout_stop_safe(struct callout *, void callout_process(sbintime_t now); #define callout_async_drain(c, d) \ _callout_stop_safe(c, 0, d) +void callout_when(sbintime_t sbt, sbintime_t precision, int flags, + sbintime_t *sbt_res, sbintime_t *prec_res); #endif #endif /* _SYS_CALLOUT_H_ */ From owner-svn-src-stable@freebsd.org Sat Aug 27 09:23:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62334B77A0B; Sat, 27 Aug 2016 09:23:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EF1C648; Sat, 27 Aug 2016 09:23:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R9NLZK070714; Sat, 27 Aug 2016 09:23:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R9NKoT070707; Sat, 27 Aug 2016 09:23:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608270923.u7R9NKoT070707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Aug 2016 09:23:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304883 - in stable/11/sys: ddb kern sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 09:23:22 -0000 Author: kib Date: Sat Aug 27 09:23:20 2016 New Revision: 304883 URL: https://svnweb.freebsd.org/changeset/base/304883 Log: MFC r303426: Rewrite subr_sleepqueue.c use of callouts to not depend on the specifics of callout KPI. Modified: stable/11/sys/ddb/db_ps.c stable/11/sys/kern/kern_fork.c stable/11/sys/kern/kern_kthread.c stable/11/sys/kern/kern_thr.c stable/11/sys/kern/kern_thread.c stable/11/sys/kern/subr_sleepqueue.c stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ddb/db_ps.c ============================================================================== --- stable/11/sys/ddb/db_ps.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/ddb/db_ps.c Sat Aug 27 09:23:20 2016 (r304883) @@ -375,8 +375,13 @@ DB_SHOW_COMMAND(thread, db_show_thread) db_printf(" lock: %s turnstile: %p\n", td->td_lockname, td->td_blocked); if (TD_ON_SLEEPQ(td)) - db_printf(" wmesg: %s wchan: %p\n", td->td_wmesg, - td->td_wchan); + db_printf( + " wmesg: %s wchan: %p sleeptimo %lx. %jx (curr %lx. %jx)\n", + td->td_wmesg, td->td_wchan, + (long)sbttobt(td->td_sleeptimo).sec, + (uintmax_t)sbttobt(td->td_sleeptimo).frac, + (long)sbttobt(sbinuptime()).sec, + (uintmax_t)sbttobt(sbinuptime()).frac); db_printf(" priority: %d\n", td->td_priority); db_printf(" container lock: %s (%p)\n", lock->lo_name, lock); if (td->td_swvoltick != 0) { Modified: stable/11/sys/kern/kern_fork.c ============================================================================== --- stable/11/sys/kern/kern_fork.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/kern/kern_fork.c Sat Aug 27 09:23:20 2016 (r304883) @@ -472,6 +472,7 @@ do_fork(struct thread *td, struct fork_r bzero(&td2->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); + td2->td_sleeptimo = 0; bcopy(&td->td_startcopy, &td2->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); Modified: stable/11/sys/kern/kern_kthread.c ============================================================================== --- stable/11/sys/kern/kern_kthread.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/kern/kern_kthread.c Sat Aug 27 09:23:20 2016 (r304883) @@ -273,6 +273,7 @@ kthread_add(void (*func)(void *), void * bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); + newtd->td_sleeptimo = 0; bcopy(&oldtd->td_startcopy, &newtd->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); Modified: stable/11/sys/kern/kern_thr.c ============================================================================== --- stable/11/sys/kern/kern_thr.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/kern/kern_thr.c Sat Aug 27 09:23:20 2016 (r304883) @@ -232,6 +232,7 @@ thread_create(struct thread *td, struct bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); + newtd->td_sleeptimo = 0; bcopy(&td->td_startcopy, &newtd->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); newtd->td_proc = td->td_proc; Modified: stable/11/sys/kern/kern_thread.c ============================================================================== --- stable/11/sys/kern/kern_thread.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/kern/kern_thread.c Sat Aug 27 09:23:20 2016 (r304883) @@ -318,7 +318,7 @@ thread_reap(void) /* * Don't even bother to lock if none at this instant, - * we really don't care about the next instant.. + * we really don't care about the next instant. */ if (!TAILQ_EMPTY(&zombie_threads)) { mtx_lock_spin(&zombie_lock); @@ -383,6 +383,7 @@ thread_free(struct thread *td) if (td->td_kstack != 0) vm_thread_dispose(td); vm_domain_policy_cleanup(&td->td_vm_dom_policy); + callout_drain(&td->td_slpcallout); uma_zfree(thread_zone, td); } @@ -580,6 +581,7 @@ thread_wait(struct proc *p) td->td_cpuset = NULL; cpu_thread_clean(td); thread_cow_free(td); + callout_drain(&td->td_slpcallout); thread_reap(); /* check for zombie threads etc. */ } Modified: stable/11/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/11/sys/kern/subr_sleepqueue.c Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/kern/subr_sleepqueue.c Sat Aug 27 09:23:20 2016 (r304883) @@ -378,6 +378,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin { struct sleepqueue_chain *sc; struct thread *td; + sbintime_t pr1; td = curthread; sc = SC_LOOKUP(wchan); @@ -387,8 +388,14 @@ sleepq_set_timeout_sbt(void *wchan, sbin MPASS(wchan != NULL); if (cold) panic("timed sleep before timers are working"); - callout_reset_sbt_on(&td->td_slpcallout, sbt, pr, - sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC); + KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx", + td->td_tid, td, (uintmax_t)td->td_sleeptimo)); + thread_lock(td); + callout_when(sbt, pr, flags, &td->td_sleeptimo, &pr1); + thread_unlock(td); + callout_reset_sbt_on(&td->td_slpcallout, td->td_sleeptimo, pr1, + sleepq_timeout, td, PCPU_GET(cpuid), flags | C_PRECALC | + C_DIRECT_EXEC); } /* @@ -576,37 +583,36 @@ static int sleepq_check_timeout(void) { struct thread *td; + int res; td = curthread; THREAD_LOCK_ASSERT(td, MA_OWNED); /* - * If TDF_TIMEOUT is set, we timed out. + * If TDF_TIMEOUT is set, we timed out. But recheck + * td_sleeptimo anyway. */ - if (td->td_flags & TDF_TIMEOUT) { - td->td_flags &= ~TDF_TIMEOUT; - return (EWOULDBLOCK); + res = 0; + if (td->td_sleeptimo != 0) { + if (td->td_sleeptimo <= sbinuptime()) + res = EWOULDBLOCK; + td->td_sleeptimo = 0; } - - /* - * If TDF_TIMOFAIL is set, the timeout ran after we had - * already been woken up. - */ - if (td->td_flags & TDF_TIMOFAIL) - td->td_flags &= ~TDF_TIMOFAIL; - - /* - * If callout_stop() fails, then the timeout is running on - * another CPU, so synchronize with it to avoid having it - * accidentally wake up a subsequent sleep. - */ - else if (_callout_stop_safe(&td->td_slpcallout, CS_EXECUTING, NULL) - == 0) { - td->td_flags |= TDF_TIMEOUT; - TD_SET_SLEEPING(td); - mi_switch(SW_INVOL | SWT_SLEEPQTIMO, NULL); - } - return (0); + if (td->td_flags & TDF_TIMEOUT) + td->td_flags &= ~TDF_TIMEOUT; + else + /* + * We ignore the situation where timeout subsystem was + * unable to stop our callout. The struct thread is + * type-stable, the callout will use the correct + * memory when running. The checks of the + * td_sleeptimo value in this function and in + * sleepq_timeout() ensure that the thread does not + * get spurious wakeups, even if the callout was reset + * or thread reused. + */ + callout_stop(&td->td_slpcallout); + return (res); } /* @@ -914,12 +920,17 @@ sleepq_timeout(void *arg) CTR3(KTR_PROC, "sleepq_timeout: thread %p (pid %ld, %s)", (void *)td, (long)td->td_proc->p_pid, (void *)td->td_name); - /* - * First, see if the thread is asleep and get the wait channel if - * it is. - */ thread_lock(td); - if (TD_IS_SLEEPING(td) && TD_ON_SLEEPQ(td)) { + + if (td->td_sleeptimo > sbinuptime() || td->td_sleeptimo == 0) { + /* + * The thread does not want a timeout (yet). + */ + } else if (TD_IS_SLEEPING(td) && TD_ON_SLEEPQ(td)) { + /* + * See if the thread is asleep and get the wait + * channel if it is. + */ wchan = td->td_wchan; sc = SC_LOOKUP(wchan); THREAD_LOCKPTR_ASSERT(td, &sc->sc_lock); @@ -927,40 +938,16 @@ sleepq_timeout(void *arg) MPASS(sq != NULL); td->td_flags |= TDF_TIMEOUT; wakeup_swapper = sleepq_resume_thread(sq, td, 0); - thread_unlock(td); - if (wakeup_swapper) - kick_proc0(); - return; - } - - /* - * If the thread is on the SLEEPQ but isn't sleeping yet, it - * can either be on another CPU in between sleepq_add() and - * one of the sleepq_*wait*() routines or it can be in - * sleepq_catch_signals(). - */ - if (TD_ON_SLEEPQ(td)) { + } else if (TD_ON_SLEEPQ(td)) { + /* + * If the thread is on the SLEEPQ but isn't sleeping + * yet, it can either be on another CPU in between + * sleepq_add() and one of the sleepq_*wait*() + * routines or it can be in sleepq_catch_signals(). + */ td->td_flags |= TDF_TIMEOUT; - thread_unlock(td); - return; } - /* - * Now check for the edge cases. First, if TDF_TIMEOUT is set, - * then the other thread has already yielded to us, so clear - * the flag and resume it. If TDF_TIMEOUT is not set, then the - * we know that the other thread is not on a sleep queue, but it - * hasn't resumed execution yet. In that case, set TDF_TIMOFAIL - * to let it know that the timeout has already run and doesn't - * need to be canceled. - */ - if (td->td_flags & TDF_TIMEOUT) { - MPASS(TD_IS_SLEEPING(td)); - td->td_flags &= ~TDF_TIMEOUT; - TD_CLR_SLEEPING(td); - wakeup_swapper = setrunnable(td); - } else - td->td_flags |= TDF_TIMOFAIL; thread_unlock(td); if (wakeup_swapper) kick_proc0(); Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Sat Aug 27 09:11:57 2016 (r304882) +++ stable/11/sys/sys/proc.h Sat Aug 27 09:23:20 2016 (r304883) @@ -338,6 +338,7 @@ struct thread { void *td_emuldata; /* Emulator state data */ int td_lastcpu; /* (t) Last cpu we were on. */ int td_oncpu; /* (t) Which cpu we are on. */ + sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ }; struct thread0_storage { @@ -388,7 +389,7 @@ do { \ #define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */ #define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ #define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ -#define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */ +#define TDF_UNUSED12 0x00001000 /* --available-- */ #define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */ #define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ #define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */ From owner-svn-src-stable@freebsd.org Sat Aug 27 09:58:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCA6DA93202; Sat, 27 Aug 2016 09:58:07 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6E43C48; Sat, 27 Aug 2016 09:58:07 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7R9w6cW082400; Sat, 27 Aug 2016 09:58:06 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7R9w6VH082397; Sat, 27 Aug 2016 09:58:06 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608270958.u7R9w6VH082397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 27 Aug 2016 09:58: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: r304888 - stable/10/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 09:58:07 -0000 Author: ache Date: Sat Aug 27 09:58:06 2016 New Revision: 304888 URL: https://svnweb.freebsd.org/changeset/base/304888 Log: MFC r304810 Don't check for __SERR which may stick from one of any previous stdio functions. __SERR is for user and the rest of stdio code do not check it for error sensing internally, only set it. In vf(w)printf.c here it is more easy to save __SERR, clear and restore it. Modified: stable/10/lib/libc/stdio/getdelim.c stable/10/lib/libc/stdio/vfprintf.c stable/10/lib/libc/stdio/vfwprintf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/getdelim.c ============================================================================== --- stable/10/lib/libc/stdio/getdelim.c Sat Aug 27 09:51:57 2016 (r304887) +++ stable/10/lib/libc/stdio/getdelim.c Sat Aug 27 09:58:06 2016 (r304888) @@ -125,7 +125,7 @@ getdelim(char ** __restrict linep, size_ if (fp->_r <= 0 && __srefill(fp)) { /* If fp is at EOF already, we just need space for the NUL. */ - if (__sferror(fp) || expandtofit(linep, 1, linecapp)) + if (!__sfeof(fp) || expandtofit(linep, 1, linecapp)) goto error; FUNLOCKFILE(fp); (*linep)[0] = '\0'; @@ -137,7 +137,7 @@ getdelim(char ** __restrict linep, size_ if (sappend(linep, &linelen, linecapp, fp->_p, fp->_r)) goto error; if (__srefill(fp)) { - if (__sferror(fp)) + if (!__sfeof(fp)) goto error; goto done; /* hit EOF */ } Modified: stable/10/lib/libc/stdio/vfprintf.c ============================================================================== --- stable/10/lib/libc/stdio/vfprintf.c Sat Aug 27 09:51:57 2016 (r304887) +++ stable/10/lib/libc/stdio/vfprintf.c Sat Aug 27 09:58:06 2016 (r304888) @@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, co int nextarg; /* 1-based argument index */ va_list orgap; /* original argument pointer */ char *convbuf; /* wide to multibyte conversion result */ + int savserr; static const char xdigs_lower[16] = "0123456789abcdef"; static const char xdigs_upper[16] = "0123456789ABCDEF"; @@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, co return (EOF); } + savserr = fp->_flags & __SERR; + fp->_flags &= ~__SERR; + convbuf = NULL; fmt = (char *)fmt0; argtable = NULL; @@ -1031,6 +1035,8 @@ error: free(convbuf); if (__sferror(fp)) ret = EOF; + else + fp->_flags |= savserr; if ((argtable != NULL) && (argtable != statargtable)) free (argtable); return (ret); Modified: stable/10/lib/libc/stdio/vfwprintf.c ============================================================================== --- stable/10/lib/libc/stdio/vfwprintf.c Sat Aug 27 09:51:57 2016 (r304887) +++ stable/10/lib/libc/stdio/vfwprintf.c Sat Aug 27 09:58:06 2016 (r304888) @@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, c int nextarg; /* 1-based argument index */ va_list orgap; /* original argument pointer */ wchar_t *convbuf; /* multibyte to wide conversion result */ + int savserr; static const char xdigs_lower[16] = "0123456789abcdef"; static const char xdigs_upper[16] = "0123456789ABCDEF"; @@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, c return (EOF); } + savserr = fp->_flags & __SERR; + fp->_flags &= ~__SERR; + convbuf = NULL; fmt = (wchar_t *)fmt0; argtable = NULL; @@ -1096,6 +1100,8 @@ error: free(convbuf); if (__sferror(fp)) ret = EOF; + else + fp->_flags |= savserr; if ((argtable != NULL) && (argtable != statargtable)) free (argtable); return (ret); From owner-svn-src-stable@freebsd.org Sat Aug 27 10:00:37 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E784CA933C7; Sat, 27 Aug 2016 10:00:37 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4ADEFAD; Sat, 27 Aug 2016 10:00:37 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RA0bv6082930; Sat, 27 Aug 2016 10:00:37 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RA0aYM082927; Sat, 27 Aug 2016 10:00:36 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608271000.u7RA0aYM082927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 27 Aug 2016 10:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304890 - stable/11/lib/libc/stdio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 10:00:38 -0000 Author: ache Date: Sat Aug 27 10:00:36 2016 New Revision: 304890 URL: https://svnweb.freebsd.org/changeset/base/304890 Log: MFC r304810 Don't check for __SERR which may stick from one of any previous stdio functions. __SERR is for user and the rest of stdio code do not check it for error sensing internally, only set it. In vf(w)printf.c here it is more easy to save __SERR, clear and restore it. Modified: stable/11/lib/libc/stdio/getdelim.c stable/11/lib/libc/stdio/vfprintf.c stable/11/lib/libc/stdio/vfwprintf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdio/getdelim.c ============================================================================== --- stable/11/lib/libc/stdio/getdelim.c Sat Aug 27 10:00:33 2016 (r304889) +++ stable/11/lib/libc/stdio/getdelim.c Sat Aug 27 10:00:36 2016 (r304890) @@ -125,7 +125,7 @@ getdelim(char ** __restrict linep, size_ if (fp->_r <= 0 && __srefill(fp)) { /* If fp is at EOF already, we just need space for the NUL. */ - if (__sferror(fp) || expandtofit(linep, 1, linecapp)) + if (!__sfeof(fp) || expandtofit(linep, 1, linecapp)) goto error; FUNLOCKFILE(fp); (*linep)[0] = '\0'; @@ -137,7 +137,7 @@ getdelim(char ** __restrict linep, size_ if (sappend(linep, &linelen, linecapp, fp->_p, fp->_r)) goto error; if (__srefill(fp)) { - if (__sferror(fp)) + if (!__sfeof(fp)) goto error; goto done; /* hit EOF */ } Modified: stable/11/lib/libc/stdio/vfprintf.c ============================================================================== --- stable/11/lib/libc/stdio/vfprintf.c Sat Aug 27 10:00:33 2016 (r304889) +++ stable/11/lib/libc/stdio/vfprintf.c Sat Aug 27 10:00:36 2016 (r304890) @@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, co int nextarg; /* 1-based argument index */ va_list orgap; /* original argument pointer */ char *convbuf; /* wide to multibyte conversion result */ + int savserr; static const char xdigs_lower[16] = "0123456789abcdef"; static const char xdigs_upper[16] = "0123456789ABCDEF"; @@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, co return (EOF); } + savserr = fp->_flags & __SERR; + fp->_flags &= ~__SERR; + convbuf = NULL; fmt = (char *)fmt0; argtable = NULL; @@ -1031,6 +1035,8 @@ error: free(convbuf); if (__sferror(fp)) ret = EOF; + else + fp->_flags |= savserr; if ((argtable != NULL) && (argtable != statargtable)) free (argtable); return (ret); Modified: stable/11/lib/libc/stdio/vfwprintf.c ============================================================================== --- stable/11/lib/libc/stdio/vfwprintf.c Sat Aug 27 10:00:33 2016 (r304889) +++ stable/11/lib/libc/stdio/vfwprintf.c Sat Aug 27 10:00:36 2016 (r304890) @@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, c int nextarg; /* 1-based argument index */ va_list orgap; /* original argument pointer */ wchar_t *convbuf; /* multibyte to wide conversion result */ + int savserr; static const char xdigs_lower[16] = "0123456789abcdef"; static const char xdigs_upper[16] = "0123456789ABCDEF"; @@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, c return (EOF); } + savserr = fp->_flags & __SERR; + fp->_flags &= ~__SERR; + convbuf = NULL; fmt = (wchar_t *)fmt0; argtable = NULL; @@ -1096,6 +1100,8 @@ error: free(convbuf); if (__sferror(fp)) ret = EOF; + else + fp->_flags |= savserr; if ((argtable != NULL) && (argtable != statargtable)) free (argtable); return (ret); From owner-svn-src-stable@freebsd.org Sat Aug 27 10:34:03 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FBA0A93B68; Sat, 27 Aug 2016 10:34:03 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 085AA1E0; Sat, 27 Aug 2016 10:34:02 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RAY2tB097435; Sat, 27 Aug 2016 10:34:02 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RAY1X1097431; Sat, 27 Aug 2016 10:34:01 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608271034.u7RAY1X1097431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 27 Aug 2016 10:34: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: r304893 - stable/10/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 10:34:03 -0000 Author: ache Date: Sat Aug 27 10:34:01 2016 New Revision: 304893 URL: https://svnweb.freebsd.org/changeset/base/304893 Log: MFC r304607,r304641,r304819,r304811 1) Don't forget to set __SERR on __slbexpand() error. 2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect encoding errors and ignores them all. One of affected encoding example: US-ASCII 3) Original fgetln() from 44lite return success for line tail errors, i.e. partial line, but set __SERR and errno in the same time, which is inconsistent. Now both OpenBSD and NetBSD return failure, i.e. no line and set error indicators for such case, so make our fgetln() and fgetwln() (as its wide version) compatible with the rest of *BSD. PR: 212033 Modified: stable/10/lib/libc/stdio/fgetln.c stable/10/lib/libc/stdio/fgetwc.c stable/10/lib/libc/stdio/fgetwln.c stable/10/lib/libc/stdio/fputwc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fgetln.c ============================================================================== --- stable/10/lib/libc/stdio/fgetln.c Sat Aug 27 10:30:20 2016 (r304892) +++ stable/10/lib/libc/stdio/fgetln.c Sat Aug 27 10:34:01 2016 (r304893) @@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp) (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p, len - off); off = len; - if (__srefill(fp)) - break; /* EOF or error: return partial line */ + if (__srefill(fp)) { + if (__sfeof(fp)) + break; + goto error; + } if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL) continue; Modified: stable/10/lib/libc/stdio/fgetwc.c ============================================================================== --- stable/10/lib/libc/stdio/fgetwc.c Sat Aug 27 10:30:20 2016 (r304892) +++ stable/10/lib/libc/stdio/fgetwc.c Sat Aug 27 10:34:01 2016 (r304893) @@ -79,18 +79,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i size_t nconv; struct xlocale_ctype *l = XLOCALE_CTYPE(locale); - if (fp->_r <= 0 && __srefill(fp)) { - *nread = 0; - return (WEOF); - } - if (MB_CUR_MAX == 1) { - /* Fast path for single-byte encodings. */ - wc = *fp->_p++; - fp->_r--; - *nread = 1; - return (wc); - } *nread = 0; + if (fp->_r <= 0 && __srefill(fp)) + return (WEOF); do { nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); if (nconv == (size_t)-1) Modified: stable/10/lib/libc/stdio/fgetwln.c ============================================================================== --- stable/10/lib/libc/stdio/fgetwln.c Sat Aug 27 10:30:20 2016 (r304892) +++ stable/10/lib/libc/stdio/fgetwln.c Sat Aug 27 10:34:01 2016 (r304893) @@ -56,13 +56,15 @@ fgetwln_l(FILE * __restrict fp, size_t * while ((wc = __fgetwc(fp, locale)) != WEOF) { #define GROW 512 if (len * sizeof(wchar_t) >= fp->_lb._size && - __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) + __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) { + fp->_flags |= __SERR; goto error; + } *((wchar_t *)fp->_lb._base + len++) = wc; if (wc == L'\n') break; } - if (len == 0) + if (len == 0 || (wc == WEOF && !__sfeof(fp))) goto error; FUNLOCKFILE(fp); @@ -74,6 +76,7 @@ error: *lenp = 0; return (NULL); } + wchar_t * fgetwln(FILE * __restrict fp, size_t *lenp) { Modified: stable/10/lib/libc/stdio/fputwc.c ============================================================================== --- stable/10/lib/libc/stdio/fputwc.c Sat Aug 27 10:30:20 2016 (r304892) +++ stable/10/lib/libc/stdio/fputwc.c Sat Aug 27 10:34:01 2016 (r304893) @@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t size_t i, len; struct xlocale_ctype *l = XLOCALE_CTYPE(locale); - if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) { - /* - * Assume single-byte locale with no special encoding. - * A more careful test would be to check - * _CurrentRuneLocale->encoding. - */ - *buf = (unsigned char)wc; - len = 1; - } else { - if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) { - fp->_flags |= __SERR; - return (WEOF); - } + if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) { + fp->_flags |= __SERR; + return (WEOF); } for (i = 0; i < len; i++) From owner-svn-src-stable@freebsd.org Sat Aug 27 10:56:05 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0BCBB764B0; Sat, 27 Aug 2016 10:56:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91868FA8; Sat, 27 Aug 2016 10:56:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RAu42Z004988; Sat, 27 Aug 2016 10:56:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RAu4AS004982; Sat, 27 Aug 2016 10:56:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608271056.u7RAu4AS004982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Aug 2016 10:56: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: r304894 - in stable/10/sys: kern 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 10:56:05 -0000 Author: kib Date: Sat Aug 27 10:56:04 2016 New Revision: 304894 URL: https://svnweb.freebsd.org/changeset/base/304894 Log: MFC r264388 (by davide): Define SBT_MAX. MFC r267896 (by davide): Improve r264388. MFC note. The SBT_MAX definition already existed on stable/10, but without the refinement from r267896. Also, consumers of SBT_MAX were not converted, since r264388 was not merged properly. Reviewed by: mav Modified: stable/10/sys/kern/kern_clocksource.c stable/10/sys/kern/kern_event.c stable/10/sys/kern/kern_timeout.c stable/10/sys/kern/sys_generic.c stable/10/sys/sys/time.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_clocksource.c ============================================================================== --- stable/10/sys/kern/kern_clocksource.c Sat Aug 27 10:34:01 2016 (r304893) +++ stable/10/sys/kern/kern_clocksource.c Sat Aug 27 10:56:04 2016 (r304894) @@ -211,7 +211,7 @@ handleevents(sbintime_t now, int fake) } else state->nextprof = state->nextstat; if (now >= state->nextcallopt) { - state->nextcall = state->nextcallopt = INT64_MAX; + state->nextcall = state->nextcallopt = SBT_MAX; callout_process(now); } @@ -492,7 +492,7 @@ configtimer(int start) state = DPCPU_ID_PTR(cpu, timerstate); state->now = now; if (!smp_started && cpu != CPU_FIRST()) - state->nextevent = INT64_MAX; + state->nextevent = SBT_MAX; else state->nextevent = next; if (periodic) @@ -580,8 +580,8 @@ cpu_initclocks_bsp(void) CPU_FOREACH(cpu) { state = DPCPU_ID_PTR(cpu, timerstate); mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN); - state->nextcall = INT64_MAX; - state->nextcallopt = INT64_MAX; + state->nextcall = SBT_MAX; + state->nextcallopt = SBT_MAX; } periodic = want_periodic; /* Grab requested timer or the best of present. */ Modified: stable/10/sys/kern/kern_event.c ============================================================================== --- stable/10/sys/kern/kern_event.c Sat Aug 27 10:34:01 2016 (r304893) +++ stable/10/sys/kern/kern_event.c Sat Aug 27 10:56:04 2016 (r304894) @@ -1471,7 +1471,7 @@ kqueue_scan(struct kqueue *kq, int maxev rsbt = tstosbt(*tsp); if (TIMESEL(&asbt, rsbt)) asbt += tc_tick_sbt; - if (asbt <= INT64_MAX - rsbt) + if (asbt <= SBT_MAX - rsbt) asbt += rsbt; else asbt = 0; Modified: stable/10/sys/kern/kern_timeout.c ============================================================================== --- stable/10/sys/kern/kern_timeout.c Sat Aug 27 10:34:01 2016 (r304893) +++ stable/10/sys/kern/kern_timeout.c Sat Aug 27 10:56:04 2016 (r304894) @@ -296,7 +296,7 @@ callout_cpu_init(struct callout_cpu *cc, for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); TAILQ_INIT(&cc->cc_expireq); - cc->cc_firstevent = INT64_MAX; + cc->cc_firstevent = SBT_MAX; for (i = 0; i < 2; i++) cc_cce_cleanup(cc, i); snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name), @@ -569,8 +569,8 @@ callout_cc_add(struct callout *c, struct * Inform the eventtimers(4) subsystem there's a new callout * that has been inserted, but only if really required. */ - if (INT64_MAX - c->c_time < c->c_precision) - c->c_precision = INT64_MAX - c->c_time; + if (SBT_MAX - c->c_time < c->c_precision) + c->c_precision = SBT_MAX - c->c_time; sbt = c->c_time + c->c_precision; if (sbt < cc->cc_firstevent) { cc->cc_firstevent = sbt; @@ -961,8 +961,8 @@ callout_reset_sbt_on(struct callout *c, to_sbt += tick_sbt; } else to_sbt = sbinuptime(); - if (INT64_MAX - to_sbt < sbt) - to_sbt = INT64_MAX; + if (SBT_MAX - to_sbt < sbt) + to_sbt = SBT_MAX; else to_sbt += sbt; pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp : Modified: stable/10/sys/kern/sys_generic.c ============================================================================== --- stable/10/sys/kern/sys_generic.c Sat Aug 27 10:34:01 2016 (r304893) +++ stable/10/sys/kern/sys_generic.c Sat Aug 27 10:56:04 2016 (r304894) @@ -1089,7 +1089,7 @@ kern_select(struct thread *td, int nd, f precision >>= tc_precexp; if (TIMESEL(&asbt, rsbt)) asbt += tc_tick_sbt; - if (asbt <= INT64_MAX - rsbt) + if (asbt <= SBT_MAX - rsbt) asbt += rsbt; else asbt = -1; @@ -1626,7 +1626,7 @@ selsocket(struct socket *so, int events, precision >>= tc_precexp; if (TIMESEL(&asbt, rsbt)) asbt += tc_tick_sbt; - if (asbt <= INT64_MAX - rsbt) + if (asbt <= SBT_MAX - rsbt) asbt += rsbt; else asbt = -1; Modified: stable/10/sys/sys/time.h ============================================================================== --- stable/10/sys/sys/time.h Sat Aug 27 10:34:01 2016 (r304893) +++ stable/10/sys/sys/time.h Sat Aug 27 10:56:04 2016 (r304894) @@ -129,7 +129,7 @@ bintime_shift(struct bintime *_bt, int _ #define SBT_1MS (SBT_1S / 1000) #define SBT_1US (SBT_1S / 1000000) #define SBT_1NS (SBT_1S / 1000000000) -#define SBT_MAX 0x7fffffffffffffff +#define SBT_MAX 0x7fffffffffffffffLL static __inline int sbintime_getsec(sbintime_t _sbt) From owner-svn-src-stable@freebsd.org Sat Aug 27 11:07:58 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84C19B76A42; Sat, 27 Aug 2016 11:07:58 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BE18BA2; Sat, 27 Aug 2016 11:07:58 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RB7vw6009246; Sat, 27 Aug 2016 11:07:57 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RB7vYo009241; Sat, 27 Aug 2016 11:07:57 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608271107.u7RB7vYo009241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 27 Aug 2016 11:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304896 - stable/11/lib/libc/stdio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 11:07:58 -0000 Author: ache Date: Sat Aug 27 11:07:57 2016 New Revision: 304896 URL: https://svnweb.freebsd.org/changeset/base/304896 Log: MFC r304607,r304641,r304819,r304811 1) Don't forget to set __SERR on __slbexpand() error. 2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect encoding errors and ignores them all. One of affected encoding example: US-ASCII 3) Original fgetln() from 44lite return success for line tail errors, i.e. partial line, but set __SERR and errno in the same time, which is inconsistent. Now both OpenBSD and NetBSD return failure, i.e. no line and set error indicators for such case, so make our fgetln() and fgetwln() (as its wide version) compatible with the rest of *BSD. PR: 212033 Modified: stable/11/lib/libc/stdio/fgetln.c stable/11/lib/libc/stdio/fgetwc.c stable/11/lib/libc/stdio/fgetwln.c stable/11/lib/libc/stdio/fputwc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdio/fgetln.c ============================================================================== --- stable/11/lib/libc/stdio/fgetln.c Sat Aug 27 11:06:06 2016 (r304895) +++ stable/11/lib/libc/stdio/fgetln.c Sat Aug 27 11:07:57 2016 (r304896) @@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp) (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p, len - off); off = len; - if (__srefill(fp)) - break; /* EOF or error: return partial line */ + if (__srefill(fp)) { + if (__sfeof(fp)) + break; + goto error; + } if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL) continue; Modified: stable/11/lib/libc/stdio/fgetwc.c ============================================================================== --- stable/11/lib/libc/stdio/fgetwc.c Sat Aug 27 11:06:06 2016 (r304895) +++ stable/11/lib/libc/stdio/fgetwc.c Sat Aug 27 11:07:57 2016 (r304896) @@ -79,18 +79,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i size_t nconv; struct xlocale_ctype *l = XLOCALE_CTYPE(locale); - if (fp->_r <= 0 && __srefill(fp)) { - *nread = 0; - return (WEOF); - } - if (MB_CUR_MAX == 1) { - /* Fast path for single-byte encodings. */ - wc = *fp->_p++; - fp->_r--; - *nread = 1; - return (wc); - } *nread = 0; + if (fp->_r <= 0 && __srefill(fp)) + return (WEOF); do { nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); if (nconv == (size_t)-1) Modified: stable/11/lib/libc/stdio/fgetwln.c ============================================================================== --- stable/11/lib/libc/stdio/fgetwln.c Sat Aug 27 11:06:06 2016 (r304895) +++ stable/11/lib/libc/stdio/fgetwln.c Sat Aug 27 11:07:57 2016 (r304896) @@ -56,13 +56,15 @@ fgetwln_l(FILE * __restrict fp, size_t * while ((wc = __fgetwc(fp, locale)) != WEOF) { #define GROW 512 if (len * sizeof(wchar_t) >= fp->_lb._size && - __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) + __slbexpand(fp, (len + GROW) * sizeof(wchar_t))) { + fp->_flags |= __SERR; goto error; + } *((wchar_t *)fp->_lb._base + len++) = wc; if (wc == L'\n') break; } - if (len == 0) + if (len == 0 || (wc == WEOF && !__sfeof(fp))) goto error; FUNLOCKFILE(fp); @@ -74,6 +76,7 @@ error: *lenp = 0; return (NULL); } + wchar_t * fgetwln(FILE * __restrict fp, size_t *lenp) { Modified: stable/11/lib/libc/stdio/fputwc.c ============================================================================== --- stable/11/lib/libc/stdio/fputwc.c Sat Aug 27 11:06:06 2016 (r304895) +++ stable/11/lib/libc/stdio/fputwc.c Sat Aug 27 11:07:57 2016 (r304896) @@ -53,19 +53,9 @@ __fputwc(wchar_t wc, FILE *fp, locale_t size_t i, len; struct xlocale_ctype *l = XLOCALE_CTYPE(locale); - if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) { - /* - * Assume single-byte locale with no special encoding. - * A more careful test would be to check - * _CurrentRuneLocale->encoding. - */ - *buf = (unsigned char)wc; - len = 1; - } else { - if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) { - fp->_flags |= __SERR; - return (WEOF); - } + if ((len = l->__wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) { + fp->_flags |= __SERR; + return (WEOF); } for (i = 0; i < len; i++) From owner-svn-src-stable@freebsd.org Sat Aug 27 11:38:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B9EBB772C9; Sat, 27 Aug 2016 11:38:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CDD8E1B; Sat, 27 Aug 2016 11:38:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RBccBD020446; Sat, 27 Aug 2016 11:38:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RBcbrf020442; Sat, 27 Aug 2016 11:38:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608271138.u7RBcbrf020442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Aug 2016 11:38: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: r304900 - in stable/10: share/man/man9 sys/kern sys/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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 11:38:39 -0000 Author: kib Date: Sat Aug 27 11:38:37 2016 New Revision: 304900 URL: https://svnweb.freebsd.org/changeset/base/304900 Log: MFC r303425: Add callout_when(9). MFC r303919: Fix indentation. Modified: stable/10/share/man/man9/Makefile stable/10/share/man/man9/timeout.9 stable/10/sys/kern/kern_timeout.c stable/10/sys/sys/callout.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/Makefile ============================================================================== --- stable/10/share/man/man9/Makefile Sat Aug 27 11:38:21 2016 (r304899) +++ stable/10/share/man/man9/Makefile Sat Aug 27 11:38:37 2016 (r304900) @@ -1401,6 +1401,7 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_schedule_sbt_curcpu.9 \ timeout.9 callout_schedule_sbt_on.9 \ timeout.9 callout_stop.9 \ + timeout.9 callout_when.9 \ timeout.9 untimeout.9 MLINKS+=ucred.9 crcopy.9 \ ucred.9 crdup.9 \ Modified: stable/10/share/man/man9/timeout.9 ============================================================================== --- stable/10/share/man/man9/timeout.9 Sat Aug 27 11:38:21 2016 (r304899) +++ stable/10/share/man/man9/timeout.9 Sat Aug 27 11:38:37 2016 (r304900) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 8, 2014 +.Dd July 27, 2016 .Dt TIMEOUT 9 .Os .Sh NAME @@ -55,6 +55,7 @@ .Nm callout_schedule_sbt_curcpu , .Nm callout_schedule_sbt_on , .Nm callout_stop , +.Nm callout_when , .Nm timeout , .Nm untimeout .Nd execute a function after a specified length of time @@ -88,20 +89,48 @@ struct callout_handle handle = CALLOUT_H .Ft int .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg" .Ft int -.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \ -"void *arg" -.Ft int -.Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \ -"void *arg" "int cpu" -.Ft int -.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" -.Ft int -.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" -.Ft int -.Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags" +.Fo callout_reset_curcpu +.Fa "struct callout *c" +.Fa "int ticks" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fc +.Ft int +.Fo callout_reset_on +.Fa "struct callout *c" +.Fa "int ticks" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int cpu" +.Fc +.Ft int +.Fo callout_reset_sbt +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_reset_sbt_curcpu +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_reset_sbt_on +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "timeout_t *func" +.Fa "void *arg" +.Fa "int cpu" +.Fa "int flags" +.Fc .Ft int .Fn callout_schedule "struct callout *c" "int ticks" .Ft int @@ -109,16 +138,37 @@ struct callout_handle handle = CALLOUT_H .Ft int .Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu" .Ft int -.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int flags" -.Ft int -.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int flags" -.Ft int -.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \ -"sbintime_t pr" "int cpu" "int flags" +.Fo callout_schedule_sbt +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_schedule_sbt_curcpu +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int flags" +.Fc +.Ft int +.Fo callout_schedule_sbt_on +.Fa "struct callout *c" +.Fa "sbintime_t sbt" +.Fa "sbintime_t pr" +.Fa "int cpu" +.Fa "int flags" +.Fc .Ft int .Fn callout_stop "struct callout *c" +.Ft sbintime_t +.Fo callout_when +.Fa "sbintime_t sbt" +.Fa "sbintime_t precision" +.Fa "int flags" +.Fa "sbintime_t *sbt_res" +.Fa "sbintime_t *precision_res" +.Fc .Ft struct callout_handle .Fn timeout "timeout_t *func" "void *arg" "int ticks" .Ft void @@ -354,6 +404,26 @@ or this value is used as the length of t Smaller values .Pq which result in larger time intervals allow the callout subsystem to aggregate more events in one timer interrupt. +.It Dv C_PRECALC +The +.Fa sbt +argument specifies the absolute time at which the callout should be run, +and the +.Fa pr +argument specifies the requested precision, which will not be +adjusted during the scheduling process. +The +.Fa sbt +and +.Fa pr +values should be calculated by an earlier call to +.Fn callout_when +which uses the user-supplied +.Fa sbt , +.Fa pr , +and +.Fa flags +values. .It Dv C_HARDCLOCK Align the timeouts to .Fn hardclock @@ -470,6 +540,39 @@ but it .Em does not clear it when a callout expires normally via the execution of the callout function. +.Pp +The +.Fn callout_when +function may be used to pre-calculate the absolute time at which the +timeout should be run and the precision of the scheduled run time +according to the required time +.Fa sbt , +precision +.Fa precision , +and additional adjustments requested by the +.Fa flags +argument. +Flags accepted by the +.Fn callout_when +function are the same as flags for the +.Fn callout_reset +function. +The resulting time is assigned to the variable pointed to by the +.Fa sbt_res +argument, and the resulting precision is assigned to +.Fa *precision_res . +When passing the results to +.Fa callout_reset , +add the +.Va C_PRECALC +flag to +.Fa flags , +to avoid incorrect re-adjustment. +The function is intended for situations where precise time of the callout +run should be known in advance, since +trying to read this time from the callout structure itself after a +.Fn callout_reset +call is racy. .Ss "Avoiding Race Conditions" The callout subsystem invokes callout functions from its own thread context. Modified: stable/10/sys/kern/kern_timeout.c ============================================================================== --- stable/10/sys/kern/kern_timeout.c Sat Aug 27 11:38:21 2016 (r304899) +++ stable/10/sys/kern/kern_timeout.c Sat Aug 27 11:38:37 2016 (r304900) @@ -896,6 +896,56 @@ callout_handle_init(struct callout_handl handle->callout = NULL; } +void +callout_when(sbintime_t sbt, sbintime_t precision, int flags, + sbintime_t *res, sbintime_t *prec_res) +{ + sbintime_t to_sbt, to_pr; + + if ((flags & (C_ABSOLUTE | C_PRECALC)) != 0) { + *res = sbt; + *prec_res = precision; + return; + } + if ((flags & C_HARDCLOCK) != 0 && sbt < tick_sbt) + sbt = tick_sbt; + if ((flags & C_HARDCLOCK) != 0 || +#ifdef NO_EVENTTIMERS + sbt >= sbt_timethreshold) { + to_sbt = getsbinuptime(); + + /* Add safety belt for the case of hz > 1000. */ + to_sbt += tc_tick_sbt - tick_sbt; +#else + sbt >= sbt_tickthreshold) { + /* + * Obtain the time of the last hardclock() call on + * this CPU directly from the kern_clocksource.c. + * This value is per-CPU, but it is equal for all + * active ones. + */ +#ifdef __LP64__ + to_sbt = DPCPU_GET(hardclocktime); +#else + spinlock_enter(); + to_sbt = DPCPU_GET(hardclocktime); + spinlock_exit(); +#endif +#endif + if ((flags & C_HARDCLOCK) == 0) + to_sbt += tick_sbt; + } else + to_sbt = sbinuptime(); + if (SBT_MAX - to_sbt < sbt) + to_sbt = SBT_MAX; + else + to_sbt += sbt; + *res = to_sbt; + to_pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp : + sbt >> C_PRELGET(flags)); + *prec_res = to_pr > precision ? to_pr : precision; +} + /* * New interface; clients allocate their own callout structures. * @@ -913,10 +963,10 @@ callout_handle_init(struct callout_handl * callout_deactivate() - marks the callout as having been serviced */ int -callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t precision, +callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t prec, void (*ftn)(void *), void *arg, int cpu, int flags) { - sbintime_t to_sbt, pr; + sbintime_t to_sbt, precision; struct callout_cpu *cc; int cancelled, direct; int ignore_cpu=0; @@ -929,47 +979,8 @@ callout_reset_sbt_on(struct callout *c, /* Invalid CPU spec */ panic("Invalid CPU in callout %d", cpu); } - if (flags & C_ABSOLUTE) { - to_sbt = sbt; - } else { - if ((flags & C_HARDCLOCK) && (sbt < tick_sbt)) - sbt = tick_sbt; - if ((flags & C_HARDCLOCK) || -#ifdef NO_EVENTTIMERS - sbt >= sbt_timethreshold) { - to_sbt = getsbinuptime(); + callout_when(sbt, prec, flags, &to_sbt, &precision); - /* Add safety belt for the case of hz > 1000. */ - to_sbt += tc_tick_sbt - tick_sbt; -#else - sbt >= sbt_tickthreshold) { - /* - * Obtain the time of the last hardclock() call on - * this CPU directly from the kern_clocksource.c. - * This value is per-CPU, but it is equal for all - * active ones. - */ -#ifdef __LP64__ - to_sbt = DPCPU_GET(hardclocktime); -#else - spinlock_enter(); - to_sbt = DPCPU_GET(hardclocktime); - spinlock_exit(); -#endif -#endif - if ((flags & C_HARDCLOCK) == 0) - to_sbt += tick_sbt; - } else - to_sbt = sbinuptime(); - if (SBT_MAX - to_sbt < sbt) - to_sbt = SBT_MAX; - else - to_sbt += sbt; - pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp : - sbt >> C_PRELGET(flags)); - if (pr > precision) - precision = pr; - } /* * This flag used to be added by callout_cc_add, but the * first time you call this we could end up with the Modified: stable/10/sys/sys/callout.h ============================================================================== --- stable/10/sys/sys/callout.h Sat Aug 27 11:38:21 2016 (r304899) +++ stable/10/sys/sys/callout.h Sat Aug 27 11:38:37 2016 (r304900) @@ -57,6 +57,7 @@ #define C_PRELGET(x) (int)((((x) >> 1) & C_PRELRANGE) - 1) #define C_HARDCLOCK 0x0100 /* align to hardclock() calls */ #define C_ABSOLUTE 0x0200 /* event time is absolute. */ +#define C_PRECALC 0x0400 /* event time is pre-calculated. */ struct callout_handle { struct callout *callout; @@ -129,6 +130,8 @@ int callout_schedule_on(struct callout * int _callout_stop_safe(struct callout *, int); void callout_process(sbintime_t now); +void callout_when(sbintime_t sbt, sbintime_t precision, int flags, + sbintime_t *sbt_res, sbintime_t *prec_res); #endif #endif /* _SYS_CALLOUT_H_ */ From owner-svn-src-stable@freebsd.org Sat Aug 27 11:45:06 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3ACAB77647; Sat, 27 Aug 2016 11:45:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5192B72; Sat, 27 Aug 2016 11:45:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RBj5TF024441; Sat, 27 Aug 2016 11:45:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RBj5oT024434; Sat, 27 Aug 2016 11:45:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608271145.u7RBj5oT024434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Aug 2016 11:45: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: r304905 - in stable/10/sys: ddb kern 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-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 11:45:07 -0000 Author: kib Date: Sat Aug 27 11:45:05 2016 New Revision: 304905 URL: https://svnweb.freebsd.org/changeset/base/304905 Log: MFC r303426: Rewrite subr_sleepqueue.c use of callouts to not depend on the specifics of callout KPI. Modified: stable/10/sys/ddb/db_ps.c stable/10/sys/kern/kern_fork.c stable/10/sys/kern/kern_kthread.c stable/10/sys/kern/kern_thr.c stable/10/sys/kern/kern_thread.c stable/10/sys/kern/subr_sleepqueue.c stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ddb/db_ps.c ============================================================================== --- stable/10/sys/ddb/db_ps.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/ddb/db_ps.c Sat Aug 27 11:45:05 2016 (r304905) @@ -371,8 +371,13 @@ DB_SHOW_COMMAND(thread, db_show_thread) db_printf(" lock: %s turnstile: %p\n", td->td_lockname, td->td_blocked); if (TD_ON_SLEEPQ(td)) - db_printf(" wmesg: %s wchan: %p\n", td->td_wmesg, - td->td_wchan); + db_printf( + " wmesg: %s wchan: %p sleeptimo %lx. %jx (curr %lx. %jx)\n", + td->td_wmesg, td->td_wchan, + (long)sbttobt(td->td_sleeptimo).sec, + (uintmax_t)sbttobt(td->td_sleeptimo).frac, + (long)sbttobt(sbinuptime()).sec, + (uintmax_t)sbttobt(sbinuptime()).frac); db_printf(" priority: %d\n", td->td_priority); db_printf(" container lock: %s (%p)\n", lock->lo_name, lock); } Modified: stable/10/sys/kern/kern_fork.c ============================================================================== --- stable/10/sys/kern/kern_fork.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/kern/kern_fork.c Sat Aug 27 11:45:05 2016 (r304905) @@ -470,6 +470,7 @@ do_fork(struct thread *td, int flags, st bzero(&td2->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); td2->td_su = NULL; + td2->td_sleeptimo = 0; bcopy(&td->td_startcopy, &td2->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); Modified: stable/10/sys/kern/kern_kthread.c ============================================================================== --- stable/10/sys/kern/kern_kthread.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/kern/kern_kthread.c Sat Aug 27 11:45:05 2016 (r304905) @@ -272,6 +272,7 @@ kthread_add(void (*func)(void *), void * bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); newtd->td_su = NULL; + newtd->td_sleeptimo = 0; bcopy(&oldtd->td_startcopy, &newtd->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); Modified: stable/10/sys/kern/kern_thr.c ============================================================================== --- stable/10/sys/kern/kern_thr.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/kern/kern_thr.c Sat Aug 27 11:45:05 2016 (r304905) @@ -229,6 +229,7 @@ thread_create(struct thread *td, struct bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); newtd->td_su = NULL; + newtd->td_sleeptimo = 0; bcopy(&td->td_startcopy, &newtd->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); newtd->td_proc = td->td_proc; Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/kern/kern_thread.c Sat Aug 27 11:45:05 2016 (r304905) @@ -319,7 +319,7 @@ thread_reap(void) /* * Don't even bother to lock if none at this instant, - * we really don't care about the next instant.. + * we really don't care about the next instant. */ if (!TAILQ_EMPTY(&zombie_threads)) { mtx_lock_spin(&zombie_lock); @@ -383,6 +383,7 @@ thread_free(struct thread *td) cpu_thread_free(td); if (td->td_kstack != 0) vm_thread_dispose(td); + callout_drain(&td->td_slpcallout); uma_zfree(thread_zone, td); } @@ -524,6 +525,7 @@ thread_wait(struct proc *p) td->td_cpuset = NULL; cpu_thread_clean(td); crfree(td->td_ucred); + callout_drain(&td->td_slpcallout); thread_reap(); /* check for zombie threads etc. */ } Modified: stable/10/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/10/sys/kern/subr_sleepqueue.c Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/kern/subr_sleepqueue.c Sat Aug 27 11:45:05 2016 (r304905) @@ -361,6 +361,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin { struct sleepqueue_chain *sc; struct thread *td; + sbintime_t pr1; td = curthread; sc = SC_LOOKUP(wchan); @@ -368,8 +369,14 @@ sleepq_set_timeout_sbt(void *wchan, sbin MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - callout_reset_sbt_on(&td->td_slpcallout, sbt, pr, - sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC); + KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx", + td->td_tid, td, (uintmax_t)td->td_sleeptimo)); + thread_lock(td); + callout_when(sbt, pr, flags, &td->td_sleeptimo, &pr1); + thread_unlock(td); + callout_reset_sbt_on(&td->td_slpcallout, td->td_sleeptimo, pr1, + sleepq_timeout, td, PCPU_GET(cpuid), flags | C_PRECALC | + C_DIRECT_EXEC); } /* @@ -548,37 +555,36 @@ static int sleepq_check_timeout(void) { struct thread *td; + int res; td = curthread; THREAD_LOCK_ASSERT(td, MA_OWNED); /* - * If TDF_TIMEOUT is set, we timed out. + * If TDF_TIMEOUT is set, we timed out. But recheck + * td_sleeptimo anyway. */ - if (td->td_flags & TDF_TIMEOUT) { - td->td_flags &= ~TDF_TIMEOUT; - return (EWOULDBLOCK); + res = 0; + if (td->td_sleeptimo != 0) { + if (td->td_sleeptimo <= sbinuptime()) + res = EWOULDBLOCK; + td->td_sleeptimo = 0; } - - /* - * If TDF_TIMOFAIL is set, the timeout ran after we had - * already been woken up. - */ - if (td->td_flags & TDF_TIMOFAIL) - td->td_flags &= ~TDF_TIMOFAIL; - - /* - * If callout_stop() fails, then the timeout is running on - * another CPU, so synchronize with it to avoid having it - * accidentally wake up a subsequent sleep. - */ - else if (_callout_stop_safe(&td->td_slpcallout, CS_MIGRBLOCK) - == 0) { - td->td_flags |= TDF_TIMEOUT; - TD_SET_SLEEPING(td); - mi_switch(SW_INVOL | SWT_SLEEPQTIMO, NULL); - } - return (0); + if (td->td_flags & TDF_TIMEOUT) + td->td_flags &= ~TDF_TIMEOUT; + else + /* + * We ignore the situation where timeout subsystem was + * unable to stop our callout. The struct thread is + * type-stable, the callout will use the correct + * memory when running. The checks of the + * td_sleeptimo value in this function and in + * sleepq_timeout() ensure that the thread does not + * get spurious wakeups, even if the callout was reset + * or thread reused. + */ + callout_stop(&td->td_slpcallout); + return (res); } /* @@ -887,12 +893,17 @@ sleepq_timeout(void *arg) CTR3(KTR_PROC, "sleepq_timeout: thread %p (pid %ld, %s)", (void *)td, (long)td->td_proc->p_pid, (void *)td->td_name); - /* - * First, see if the thread is asleep and get the wait channel if - * it is. - */ thread_lock(td); - if (TD_IS_SLEEPING(td) && TD_ON_SLEEPQ(td)) { + + if (td->td_sleeptimo > sbinuptime() || td->td_sleeptimo == 0) { + /* + * The thread does not want a timeout (yet). + */ + } else if (TD_IS_SLEEPING(td) && TD_ON_SLEEPQ(td)) { + /* + * See if the thread is asleep and get the wait + * channel if it is. + */ wchan = td->td_wchan; sc = SC_LOOKUP(wchan); THREAD_LOCKPTR_ASSERT(td, &sc->sc_lock); @@ -900,40 +911,16 @@ sleepq_timeout(void *arg) MPASS(sq != NULL); td->td_flags |= TDF_TIMEOUT; wakeup_swapper = sleepq_resume_thread(sq, td, 0); - thread_unlock(td); - if (wakeup_swapper) - kick_proc0(); - return; - } - - /* - * If the thread is on the SLEEPQ but isn't sleeping yet, it - * can either be on another CPU in between sleepq_add() and - * one of the sleepq_*wait*() routines or it can be in - * sleepq_catch_signals(). - */ - if (TD_ON_SLEEPQ(td)) { + } else if (TD_ON_SLEEPQ(td)) { + /* + * If the thread is on the SLEEPQ but isn't sleeping + * yet, it can either be on another CPU in between + * sleepq_add() and one of the sleepq_*wait*() + * routines or it can be in sleepq_catch_signals(). + */ td->td_flags |= TDF_TIMEOUT; - thread_unlock(td); - return; } - /* - * Now check for the edge cases. First, if TDF_TIMEOUT is set, - * then the other thread has already yielded to us, so clear - * the flag and resume it. If TDF_TIMEOUT is not set, then the - * we know that the other thread is not on a sleep queue, but it - * hasn't resumed execution yet. In that case, set TDF_TIMOFAIL - * to let it know that the timeout has already run and doesn't - * need to be canceled. - */ - if (td->td_flags & TDF_TIMEOUT) { - MPASS(TD_IS_SLEEPING(td)); - td->td_flags &= ~TDF_TIMEOUT; - TD_CLR_SLEEPING(td); - wakeup_swapper = setrunnable(td); - } else - td->td_flags |= TDF_TIMOFAIL; thread_unlock(td); if (wakeup_swapper) kick_proc0(); Modified: stable/10/sys/sys/proc.h ============================================================================== --- stable/10/sys/sys/proc.h Sat Aug 27 11:40:37 2016 (r304904) +++ stable/10/sys/sys/proc.h Sat Aug 27 11:45:05 2016 (r304905) @@ -325,6 +325,7 @@ struct thread { u_int td_dbg_sc_code; /* (c) Syscall code to debugger. */ u_int td_dbg_sc_narg; /* (c) Syscall arg count to debugger.*/ void *td_emuldata; /* Emulator state data */ + sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ }; struct mtx *thread_lock_block(struct thread *); @@ -364,7 +365,7 @@ do { \ #define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */ #define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ #define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ -#define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */ +#define TDF_UNUSED12 0x00001000 /* --available-- */ #define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */ #define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ #define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */ From owner-svn-src-stable@freebsd.org Sat Aug 27 20:08:35 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B0DAB77103; Sat, 27 Aug 2016 20:08:35 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37B37D2D; Sat, 27 Aug 2016 20:08:35 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RK8Y8F011316; Sat, 27 Aug 2016 20:08:34 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RK8Ykr011315; Sat, 27 Aug 2016 20:08:34 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201608272008.u7RK8Ykr011315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer Date: Sat, 27 Aug 2016 20:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304919 - stable/11/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 20:08:35 -0000 Author: skreuzer (doc,ports committer) Date: Sat Aug 27 20:08:34 2016 New Revision: 304919 URL: https://svnweb.freebsd.org/changeset/base/304919 Log: Document 292120, Update to ELF Tool Chain r3272 Approved by: re (gjb, implicit, relnotes) Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Aug 27 19:51:37 2016 (r304918) +++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Aug 27 20:08:34 2016 (r304919) @@ -466,9 +466,9 @@ patches that add new relocations for &arch.powerpc; support. - The + The ELF Tool Chain has been updated to - upstream revision r3136. + upstream revision r3272. The texinfo utility and info pages were removed from From owner-svn-src-stable@freebsd.org Sat Aug 27 20:43:53 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 920EFB77F40; Sat, 27 Aug 2016 20:43:53 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 453D8A07; Sat, 27 Aug 2016 20:43:53 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RKhq8X026367; Sat, 27 Aug 2016 20:43:52 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RKhqtY026366; Sat, 27 Aug 2016 20:43:52 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201608272043.u7RKhqtY026366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer Date: Sat, 27 Aug 2016 20:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304921 - stable/11/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 20:43:53 -0000 Author: skreuzer (doc,ports committer) Date: Sat Aug 27 20:43:52 2016 New Revision: 304921 URL: https://svnweb.freebsd.org/changeset/base/304921 Log: MFC r303877: Write kern.randompid to /etc/sysctl.conf Approved by: allanjude Modified: stable/11/usr.sbin/bsdinstall/scripts/hardening Modified: stable/11/usr.sbin/bsdinstall/scripts/hardening ============================================================================== --- stable/11/usr.sbin/bsdinstall/scripts/hardening Sat Aug 27 20:33:19 2016 (r304920) +++ stable/11/usr.sbin/bsdinstall/scripts/hardening Sat Aug 27 20:43:52 2016 (r304921) @@ -29,6 +29,7 @@ : ${DIALOG_OK=0} echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening +echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening exec 3>&1 FEATURES=$( dialog --backtitle "FreeBSD Installer" \ @@ -39,7 +40,7 @@ FEATURES=$( dialog --backtitle "FreeBSD "hide_gids" "Hide processes running as other groups" ${hide_gids:-off} \ "read_msgbuf" "Disable reading kernel message buffer for unprivileged users" ${read_msgbuf:-off} \ "proc_debug" "Disable process debugging facilities for unprivileged users" ${proc_debug:-off} \ - "random_pid" "Randomize the PID of newly created processes" ${random_id:-off} \ + "random_pid" "Randomize the PID of newly created processes" ${random_pid:-off} \ "stack_guard" "Insert stack guard page ahead of the growable segments" ${stack_guard:-off} \ "clear_tmp" "Clean the /tmp filesystem on system startup" ${clear_tmp:-off} \ "disable_syslogd" "Disable opening Syslogd network socket (disables remote logging)" ${disable_syslogd:-off} \ @@ -60,7 +61,7 @@ for feature in $FEATURES; do if [ "$feature" = "proc_debug" ]; then echo security.bsd.unprivileged_proc_debug=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening fi - if [ "$feature" = "random_id" ]; then + if [ "$feature" = "random_pid" ]; then echo kern.randompid=$(jot -r 1 9999) >> $BSDINSTALL_TMPETC/sysctl.conf.hardening fi if [ "$feature" = "stack_guard" ]; then From owner-svn-src-stable@freebsd.org Sat Aug 27 21:31:01 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77E9AB7798A; Sat, 27 Aug 2016 21:31:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4893FBFF; Sat, 27 Aug 2016 21:31:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RLV0HD041536; Sat, 27 Aug 2016 21:31:00 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RLV0rS041535; Sat, 27 Aug 2016 21:31:00 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201608272131.u7RLV0rS041535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 27 Aug 2016 21:31:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304922 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 21:31:01 -0000 Author: alc Date: Sat Aug 27 21:31:00 2016 New Revision: 304922 URL: https://svnweb.freebsd.org/changeset/base/304922 Log: MFC r303747,303982 Correct errors and clean up the comments on the active queue scan. Eliminate some unnecessary blank lines. Clean up the comments and code style in and around vm_pageout_cluster(). In particular, fix factual, grammatical, and spelling errors in various comments, and remove comments that are out of place in this function. Modified: stable/11/sys/vm/vm_pageout.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_pageout.c ============================================================================== --- stable/11/sys/vm/vm_pageout.c Sat Aug 27 20:43:52 2016 (r304921) +++ stable/11/sys/vm/vm_pageout.c Sat Aug 27 21:31:00 2016 (r304922) @@ -355,41 +355,28 @@ vm_pageout_page_lock(vm_page_t m, vm_pag } /* - * vm_pageout_clean: - * - * Clean the page and remove it from the laundry. - * - * We set the busy bit to cause potential page faults on this page to - * block. Note the careful timing, however, the busy bit isn't set till - * late and we cannot do anything that will mess with the page. + * Scan for pages at adjacent offsets within the given page's object that are + * eligible for laundering, form a cluster of these pages and the given page, + * and launder that cluster. */ static int vm_pageout_cluster(vm_page_t m) { vm_object_t object; - vm_page_t mc[2*vm_pageout_page_count], pb, ps; - int pageout_count; - int ib, is, page_base; - vm_pindex_t pindex = m->pindex; + vm_page_t mc[2 * vm_pageout_page_count], p, pb, ps; + vm_pindex_t pindex; + int ib, is, page_base, pageout_count; - vm_page_lock_assert(m, MA_OWNED); + vm_page_assert_locked(m); object = m->object; VM_OBJECT_ASSERT_WLOCKED(object); + pindex = m->pindex; /* - * It doesn't cost us anything to pageout OBJT_DEFAULT or OBJT_SWAP - * with the new swapper, but we could have serious problems paging - * out other object types if there is insufficient memory. - * - * Unfortunately, checking free memory here is far too late, so the - * check has been moved up a procedural level. - */ - - /* - * Can't clean the page if it's busy or held. + * We can't clean the page if it is busy or held. */ vm_page_assert_unbusied(m); - KASSERT(m->hold_count == 0, ("vm_pageout_clean: page %p is held", m)); + KASSERT(m->hold_count == 0, ("page %p is held", m)); vm_page_unlock(m); mc[vm_pageout_page_count] = pb = ps = m; @@ -399,33 +386,23 @@ vm_pageout_cluster(vm_page_t m) is = 1; /* - * Scan object for clusterable pages. - * - * We can cluster ONLY if: ->> the page is NOT - * clean, wired, busy, held, or mapped into a - * buffer, and one of the following: - * 1) The page is inactive, or a seldom used - * active page. - * -or- - * 2) we force the issue. + * We can cluster only if the page is not clean, busy, or held, and + * the page is inactive. * * During heavy mmap/modification loads the pageout * daemon can really fragment the underlying file - * due to flushing pages out of order and not trying - * align the clusters (which leave sporatic out-of-order + * due to flushing pages out of order and not trying to + * align the clusters (which leaves sporadic out-of-order * holes). To solve this problem we do the reverse scan * first and attempt to align our cluster, then do a * forward scan if room remains. */ more: - while (ib && pageout_count < vm_pageout_page_count) { - vm_page_t p; - + while (ib != 0 && pageout_count < vm_pageout_page_count) { if (ib > pindex) { ib = 0; break; } - if ((p = vm_page_prev(pb)) == NULL || vm_page_busied(p)) { ib = 0; break; @@ -446,18 +423,16 @@ more: mc[--page_base] = pb = p; ++pageout_count; ++ib; + /* - * alignment boundary, stop here and switch directions. Do - * not clear ib. + * We are at an alignment boundary. Stop here, and switch + * directions. Do not clear ib. */ if ((pindex - (ib - 1)) % vm_pageout_page_count == 0) break; } - while (pageout_count < vm_pageout_page_count && pindex + is < object->size) { - vm_page_t p; - if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p)) break; vm_page_test_dirty(p); @@ -477,15 +452,12 @@ more: /* * If we exhausted our forward scan, continue with the reverse scan - * when possible, even past a page boundary. This catches boundary - * conditions. + * when possible, even past an alignment boundary. This catches + * boundary conditions. */ - if (ib && pageout_count < vm_pageout_page_count) + if (ib != 0 && pageout_count < vm_pageout_page_count) goto more; - /* - * we allow reads during pageouts... - */ return (vm_pageout_flush(&mc[page_base], pageout_count, 0, 0, NULL, NULL)); } @@ -1216,15 +1188,13 @@ relock_queue: /* * Scan the active queue for pages that can be deactivated. Update * the per-page activity counter and use it to identify deactivation - * candidates. + * candidates. Held pages may be deactivated. */ 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) continue; @@ -1238,8 +1208,8 @@ relock_queue: } /* - * The count for pagedaemon pages is done after checking the - * page for eligibility... + * The count for page daemon pages is updated after checking + * the page for eligibility. */ PCPU_INC(cnt.v_pdpages); @@ -1253,12 +1223,17 @@ relock_queue: act_delta = 0; /* - * Unlocked object ref count check. Two races are possible. - * 1) The ref was transitioning to zero and we saw non-zero, - * the pmap bits will be checked unnecessarily. - * 2) The ref was transitioning to one and we saw zero. - * The page lock prevents a new reference to this page so - * we need not check the reference bits. + * Perform an unsynchronized object ref count check. While + * the page lock ensures that the page is not reallocated to + * another object, in particular, one with unmanaged mappings + * that cannot support pmap_ts_referenced(), two races are, + * nonetheless, possible: + * 1) The count was transitioning to zero, but we saw a non- + * zero value. pmap_ts_referenced() will return zero + * because the page is not mapped. + * 2) The count was transitioning to one, but we saw zero. + * This race delays the detection of a new reference. At + * worst, we will deactivate and reactivate the page. */ if (m->object->ref_count != 0) act_delta += pmap_ts_referenced(m); From owner-svn-src-stable@freebsd.org Sat Aug 27 21:32:57 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0F76B77B25; Sat, 27 Aug 2016 21:32:57 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 592A7EFD; Sat, 27 Aug 2016 21:32:57 +0000 (UTC) (envelope-from skreuzer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7RLWuUC044950; Sat, 27 Aug 2016 21:32:56 GMT (envelope-from skreuzer@FreeBSD.org) Received: (from skreuzer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7RLWuft044949; Sat, 27 Aug 2016 21:32:56 GMT (envelope-from skreuzer@FreeBSD.org) Message-Id: <201608272132.u7RLWuft044949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skreuzer set sender to skreuzer@FreeBSD.org using -f From: Steven Kreuzer Date: Sat, 27 Aug 2016 21:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304923 - stable/11/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2016 21:32:57 -0000 Author: skreuzer (doc,ports committer) Date: Sat Aug 27 21:32:56 2016 New Revision: 304923 URL: https://svnweb.freebsd.org/changeset/base/304923 Log: Document r299142, Native PCIe Hotplug support Document r298166, libucl has been updated to version 0.8.0 Document r302288, Enable indirect segment I/O by default when running on EC2 Document r302265, Allow ZFS ARC min / max to be tuned at runtime Approved by: re (gjb, implicit, relnotes) Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Aug 27 21:31:00 2016 (r304922) +++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml Sat Aug 27 21:32:56 2016 (r304923) @@ -602,6 +602,9 @@ OpenBSM has been updated to version 1.2 alpha 4. + libucl has + been updated to version 0.8.0. + The NetBSD Project's &man.libblacklist.3; library and applications have been ported and integrated into the system. Packet @@ -1310,6 +1313,10 @@ Hardware Support + Native PCI-express HotPlug + support is enabled by default on &arch.amd64;, &arch.arm64; and + &arch.powerpc; + The &man.asmc.4; driver has been updated to support the &apple; MacMini 3,1. @@ -1445,6 +1452,9 @@ The &man.xen.4; driver has been updated to include support for blkif indirect segment I/O. + + Indirect segment I/O is enabled by default + in the Xen blkfront driver when running on AWS EC2. @@ -1613,6 +1623,10 @@ sponsor="&ix;, &spectralogic;">The zfsd daemon has been added, which manages hotspares and replements in drive slots that publish physical paths. + + The + minimum and maximum values for the ZFS adaptive replacement + cache can be modified at runtime.