From owner-svn-src-head@freebsd.org Sun Jul 8 00:02:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2E73103DCEE; Sun, 8 Jul 2018 00:02:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95194734F3; Sun, 8 Jul 2018 00:02:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 761DA1E67F; Sun, 8 Jul 2018 00:02:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6802FqZ058285; Sun, 8 Jul 2018 00:02:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6802FoJ058284; Sun, 8 Jul 2018 00:02:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807080002.w6802FoJ058284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 00:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336078 - in head/share/man/man4: . man4.aarch64 X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/share/man/man4: . man4.aarch64 X-SVN-Commit-Revision: 336078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:02:16 -0000 Author: ian Date: Sun Jul 8 00:02:14 2018 New Revision: 336078 URL: https://svnweb.freebsd.org/changeset/base/336078 Log: Move armv8crypto.4 into the aarch64 dir; should have been part of r336077. Pointy hat: ian@ Reported by: rpokola@ Added: head/share/man/man4/man4.aarch64/armv8crypto.4 - copied unchanged from r336077, head/share/man/man4/armv8crypto.4 Deleted: head/share/man/man4/armv8crypto.4 Copied: head/share/man/man4/man4.aarch64/armv8crypto.4 (from r336077, head/share/man/man4/armv8crypto.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.aarch64/armv8crypto.4 Sun Jul 8 00:02:14 2018 (r336078, copy of r336077, head/share/man/man4/armv8crypto.4) @@ -0,0 +1,83 @@ +.\" Copyright (c) 2016 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by Andrew Turner under +.\" sponsorship from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 20, 2016 +.Dt ARMV8CRYPTO 4 +.Os +.Sh NAME +.Nm armv8crypto +.Nd "driver for the AES accelerator on ARM CPUs" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device crypto" +.Cd "device armv8crypto" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +armv8crypto_load="YES" +.Ed +.Sh DESCRIPTION +Starting with the ARMv8 architecture ARM Limited has added optional +cryptography instructions to accelerate AES, SHA-1, SHA-2, and +finite field arithmetic. +.Pp +The processor capability is reported as AES in the Instruction Set +Attributes 0 line at boot. +The +.Nm +driver does not attach on systems that lack the required CPU capability. +.Pp +The +.Nm +driver registers itself to accelerate AES operations for +.Xr crypto 4 . +.Sh SEE ALSO +.Xr crypt 3 , +.Xr crypto 4 , +.Xr intro 4 , +.Xr ipsec 4 , +.Xr random 4 , +.Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 11.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Andrew Turner Aq Mt andrew@FreeBSD.org . From owner-svn-src-head@freebsd.org Sun Jul 8 00:03:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE24F103DE20 for ; Sun, 8 Jul 2018 00:03:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EAB57368A for ; Sun, 8 Jul 2018 00:03:01 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 3f7e9de4-8242-11e8-aa1a-954dbaed88ca X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 3f7e9de4-8242-11e8-aa1a-954dbaed88ca; Sun, 08 Jul 2018 00:02:49 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w6802lZi029954; Sat, 7 Jul 2018 18:02:47 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1531008167.1336.1.camel@freebsd.org> Subject: Re: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm From: Ian Lepore To: Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 07 Jul 2018 18:02:47 -0600 In-Reply-To: <4521CE35-F466-4757-9539-64C6386E74CD@panasas.com> References: <201807072149.w67LnUtT087621@repo.freebsd.org> <4521CE35-F466-4757-9539-64C6386E74CD@panasas.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:03:01 -0000 On Sat, 2018-07-07 at 16:35 -0700, Ravi Pokala wrote: > -----Original Message----- > From: on behalf of Ian Lepore > Date: 2018-07-07, Saturday at 14:49 > To: , , > Subject: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm > > > > > Author: ian > > Date: Sat Jul  7 21:49:30 2018 > > New Revision: 336077 > > URL: https://svnweb.freebsd.org/changeset/base/336077 > > > > Log: > >   Move arm- and aarch64-specific manpages into arch-specific directories. > >    > >   This removes a bit of the .if/.endif clutter from man4/Makefile by using > >   the existing machinery that supports per-arch manpages. > Hi Ian, > > This breaks arm64 buildworld: > >     make[8]: make[8]: don't know how to make armv8crypto.4. Stop > Doh! Fixed in r336078; sorry about that. -- Ian From owner-svn-src-head@freebsd.org Sun Jul 8 00:05:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF8A7103E2D8; Sun, 8 Jul 2018 00:05:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61D53738FF; Sun, 8 Jul 2018 00:05:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.4] (c-71-198-162-232.hsd1.ca.comcast.net [71.198.162.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 9D3E21CCBF; Sun, 8 Jul 2018 00:05:10 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.e.1.180613 Date: Sat, 07 Jul 2018 17:05:07 -0700 Subject: Re: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm From: Ravi Pokala To: Ian Lepore , Ravi Pokala , , , Message-ID: <97098C49-BDD3-4770-AB91-F18774DE143E@panasas.com> Thread-Topic: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm References: <201807072149.w67LnUtT087621@repo.freebsd.org> <4521CE35-F466-4757-9539-64C6386E74CD@panasas.com> <1531008167.1336.1.camel@freebsd.org> In-Reply-To: <1531008167.1336.1.camel@freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:05:11 -0000 -----Original Message----- From: on behalf of Ian Lepore Date: 2018-07-07, Saturday at 17:02 To: Ravi Pokala , , , Subject: Re: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm > On Sat, 2018-07-07 at 16:35 -0700, Ravi Pokala wrote: >> -----Original Message----- >> From: on behalf of Ian Lepore >> Date: 2018-07-07, Saturday at 14:49 >> To: , , >> Subject: svn commit: r336077 - in head/share/man/man4: . man4.aarch64 man4.arm >> >>> >>> Author: ian >>> Date: Sat Jul 7 21:49:30 2018 >>> New Revision: 336077 >>> URL: https://svnweb.freebsd.org/changeset/base/336077 >>> >>> Log: >>> Move arm- and aarch64-specific manpages into arch-specific directories. >>> >>> This removes a bit of the .if/.endif clutter from man4/Makefile by using >>> the existing machinery that supports per-arch manpages. >> Hi Ian, >> >> This breaks arm64 buildworld: >> >> make[8]: make[8]: don't know how to make armv8crypto.4. Stop >> > > Doh! Fixed in r336078; sorry about that. > > -- Ian No worries. :-) Thanks, Ravi (rpokala@) From owner-svn-src-head@freebsd.org Sun Jul 8 00:27:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFF40104046A; Sun, 8 Jul 2018 00:27:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79140747A4; Sun, 8 Jul 2018 00:27:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D5D91E9BE; Sun, 8 Jul 2018 00:27:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w680RTXM068971; Sun, 8 Jul 2018 00:27:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w680RSFk068967; Sun, 8 Jul 2018 00:27:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807080027.w680RSFk068967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 00:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336079 - in head: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_ahci X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_ahci X-SVN-Commit-Revision: 336079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:27:30 -0000 Author: ian Date: Sun Jul 8 00:27:28 2018 New Revision: 336079 URL: https://svnweb.freebsd.org/changeset/base/336079 Log: Add pnp info to imx6_ahci, and add a module makefile, and a manpage for it. Added: head/share/man/man4/man4.arm/imx6_ahci.4 (contents, props changed) head/sys/modules/imx/imx6_ahci/ head/sys/modules/imx/imx6_ahci/Makefile (contents, props changed) Modified: head/share/man/man4/man4.arm/Makefile head/sys/arm/freescale/imx/imx6_ahci.c head/sys/modules/imx/Makefile Modified: head/share/man/man4/man4.arm/Makefile ============================================================================== --- head/share/man/man4/man4.arm/Makefile Sun Jul 8 00:02:14 2018 (r336078) +++ head/share/man/man4/man4.arm/Makefile Sun Jul 8 00:27:28 2018 (r336079) @@ -12,6 +12,7 @@ MAN= \ bcm283x_pwm.4 \ cgem.4 \ devcfg.4 \ + imx6_ahci.4 \ imx_wdog.4 \ mge.4 \ npe.4 \ Added: head/share/man/man4/man4.arm/imx6_ahci.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.arm/imx6_ahci.4 Sun Jul 8 00:27:28 2018 (r336079) @@ -0,0 +1,65 @@ +.\" +.\" Copyright (c) 2018 Ian Lepore +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 7, 2018 +.Dt IMX6_AHCI 4 +.Os +.Sh NAME +.Nm imx6_ahci +.Nd device driver for the NXP i.MX6 on-chip SATA controller +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ahci" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +imx6_ahci_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +support for the on-chip SATA controller found on some models of +the NXP i.MX6 chip. +The driver is a thin glue layer to interpret the platform's FDT +data and marshall resources for the standard +.Xr ahci 4 +driver. +.Sh SEE ALSO +.Xr ahci 4 , +.Xr fdt 4 , +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . Modified: head/sys/arm/freescale/imx/imx6_ahci.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ahci.c Sun Jul 8 00:02:14 2018 (r336078) +++ head/sys/arm/freescale/imx/imx6_ahci.c Sun Jul 8 00:27:28 2018 (r336079) @@ -64,6 +64,11 @@ __FBSDID("$FreeBSD$"); #define SATA_PHY_LANE0_OUT_STAT 0x2003 #define SATA_PHY_LANE0_OUT_STAT_RX_PLL_STATE (1 << 1) +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-ahci", true}, + {NULL, false} +}; + static int imx6_ahci_phy_ctrl(struct ahci_controller* sc, uint32_t bitmask, bool on) { @@ -215,7 +220,7 @@ imx6_ahci_probe(device_t dev) return (ENXIO); } - if (!ofw_bus_is_compatible(dev, "fsl,imx6q-ahci")) { + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) { return (ENXIO); } device_set_desc(dev, "i.MX6 Integrated AHCI controller"); @@ -354,3 +359,5 @@ static driver_t ahci_ata_driver = { }; DRIVER_MODULE(imx6_ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0); +MODULE_DEPEND(imx6_ahci, ahci, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data) Modified: head/sys/modules/imx/Makefile ============================================================================== --- head/sys/modules/imx/Makefile Sun Jul 8 00:02:14 2018 (r336078) +++ head/sys/modules/imx/Makefile Sun Jul 8 00:27:28 2018 (r336079) @@ -3,6 +3,7 @@ SUBDIR = \ ../ffec \ + imx6_ahci \ imx_i2c \ imx_spi \ imx_wdog \ Added: head/sys/modules/imx/imx6_ahci/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/imx6_ahci/Makefile Sun Jul 8 00:27:28 2018 (r336079) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm/freescale/imx + +KMOD= imx6_ahci +SRCS= imx6_ahci.c + +# Generated files... +SRCS+= \ + bus_if.h \ + device_if.h \ + ofw_bus_if.h \ + +.include From owner-svn-src-head@freebsd.org Sun Jul 8 00:34:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E595C1041361 for ; Sun, 8 Jul 2018 00:34:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7581774E58 for ; Sun, 8 Jul 2018 00:34:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id l7-v6so14054469ioj.1 for ; Sat, 07 Jul 2018 17:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/BXeOdyhXP20OvsxEY/ArruHGqqiqGrutVCJSZLw3V0=; b=j2k34q33pFSZiUkiiR4Vy7L5nVRTW+j7VtvxrVVrLO388kfDSXvwj8fj8UT21+Fzlb vylh72a3g0daFkIF/fYxO/EbXhryC4NlgihLZkrgVP13lpW3ERiXmkqOyQi6bgWyZrDL QjEejRS4kH7xKZYIai5nrjmpw/noiQ2E+qmlUfLoEdfgzdkgOssua8yow2N4acEU63FM r2ChDxHPw8RRkrsd4bu23ZzZ1dg93bncUqaxEhdvwlFv9591tHidK7uCbIfdgLicYaTq Ftb8DjxyL4ZHlvmPg+5CX1UkkULmRDW0t3QvYwxXcEsWby+DCcju9e/SyRQkdj/qOr7W e7Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/BXeOdyhXP20OvsxEY/ArruHGqqiqGrutVCJSZLw3V0=; b=qimxoNHLDKAassxvdKa9B+KhTJlZGi9RwCtHx4R0PZL7KUQXAuFTUmE+Q48tdBSE0r iDQn4W7WNqzhyT4gTmo8aRsl+3eM81lFgRXAk6Ha2JZcK7pHhcNbJgKI49UOC+SSDe23 Vyu2YX1jmhCozNYcnvoLxfPO9LL136FQgM6KBQsaKrBvnDI5IdInOGdizzBX4n0KO0EQ oFjlx+FlMKSvJ2Hu7phYmpd2KtfG3OCY8Pr90iKzvuFcj68LuYnx3hAQon2M9S+IS/FO myTF5RwjRroyFei1RMo0dcUf5B3Q9tQ9MhWuTbCpnoT3Uh3di6oodnzCwd6ig91q6HEu ck9g== X-Gm-Message-State: APt69E17BpLSB3I9SCu1DDl8sXUylT37oU2B3BUI6b0/nNCTSgfIyZh9 l8Nx0/F9wQ4M9bh4zyfjZAHGiTEas23jhm/bVFzQlA== X-Google-Smtp-Source: AAOMgpcgPh7f+LpAV4CaXcC9ziXNZqZQNeXmdyg2F38qAJPbdXZxuS6mKKWr6PqZPdSNJ7EjcKoZgPrtJsgig3WRxkA= X-Received: by 2002:a6b:d004:: with SMTP id x4-v6mr12528358ioa.299.1531010044848; Sat, 07 Jul 2018 17:34:04 -0700 (PDT) MIME-Version: 1.0 References: <201807032305.w63N5guY063293@repo.freebsd.org> <20180704142233.GB5562@kib.kiev.ua> <6e5bc5e4-052c-877f-1c36-c72e276ff045@FreeBSD.org> <20180705155417.GI5562@kib.kiev.ua> <2a5b1c50-0f50-bbe1-4fcd-b98f61d24571@FreeBSD.org> <5B3EA725.4010202@grosbein.net> <1dd03d43-6f0d-580b-fd3b-f4494da42c70@FreeBSD.org> <51ec1e54-c940-9800-5c84-0f9b6e08895f@cs.duke.edu> <5B412CEF.3020901@grosbein.net> <5B414F22.4030501@grosbein.net> In-Reply-To: <5B414F22.4030501@grosbein.net> From: Warner Losh Date: Sat, 7 Jul 2018 18:33:52 -0600 Message-ID: Subject: Re: svn commit: r335916 - head/sys/conf To: Eugene Grosbein Cc: Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:34:06 -0000 On Sat, Jul 7, 2018, 5:40 PM Eugene Grosbein wrote: > 08.07.2018 4:38, Warner Losh wrote: > > > On Sat, Jul 7, 2018, 4:14 PM Eugene Grosbein > wrote: > > > > 07.07.2018 22:02, Andrew Gallatin wrote: > > > > > One thing that was tangentially brought up is that the ability > > > to compile out-of-tree modules requires keeping the kernel-headers > > > around. So we may need to identify all the headers that a module > might > > > need, and install them in /boot/$KERNEL/sys or some-such. This > would > > > be needed if, for example, we wanted to install a new Nvidia or > Virtual > > > Box module and have it work for older installed kernel versions too > > > (eg, across ABI breaking changes in -current). > > > > We already have all headers in /usr/include, don't we? > > > > > > Not really. We have a subset of the kernel headers that might not match > the running kernel, nor be enough to build modules. > > They should match running kernel definitely as we do not support not > syncronized kernel/world > and installworld populates /usr/include. > Nice theory. Lots and lots of people run this way. And it has worked well, so long as the kernel is newer... so, no, they don't have to match. And why a subset? Don'we support old-style kernel re-build "config; make > depend; make" > that does not require full /usr/src tree but /usr/src/sys only? > /usr/include is never, ever used to build the kernel (except for things like aicasm). Warner > From owner-svn-src-head@freebsd.org Sun Jul 8 00:42:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75435104237A; Sun, 8 Jul 2018 00:42:50 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (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 DAB0B75660; Sun, 8 Jul 2018 00:42:49 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f193.google.com with SMTP id 1-v6so11591922ljv.9; Sat, 07 Jul 2018 17:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=02yTAdAXoc2bFqWMLz7CkXCOrz8W0rRN5ictaL3gF4U=; b=o6u7qVzdLy4Jznq1mIc3gkWBNlTFhMKzP8BPUZJhZ8afJUdN6PQWIWwrfggRpdIyMj AkbAP5pXDsrCZ5pPl7k2rml9RlQuRdhArl+oV/rZcJzmftT5d54Vmk4hJGiGHuIMhKdt UEdZ7AErMRgvdRpvqOdzlJaS5THt+1qnizUreHRQXGakTTNe2OCjqz91huazcGOk+MLw p32l8iZ4l1xpOGxpjDzM1ckZoO6GTCEBF9vqxp6EGNEpoQ4R32vtUUw8B/UqbwdtYWiB zxl03igevhnuVZylUhr6hFR4/gk8cITDPz9nm4gV1HsER6SdgSTduQmDfSCm1xjnqt2S 9QOg== X-Gm-Message-State: APt69E3B7SBhW/AtaADTl5FZdcyBp14EYAPiCEnIBl0jdCWoq4LgZ8Gy aDeU7fUAW3zeOL/UgCCQlC+zrJ9V X-Google-Smtp-Source: AAOMgpezL2De7ydaXYEiB4dXjJbnm7ysmq8kpDlv3UEkl8EkgESHthhmn7Ei8dnTEO7mOFRVhIeb2Q== X-Received: by 2002:a2e:5d88:: with SMTP id v8-v6mr9568248lje.137.1530997315665; Sat, 07 Jul 2018 14:01:55 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id o3-v6sm2371624lfc.95.2018.07.07.14.01.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jul 2018 14:01:55 -0700 (PDT) Subject: Re: svn commit: r336068 - in head/sys: dev/amdsmb modules/amdsmb To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807071555.w67FtqrL004956@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= xsFNBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABzR5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz7CwZQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryM7BTQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAcLBfAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Sun, 8 Jul 2018 00:01:53 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201807071555.w67FtqrL004956@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:42:50 -0000 On 07/07/2018 18:55, Warner Losh wrote: > Author: imp > Date: Sat Jul 7 15:55:52 2018 > New Revision: 336068 > URL: https://svnweb.freebsd.org/changeset/base/336068 > > Log: > Update AMDSMB to use PCI_MATCH Just curious if anyone still uses this driver for ancient hardware. maybe de-orbit time? > Differential Review: https://reviews.freebsd.org/D16172 Just curious what's the point of referencing a review request that - had no reviewers - had no reviews - does not even have a description > Added: > head/sys/modules/amdsmb/ > head/sys/modules/amdsmb/Makefile (contents, props changed) > Modified: > head/sys/dev/amdsmb/amdsmb.c > > Modified: head/sys/dev/amdsmb/amdsmb.c > ============================================================================== > --- head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:25:16 2018 (r336067) > +++ head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:55:52 2018 (r336068) > @@ -125,24 +125,22 @@ struct amdsmb_softc { > > static int amdsmb_detach(device_t dev); > > +struct pci_device_table amdsmb_devs[] = { > + { PCI_DEV(AMDSMB_VENDORID_AMD, AMDSMB_DEVICEID_AMD8111_SMB2), > + PCI_DESCR("AMD-8111 SMBus 2.0 Controller") } > +}; > + > static int > amdsmb_probe(device_t dev) > { > - u_int16_t vid; > - u_int16_t did; > + const struct pci_device_table *tbl; > > - vid = pci_get_vendor(dev); > - did = pci_get_device(dev); > + tbl = PCI_MATCH(dev, amdsmb_devs); > + if (tbl == NULL) > + return (ENXIO); > + device_set_desc(dev, tbl->descr); > > - if (vid == AMDSMB_VENDORID_AMD) { > - switch(did) { > - case AMDSMB_DEVICEID_AMD8111_SMB2: > - device_set_desc(dev, "AMD-8111 SMBus 2.0 Controller"); > - return (BUS_PROBE_DEFAULT); > - } > - } > - > - return (ENXIO); > + return (BUS_PROBE_DEFAULT); > } > > static int > > Added: head/sys/modules/amdsmb/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/modules/amdsmb/Makefile Sat Jul 7 15:55:52 2018 (r336068) > @@ -0,0 +1,8 @@ > +# $FreeBSD$ > + > +.PATH: ${SRCTOP}/sys/dev/amdsmb > + > +KMOD= amdsmb > +SRCS= amdsmb.c bus_if.h device_if.h pci_if.h smbus_if.h > + > +.include > -- Andriy Gapon From owner-svn-src-head@freebsd.org Sun Jul 8 00:51:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3038810432C9 for ; Sun, 8 Jul 2018 00:51:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A907B75D02 for ; Sun, 8 Jul 2018 00:51:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id y124-v6so8548899itc.0 for ; Sat, 07 Jul 2018 17:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y+8FVg87mrsWwvUAmrsjpOujLtwBdRefk8XDE4CSRks=; b=UrxZzXp1KLJRiY000WnAm5B/GClXaD3EUugztMzV1eL72AoEhCTfONV4+zQ8clyVMJ 1ojRyjDHNlyFqjuMDIkjkc920oKivCtPUd5C1EpiBv6C31DD8VHyQjt8PoP58rPR3Vrk gbtzWjjTASzUY/0baTDKrLGys1WMwy0g+yMfy97Y7q1niMctvmVveTli+1I93Y/Gx58c IU2h+EbKL8xReHOYTqBTO9zRdgM5gmMDV+gLNSYX5bQK1o2iOVpRH+cUDkDdG90iovKj cctqtyeSA/fDbrgKdoBdBj7kxgQLHI5KwPezNdIrhHokezWHsQIRV1bh7eHjuPiat/l/ L+YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y+8FVg87mrsWwvUAmrsjpOujLtwBdRefk8XDE4CSRks=; b=ELO63Ya9G6no/rqEmVoTo4dfUo6a136HqTeoHZO4YBQNURDLcoQ1Ly2pUSdwSMCRio GXUKSGFhPQE1kIJelUBuWp6aKFh2swZKLvMj3ByqsaSfs5IkpWxMH/KP0MfMcmgwf+oG wGgIuinwh9xGeLbSgpetO12qDlJvValBee71ZqarFO/O//2bBraW7P9GTnpV1z3136e8 ABY658IGE5YvaFw6sY7Tkq9FS1SOZ2PQuY6O0gOjQAnDRWXZFOIg2dMTWCcY6clNoSUx 3Sc7UmEbm9VOYjZIWkbfxeP8l/MX/GWGg0sL0iK4K86Lb1aC6rxzBVyh18g7DECiNfnF TE/w== X-Gm-Message-State: APt69E1Qeb/+3bF6o2SXpbtDOaAVUBcDvktsYeaD8U51NhUX5cAkT5iV nh25Txs5/55vQbUc7/jN0ilq5haScQcxEctMJyBniw== X-Google-Smtp-Source: AAOMgpfFheMkbrMkVNXH2JtjMUPua9H4UlmV+quYj/R3T5YLwVefmXFWT2jMGbbyXye6SoDFJ9l3EgsMvSCVkYefscw= X-Received: by 2002:a24:d0d7:: with SMTP id m206-v6mr11786432itg.1.1531011081911; Sat, 07 Jul 2018 17:51:21 -0700 (PDT) MIME-Version: 1.0 References: <201807071555.w67FtqrL004956@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sat, 7 Jul 2018 18:51:09 -0600 Message-ID: Subject: Re: svn commit: r336068 - in head/sys: dev/amdsmb modules/amdsmb To: Andriy Gapon Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:51:23 -0000 On Sat, Jul 7, 2018, 6:42 PM Andriy Gapon wrote: > On 07/07/2018 18:55, Warner Losh wrote: > > Author: imp > > Date: Sat Jul 7 15:55:52 2018 > > New Revision: 336068 > > URL: https://svnweb.freebsd.org/changeset/base/336068 > > > > Log: > > Update AMDSMB to use PCI_MATCH > > Just curious if anyone still uses this driver for ancient hardware. > maybe de-orbit time? > No. All such discussions are on hold until I get the depreciation doc done, due by the end of the month. Then it might be a good one, but there is a lot in line in front of it... > Differential Review: https://reviews.freebsd.org/D16172 > > Just curious what's the point of referencing a review request that > - had no reviewers > - had no reviews > - does not even have a description > I shared it there for my GSoC student, and it wound up getting pushed as part of a different commute train by mistake. Warner > Added: > > head/sys/modules/amdsmb/ > > head/sys/modules/amdsmb/Makefile (contents, props changed) > > Modified: > > head/sys/dev/amdsmb/amdsmb.c > > > > Modified: head/sys/dev/amdsmb/amdsmb.c > > > ============================================================================== > > --- head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:25:16 2018 > (r336067) > > +++ head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:55:52 2018 > (r336068) > > @@ -125,24 +125,22 @@ struct amdsmb_softc { > > > > static int amdsmb_detach(device_t dev); > > > > +struct pci_device_table amdsmb_devs[] = { > > + { PCI_DEV(AMDSMB_VENDORID_AMD, AMDSMB_DEVICEID_AMD8111_SMB2), > > + PCI_DESCR("AMD-8111 SMBus 2.0 Controller") } > > +}; > > + > > static int > > amdsmb_probe(device_t dev) > > { > > - u_int16_t vid; > > - u_int16_t did; > > + const struct pci_device_table *tbl; > > > > - vid = pci_get_vendor(dev); > > - did = pci_get_device(dev); > > + tbl = PCI_MATCH(dev, amdsmb_devs); > > + if (tbl == NULL) > > + return (ENXIO); > > + device_set_desc(dev, tbl->descr); > > > > - if (vid == AMDSMB_VENDORID_AMD) { > > - switch(did) { > > - case AMDSMB_DEVICEID_AMD8111_SMB2: > > - device_set_desc(dev, "AMD-8111 SMBus 2.0 > Controller"); > > - return (BUS_PROBE_DEFAULT); > > - } > > - } > > - > > - return (ENXIO); > > + return (BUS_PROBE_DEFAULT); > > } > > > > static int > > > > Added: head/sys/modules/amdsmb/Makefile > > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/sys/modules/amdsmb/Makefile Sat Jul 7 15:55:52 2018 > (r336068) > > @@ -0,0 +1,8 @@ > > +# $FreeBSD$ > > + > > +.PATH: ${SRCTOP}/sys/dev/amdsmb > > + > > +KMOD= amdsmb > > +SRCS= amdsmb.c bus_if.h device_if.h pci_if.h smbus_if.h > > + > > +.include > > > > > -- > Andriy Gapon > From owner-svn-src-head@freebsd.org Sun Jul 8 00:59:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7556610441CD for ; Sun, 8 Jul 2018 00:59:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0611476472 for ; Sun, 8 Jul 2018 00:59:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id l16-v6so22076099ita.0 for ; Sat, 07 Jul 2018 17:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+jaVBqcvDwEDhn7/CNN4rhS+QJoIK5dM9AbqzfdcvgQ=; b=VVWTYU83XrpHBp9Sbtlw8AQsKNXpBjH+nF9t+LROLuIRkVtuMH38paENwpeTFuqlNI ABWy/zorOqJpgVIF12gsAd0KlE13dUHZ8FXKEylrJmQDGtlT5gXaATp/FLPB9zYHq4i6 FQFsyTN5D5HNCDAPwDqFv9m98ZBvkg4WJNqaQgFZLuHsX4IvRzSQ90TPFtH+eXGLGapq LMB4kI9rCJqPpauWpOaZinhNCdNHzVPmhbiAiPsyn2+4LBXP2DDIb+dohkz2cJ3bb1e6 qJyGJ091RdqH8VoSaWowXWXFN8yksWZPj+meAiYJtyUaeHG9seWH1zzdm3TqCYWNCFbX wXng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+jaVBqcvDwEDhn7/CNN4rhS+QJoIK5dM9AbqzfdcvgQ=; b=G4ud+96Gqx1//2kjJnOx2ijYkZcYEu691V7KokYBZuGSk6tKUEQpHx8UYbw5MiibNx rKLRgVJJWDLeS+VhRDN9Hjo+oD0tprjXDk4V1c+ST6wPLqVcv1p2pxtQschg2Wy02LFn JPwSJCg6RASwceDvfAcAokrxJW1RKDLvHXrRNswHeZNeQgyryj4vCnmIjUaX4huqa7yV TbaJ1hKYS5sElCw2qsSeDC9ZKekeOf/IVktuGV5poeEoGcHe0RedirKxT1kROhkc1GmR T8BBOFDRuLb7+oSkIqP0Iy0vS2nHvm7ZUJAqAbSYmX8VJ6pmlXiWTWq6qRj9QUd/sigE aKrQ== X-Gm-Message-State: APt69E2pPUHCKRifAjYhHuJ3JwlHesQDs21J8xA4yMU4Ws+Md9tRtWIP mYUkp9V5Qa1eB46qV3HnDu2ENhbnHFnvvpnh6Mza5w== X-Google-Smtp-Source: AAOMgpcwPTsWNBQm/Z7KAaTFaDPGKq7KB0pKMCgIpy3q2i1tozyZn3TrHvLzdjgkVn+3Lv7Df+Ea2XsAk5xAXq1vt3o= X-Received: by 2002:a24:d0d7:: with SMTP id m206-v6mr11795691itg.1.1531011595355; Sat, 07 Jul 2018 17:59:55 -0700 (PDT) MIME-Version: 1.0 References: <201807071555.w67FtqrL004956@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sat, 7 Jul 2018 18:59:42 -0600 Message-ID: Subject: Re: svn commit: r336068 - in head/sys: dev/amdsmb modules/amdsmb To: Andriy Gapon Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 00:59:56 -0000 On Sat, Jul 7, 2018, 6:51 PM Warner Losh wrote: > > > On Sat, Jul 7, 2018, 6:42 PM Andriy Gapon wrote: > >> On 07/07/2018 18:55, Warner Losh wrote: >> > Author: imp >> > Date: Sat Jul 7 15:55:52 2018 >> > New Revision: 336068 >> > URL: https://svnweb.freebsd.org/changeset/base/336068 >> > >> > Log: >> > Update AMDSMB to use PCI_MATCH >> >> Just curious if anyone still uses this driver for ancient hardware. >> maybe de-orbit time? >> > > No. All such discussions are on hold until I get the depreciation doc > done, due by the end of the month. Then it might be a good one, but there > is a lot in line in front of it... > > > Differential Review: https://reviews.freebsd.org/D16172 >> >> Just curious what's the point of referencing a review request that >> - had no reviewers >> - had no reviews >> - does not even have a description >> > > I shared it there for my GSoC student, and it wound up getting pushed as > part of a different commute train by mistake. > Stupid autocorrect. Commit train. An unrelated fix was committed to the branch I had for this by mistake (the ath one). I was in a hurry since I wanted to get on the road and didn't check before pushing. My bad. I didn't think it worth backing out... Warner > > > Added: >> > head/sys/modules/amdsmb/ >> > head/sys/modules/amdsmb/Makefile (contents, props changed) >> > Modified: >> > head/sys/dev/amdsmb/amdsmb.c >> > >> > Modified: head/sys/dev/amdsmb/amdsmb.c >> > >> ============================================================================== >> > --- head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:25:16 2018 >> (r336067) >> > +++ head/sys/dev/amdsmb/amdsmb.c Sat Jul 7 15:55:52 2018 >> (r336068) >> > @@ -125,24 +125,22 @@ struct amdsmb_softc { >> > >> > static int amdsmb_detach(device_t dev); >> > >> > +struct pci_device_table amdsmb_devs[] = { >> > + { PCI_DEV(AMDSMB_VENDORID_AMD, AMDSMB_DEVICEID_AMD8111_SMB2), >> > + PCI_DESCR("AMD-8111 SMBus 2.0 Controller") } >> > +}; >> > + >> > static int >> > amdsmb_probe(device_t dev) >> > { >> > - u_int16_t vid; >> > - u_int16_t did; >> > + const struct pci_device_table *tbl; >> > >> > - vid = pci_get_vendor(dev); >> > - did = pci_get_device(dev); >> > + tbl = PCI_MATCH(dev, amdsmb_devs); >> > + if (tbl == NULL) >> > + return (ENXIO); >> > + device_set_desc(dev, tbl->descr); >> > >> > - if (vid == AMDSMB_VENDORID_AMD) { >> > - switch(did) { >> > - case AMDSMB_DEVICEID_AMD8111_SMB2: >> > - device_set_desc(dev, "AMD-8111 SMBus 2.0 >> Controller"); >> > - return (BUS_PROBE_DEFAULT); >> > - } >> > - } >> > - >> > - return (ENXIO); >> > + return (BUS_PROBE_DEFAULT); >> > } >> > >> > static int >> > >> > Added: head/sys/modules/amdsmb/Makefile >> > >> ============================================================================== >> > --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> > +++ head/sys/modules/amdsmb/Makefile Sat Jul 7 15:55:52 2018 >> (r336068) >> > @@ -0,0 +1,8 @@ >> > +# $FreeBSD$ >> > + >> > +.PATH: ${SRCTOP}/sys/dev/amdsmb >> > + >> > +KMOD= amdsmb >> > +SRCS= amdsmb.c bus_if.h device_if.h pci_if.h smbus_if.h >> > + >> > +.include >> > >> >> >> -- >> Andriy Gapon >> > From owner-svn-src-head@freebsd.org Sun Jul 8 01:04:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8097104493A for ; Sun, 8 Jul 2018 01:04:04 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic302-20.consmr.mail.gq1.yahoo.com (sonic302-20.consmr.mail.gq1.yahoo.com [98.137.68.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37EB57699C for ; Sun, 8 Jul 2018 01:04:04 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: DWLJDF8VM1n3EHwAR8TXG8GLzC.2FoVcMKZghWhZAzdSmrCCQX8wMvgpgRCfJGT r5GSAoIjijwRHKTi8AW0rNXyZpItNN7kUaaeaYlKtQdxJHFi1wEaXKUDsWmtuvTJz.UtZh1rkHgk Ci5UGhpuW_2ZplIkfJd2MB1yKOIf_uHyblUu61NjFSUlHoopiUVSXbc9zWmIih5byHL_AHWh0p3C KOhJxwSlXp.NV1EZ6lJQuN1loiTaZ.4GeQjFi_mVFi5V3E1ahO7YqF6qhz4646HxIryC8RAVqPYG LfKq4Xdp60cGRDLu9ckrio7m32oIkQRz5fwnljOPY9zv.caikE8AXt2.B7ECweh3kocLMjRzGK6R xhM2PUkQbEfzw2jilUpBGBhHkppKUL.FgivG0PdE3N0hGv4tb1ToICacmXTAGhN1Dc.rBvpL2D9l nkPBs3noq86noF1_kJG18D96XpuWIrZTrhvYJNgsJ_s_RMw3Xcjm0MN_L2gR4EZy4uDlbksO36Wf NamXUsDnOXKVsZ8LqtdcgvZUrsUY0RKtU8FasOngnsal1ornQ0v1THllXM922kfs8O1VW3JZ7Y1f DW52j_KYEoTLHk9t1I.fXu5MmN.6xjYtNW0WcirOP5UsUFVWtIkkm1x9cYJ_sVz.6duNfN4vtf2D sBnhwGrbySWCcjMSuhj.cQrNRsRG2hqZOdQ1v0oM70Ll6MgBIY.zx_n5qs.H4g9Nin9mza8DPkYe FD45GkkCgprlVT4Fti3MziKoIl6IlcEb75YUMuC7S_6AKFaCXW92Ouz1a6uQb1HjF_Lhlr.EC83a cymjQMtOO8qAKajDTdC_j4mLotGmWhELqcEF4u24mT93rq_xy03bcAzPq0ZaAdw2IzslxF9FIJzf y9s2YvuusNULFTBHk0WzxDYui2XEOwLk_reb4HJieCZveGN5aFsPZlQGpsxeAZaerTQTNr85P9Km OFHESMk4fHhGz.qll1JYzzlr.6wJn2Ol0WmwnMnlmz8_0S32scl0uiOaPzrfUwA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sun, 8 Jul 2018 01:04:02 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp424.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID e3da6c7a5a50ecd55b4205549b4b6e3d; Sun, 08 Jul 2018 01:04:00 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: svn commit: r336078 [ ci.freebsd.org 's FreeBSD-head-aarch64-build still broken ] Message-Id: Date: Sat, 7 Jul 2018 18:03:58 -0700 To: ian@FreeBSD.org, svn-src-head@freebsd.org, freebsd-arm X-Mailer: Apple Mail (2.3445.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 01:04:04 -0000 https://ci.freebsd.org/job/FreeBSD-head-aarch64-build/8461/consoleText = shows: =3D=3D=3D> share/man/man4/man4.aarch64 (distribute) cd = /usr/src/share/man/man4/man4.aarch64; make __MAKE_CONF=3D/dev/null = SRCCONF=3D/dev/null install installconfig -DNO_SUBDIR = DESTDIR=3D/usr/obj/usr/src/arm64.aarch64/release/dist/base SHARED=3Dcopies= install -o root -g wheel -m 444 armv8crypto.4.gz = /usr/obj/usr/src/arm64.aarch64/release/dist/base/usr/share/man/man4/aarch6= 4/ install: = /usr/obj/usr/src/arm64.aarch64/release/dist/base/usr/share/man/man4/aarch6= 4/: No such file or directory *** Error code 71=20 (which is farther than it got before.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Sun Jul 8 01:05:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 163A51044B6A; Sun, 8 Jul 2018 01:05:24 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (unknown [IPv6:2a01:4f8:d12:604::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BD8176AA1; Sun, 8 Jul 2018 01:05:22 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w6815AKH050391 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 8 Jul 2018 03:05:11 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: imp@bsdimp.com Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w68156oh012169 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 8 Jul 2018 08:05:06 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r335916 - head/sys/conf To: Warner Losh References: <201807032305.w63N5guY063293@repo.freebsd.org> <20180704142233.GB5562@kib.kiev.ua> <6e5bc5e4-052c-877f-1c36-c72e276ff045@FreeBSD.org> <20180705155417.GI5562@kib.kiev.ua> <2a5b1c50-0f50-bbe1-4fcd-b98f61d24571@FreeBSD.org> <5B3EA725.4010202@grosbein.net> <1dd03d43-6f0d-580b-fd3b-f4494da42c70@FreeBSD.org> <51ec1e54-c940-9800-5c84-0f9b6e08895f@cs.duke.edu> <5B412CEF.3020901@grosbein.net> <5B414F22.4030501@grosbein.net> Cc: Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Eugene Grosbein Message-ID: <5B41633D.3070805@grosbein.net> Date: Sun, 8 Jul 2018 08:05:01 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00, LOCAL_FROM, RDNS_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -0.0 SPF_PASS SPF: sender matches SPF record * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS * 2.6 LOCAL_FROM From my domains X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 01:05:24 -0000 08.07.2018 7:33, Warner Losh wrote: > > We already have all headers in /usr/include, don't we? > > Not really. We have a subset of the kernel headers that might not match the running kernel, nor be enough to build modules. > They should match running kernel definitely as we do not support not syncronized kernel/world > and installworld populates /usr/include. > Nice theory. Lots and lots of people run this way. And it has worked well, so long as the kernel is newer... so, no, they don't have to match. It could work. It can also easily break things with newer kernel too, I can remember many cases. /sbin/ipfw, ps, ifconfig, netstat, top, killall and some important others are not guaranteed to run with newer kernel. I still run FreeBSD 4.11-STABLE inside 11.2-STABLE jail and that's why I know this. > And why a subset? Don'we support old-style kernel re-build "config; make depend; make" > that does not require full /usr/src tree but /usr/src/sys only? > /usr/include is never, ever used to build the kernel (except for things like aicasm). OO. We could still add the whole bunch of needed .h files from /usr/src/sys/ there. From owner-svn-src-head@freebsd.org Sun Jul 8 01:06:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 155BD1044E73; Sun, 8 Jul 2018 01:06:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7308476C8E; Sun, 8 Jul 2018 01:06:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w6816Y2w059289; Sat, 7 Jul 2018 18:06:34 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w6816V3r059288; Sat, 7 Jul 2018 18:06:31 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201807080106.w6816V3r059288@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r335916 - head/sys/conf In-Reply-To: To: Warner Losh Date: Sat, 7 Jul 2018 18:06:31 -0700 (PDT) CC: Eugene Grosbein , Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 01:06:44 -0000 > On Sat, Jul 7, 2018, 5:40 PM Eugene Grosbein wrote: > > > 08.07.2018 4:38, Warner Losh wrote: > > > > > On Sat, Jul 7, 2018, 4:14 PM Eugene Grosbein > > wrote: > > > > > > 07.07.2018 22:02, Andrew Gallatin wrote: > > > > > > > One thing that was tangentially brought up is that the ability > > > > to compile out-of-tree modules requires keeping the kernel-headers > > > > around. So we may need to identify all the headers that a module > > might > > > > need, and install them in /boot/$KERNEL/sys or some-such. This > > would > > > > be needed if, for example, we wanted to install a new Nvidia or > > Virtual > > > > Box module and have it work for older installed kernel versions too > > > > (eg, across ABI breaking changes in -current). > > > > > > We already have all headers in /usr/include, don't we? > > > > > > > > > Not really. We have a subset of the kernel headers that might not match > > the running kernel, nor be enough to build modules. > > > > They should match running kernel definitely as we do not support not > > syncronized kernel/world > > and installworld populates /usr/include. > > > > Nice theory. Lots and lots of people run this way. And it has worked well, > so long as the kernel is newer... so, no, they don't have to match. At some point I had an evolution of "make includes" that would work without the other parts of src being present (ie, only sys) so that you could update /usr/include with the kernel headers if you reved your kernel sources. Not sure how hard this would be to reimplement, but basically skip over missing parts of the src tree with a message (echo) that it could not find that particular set of sources was how it worked. > And why a subset? Don'we support old-style kernel re-build "config; make > > depend; make" > > that does not require full /usr/src tree but /usr/src/sys only? > > Your mail agent is still mangling quoting. Mostly when it line wraps. > > /usr/include is never, ever used to build the kernel (except for things > like aicasm). Is not /usr/include really the kernel/userland interface, not the kernel/kernel interface? > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jul 8 01:29:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D6721047712; Sun, 8 Jul 2018 01:29:49 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2A3778007; Sun, 8 Jul 2018 01:29:48 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3EEA1F400; Sun, 8 Jul 2018 01:29:48 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w681TmEK000152; Sun, 8 Jul 2018 01:29:48 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w681Tmmu000151; Sun, 8 Jul 2018 01:29:48 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807080129.w681Tmmu000151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 01:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336080 - head/etc/mtree X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/etc/mtree X-SVN-Commit-Revision: 336080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 01:29:49 -0000 Author: ian Date: Sun Jul 8 01:29:48 2018 New Revision: 336080 URL: https://svnweb.freebsd.org/changeset/base/336080 Log: Create an aarch64 subdir under man4, now that we have aarch64 manpages. Reported by: Mark Millard Modified: head/etc/mtree/BSD.usr.dist Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Sun Jul 8 00:27:28 2018 (r336079) +++ head/etc/mtree/BSD.usr.dist Sun Jul 8 01:29:48 2018 (r336080) @@ -816,6 +816,8 @@ man3 .. man4 + aarch64 + .. amd64 .. arm From owner-svn-src-head@freebsd.org Sun Jul 8 01:30:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E08D1047A7B for ; Sun, 8 Jul 2018 01:30:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17381783B0 for ; Sun, 8 Jul 2018 01:30:57 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 8c9601ad-824e-11e8-aa1a-954dbaed88ca X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 8c9601ad-824e-11e8-aa1a-954dbaed88ca; Sun, 08 Jul 2018 01:30:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w681UobJ030092; Sat, 7 Jul 2018 19:30:50 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1531013450.1336.6.camel@freebsd.org> Subject: Re: svn commit: r336078 [ ci.freebsd.org 's FreeBSD-head-aarch64-build still broken ] From: Ian Lepore To: Mark Millard , svn-src-head@freebsd.org, freebsd-arm Date: Sat, 07 Jul 2018 19:30:50 -0600 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 01:30:58 -0000 On Sat, 2018-07-07 at 18:03 -0700, Mark Millard wrote: > https://ci.freebsd.org/job/FreeBSD-head-aarch64-build/8461/consoleTex > t shows: > > ===> share/man/man4/man4.aarch64 (distribute) cd > /usr/src/share/man/man4/man4.aarch64; make __MAKE_CONF=/dev/null > SRCCONF=/dev/null install installconfig -DNO_SUBDIR > DESTDIR=/usr/obj/usr/src/arm64.aarch64/release/dist/base > SHARED=copies install -o root -g wheel -m 444 armv8crypto.4.gz > /usr/obj/usr/src/arm64.aarch64/release/dist/base/usr/share/man/man4/a > arch64/ install: > /usr/obj/usr/src/arm64.aarch64/release/dist/base/usr/share/man/man4/a > arch64/: No such file or directory *** Error code 71  > > (which is farther than it got before.) > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > > r336080 may fix it.  I'm not sure, because I can't build an aarch64 world right now because of other build errors. -- Ian From owner-svn-src-head@freebsd.org Sun Jul 8 04:46:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC38DFE9090 for ; Sun, 8 Jul 2018 04:46:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::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 610F080480 for ; Sun, 8 Jul 2018 04:46:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id 188-v6so22294680ita.5 for ; Sat, 07 Jul 2018 21:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DpDlHy6iBUOdwRKK3HEVxcmo5Qc4BoCmco8v1ed6ahg=; b=B02J7BdY83frG61dW9H/F+utZG11s9UGTGGr/3uPDdvonSnUnzLliYoCIzECkOibLL VvbpelterWYYp/VUNbmCxfeFcjCoJsuujgChgfFNAGznI3qHDnZi40jjqYYXpw3AyYSm m5khN2+e4smo1CEvG4z5fXa8HCbFBpCAsSgzsYjyEuQYuTAO6q3GZSPaL1VFXNWzNtgj r5J6wM4KaeBHepoUtxeiFhUxly/qR8E8JiJOc6cHB0vJZfSD1PdwzUJnsPJvqODj2Hwm 39VxuadP6LcOFTFrMqqkY3aZ5vemelW1YYCcv5oOYmKSNVoPJL4p4xnVgIbfhN3qIvim SrQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DpDlHy6iBUOdwRKK3HEVxcmo5Qc4BoCmco8v1ed6ahg=; b=Fo9bmRgVfaHFE5E3xXLcifag9YjwiluIIN6HWJ70YRiliFmbTKQBiwrKQxuNcUZ2iH //r9Z6ihVCDid5bCO1zNSl3GXsx59gmFUPvJhc2Ya5+8DyY7rwZXCqCGFxEsUJyC7yMK UxFYQUAnedTiiyAs4Yo77IG+/fq/9ospXSGkx72JVvNre5PMg/+CZ69WQEbOeRT1PnZT 8iojNLSrQmDbrRE2xfiK7T1i/MgrgfSsjmoaQOgylYNAPt3kh2M7X259kOAA54O3nrbV q/ANcKxURIo9/enmMCPqAQoPMzLtMCEGNz4jEvQZdtwUKwepHrpWSZ1sBvHg5+CjAq6E ufRA== X-Gm-Message-State: APt69E1ekO272wtn7BOatjZt5X3sbTFlafXzD7GSoRNA31b7fsjtxi6C DWnVNWlWNE4njQ+BSu5BA8S6YWBek4c/RqESKGJDhA== X-Google-Smtp-Source: AAOMgpfZr2406kw5nNfD0+y4zXU5isrrzV8Kv3fbSt2GFNgm4L4h289OIO7xb8uv7oX+vI4DuTLLCZmJBQ4AiJ2JwEw= X-Received: by 2002:a24:d0d7:: with SMTP id m206-v6mr12062724itg.1.1531025185561; Sat, 07 Jul 2018 21:46:25 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:1183:0:0:0:0:0 with HTTP; Sat, 7 Jul 2018 21:46:24 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201807080106.w6816V3r059288@pdx.rh.CN85.dnsmgr.net> References: <201807080106.w6816V3r059288@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Sat, 7 Jul 2018 22:46:24 -0600 X-Google-Sender-Auth: 54AfneZcvnFQEQ9b4uqPWw9wrNg Message-ID: Subject: Re: svn commit: r335916 - head/sys/conf To: "Rodney W. Grimes" Cc: Eugene Grosbein , Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 04:46:27 -0000 On Sat, Jul 7, 2018 at 7:06 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Sat, Jul 7, 2018, 5:40 PM Eugene Grosbein wrote: > > > > > 08.07.2018 4:38, Warner Losh wrote: > > > > > > > On Sat, Jul 7, 2018, 4:14 PM Eugene Grosbein > > > wrote: > > > > > > > > 07.07.2018 22:02, Andrew Gallatin wrote: > > > > > > > > > One thing that was tangentially brought up is that the ability > > > > > to compile out-of-tree modules requires keeping the > kernel-headers > > > > > around. So we may need to identify all the headers that a > module > > > might > > > > > need, and install them in /boot/$KERNEL/sys or some-such. This > > > would > > > > > be needed if, for example, we wanted to install a new Nvidia or > > > Virtual > > > > > Box module and have it work for older installed kernel > versions too > > > > > (eg, across ABI breaking changes in -current). > > > > > > > > We already have all headers in /usr/include, don't we? > > > > > > > > > > > > Not really. We have a subset of the kernel headers that might not > match > > > the running kernel, nor be enough to build modules. > > > > > > They should match running kernel definitely as we do not support not > > > syncronized kernel/world > > > and installworld populates /usr/include. > > > > > > > Nice theory. Lots and lots of people run this way. And it has worked > well, > > so long as the kernel is newer... so, no, they don't have to match. > > At some point I had an evolution of "make includes" that would work > without the other parts of src being present (ie, only sys) so that > you could update /usr/include with the kernel headers if you reved > your kernel sources. > > Not sure how hard this would be to reimplement, but basically skip over > missing parts of the src tree with a message (echo) that it could not > find that particular set of sources was how it worked. I really don't like this idea. It assumes The Kernel and The Includes. However, that's not quite right. For people running releases, it's near enough, but for developers it's not. I have, in the past, installed a weekly kernel into /boot/kernel.$DATE and kept a constant userland. I did this to catch performance regressions by being able to reboot quickly between then. At any given time, we'd not have the right headers with this scheme. Certainly not good enough to compile a module against the currently booted kernel. I've started to like the idea of keeping module sources for 3rd party modules /usr/local/ and using that to rebuild the module for a specific kernel. If we were to install the kernel includes / opt*.h files also into /boot/$KERNEL/include somehow, then 3rd party modules could be rebuilt at any time and we'd always have access to the builddir files that matter... Something to consider... I think I read that Linux did this to help prevent module breakage when new kernels are used... It may be time to ditch /boot/modules entirely in favor of a scheme like this. > /usr/include is never, ever used to build the kernel (except for things > > like aicasm). > > Is not /usr/include really the kernel/userland interface, > not the kernel/kernel interface? > Yea, and more. It's a bit of hodge-podge, but on the whole, that's not an inaccurate characterization. Especially the bit about it not being the intra-kernel interface. Warner From owner-svn-src-head@freebsd.org Sun Jul 8 05:48:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03436FEED35 for ; Sun, 8 Jul 2018 05:48:37 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-15.consmr.mail.bf2.yahoo.com (sonic310-15.consmr.mail.bf2.yahoo.com [74.6.135.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F3F5825C0 for ; Sun, 8 Jul 2018 05:48:36 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: LeVXZwQVM1kXgOTgHrjWUrxJ3oQ5vvOoPmZCw7Ad.0m9pY6FPxi_HJDgRUIU0PF lJ7JaRTIyJq1ui37G3wjH7BLRlW3SQm17Ayu_kCQZiW6.WZ1DpXPUa1uNCGLHaGeOQNvxXhpdd4C wsr.ZFVQuux_F.ri10kQjzjCkx8qviB.v8zrhKLdos0nU6u3fiBrdgqC2yyrt941H5yhF4Rv5SaQ 5DieDbePjJUeqdYqd9hkEj2QZNyCMuwvE0FjA3qYiIB2IUar8iOO3r00Fl8cUtCq6eSJFtCLvPCr tJJ9H00Cm2QzlEF8yJPzwv66rR5G1Yx8feUK0d6DT.l8F3drszdG_6.aicO2OiG.JMwiPaNDHgxn QEscFAuhKFQN2O4QvCEmGK79AWtVfN.x2SsWuEGt_LysjM8JV63NGKBEYgoUwEeZ.V8AaNhEE_5P rIK4a1o8etZ1c_SjzrFQEFSRYlKRNmcphQgYTnPQew.Ai_DUjp7n89.deGBNGrPQhV0Xki.lduSm yYen2.mMTBkamcDEZqwIBkXjX8hWvcL0djJYxYeX7mFeGZHJLE26vpDn_xjuHlsDg0xNRDNv2ajo KdMYvK06T4PjhUHUEPmAOQaOsScNF_R6An75mj4Onux3HWNCah449qn3REM0nB_gGY9xXlUZ0YNH i9VIyRikgOQzg5YEfOYefozlWe_Fw_XhtjPThBEdDq5xV.xFmdrQsVKm1R1AGd4qem7AtgdZAOPO fHCcODzcOsXrwy.qUtK2UvgicLa9BxKPQKrYBYKof6eawJOvVNo0FtrRyJsnRkw2EPqJlYrqdS7G BNroqCsWHq6JD_yRM3hK3Evtp3hPpRJe10Eb6hpPiapbUnfyY3iPZsQTI52miKzgQZxwLj0wPXZi k0nskaZk0eu82EqT3c6oJAuSSUu2gnBUX.1__o5.iYlSbEUAKQ0ALVellQ9MFytt0_mIRFFygjtn CfhcuQomNNaLQipeV.Q.JvN.KAaBW0Vx7SfGrrD75BuIU15FWDz75AS4C9COTMzBPletn_A-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Sun, 8 Jul 2018 05:48:30 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp417.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID a1d83acafe9638f7f82acf713d1d8222; Sun, 08 Jul 2018 05:48:26 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: svn commit: r335916 - head/sys/conf Message-Id: Date: Sat, 7 Jul 2018 22:48:24 -0700 To: Eugene Grosbein , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3445.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 05:48:37 -0000 Eugene Grosbein eugen at grosbein.net wrote on Sat Jul 7 21:14:06 UTC 2018 : > 07.07.2018 22:02, Andrew Gallatin wrote: > > > One thing that was tangentially brought up is that the ability > > to compile out-of-tree modules requires keeping the kernel-headers > > around. So we may need to identify all the headers that a module might > > need, and install them in /boot/$KERNEL/sys or some-such. This would > > be needed if, for example, we wanted to install a new Nvidia or Virtual > > Box module and have it work for older installed kernel versions too > > (eg, across ABI breaking changes in -current). > > We already have all headers in /usr/include, don't we? Even if were true, it seems such would only be for self-hosted builds, not cross-builds. Even for self-host builds, it is not true as I understand. (May be there is some implicit expectations/principles that I'm missing that automatically covers the related issues, but cross-builds seem to not be covered by parts of the discussion.) === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Sun Jul 8 06:25:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 118A7FF1E94 for ; Sun, 8 Jul 2018 06:25:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CAC283799 for ; Sun, 8 Jul 2018 06:25:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w686PUtA033421 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 8 Jul 2018 09:25:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w686PUtA033421 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w686PTnY033417; Sun, 8 Jul 2018 09:25:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 8 Jul 2018 09:25:29 +0300 From: Konstantin Belousov To: Warner Losh Cc: "Rodney W. Grimes" , Eugene Grosbein , Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335916 - head/sys/conf Message-ID: <20180708062529.GV5562@kib.kiev.ua> References: <201807080106.w6816V3r059288@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 06:25:47 -0000 On Sat, Jul 07, 2018 at 10:46:24PM -0600, Warner Losh wrote: > On Sat, Jul 7, 2018 at 7:06 PM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > > On Sat, Jul 7, 2018, 5:40 PM Eugene Grosbein wrote: > > > > > > > 08.07.2018 4:38, Warner Losh wrote: > > > > > > > > > On Sat, Jul 7, 2018, 4:14 PM Eugene Grosbein > > > > wrote: > > > > > > > > > > 07.07.2018 22:02, Andrew Gallatin wrote: > > > > > > > > > > > One thing that was tangentially brought up is that the ability > > > > > > to compile out-of-tree modules requires keeping the > > kernel-headers > > > > > > around. So we may need to identify all the headers that a > > module > > > > might > > > > > > need, and install them in /boot/$KERNEL/sys or some-such. This > > > > would > > > > > > be needed if, for example, we wanted to install a new Nvidia or > > > > Virtual > > > > > > Box module and have it work for older installed kernel > > versions too > > > > > > (eg, across ABI breaking changes in -current). > > > > > > > > > > We already have all headers in /usr/include, don't we? > > > > > > > > > > > > > > > Not really. We have a subset of the kernel headers that might not > > match > > > > the running kernel, nor be enough to build modules. > > > > > > > > They should match running kernel definitely as we do not support not > > > > syncronized kernel/world > > > > and installworld populates /usr/include. > > > > > > > > > > Nice theory. Lots and lots of people run this way. And it has worked > > well, > > > so long as the kernel is newer... so, no, they don't have to match. > > > > At some point I had an evolution of "make includes" that would work > > without the other parts of src being present (ie, only sys) so that > > you could update /usr/include with the kernel headers if you reved > > your kernel sources. > > > > Not sure how hard this would be to reimplement, but basically skip over > > missing parts of the src tree with a message (echo) that it could not > > find that particular set of sources was how it worked. > > > I really don't like this idea. It assumes The Kernel and The Includes. > However, that's not quite right. For people running releases, it's near > enough, but for developers it's not. I have, in the past, installed a > weekly kernel into /boot/kernel.$DATE and kept a constant userland. I did > this to catch performance regressions by being able to reboot quickly > between then. At any given time, we'd not have the right headers with this > scheme. Certainly not good enough to compile a module against the currently > booted kernel. > > I've started to like the idea of keeping module sources for 3rd party > modules /usr/local/ and using that to rebuild the module for a > specific kernel. If we were to install the kernel includes / opt*.h files > also into /boot/$KERNEL/include somehow, then 3rd party modules could be > rebuilt at any time and we'd always have access to the builddir files that > matter... Something to consider... I think I read that Linux did this to > help prevent module breakage when new kernels are used... It may be time > to ditch /boot/modules entirely in favor of a scheme like this. > > > /usr/include is never, ever used to build the kernel (except for things > > > like aicasm). > > > > Is not /usr/include really the kernel/userland interface, > > not the kernel/kernel interface? > > > > Yea, and more. It's a bit of hodge-podge, but on the whole, that's not an > inaccurate characterization. Especially the bit about it not being the > intra-kernel interface. Building modules against /usr/include/sys mostly worked until recently, esp. if the proper default options were empirically collected into module' Makefile (like -DVIMAGE etc). Now with the ck use, and the fact that ck headers are not installed, this is impossible. You need the full kernel sources for module build. From owner-svn-src-head@freebsd.org Sun Jul 8 07:42:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4086FF9489; Sun, 8 Jul 2018 07:42:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6392B86705; Sun, 8 Jul 2018 07:42:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44A0D23266; Sun, 8 Jul 2018 07:42:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w687gr31093852; Sun, 8 Jul 2018 07:42:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w687gnOu093835; Sun, 8 Jul 2018 07:42:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807080742.w687gnOu093835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 07:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336084 - in head/stand: . efi/boot1 efi/loader i386/gptzfsboot i386/loader i386/zfsboot i386/zfsloader libsa libsa/zfs sparc64/loader sparc64/zfsloader userboot/userboot zfs zfs32 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . efi/boot1 efi/loader i386/gptzfsboot i386/loader i386/zfsboot i386/zfsloader libsa libsa/zfs sparc64/loader sparc64/zfsloader userboot/userboot zfs zfs32 X-SVN-Commit-Revision: 336084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 07:42:54 -0000 Author: imp Date: Sun Jul 8 07:42:49 2018 New Revision: 336084 URL: https://svnweb.freebsd.org/changeset/base/336084 Log: Move ZFS files into libsa Move the libzfs stuff into libsa. There's no need for it to be a separate library. The separate library adds to the issues of build ordering that we see from time to time. Move the filesystem support into libsa, like all the other filesystem support rather than making zfs the odd-duck out. Discussed with: allanjude@ Added: head/stand/libsa/zfs/ head/stand/libsa/zfs/Makefile.inc (contents, props changed) - copied, changed from r336080, head/stand/zfs/Makefile head/stand/libsa/zfs/devicename_stubs.c (contents, props changed) - copied, changed from r336080, head/stand/zfs/devicename_stubs.c head/stand/libsa/zfs/libzfs.h (contents, props changed) - copied, changed from r336080, head/stand/zfs/libzfs.h head/stand/libsa/zfs/zfs.c (contents, props changed) - copied, changed from r336080, head/stand/zfs/zfs.c head/stand/libsa/zfs/zfsimpl.c (contents, props changed) - copied, changed from r336080, head/stand/zfs/zfsimpl.c Deleted: head/stand/zfs/Makefile head/stand/zfs/Makefile.depend head/stand/zfs/devicename_stubs.c head/stand/zfs/libzfs.h head/stand/zfs/zfs.c head/stand/zfs/zfsimpl.c head/stand/zfs32/Makefile head/stand/zfs32/Makefile.depend Modified: head/stand/Makefile head/stand/defs.mk head/stand/efi/boot1/Makefile head/stand/efi/loader/Makefile head/stand/i386/gptzfsboot/Makefile head/stand/i386/loader/Makefile head/stand/i386/zfsboot/Makefile head/stand/i386/zfsloader/Makefile head/stand/libsa/Makefile head/stand/loader.mk head/stand/sparc64/loader/Makefile head/stand/sparc64/zfsloader/Makefile head/stand/userboot/userboot/Makefile Modified: head/stand/Makefile ============================================================================== --- head/stand/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -6,7 +6,7 @@ # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" -LIB32LIST=libsa ficl liblua zfs +LIB32LIST=libsa ficl liblua .endif S.yes+= libsa @@ -17,7 +17,6 @@ S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt S.${MK_LOADER_OFW}+= ofw -S.${MK_ZFS}+= zfs S.yes+= defaults S.yes+= man Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/defs.mk Sun Jul 8 07:42:49 2018 (r336084) @@ -28,7 +28,7 @@ LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot -ZFSSRC= ${BOOTSRC}/zfs +ZFSSRC= ${SASRC}/zfs BOOTOBJ= ${OBJTOP}/stand Modified: head/stand/efi/boot1/Makefile ============================================================================== --- head/stand/efi/boot1/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/efi/boot1/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -30,7 +30,6 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS+= -DEFI_ZFS_BOOT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -72,8 +71,8 @@ LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LIBEFI} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} Modified: head/stand/efi/loader/Makefile ============================================================================== --- head/stand/efi/loader/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/efi/loader/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -25,7 +25,6 @@ SRCS= autoload.c \ vers.c .if ${MK_ZFS} != "no" -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT HAVE_ZFS= yes @@ -120,8 +119,7 @@ loader.efi: ${PROG} LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ - ${LDSCRIPT} -LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} +LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} .include Modified: head/stand/i386/gptzfsboot/Makefile ============================================================================== --- head/stand/i386/gptzfsboot/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/i386/gptzfsboot/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -43,12 +43,6 @@ CFLAGS.clang+= -Wno-tentative-definition-incomplete-ty NO_WCAST_ALIGN= -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif - CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS+=${LD_FLAGS_BIN} @@ -75,7 +69,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} zfsboot.o: ${ZFSSRC}/zfsimpl.c Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/i386/loader/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} -LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 Modified: head/stand/i386/zfsboot/Makefile ============================================================================== --- head/stand/i386/zfsboot/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/i386/zfsboot/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -37,11 +37,6 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings CFLAGS.gcc+= --param max-inline-insns-single=100 -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif LD_FLAGS+=${LD_FLAGS_BIN} @@ -82,7 +77,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} SRCS= zfsboot.c Modified: head/stand/i386/zfsloader/Makefile ============================================================================== --- head/stand/i386/zfsloader/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/i386/zfsloader/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -3,5 +3,6 @@ LOADER= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/libsa/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -155,4 +155,9 @@ SRCS+= explicit_bzero.c .include "${SASRC}/geli/Makefile.inc" .endif +# Maybe ZFS +.if ${MK_ZFS} == "yes" +.include "${SASRC}/zfs/Makefile.inc" +.endif + .include Copied and modified: head/stand/libsa/zfs/Makefile.inc (from r336080, head/stand/zfs/Makefile) ============================================================================== --- head/stand/zfs/Makefile Sun Jul 8 01:29:48 2018 (r336080, copy source) +++ head/stand/libsa/zfs/Makefile.inc Sun Jul 8 07:42:49 2018 (r336084) @@ -1,20 +1,13 @@ # $FreeBSD$ -.include - -LIB= zfsboot - .PATH: ${ZFSSRC} SRCS+= zfs.c skein.c skein_block.c # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 .PATH: ${SYSDIR}/crypto/skein -CFLAGS+= -DBOOTPROG=\"zfsloader\" CFLAGS+= -I${LDRSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/crypto/skein CFLAGS+= -Wformat -Wall - -.include Copied and modified: head/stand/libsa/zfs/devicename_stubs.c (from r336080, head/stand/zfs/devicename_stubs.c) ============================================================================== Copied and modified: head/stand/libsa/zfs/libzfs.h (from r336080, head/stand/zfs/libzfs.h) ============================================================================== Copied and modified: head/stand/libsa/zfs/zfs.c (from r336080, head/stand/zfs/zfs.c) ============================================================================== Copied and modified: head/stand/libsa/zfs/zfsimpl.c (from r336080, head/stand/zfs/zfsimpl.c) ============================================================================== Modified: head/stand/loader.mk ============================================================================== --- head/stand/loader.mk Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/loader.mk Sun Jul 8 07:42:49 2018 (r336084) @@ -129,13 +129,6 @@ CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs SRCS+= zfs_cmd.c -.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 -# Have to override to use 32-bit version of zfs library... -# kinda lame to select that there XXX -LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a -.endif .endif LIBFICL= ${BOOTOBJ}/ficl/libficl.a Modified: head/stand/sparc64/loader/Makefile ============================================================================== --- head/stand/sparc64/loader/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/sparc64/loader/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -44,7 +44,7 @@ LDFLAGS+= -static LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw/ -DPADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} -LDADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} .include Modified: head/stand/sparc64/zfsloader/Makefile ============================================================================== --- head/stand/sparc64/zfsloader/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/sparc64/zfsloader/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -3,5 +3,6 @@ PROG= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" Modified: head/stand/userboot/userboot/Makefile ============================================================================== --- head/stand/userboot/userboot/Makefile Sun Jul 8 06:50:34 2018 (r336083) +++ head/stand/userboot/userboot/Makefile Sun Jul 8 07:42:49 2018 (r336084) @@ -41,14 +41,13 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a HAVE_ZFS=yes .endif # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. -DPADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LDR_INTERP} ${LIBSA} +LDADD+= ${LDR_INTERP} ${LIBSA} .include From owner-svn-src-head@freebsd.org Sun Jul 8 07:43:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F101FF94F3; Sun, 8 Jul 2018 07:43:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A04C7867EC; Sun, 8 Jul 2018 07:43:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8133323267; Sun, 8 Jul 2018 07:43:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w687h113093920; Sun, 8 Jul 2018 07:43:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w687gxcg093905; Sun, 8 Jul 2018 07:42:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807080742.w687gxcg093905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 07:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336085 - in head/stand: common i386/libi386 i386/loader ofw/libofw sparc64/loader userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common i386/libi386 i386/loader ofw/libofw sparc64/loader userboot/userboot X-SVN-Commit-Revision: 336085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 07:43:02 -0000 Author: imp Date: Sun Jul 8 07:42:58 2018 New Revision: 336085 URL: https://svnweb.freebsd.org/changeset/base/336085 Log: Stop using ../zfs/libzfs.h but instead use libzfs.h. While ../zfs/libzfs.h mostly works, there are a few situations where it does not. Eliminate the problem by using plain libzfs.h, like we do for ufs support. This fixes the weird cases, and is easier to understand. It also follows the general style convetion of avoiding ../ in #includes. Modified: head/stand/common/zfs_cmd.c head/stand/i386/libi386/Makefile head/stand/i386/libi386/devicename.c head/stand/i386/loader/conf.c head/stand/i386/loader/main.c head/stand/ofw/libofw/Makefile head/stand/ofw/libofw/devicename.c head/stand/sparc64/loader/main.c head/stand/userboot/userboot/conf.c head/stand/userboot/userboot/devicename.c head/stand/userboot/userboot/main.c Modified: head/stand/common/zfs_cmd.c ============================================================================== --- head/stand/common/zfs_cmd.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/common/zfs_cmd.c Sun Jul 8 07:42:58 2018 (r336085) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", Modified: head/stand/i386/libi386/Makefile ============================================================================== --- head/stand/i386/libi386/Makefile Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/i386/libi386/Makefile Sun Jul 8 07:42:58 2018 (r336085) @@ -14,6 +14,7 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} Modified: head/stand/i386/libi386/devicename.c ============================================================================== --- head/stand/i386/libi386/devicename.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/i386/libi386/devicename.c Sun Jul 8 07:42:58 2018 (r336085) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "disk.h" #include "libi386.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path); Modified: head/stand/i386/loader/conf.c ============================================================================== --- head/stand/i386/loader/conf.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/i386/loader/conf.c Sun Jul 8 07:42:58 2018 (r336085) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include "libi386/libi386.h" #if defined(LOADER_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/i386/loader/main.c Sun Jul 8 07:42:58 2018 (r336085) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "btxv86.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); Modified: head/stand/ofw/libofw/Makefile ============================================================================== --- head/stand/ofw/libofw/Makefile Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/ofw/libofw/Makefile Sun Jul 8 07:42:58 2018 (r336085) @@ -9,6 +9,7 @@ SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c ofw_time.c openfirm.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} Modified: head/stand/ofw/libofw/devicename.c ============================================================================== --- head/stand/ofw/libofw/devicename.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/ofw/libofw/devicename.c Sun Jul 8 07:42:58 2018 (r336085) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libofw.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); Modified: head/stand/sparc64/loader/main.c ============================================================================== --- head/stand/sparc64/loader/main.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/sparc64/loader/main.c Sun Jul 8 07:42:58 2018 (r336085) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef LOADER_ZFS_SUPPORT #include -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif #include Modified: head/stand/userboot/userboot/conf.c ============================================================================== --- head/stand/userboot/userboot/conf.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/userboot/userboot/conf.c Sun Jul 8 07:42:58 2018 (r336085) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* Modified: head/stand/userboot/userboot/devicename.c ============================================================================== --- head/stand/userboot/userboot/devicename.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/userboot/userboot/devicename.c Sun Jul 8 07:42:58 2018 (r336085) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path); Modified: head/stand/userboot/userboot/main.c ============================================================================== --- head/stand/userboot/userboot/main.c Sun Jul 8 07:42:49 2018 (r336084) +++ head/stand/userboot/userboot/main.c Sun Jul 8 07:42:58 2018 (r336085) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" static void userboot_zfs_probe(void); static int userboot_zfs_found; From owner-svn-src-head@freebsd.org Sun Jul 8 10:08:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CFA810319BB; Sun, 8 Jul 2018 10:08:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E86F8D0C9; Sun, 8 Jul 2018 10:08:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B52B248F8; Sun, 8 Jul 2018 10:08:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68A8OWD066860; Sun, 8 Jul 2018 10:08:24 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68A8Oc7066859; Sun, 8 Jul 2018 10:08:24 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201807081008.w68A8Oc7066859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 8 Jul 2018 10:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336086 - head/usr.sbin/newsyslog X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/usr.sbin/newsyslog X-SVN-Commit-Revision: 336086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 10:08:25 -0000 Author: ed Date: Sun Jul 8 10:08:24 2018 New Revision: 336086 URL: https://svnweb.freebsd.org/changeset/base/336086 Log: Use the FQDN in the newsyslog log message when RFC 5424 is enabled. The RFC 5424 spec mentions that logging FQDNs over short hostnames is preferred. Alter this code, so that the hostname doesn't get truncated on startup. Keep track of the length of the short hostname, so that fprintf() can do the truncation where necessary. MFC after: 1 month Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Sun Jul 8 07:42:58 2018 (r336085) +++ head/usr.sbin/newsyslog/newsyslog.c Sun Jul 8 10:08:24 2018 (r336086) @@ -271,6 +271,7 @@ static char daytime[DAYTIME_LEN];/* The current time i static char daytime_rfc5424[DAYTIME_RFC5424_LEN]; static char hostname[MAXHOSTNAMELEN]; /* hostname */ +static size_t hostname_shortlen; static const char *path_syslogpid = _PATH_SYSLOGPID; @@ -657,11 +658,8 @@ parse_args(int argc, char **argv) /* Let's get our hostname */ (void)gethostname(hostname, sizeof(hostname)); + hostname_shortlen = strcspn(hostname, "."); - /* Truncate domain */ - if ((p = strchr(hostname, '.')) != NULL) - *p = '\0'; - /* Parse command line options. */ while ((ch = getopt(argc, argv, "a:d:f:nrst:vCD:FNPR:S:")) != -1) switch (ch) { @@ -2349,14 +2347,20 @@ log_trim(const char *logname, const struct conf_entry } } else { if (log_ent->firstcreate) - fprintf(f, "%s %s newsyslog[%d]: logfile first created%s\n", - daytime, hostname, getpid(), xtra); + fprintf(f, + "%s %.*s newsyslog[%d]: logfile first created%s\n", + daytime, (int)hostname_shortlen, hostname, getpid(), + xtra); else if (log_ent->r_reason != NULL) - fprintf(f, "%s %s newsyslog[%d]: logfile turned over%s%s\n", - daytime, hostname, getpid(), log_ent->r_reason, xtra); + fprintf(f, + "%s %.*s newsyslog[%d]: logfile turned over%s%s\n", + daytime, (int)hostname_shortlen, hostname, getpid(), + log_ent->r_reason, xtra); else - fprintf(f, "%s %s newsyslog[%d]: logfile turned over%s\n", - daytime, hostname, getpid(), xtra); + fprintf(f, + "%s %.*s newsyslog[%d]: logfile turned over%s\n", + daytime, (int)hostname_shortlen, hostname, getpid(), + xtra); } if (fclose(f) == EOF) err(1, "log_trim: fclose"); From owner-svn-src-head@freebsd.org Sun Jul 8 14:22:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E78F1029340; Sun, 8 Jul 2018 14:22:25 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 A7587768A6; Sun, 8 Jul 2018 14:22:24 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-wr1-x443.google.com with SMTP id t6-v6so8349076wrn.7; Sun, 08 Jul 2018 07:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J38f9Mqa8BXeiJ+U++RUytZ6xTycrx8+h78xL31lSTQ=; b=kbQq+SgoFNdJrCON0HEt3by3pBEhnROL+q9nkhvFyWWQ7LyI5DPSjJ7hYKSfTpsozG jEtc7rXah15FJZ/wKtIoqrvBjFSC3VxjgRbQ45fuvYHRe/kq7Ek6s3818IkHYVsPA1SQ UW56r/kB538xyBb4v+Lbi5aAMIuvQvc2ytDOz1Ftf8PXHzZ7QPs9sWdULrnM1peem3vA 5uEsC5Hk+9kKmWVdhdS+vIAvlaDGCS8b25QrYhk+jSywB0RyVIvHPI+ncZ+H5Rq6Yj2k 67ekICoubVdn1hgWe0rj4Dw0FkMO/MFlQIsALb+xgZVnnd8LqtbUcphHgq30/3my2h8+ 3nTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=J38f9Mqa8BXeiJ+U++RUytZ6xTycrx8+h78xL31lSTQ=; b=pLuDjRSRndPOEDEL8Q9xafvyy9Nd8/l4Ar68FRrhcze/p95bjnDbv92BzgQRrEvq5V f8J3UwvmBFS7md5PKshUdGcxCoYsxTT4bxjBAvxuJBXcAx72HKsjFvlF+QA/70OVGpDe xs1Pwq8KZ5Z9rN3H7/7s4OVjzNYeI4aYHXEb39qPIFjVQdBJLGGlXiKpLwBPrhrPhSa8 nu8aR8wF07Wkm9fBT05GiYJJomXKcqRMC5MonLT9fdz7+hneBkFhhhurhvzf/RWVxBdn cEe8FO+/fVEmrzy/a1NKPZt51KGOUzRzKCQ/0hFKCIzBdkG+mSZq1ThbJJgtp71yMZJ4 mJRw== X-Gm-Message-State: APt69E2wxFMbYd/weLKu4zhMM3dclFSFgXmdDk1z8BggYVNRPrgrwuNA 3ZZadFgIKwTrjBzB6k1684Ho4g== X-Google-Smtp-Source: AAOMgpeufyyXmn6dDr60hEkt5GZ3kH1JkUZQmZS0ydnpnCIfRS7HanTBx9NtbeTqA66O+DqVuUitJA== X-Received: by 2002:adf:acc3:: with SMTP id o61-v6mr13024326wrc.34.1531059743419; Sun, 08 Jul 2018 07:22:23 -0700 (PDT) Received: from pesky (174.red-81-43-74.staticip.rima-tde.net. [81.43.74.174]) by smtp.gmail.com with ESMTPSA id h102-v6sm19315481wrh.60.2018.07.08.07.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 07:22:22 -0700 (PDT) Sender: Mark Johnston Date: Sun, 8 Jul 2018 10:22:17 -0400 From: Mark Johnston To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335879 - in head/sys: conf kern sys Message-ID: <20180708142210.GA18193@pesky> References: <201807030155.w631tARo009470@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807030155.w631tARo009470@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 14:22:25 -0000 On Tue, Jul 03, 2018 at 01:55:10AM +0000, Matt Macy wrote: > Author: mmacy > Date: Tue Jul 3 01:55:09 2018 > New Revision: 335879 > URL: https://svnweb.freebsd.org/changeset/base/335879 > > Log: > make critical_{enter, exit} inline > > Avoid pulling in all of the dependencies by > automatically generating a stripped down thread_lite exporting > only the fields of interest. The field declarations are type checked > against the original and the offsets of the generated result is > automatically checked. > > kib has expressed disagreement and would have preferred to simply > use genassym style offsets (which loses type check enforcement). > jhb has expressed dislike of it due to header pollution and a > duplicate structure. He would have preferred to just have defined > thread in _thread.h. Nonetheless, he admits that this is the only > viable solution at the moment. > > The impetus for this came from mjg's D15331: > "Inline critical_enter/exit for amd64" > > Reviewed by: jeff > Differential Revision: https://reviews.freebsd.org/D16078 > > [...] > +#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET) > +#define critical_enter() critical_enter_KBI() > +#define critical_exit() critical_exit_KBI() > +#else > +static __inline void > +critical_enter(void) > +{ > + struct thread_lite *td; > + > + td = (struct thread_lite *)curthread; > + td->td_critnest++; Don't we need a compiler barrier here? > +} > + > +static __inline void > +critical_exit(void) > +{ > + struct thread_lite *td; > + > + td = (struct thread_lite *)curthread; > + KASSERT(td->td_critnest != 0, > + ("critical_exit: td_critnest == 0")); > + td->td_critnest--; > + __compiler_membar(); > + if (__predict_false(td->td_owepreempt)) > + critical_exit_preempt(); > + > +} > +#endif > + > + > #ifdef EARLY_PRINTF > typedef void early_putc_t(int ch); > extern early_putc_t *early_putc; > From owner-svn-src-head@freebsd.org Sun Jul 8 15:05:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27896102DBE0 for ; Sun, 8 Jul 2018 15:05:04 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89016781FF for ; Sun, 8 Jul 2018 15:05:03 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w68F4v49061874; Sun, 8 Jul 2018 08:04:57 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w68F4tas061873; Sun, 8 Jul 2018 08:04:55 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201807081504.w68F4tas061873@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r335916 - head/sys/conf In-Reply-To: To: Warner Losh Date: Sun, 8 Jul 2018 08:04:55 -0700 (PDT) CC: "Rodney W. Grimes" , Eugene Grosbein , Andrew Gallatin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:05:04 -0000 > On Sat, Jul 7, 2018 at 7:06 PM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > > On Sat, Jul 7, 2018, 5:40 PM Eugene Grosbein wrote: > > > > > > > 08.07.2018 4:38, Warner Losh wrote: > > > > > > > > > On Sat, Jul 7, 2018, 4:14 PM Eugene Grosbein > > > > wrote: > > > > > > > > > > 07.07.2018 22:02, Andrew Gallatin wrote: > > > > > > > > > > > One thing that was tangentially brought up is that the ability > > > > > > to compile out-of-tree modules requires keeping the > > kernel-headers > > > > > > around. So we may need to identify all the headers that a > > module > > > > might > > > > > > need, and install them in /boot/$KERNEL/sys or some-such. This > > > > would > > > > > > be needed if, for example, we wanted to install a new Nvidia or > > > > Virtual > > > > > > Box module and have it work for older installed kernel > > versions too > > > > > > (eg, across ABI breaking changes in -current). > > > > > > > > > > We already have all headers in /usr/include, don't we? > > > > > > > > > > > > > > > Not really. We have a subset of the kernel headers that might not > > match > > > > the running kernel, nor be enough to build modules. > > > > > > > > They should match running kernel definitely as we do not support not > > > > syncronized kernel/world > > > > and installworld populates /usr/include. > > > > > > > > > > Nice theory. Lots and lots of people run this way. And it has worked > > well, > > > so long as the kernel is newer... so, no, they don't have to match. > > > > At some point I had an evolution of "make includes" that would work > > without the other parts of src being present (ie, only sys) so that > > you could update /usr/include with the kernel headers if you reved > > your kernel sources. > > > > Not sure how hard this would be to reimplement, but basically skip over > > missing parts of the src tree with a message (echo) that it could not > > find that particular set of sources was how it worked. > > > I really don't like this idea. It assumes The Kernel and The Includes. + match? > However, that's not quite right. For people running releases, it's near > enough, but for developers it's not. I have, in the past, installed a > weekly kernel into /boot/kernel.$DATE and kept a constant userland. I did > this to catch performance regressions by being able to reboot quickly > between then. At any given time, we'd not have the right headers with this > scheme. Certainly not good enough to compile a module against the currently > booted kernel. This addition is for the users, not for the developers, developers are in there own world and far more capable of managing the complex environment of multiple kernels and includes. I strongly encourage rm -rf /usr/include/ && make includes Users typically only run the latest sys/kernel tree and this only need to move forward with /usr/include and this works well for that. > > I've started to like the idea of keeping module sources for 3rd party > modules /usr/local/ and using that to rebuild the module for a > specific kernel. I think we are all on board with that idea. > If we were to install the kernel includes / opt*.h files > also into /boot/$KERNEL/include somehow, then 3rd party modules could be > rebuilt at any time and we'd always have access to the builddir files that > matter... Something to consider... I think I read that Linux did this to > help prevent module breakage when new kernels are used... It may be time > to ditch /boot/modules entirely in favor of a scheme like this. First order to me would be to implement "kernelincludes" as a top level target, that would populate ${DESTDIR}/some/mumble. This would be a fairly general use function that could be abused to implement the above. > > > /usr/include is never, ever used to build the kernel (except for things > > > like aicasm). > > > > Is not /usr/include really the kernel/userland interface, > > not the kernel/kernel interface? > > > > Yea, and more. It's a bit of hodge-podge, but on the whole, that's not an > inaccurate characterization. Especially the bit about it not being the > intra-kernel interface. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jul 8 15:10:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A5FD102E57F; Sun, 8 Jul 2018 15:10:38 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE464784FA; Sun, 8 Jul 2018 15:10:37 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-234-146.albq.qwest.net [67.0.234.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 19BD81AF636; Sun, 8 Jul 2018 07:21:19 +0000 (UTC) Subject: Re: svn commit: r334880 - head/sys/dev/vnic To: Mark Johnston , Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: Date: Sun, 8 Jul 2018 09:10:27 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180707174351.GA95934@pesky> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GvQmRhFURa83tvIVOlxHjsgU37ym3N6yw" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:10:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GvQmRhFURa83tvIVOlxHjsgU37ym3N6yw Content-Type: multipart/mixed; boundary="g7z02vWL7XFIzbuyfh2VKta7p2q26nzWV"; protected-headers="v1" From: Sean Bruno To: Mark Johnston , Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r334880 - head/sys/dev/vnic References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> In-Reply-To: <20180707174351.GA95934@pesky> --g7z02vWL7XFIzbuyfh2VKta7p2q26nzWV Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 07/07/18 11:43, Mark Johnston wrote: > On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: >> Author: andrew >> Date: Sat Jun 9 14:47:49 2018 >> New Revision: 334880 >> URL: https://svnweb.freebsd.org/changeset/base/334880 >> >> Log: >> In the ThunderX BGX network driver we were skipping the NULL termina= tor >> when parsing the phy type, however this is included in the length re= turned >> by OF_getprop. To fix this stop ignoring the terminator. >> =20 >> PR: 228828 >> Reported by: sbruno >> Sponsored by: DARPA, AFRL >=20 > This seems to break vnic on packet.net ThunderXs. In particular, VF > creation fails. It seems the problem in my case is that there are > multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With this= > change, bgx_fdt_phy_name_match() fails to match against any device > containing a unit address in the node name. >=20 Huh ... this was *required* to get the ThunderXs we have in the FreeBSD cluster to work at all. o.0 I guess "someone" needs to contact "someone" to figure out which is correct or we need to replace our FreeBSD cluster machines with ones that work like the packet.net machines? sean --g7z02vWL7XFIzbuyfh2VKta7p2q26nzWV-- --GvQmRhFURa83tvIVOlxHjsgU37ym3N6yw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAltCKWRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LY2hQf9FZse8++rIG12toi3Eo9hHYje38fRsaisK085mAhrcIsZp252Rr/fFj74 zcygj3X19VSxSuxchKI/1YSlwJM6VA9o51TvcVjwTMKADSImRWxhIX+hgmuhdlIK JTHncLtOvBREtqSuJ/mI3rtfP5NXSRYPnXrC6YUTOHcWYQBr3yLkTrLXDeyjNSLf umRMvIkcC3xxbbctIYyHn9GXfszHoohIqGFUBJfw2dLyp2L9x+oiR2VccSmbZJsu pKuTnFxtDU6RxpjWqDhvn4nx+NdNTVqXpFgu92D/d+2AI8WjNQQTQV5CQzjZIP/H bdKoRtlLo3XDxQX02XMAb8d/BIuObg== =REtC -----END PGP SIGNATURE----- --GvQmRhFURa83tvIVOlxHjsgU37ym3N6yw-- From owner-svn-src-head@freebsd.org Sun Jul 8 15:26:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 487BC102FF56; Sun, 8 Jul 2018 15:26:26 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (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 D0DC979706; Sun, 8 Jul 2018 15:26:25 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-wr1-x444.google.com with SMTP id p1-v6so8429917wrs.9; Sun, 08 Jul 2018 08:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9X7E7ebd/vk+nPtu954N7nCU6Y+7mpWI/j5JQZd7CF0=; b=G0r2xgDdSYFDCYt9Cee9OkwpZ6/neirS04XcZKLD3llitfGLRzie7XEqSEKL3P0NW8 I1J+ZWhvvmWqRNHdADAFhOxaOSrVNQqSaK9vy01nap+kxycN/tnC5TeaLXmLC1eCVuii THCUXkbLXGA1/axAkr2YdgF+jhUXGUhtpcBY2K0ptHs/Tuyt+rYZYWRxJTVYjTGCbieG PI6cL1w+KnfvqaV6ZnhcLhI+Z7KMtSF35MVkT7dibjdaSqxelEJMS3SFl9E8OfKz89BO asXOGn10ccjDiXKnnSrLJUkTeFNmZRYWd0Bmzliz9e+KgYoVbnI6sY2Sf722ttu5he/5 d/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9X7E7ebd/vk+nPtu954N7nCU6Y+7mpWI/j5JQZd7CF0=; b=M3p1PTnIXlTSHbiHB8e+S+dIl+wy8NOHGsY6R7ia17YAAjxoVqY23xMvquvS2bbRHI TiIEPp4fD2ZIyDPU1UEBk5eUL68HyK+nUqEuzup86I4Hdw9YJGYryDMNwGJucRd6e/x4 VSIZMABGRb17tgB+cyEO4DxzdRZZeSSDgxpOC/Dni75kl1Q2Jbw9KTzZFwt1GH2SKCnk DNMdtZbuRSdHmu7MGInxxgyl40qRN3KvEKrJWMz0VMOnEjqkLiQaGHRihjcHYlc36Jd1 N/ZmlibrHyAuP8ePJWtdEL25l92B5JcSmat/+W8+dmNYZ2w83dMz5uLTVwFIvS4GeAZ7 2aBA== X-Gm-Message-State: APt69E2g/8Y00/DZhUTVRHy7YES9i7cCSMVqc0zreZx2kADhBNNxNhJe qfmwrUIqtbblZdK2RpQW0sbLQQ== X-Google-Smtp-Source: AAOMgpcMuc7CYF0bHGQfWbVoKdC/tt8IW3OI6rPOMBrjQOHAKxXpyrtQzXC9LCAeecaTLg7FLfrZNw== X-Received: by 2002:adf:9996:: with SMTP id y22-v6mr13322926wrb.69.1531063584574; Sun, 08 Jul 2018 08:26:24 -0700 (PDT) Received: from pesky (174.red-81-43-74.staticip.rima-tde.net. [81.43.74.174]) by smtp.gmail.com with ESMTPSA id h4-v6sm13689821wre.89.2018.07.08.08.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 08:26:23 -0700 (PDT) Sender: Mark Johnston Date: Sun, 8 Jul 2018 11:26:21 -0400 From: Mark Johnston To: Sean Bruno Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334880 - head/sys/dev/vnic Message-ID: <20180708152621.GB18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:26:26 -0000 On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > > > On 07/07/18 11:43, Mark Johnston wrote: > > On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: > >> Author: andrew > >> Date: Sat Jun 9 14:47:49 2018 > >> New Revision: 334880 > >> URL: https://svnweb.freebsd.org/changeset/base/334880 > >> > >> Log: > >> In the ThunderX BGX network driver we were skipping the NULL terminator > >> when parsing the phy type, however this is included in the length returned > >> by OF_getprop. To fix this stop ignoring the terminator. > >> > >> PR: 228828 > >> Reported by: sbruno > >> Sponsored by: DARPA, AFRL > > > > This seems to break vnic on packet.net ThunderXs. In particular, VF > > creation fails. It seems the problem in my case is that there are > > multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With this > > change, bgx_fdt_phy_name_match() fails to match against any device > > containing a unit address in the node name. > > > > > Huh ... this was *required* to get the ThunderXs we have in the FreeBSD > cluster to work at all. o.0 > > I guess "someone" needs to contact "someone" to figure out which is > correct or we need to replace our FreeBSD cluster machines with ones > that work like the packet.net machines? I think the current code works fine if there's only one PHY device, so my problem is probably just the result of having a different hardware setup. We can probably fix the code to handle both cases. Could you mail me the output of "ofwdump -ap" from the cluster machine? From owner-svn-src-head@freebsd.org Sun Jul 8 15:39:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A46441031596 for ; Sun, 8 Jul 2018 15:39:53 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C16937A20E for ; Sun, 8 Jul 2018 15:39:52 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 25e0be1e-82c5-11e8-8837-614b7c574d04 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 25e0be1e-82c5-11e8-8837-614b7c574d04; Sun, 08 Jul 2018 15:39:49 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w68Fdm4Z031432; Sun, 8 Jul 2018 09:39:48 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1531064388.1336.10.camel@freebsd.org> Subject: Re: svn commit: r334880 - head/sys/dev/vnic From: Ian Lepore To: Mark Johnston , Sean Bruno Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 08 Jul 2018 09:39:48 -0600 In-Reply-To: <20180708152621.GB18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:39:53 -0000 On Sun, 2018-07-08 at 11:26 -0400, Mark Johnston wrote: > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > > > > > > > > On 07/07/18 11:43, Mark Johnston wrote: > > > > > > On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: > > > > > > > > Author: andrew > > > > Date: Sat Jun  9 14:47:49 2018 > > > > New Revision: 334880 > > > > URL: https://svnweb.freebsd.org/changeset/base/334880 > > > > > > > > Log: > > > >   In the ThunderX BGX network driver we were skipping the NULL terminator > > > >   when parsing the phy type, however this is included in the length returned > > > >   by OF_getprop. To fix this stop ignoring the terminator. > > > >    > > > >   PR: 228828 > > > >   Reported by: sbruno > > > >   Sponsored by: DARPA, AFRL > > > This seems to break vnic on packet.net ThunderXs.  In particular, VF > > > creation fails.  It seems the problem in my case is that there are > > > multiple PHY devices in the device tree, e.g., xfi@0, xfi@1.  With this > > > change, bgx_fdt_phy_name_match() fails to match against any device > > > containing a unit address in the node name. > > > > > > > Huh ... this was *required* to get the ThunderXs we have in the FreeBSD > > cluster to work at all.  o.0 > > > > I guess "someone" needs to contact "someone" to figure out which is > > correct or we need to replace our FreeBSD cluster machines with ones > > that work like the packet.net machines? > I think the current code works fine if there's only one PHY device, so > my problem is probably just the result of having a different hardware > setup.  We can probably fix the code to handle both cases.  Could you > mail me the output of "ofwdump -ap" from the cluster machine? > ofwdump isn't very useful, you'll get much nicer output with:   sysctl -b hw.fdt.dtb | dtc -I dtb -O dts >somefile.dts BTW, the whole idea of searching for a phy by walking the node hierarchy doing string comparisons on node names sounds pretty antithetical to the whole design of fdt data. Are these nodes not properly cross-linked with phandles? -- Ian From owner-svn-src-head@freebsd.org Sun Jul 8 15:48:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1E8D1032407; Sun, 8 Jul 2018 15:48:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EB0C7A908; Sun, 8 Jul 2018 15:48: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 714DD27F79; Sun, 8 Jul 2018 15:48:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68FmlYc041483; Sun, 8 Jul 2018 15:48:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68FmlX5041482; Sun, 8 Jul 2018 15:48:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201807081548.w68FmlX5041482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 Jul 2018 15:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336088 - head/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/include X-SVN-Commit-Revision: 336088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:48:48 -0000 Author: kib Date: Sun Jul 8 15:48:47 2018 New Revision: 336088 URL: https://svnweb.freebsd.org/changeset/base/336088 Log: Add a missed chunk r335939. Noted by: David Carlier MFC after: 9 days Differential revision: https://reviews.freebsd.org/D16178 Modified: head/include/unistd.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Sun Jul 8 10:54:11 2018 (r336087) +++ head/include/unistd.h Sun Jul 8 15:48:47 2018 (r336088) @@ -571,6 +571,7 @@ int setloginclass(const char *); void *setmode(const char *); int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ void setproctitle(const char *_fmt, ...) __printf0like(1, 2); +void setproctitle_fast(const char *_fmt, ...) __printf0like(1, 2); int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); int setrgid(gid_t); From owner-svn-src-head@freebsd.org Sun Jul 8 15:55:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 531A81033164; Sun, 8 Jul 2018 15:55:47 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB9D7B062; Sun, 8 Jul 2018 15:55:46 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-234-146.albq.qwest.net [67.0.234.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 07A0D1AF636; Sun, 8 Jul 2018 08:06:33 +0000 (UTC) Subject: Re: svn commit: r334880 - head/sys/dev/vnic To: Mark Johnston Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> Date: Sun, 8 Jul 2018 09:55:34 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180708152621.GB18193@pesky> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="U0uwA7FJ9ZOpcQwwrjY13Yxih2rrWtbJH" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:55:47 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --U0uwA7FJ9ZOpcQwwrjY13Yxih2rrWtbJH Content-Type: multipart/mixed; boundary="Fthl8wJcqgk2RIIFbKMrPvErFg9rm1sal"; protected-headers="v1" From: Sean Bruno To: Mark Johnston Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> Subject: Re: svn commit: r334880 - head/sys/dev/vnic References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> In-Reply-To: <20180708152621.GB18193@pesky> --Fthl8wJcqgk2RIIFbKMrPvErFg9rm1sal Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 07/08/18 09:26, Mark Johnston wrote: > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: >> >> >> On 07/07/18 11:43, Mark Johnston wrote: >>> On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: >>>> Author: andrew >>>> Date: Sat Jun 9 14:47:49 2018 >>>> New Revision: 334880 >>>> URL: https://svnweb.freebsd.org/changeset/base/334880 >>>> >>>> Log: >>>> In the ThunderX BGX network driver we were skipping the NULL termi= nator >>>> when parsing the phy type, however this is included in the length = returned >>>> by OF_getprop. To fix this stop ignoring the terminator. >>>> =20 >>>> PR: 228828 >>>> Reported by: sbruno >>>> Sponsored by: DARPA, AFRL >>> >>> This seems to break vnic on packet.net ThunderXs. In particular, VF >>> creation fails. It seems the problem in my case is that there are >>> multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With th= is >>> change, bgx_fdt_phy_name_match() fails to match against any device >>> containing a unit address in the node name. >>> >> >> >> Huh ... this was *required* to get the ThunderXs we have in the FreeBS= D >> cluster to work at all. o.0 >> >> I guess "someone" needs to contact "someone" to figure out which is >> correct or we need to replace our FreeBSD cluster machines with ones >> that work like the packet.net machines? >=20 > I think the current code works fine if there's only one PHY device, so > my problem is probably just the result of having a different hardware > setup. We can probably fix the code to handle both cases. Could you > mail me the output of "ofwdump -ap" from the cluster machine? >=20 >=20 I dropped the output here: https://people.freebsd.org/~sbruno/ofwdump.txt sean --Fthl8wJcqgk2RIIFbKMrPvErFg9rm1sal-- --U0uwA7FJ9ZOpcQwwrjY13Yxih2rrWtbJH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAltCM/ZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LbCeQf/f+eJK3HoXZNE0GXy13SochYy32P3nhCUNg4zZ+i0Pl7nXalRjKBbXJE3 8SRKU7xbOObcw41BBKqbEr8kAf9U4xMwVkt+K4iBReaMoPLuscHNlm+THwnDoKff O6l2zpqP7nCc5A1uG8gjOnbyx8ssnmDZ9AS6cBuBRRRAsBVY/3cfmK+jeTIT35Se ufjE9CWHjKfhNvBOpXgoA0Jhe4Hbo4mWP2lJrFYRTBinefykG+61RdehtzovikoU tozgl3zJvVF8mYqUAWnJx1oE2Huq9D9MkDESZgBKySTfexWvaobPmsQ1Js8zjS08 TLDcQJccsvCv1o9N0q7Z9n5swZxAGw== =GB/A -----END PGP SIGNATURE----- --U0uwA7FJ9ZOpcQwwrjY13Yxih2rrWtbJH-- From owner-svn-src-head@freebsd.org Sun Jul 8 15:58:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BB361033719 for ; Sun, 8 Jul 2018 15:58:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEC957B2EF for ; Sun, 8 Jul 2018 15:58:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id q4-v6so14953463iob.2 for ; Sun, 08 Jul 2018 08:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qZHvpyhsNLpGyuhzQ98YV1d4CrnoAm14lNJgZCznvAg=; b=JXAZqI2agqWquUV2d0+Dg1dRQH1TKlcqLVDOShr/e82XiWDZrFGO7bQG/zgfm/PwXP eoYBpprPRfNrSCtuV+Z7HC0CCd7WHimfjOijYHbwIUcEJpqmtlNcU2MXwmhjG4Tfu3sP EMKbsXUrM5BnKlzAdX8NbgupmewWbCDHaF9DagsEt4N+ZtyX5BGqvjNIUSILt/3mEBF6 C8TJuUIbWy3zYwQ6h2ktRExlrfmZ2YO2i7Y6xYEt40WRCodL/oTNbTkXTSSTnoUpvbam SSPc/kfOofH80NW34124u4YfHujcDl2ZtEG6UC71K20Fv9nTmUol2qmRFWXGP0L13XzD Da9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qZHvpyhsNLpGyuhzQ98YV1d4CrnoAm14lNJgZCznvAg=; b=kRoTIUD/beCxxdt27GorZx4Uof7I1OSO3ytM2wHm5mu9HFrKOAZN70ev5XKhuM3Zkt cFsncv3ljltOy/0kR3ZD7HpCiBfSP9cy+u/w+5+343cZ+fM77eIcqu2oKKPLPg4lMsOs GBkOa2hUl3zdQ9zpuxmOwG/pjOsWXuk1n1pVpsGeYZTF9a4EeIZbaSEJKeCFro1q1DFB SskSYUKu9Fca8JZyyH7ad4Ms+1jJKlikbCMreB/k3BRk5nwWI7M9jfEcYEwjqOqll2Aa q6e2V0uuv9RaUQD0hiCthianV16VHg/ywQs3clUmEwFM0GHnsKckzPj6E38/2aGA9xIl 0qJA== X-Gm-Message-State: APt69E0umiSPHi2cEgGADEjMuivyd9YobiEur/CgztUT/pQk5AtE9sed XJ6VTi5tWiSqgEq8V8Z37/KX3u4lKVw1M5HuskjLvQ== X-Google-Smtp-Source: AAOMgpfEJWhNeMLcwI/JcAtqqYkWiWZoOIMEXBvvIQ7odTqgYMHukUm6loY72WF2Rak92H6O93bmJwQ8v8c5jKB/fHI= X-Received: by 2002:a6b:d40c:: with SMTP id l12-v6mr14827251iog.37.1531065516007; Sun, 08 Jul 2018 08:58:36 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:1183:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 08:58:35 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> From: Warner Losh Date: Sun, 8 Jul 2018 09:58:35 -0600 X-Google-Sender-Auth: oMQu8iYXZNmWF3bmeormSKAQs7c Message-ID: Subject: Re: svn commit: r334880 - head/sys/dev/vnic To: Sean Bruno Cc: Mark Johnston , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:58:37 -0000 On Sun, Jul 8, 2018 at 9:55 AM, Sean Bruno wrote: > > > On 07/08/18 09:26, Mark Johnston wrote: > > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > >> > >> > >> On 07/07/18 11:43, Mark Johnston wrote: > >>> On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: > >>>> Author: andrew > >>>> Date: Sat Jun 9 14:47:49 2018 > >>>> New Revision: 334880 > >>>> URL: https://svnweb.freebsd.org/changeset/base/334880 > >>>> > >>>> Log: > >>>> In the ThunderX BGX network driver we were skipping the NULL > terminator > >>>> when parsing the phy type, however this is included in the length > returned > >>>> by OF_getprop. To fix this stop ignoring the terminator. > >>>> > >>>> PR: 228828 > >>>> Reported by: sbruno > >>>> Sponsored by: DARPA, AFRL > >>> > >>> This seems to break vnic on packet.net ThunderXs. In particular, VF > >>> creation fails. It seems the problem in my case is that there are > >>> multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With > this > >>> change, bgx_fdt_phy_name_match() fails to match against any device > >>> containing a unit address in the node name. > >>> > >> > >> > >> Huh ... this was *required* to get the ThunderXs we have in the FreeBSD > >> cluster to work at all. o.0 > >> > >> I guess "someone" needs to contact "someone" to figure out which is > >> correct or we need to replace our FreeBSD cluster machines with ones > >> that work like the packet.net machines? > > > > I think the current code works fine if there's only one PHY device, so > > my problem is probably just the result of having a different hardware > > setup. We can probably fix the code to handle both cases. Could you > > mail me the output of "ofwdump -ap" from the cluster machine? > > > > > > > I dropped the output here: > https://people.freebsd.org/~sbruno/ofwdump.txt Ian's method is better. But Ian's question is better: are there not phandles to find this stuff? Names in FDT are kinda meaningless most of the time (I say kinda here to gloss over a laundry list of exceptions that PHY finding typically does not fall into). Warner From owner-svn-src-head@freebsd.org Sun Jul 8 15:59:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AA59103380F; Sun, 8 Jul 2018 15:59:09 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB28B7B43C; Sun, 8 Jul 2018 15:59:08 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-234-146.albq.qwest.net [67.0.234.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 869D91AF636; Sun, 8 Jul 2018 08:09:56 +0000 (UTC) Subject: Re: svn commit: r334880 - head/sys/dev/vnic To: Ian Lepore , Mark Johnston Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <1531064388.1336.10.camel@freebsd.org> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: Date: Sun, 8 Jul 2018 09:59:07 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1531064388.1336.10.camel@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tqce7yKjQfaC3l3QCoOTx1l8vu3C23Lk7" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 15:59:09 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tqce7yKjQfaC3l3QCoOTx1l8vu3C23Lk7 Content-Type: multipart/mixed; boundary="nqdKMyYWPh4gGEfJM4bZiSOX2cLjxHXJp"; protected-headers="v1" From: Sean Bruno To: Ian Lepore , Mark Johnston Cc: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r334880 - head/sys/dev/vnic References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <1531064388.1336.10.camel@freebsd.org> In-Reply-To: <1531064388.1336.10.camel@freebsd.org> --nqdKMyYWPh4gGEfJM4bZiSOX2cLjxHXJp Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable >=20 > ofwdump isn't very useful, you'll get much nicer output with: >=20 > =C2=A0=C2=A0sysctl -b hw.fdt.dtb | dtc -I dtb -O dts >somefile.dts >=20 > BTW, the whole idea of searching for a phy by walking the node > hierarchy doing string comparisons on node names sounds pretty > antithetical to the whole design of fdt data. Are these nodes not > properly cross-linked with phandles? >=20 > -- Ian >=20 Hrm ... this seems broken on these thundex machines. # sysctl -b hw.fdt.dtb | dtc -I dtb -O dts Error: property check failed, while checking node: / /soc @0 /pci @8480,00000000 [-Wtype-compatible] I dropped the output of the sysctl -b to: https://people.freebsd.org/~sbruno/thunderx_dtb.bin sean --nqdKMyYWPh4gGEfJM4bZiSOX2cLjxHXJp-- --tqce7yKjQfaC3l3QCoOTx1l8vu3C23Lk7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAltCNMtfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LbbgQgApXmbcv9DAD5iS8oYAF0yhY2M1VoBy5DlOxcpR9zDrBt/8hidB+N4ar5W urEPwqWR6m6nb0Iga8uTfF0UHF67YkJZuBmZ0p1nY5+XME7DjzhimJJQojT+5RME yr+9F3nR6EHd8TwvCM1UJ1gPbTBzN2NZLMJ5u6VtUcEJCXrf5j9Lkeehse13jLy9 vYggBWOVbrF77K659P98yb7s3+TC1roR2fzy6wuxA2RvcFXwxAiIJhdzEytIrFEt VP7hNPXx+dicqs4vNM1CyBoUT6CwLr3lxVtHnlDk32yb9ZV89n7ocTW1mBIGdgSq UAHN+Zzl6aRbClKDK5wKAzogUtyf1A== =mcZG -----END PGP SIGNATURE----- --tqce7yKjQfaC3l3QCoOTx1l8vu3C23Lk7-- From owner-svn-src-head@freebsd.org Sun Jul 8 16:14:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 587B3103564E; Sun, 8 Jul 2018 16:14:20 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (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 BB5637C138; Sun, 8 Jul 2018 16:14:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-wr1-x444.google.com with SMTP id r16-v6so8497533wrt.11; Sun, 08 Jul 2018 09:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fPhRJvaRxQGk++DXhggBg7BocmERMlqv0X7zWwgbGtw=; b=iZlyks4ZWr/Dq5JaDiQkH8mp295YGitCtpCTAq75wjG9yz4wXW/iQFLo0A0j6EEdfe 63Br3N444UbwWyxGAbqpA7rrGBAEqE3jhS1AhAF3jh6SefqKnTr3lMqDSQ0q4tECm56e 5uFfSO4TsUF7JykHuNCtFPBbnn9XusMZ9GvJDgVGk7mwSST7DiAJ5GazG1k/IbjGKs8l zanQdIz0+APp31eSyxdZRIeb+Mx7dm3WPnT7hM/hzSCpGzB5Um+JQKWGeHBOw+CFbZZD OFvuPnCM6+MRb/6HGXukQB4oy+6AyyrdDLYK+nCTb85vpA0joUZ4fMeU8QvI3KawQGUF SYMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fPhRJvaRxQGk++DXhggBg7BocmERMlqv0X7zWwgbGtw=; b=gIlvV0XmsEwabCsdgALK+N2FcfQrG2riKaWIhZwGZOnpP29BwmEDcIe8v9H5Holn77 6nC6YgW0EUUKQquClfz00TYPMA2JJW3y+tkJSzik29hL7FNt8SrNHbRXjGsb55+vlHs/ X1z9ovTNF3L8uk4/CEGABHHApewmhbCJSEkEDsTu++GkH9rSod2EC1BprBiGgRUEROti x04I19CS2CFlo8rR7lOhzct7Dxw7ZOVkQIUQddVmSBFrDryI79wwH28+qTV3mafdvou/ plLRqRs022paGjHGsHctoRbo0sfdG5sYnu4ntpCSwe1fT1wIHM7x2bnaJ6mDvtluvVzb kWYA== X-Gm-Message-State: APt69E26JTluGR5DQW9/BrbRLQYXHEJq5RwX0wae44HZ7EchwgIeuuN3 GBGn5lLtA9CT2mGokPCkJ6tu2mmJ X-Google-Smtp-Source: AAOMgpfzGl2HAOK/ez0MORCwNslDQ10r86iM6YydImnV6PuYBuAG1ImRBbVbMtVKF9zAWnl5d97d5A== X-Received: by 2002:adf:a49a:: with SMTP id g26-v6mr12912277wrb.91.1531066458685; Sun, 08 Jul 2018 09:14:18 -0700 (PDT) Received: from pesky (174.red-81-43-74.staticip.rima-tde.net. [81.43.74.174]) by smtp.gmail.com with ESMTPSA id j131-v6sm14604965wmb.35.2018.07.08.09.14.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 09:14:17 -0700 (PDT) Sender: Mark Johnston Date: Sun, 8 Jul 2018 12:14:15 -0400 From: Mark Johnston To: Warner Losh Cc: Sean Bruno , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334880 - head/sys/dev/vnic Message-ID: <20180708161415.GD18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:14:20 -0000 On Sun, Jul 08, 2018 at 09:58:35AM -0600, Warner Losh wrote: > On Sun, Jul 8, 2018 at 9:55 AM, Sean Bruno wrote: > > > > > > > On 07/08/18 09:26, Mark Johnston wrote: > > > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > > >> > > >> > > >> On 07/07/18 11:43, Mark Johnston wrote: > > >>> On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: > > >>>> Author: andrew > > >>>> Date: Sat Jun 9 14:47:49 2018 > > >>>> New Revision: 334880 > > >>>> URL: https://svnweb.freebsd.org/changeset/base/334880 > > >>>> > > >>>> Log: > > >>>> In the ThunderX BGX network driver we were skipping the NULL > > terminator > > >>>> when parsing the phy type, however this is included in the length > > returned > > >>>> by OF_getprop. To fix this stop ignoring the terminator. > > >>>> > > >>>> PR: 228828 > > >>>> Reported by: sbruno > > >>>> Sponsored by: DARPA, AFRL > > >>> > > >>> This seems to break vnic on packet.net ThunderXs. In particular, VF > > >>> creation fails. It seems the problem in my case is that there are > > >>> multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With > > this > > >>> change, bgx_fdt_phy_name_match() fails to match against any device > > >>> containing a unit address in the node name. > > >>> > > >> > > >> > > >> Huh ... this was *required* to get the ThunderXs we have in the FreeBSD > > >> cluster to work at all. o.0 > > >> > > >> I guess "someone" needs to contact "someone" to figure out which is > > >> correct or we need to replace our FreeBSD cluster machines with ones > > >> that work like the packet.net machines? > > > > > > I think the current code works fine if there's only one PHY device, so > > > my problem is probably just the result of having a different hardware > > > setup. We can probably fix the code to handle both cases. Could you > > > mail me the output of "ofwdump -ap" from the cluster machine? > > > > > > > > > > > > I dropped the output here: > > https://people.freebsd.org/~sbruno/ofwdump.txt > > > Ian's method is better. But Ian's question is better: are there not > phandles to find this stuff? Names in FDT are kinda meaningless most of the > time (I say kinda here to gloss over a laundry list of exceptions that PHY > finding typically does not fall into). Sean's output shows why the current code works for him. In my case the bgx subnodes don't contain a qlm-mode property, so we're falling back to name matching: Node 0x891c: bgx0 #address-cells: 00 00 00 01 #size-cells: 00 00 00 00 reg: 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Node 0x8ad8: xfi@0 reg: 00 00 00 00 local-mac-address: fc 15 b4 97 48 b7 phy-handle: 00 00 00 75 Node 0x8b34: xfi@1 reg: 00 00 00 01 local-mac-address: fc 15 b4 97 48 b8 phy-handle: 00 00 00 76 Being unfamiliar with FDT, could I ask you to explain how the code could be using phandles to find the PHYs? From owner-svn-src-head@freebsd.org Sun Jul 8 16:23:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 112411037B7C for ; Sun, 8 Jul 2018 16:23:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::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 8FCBB7CA43 for ; Sun, 8 Jul 2018 16:23:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id z19-v6so14972949ioh.4 for ; Sun, 08 Jul 2018 09:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=hqqhprhJAAx2GoL9sqZrDmcwDDcvDFtQoyxq6msTHBY=; b=0dnwD+qJpFdy6fHClUQYK+HFQFMmsxVLXiQP8DUIXv1nCINiNZ/fEPQlLsnmmOJhUr w8aRdUW2xGYO8qSD4PVjcuYY1QuLxMeEqzc3pbPJDHsGfNpB4pgrU3e9utpqpVn9s+Fk z3+Vy7/7Ck15pr/IVpxDsO6solYWuyjT8Xa+QXTyYrB3vIvqHSn+PGmJpQuxmoCYePRJ lzpczlOKhwWUem8FCaMyaRXKCmk4o17wUKmOI2lIHgf/8dP6qo3vIpRp99a/9N/gJIk3 UBuL+KLZxjSc81mDQbUHqTgxEKTGZb3G7Cg05homotDtjgTTl3GUZn/DxANiRqrqk4v9 AOyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=hqqhprhJAAx2GoL9sqZrDmcwDDcvDFtQoyxq6msTHBY=; b=tcxhu9yjHYG2EKd2zY2I3Zs1Bo4dFSH1hmH2uR4IOabphEfu3ZpMKgaryzfYUc88rn HLTyx8w9tzqgq3DdtmUwBg22Sv/+yDne7vC2R/lK70dnaI+qAJQe9wn1PbDxb0DFa81X 8ocYTk613nOY/euXaAGyIODo9SnYVJKFVbpCdhnSRhbhhHWLskx4J+/vycBkQMm9drKG qO9bsESqZnq4v9EP5fDhcUWbLkW25KBnhfx1uh+y8QdQTvf7Q0e3M6AOXfthP8YP1zze jBcHIB/1Kc3Sdpgl+pKuRMGNls6LDvrtnrZsAsUTfHWtv2nhSD0Fy3weQJGcGmqPrNke H2jw== X-Gm-Message-State: APt69E1LIyXMeAhfFPWvGud4YYXZNh+w/ZiK/VH9kEnxjMo8uJfOybxn wcN7wR7FEMYD+GeRzohwseIFzyIGz9Zy1weVrDu8uw== X-Google-Smtp-Source: AAOMgpdkSdEazlNhTiG/VXUzoCpkI38VskA/V0+HE4LfIc6mO3z0bdH9ujxtsA0g19c9KKb1QDaSiNZX87ktQlpADgs= X-Received: by 2002:a6b:d40c:: with SMTP id l12-v6mr14887767iog.37.1531067032806; Sun, 08 Jul 2018 09:23:52 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:1183:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 09:23:52 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180708161415.GD18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> <20180708161415.GD18193@pesky> From: Warner Losh Date: Sun, 8 Jul 2018 10:23:52 -0600 X-Google-Sender-Auth: -b7HnerTbMTmQ8ODW49Qkru1TJY Message-ID: Subject: Re: svn commit: r334880 - head/sys/dev/vnic To: Mark Johnston Cc: Sean Bruno , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:23:54 -0000 On Sun, Jul 8, 2018 at 10:14 AM, Mark Johnston wrote: > On Sun, Jul 08, 2018 at 09:58:35AM -0600, Warner Losh wrote: > > On Sun, Jul 8, 2018 at 9:55 AM, Sean Bruno wrote: > > > > > > > > > > > On 07/08/18 09:26, Mark Johnston wrote: > > > > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > > > >> > > > >> > > > >> On 07/07/18 11:43, Mark Johnston wrote: > > > >>> On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner wrote: > > > >>>> Author: andrew > > > >>>> Date: Sat Jun 9 14:47:49 2018 > > > >>>> New Revision: 334880 > > > >>>> URL: https://svnweb.freebsd.org/changeset/base/334880 > > > >>>> > > > >>>> Log: > > > >>>> In the ThunderX BGX network driver we were skipping the NULL > > > terminator > > > >>>> when parsing the phy type, however this is included in the > length > > > returned > > > >>>> by OF_getprop. To fix this stop ignoring the terminator. > > > >>>> > > > >>>> PR: 228828 > > > >>>> Reported by: sbruno > > > >>>> Sponsored by: DARPA, AFRL > > > >>> > > > >>> This seems to break vnic on packet.net ThunderXs. In particular, > VF > > > >>> creation fails. It seems the problem in my case is that there are > > > >>> multiple PHY devices in the device tree, e.g., xfi@0, xfi@1. With > > > this > > > >>> change, bgx_fdt_phy_name_match() fails to match against any device > > > >>> containing a unit address in the node name. > > > >>> > > > >> > > > >> > > > >> Huh ... this was *required* to get the ThunderXs we have in the > FreeBSD > > > >> cluster to work at all. o.0 > > > >> > > > >> I guess "someone" needs to contact "someone" to figure out which is > > > >> correct or we need to replace our FreeBSD cluster machines with ones > > > >> that work like the packet.net machines? > > > > > > > > I think the current code works fine if there's only one PHY device, > so > > > > my problem is probably just the result of having a different hardware > > > > setup. We can probably fix the code to handle both cases. Could you > > > > mail me the output of "ofwdump -ap" from the cluster machine? > > > > > > > > > > > > > > > > > I dropped the output here: > > > https://people.freebsd.org/~sbruno/ofwdump.txt > > > > > > Ian's method is better. But Ian's question is better: are there not > > phandles to find this stuff? Names in FDT are kinda meaningless most of > the > > time (I say kinda here to gloss over a laundry list of exceptions that > PHY > > finding typically does not fall into). > > Sean's output shows why the current code works for him. In my case the > bgx subnodes don't contain a qlm-mode property, so we're falling back to > name matching: > > Node 0x891c: bgx0 > #address-cells: > 00 00 00 01 > #size-cells: > 00 00 00 00 > reg: > 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Node 0x8ad8: xfi@0 > reg: > 00 00 00 00 > local-mac-address: > fc 15 b4 97 48 b7 > phy-handle: > 00 00 00 75 > Node 0x8b34: xfi@1 > reg: > 00 00 00 01 > local-mac-address: > fc 15 b4 97 48 b8 > phy-handle: > 00 00 00 76 > > Being unfamiliar with FDT, could I ask you to explain how the code could > be using phandles to find the PHYs? > Allwinner provides a good example, and says it in code better than I could quickly summarize: static phandle_t awg_get_phy_node(device_t dev) { phandle_t node; pcell_t phy_handle; node = ofw_bus_get_node(dev); if (OF_getencprop(node, "phy-handle", (void *)&phy_handle, sizeof(phy_handle)) <= 0) return (0); return (OF_node_from_xref(phy_handle)); } Warner From owner-svn-src-head@freebsd.org Sun Jul 8 16:26:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF58010380FE; Sun, 8 Jul 2018 16:26:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A07B17CCB0; Sun, 8 Jul 2018 16:26:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8089365A; Sun, 8 Jul 2018 16:26:14 +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 w68GQEfZ061969; Sun, 8 Jul 2018 16:26:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68GQDR5061965; Sun, 8 Jul 2018 16:26:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807081626.w68GQDR5061965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Jul 2018 16:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336089 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 336089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:26:15 -0000 Author: markj Date: Sun Jul 8 16:26:13 2018 New Revision: 336089 URL: https://svnweb.freebsd.org/changeset/base/336089 Log: Fix whitespace issues in bessel function routines. PR: 229423 Submitted by: Steve Kargl MFC after: 3 days Modified: head/lib/msun/src/e_j0.c head/lib/msun/src/e_j1.c head/lib/msun/src/e_j1f.c head/lib/msun/src/e_jn.c Modified: head/lib/msun/src/e_j0.c ============================================================================== --- head/lib/msun/src/e_j0.c Sun Jul 8 15:48:47 2018 (r336088) +++ head/lib/msun/src/e_j0.c Sun Jul 8 16:26:13 2018 (r336089) @@ -1,4 +1,3 @@ - /* @(#)e_j0.c 1.3 95/01/18 */ /* * ==================================================== @@ -6,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -33,20 +32,20 @@ __FBSDID("$FreeBSD$"); * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j0(nan)= nan * j0(0) = 1 * j0(inf) = 0 - * + * * Method -- y0(x): * 1. For x<2. - * Since + * Since * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. * We use the following function to approximate y0, * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where + * where * U(z) = u00 + u01*z + ... + u06*z^6 * V(z) = 1 + v01*z + ... + v04*z^4 * with absolute approximation error bounded by 2**-72. @@ -71,7 +70,7 @@ huge = 1e300, one = 1.0, invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - /* R0/S0 on [0, 2.00] */ +/* R0/S0 on [0, 2.00] */ R02 = 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */ R03 = -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */ R04 = 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */ @@ -157,7 +156,7 @@ __ieee754_y0(double x) * y0(Inf) = 0. * y0(-Inf) = NaN and raise invalid exception. */ - if(ix>=0x7ff00000) return vone/(x+x*x); + if(ix>=0x7ff00000) return vone/(x+x*x); /* y0(+-0) = -inf and raise divide-by-zero exception. */ if((ix|lx)==0) return -one/vzero; /* y0(x<0) = NaN and raise invalid exception. */ @@ -293,7 +292,7 @@ pzero(double x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. Modified: head/lib/msun/src/e_j1.c ============================================================================== --- head/lib/msun/src/e_j1.c Sun Jul 8 15:48:47 2018 (r336088) +++ head/lib/msun/src/e_j1.c Sun Jul 8 16:26:13 2018 (r336089) @@ -1,4 +1,3 @@ - /* @(#)e_j1.c 1.3 95/01/18 */ /* * ==================================================== @@ -6,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -34,16 +33,16 @@ __FBSDID("$FreeBSD$"); * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j1(nan)= nan * j1(0) = 0 * j1(inf) = 0 - * + * * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN * 2. For x<2. - * Since + * Since * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. * We use the following function to approximate y1, @@ -154,7 +153,7 @@ __ieee754_y1(double x) * y1(Inf) = 0. * y1(-Inf) = NaN and raise invalid exception. */ - if(ix>=0x7ff00000) return vone/(x+x*x); + if(ix>=0x7ff00000) return vone/(x+x*x); /* y1(+-0) = -inf and raise divide-by-zero exception. */ if((ix|lx)==0) return -one/vzero; /* y1(x<0) = NaN and raise invalid exception. */ @@ -186,10 +185,10 @@ __ieee754_y1(double x) z = invsqrtpi*(u*ss+v*cc)/sqrt(x); } return z; - } + } if(ix<=0x3c900000) { /* x < 2**-54 */ return(-tpi/x); - } + } z = x*x; u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); @@ -287,7 +286,7 @@ pone(double x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. Modified: head/lib/msun/src/e_j1f.c ============================================================================== --- head/lib/msun/src/e_j1f.c Sun Jul 8 15:48:47 2018 (r336088) +++ head/lib/msun/src/e_j1f.c Sun Jul 8 16:26:13 2018 (r336089) @@ -32,7 +32,7 @@ huge = 1e30, one = 1.0, invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ tpi = 6.3661974669e-01, /* 0x3f22f983 */ - /* R0/S0 on [0,2] */ +/* R0/S0 on [0,2] */ r00 = -6.2500000000e-02, /* 0xbd800000 */ r01 = 1.4070566976e-03, /* 0x3ab86cfd */ r02 = -1.5995563444e-05, /* 0xb7862e36 */ Modified: head/lib/msun/src/e_jn.c ============================================================================== --- head/lib/msun/src/e_jn.c Sun Jul 8 15:48:47 2018 (r336088) +++ head/lib/msun/src/e_jn.c Sun Jul 8 16:26:13 2018 (r336089) @@ -1,4 +1,3 @@ - /* @(#)e_jn.c 1.4 95/01/18 */ /* * ==================================================== @@ -6,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -18,7 +17,7 @@ __FBSDID("$FreeBSD$"); * __ieee754_jn(n, x), __ieee754_yn(n, x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -37,7 +36,6 @@ __FBSDID("$FreeBSD$"); * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * */ #include "math.h" @@ -66,7 +64,7 @@ __ieee754_jn(int n, double x) ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; - if(n<0){ + if(n<0){ n = -n; x = -x; hx ^= 0x80000000; @@ -77,14 +75,14 @@ __ieee754_jn(int n, double x) x = fabs(x); if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ b = zero; - else if((double)n<=x) { + else if((double)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2), then * * n sin(xn)*sqt2 cos(xn)*sqt2 * ---------------------------------- @@ -100,7 +98,7 @@ __ieee754_jn(int n, double x) case 3: temp = cos(x)-sin(x); break; } b = invsqrtpi*temp/sqrt(x); - } else { + } else { a = __ieee754_j0(x); b = __ieee754_j1(x); for(i=1;i33) /* underflow */ @@ -126,14 +124,14 @@ __ieee754_jn(int n, double x) } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -149,9 +147,9 @@ __ieee754_jn(int n, double x) * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ double t,v; @@ -237,11 +235,11 @@ __ieee754_yn(int n, double x) if(n==1) return(sign*__ieee754_y1(x)); if(ix==0x7ff00000) return zero; if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2), then * * n sin(xn)*sqt2 cos(xn)*sqt2 * ---------------------------------- From owner-svn-src-head@freebsd.org Sun Jul 8 16:34:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08C2F1039A2F; Sun, 8 Jul 2018 16:34:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD81D7D491; Sun, 8 Jul 2018 16:33:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E90C7FD; Sun, 8 Jul 2018 16:33:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68GXxAF066984; Sun, 8 Jul 2018 16:33:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68GXxDe066982; Sun, 8 Jul 2018 16:33:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807081633.w68GXxDe066982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Jul 2018 16:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336090 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 336090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:34:00 -0000 Author: markj Date: Sun Jul 8 16:33:58 2018 New Revision: 336090 URL: https://svnweb.freebsd.org/changeset/base/336090 Log: Reduce diff between msun/src/e_pow.c and msun/src/e_powf.c. Remove unnecessary casts, use integer literal constants instead of floating point constants where possible, and introduce three const static variables to hold 0.5, 0.25, and 1/3. PR: 229420 Submitted by: Steve Kargl MFC after: 1 week Modified: head/lib/msun/src/e_pow.c head/lib/msun/src/e_powf.c Modified: head/lib/msun/src/e_pow.c ============================================================================== --- head/lib/msun/src/e_pow.c Sun Jul 8 16:26:13 2018 (r336089) +++ head/lib/msun/src/e_pow.c Sun Jul 8 16:33:58 2018 (r336090) @@ -65,6 +65,9 @@ bp[] = {1.0, 1.5,}, dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ zero = 0.0, +half = 0.5, +qrtr = 0.25, +thrd = 3.3333333333333331e-01, /* 0x3fd55555, 0x55555555 */ one = 1.0, two = 2.0, two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ @@ -197,7 +200,7 @@ __ieee754_pow(double x, double y) /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-one; /* t has 20 trailing zeros */ - w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + w = (t*t)*(half-t*(thrd-t*qrtr)); u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ v = t*ivln2_l-w*ivln2; t1 = u+v; @@ -234,9 +237,9 @@ __ieee754_pow(double x, double y) r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); r += s_l*(s_h+ss); s2 = s_h*s_h; - t_h = 3.0+s2+r; + t_h = 3+s2+r; SET_LOW_WORD(t_h,0); - t_l = r-((t_h-3.0)-s2); + t_l = r-((t_h-3)-s2); /* u+v = ss*(1+...) */ u = s_h*t_h; v = s_l*t_h+t_l*ss; @@ -247,7 +250,7 @@ __ieee754_pow(double x, double y) z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ z_l = cp_l*p_h+p_l*cp+dp_l[k]; /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double)n; + t = n; t1 = (((z_h+z_l)+dp_h[k])+t); SET_LOW_WORD(t1,0); t2 = z_l-(((t1-t)-dp_h[k])-z_h); Modified: head/lib/msun/src/e_powf.c ============================================================================== --- head/lib/msun/src/e_powf.c Sun Jul 8 16:26:13 2018 (r336089) +++ head/lib/msun/src/e_powf.c Sun Jul 8 16:33:58 2018 (r336090) @@ -24,6 +24,9 @@ bp[] = {1.0, 1.5,}, dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ zero = 0.0, +half = 0.5, +qrtr = 0.25, +thrd = 3.33333343e-01, /* 0x3eaaaaab */ one = 1.0, two = 2.0, two24 = 16777216.0, /* 0x4b800000 */ @@ -138,7 +141,7 @@ __ieee754_powf(float x, float y) /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-1; /* t has 20 trailing zeros */ - w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); + w = (t*t)*(half-t*(thrd-t*qrtr)); u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ v = t*ivln2_l-w*ivln2; t1 = u+v; @@ -177,10 +180,10 @@ __ieee754_powf(float x, float y) r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); r += s_l*(s_h+s); s2 = s_h*s_h; - t_h = (float)3.0+s2+r; + t_h = 3+s2+r; GET_FLOAT_WORD(is,t_h); SET_FLOAT_WORD(t_h,is&0xfffff000); - t_l = r-((t_h-(float)3.0)-s2); + t_l = r-((t_h-3)-s2); /* u+v = s*(1+...) */ u = s_h*t_h; v = s_l*t_h+t_l*s; @@ -192,7 +195,7 @@ __ieee754_powf(float x, float y) z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ z_l = cp_l*p_h+p_l*cp+dp_l[k]; /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (float)n; + t = n; t1 = (((z_h+z_l)+dp_h[k])+t); GET_FLOAT_WORD(is,t1); SET_FLOAT_WORD(t1,is&0xfffff000); From owner-svn-src-head@freebsd.org Sun Jul 8 16:45:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 803A9103AFC4; Sun, 8 Jul 2018 16:45:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 EB8A07DEC8; Sun, 8 Jul 2018 16:45:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-wr1-x441.google.com with SMTP id h40-v6so8534566wrh.2; Sun, 08 Jul 2018 09:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2DzOxdDmftjv6/1AeC890OG8C/RtilyVLV62USXPvis=; b=e+ZIwZ5BE6gplk0qxDPyjiOjIgzARmd3bDyhhR3cKPGmm2ceA04J2Us+kxuBrH4sHS eToBCBUU3RnAl7Qjjkp0BkhqSyvBlFqFB09x3p+XjP4rkoxH+PirGfQvrDtO6nyfyxd0 qxpOWqXJQJ1RXEu9VIXmbhcZ5QofPZTK92xI7X6qyBTx8IBR/qtUzinAaV5JxAHQfRGa 5UeeF5MDmuayM2Yf/OH2KnFQYt4lEz9v23LIhXAsClZS+tVvKPWgn26m+a1tCfAjy0ca HqnoahCWbMfXdZdjmhQ3KU6kE76I99/EBwAn0n5AFUXUTGhdoIcE40LAtHsZtc633/LJ +LBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2DzOxdDmftjv6/1AeC890OG8C/RtilyVLV62USXPvis=; b=RRzSEKILzuqf98Ns33qF+kJ3BY7yEYXjHTgCMzVX8W90MN+ptDgZhIkh3Gzy3G87BI M/L79IB7LGHDNZZcj95p2jJzKuHVzTGdoQvnfpQzOfG+2Nozs5iexogg/6Lwc403E4As SqWimZQ5/5QftQhr2/pScau/RzbVDnDKoi2PQbRmi9malnG1Io06DdXavUMqg600wpih Dadz1sUlmxjR8EJizNMdDdX+BaEDWjCpPN2mPgRnxsSoPO349XRzjXmKOFfbC8t52GVM YB2tgXpLsdXBV8hg9yvSXlhmePlkuq8d6Oa3GMz0MPLSgDdE+0VJ+X28B0JIGSZSYM2V 1xAQ== X-Gm-Message-State: APt69E36viLwLQCxMuOh6GGrUMvGSiGnz11vcud6s8056yQDKaWl4BAw VoNitkFePZbdV4CnQyalbbzRyT2V X-Google-Smtp-Source: AAOMgpfukqUxl87Nd7O4aZrQZ+gcgt14I8A9CYlK+gSEIZ57djTgTEc3rxbARVfIPkA1yvdy0G3gLg== X-Received: by 2002:adf:c546:: with SMTP id s6-v6mr13315124wrf.46.1531068302865; Sun, 08 Jul 2018 09:45:02 -0700 (PDT) Received: from pesky (174.red-81-43-74.staticip.rima-tde.net. [81.43.74.174]) by smtp.gmail.com with ESMTPSA id g125-v6sm14142982wmf.16.2018.07.08.09.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 09:45:02 -0700 (PDT) Sender: Mark Johnston Date: Sun, 8 Jul 2018 12:45:00 -0400 From: Mark Johnston To: Warner Losh Cc: Sean Bruno , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334880 - head/sys/dev/vnic Message-ID: <20180708164459.GE18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> <20180708161415.GD18193@pesky> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:45:04 -0000 On Sun, Jul 08, 2018 at 10:23:52AM -0600, Warner Losh wrote: > On Sun, Jul 8, 2018 at 10:14 AM, Mark Johnston wrote: > > Being unfamiliar with FDT, could I ask you to explain how the code could > > be using phandles to find the PHYs? > > > > Allwinner provides a good example, and says it in code better than I could > quickly summarize: > > static phandle_t > awg_get_phy_node(device_t dev) > { > phandle_t node; > pcell_t phy_handle; > > node = ofw_bus_get_node(dev); > if (OF_getencprop(node, "phy-handle", (void *)&phy_handle, > sizeof(phy_handle)) <= 0) > return (0); > > return (OF_node_from_xref(phy_handle)); > } I don't see how this can help in the fallback case where the PHY mode isn't encoded anywhere except in the device name. In this case the nodes referred to by the phy-handle properties look like this: mdio@87e005003800 { compatible = "cavium,thunder-8890-mdio"; #address-cells = <0x1>; #size-cells = <0x0>; reg = <0x87e0 0x5003800 0x0 0x30>; xfi@0 { reg = <0x0>; compatible = "cortina,cs4223-slice"; linux,phandle = <0x75>; phandle = <0x75>; }; xfi@1 { reg = <0x1>; compatible = "cortina,cs4223-slice"; linux,phandle = <0x76>; phandle = <0x76>; }; }; From owner-svn-src-head@freebsd.org Sun Jul 8 16:45:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBDF9103B169 for ; Sun, 8 Jul 2018 16:45:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D8C97E068 for ; Sun, 8 Jul 2018 16:45:55 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 5fab1e09-82ce-11e8-8837-614b7c574d04 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 5fab1e09-82ce-11e8-8837-614b7c574d04; Sun, 08 Jul 2018 16:45:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w68Gjp7L031549; Sun, 8 Jul 2018 10:45:51 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1531068351.1336.15.camel@freebsd.org> Subject: Re: svn commit: r334880 - head/sys/dev/vnic From: Ian Lepore To: Mark Johnston , Warner Losh Cc: Sean Bruno , Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 08 Jul 2018 10:45:51 -0600 In-Reply-To: <20180708161415.GD18193@pesky> References: <201806091447.w59ElnpU026396@repo.freebsd.org> <20180707174351.GA95934@pesky> <20180708152621.GB18193@pesky> <5483bcd6-f3bc-8b78-ee51-3bf3c2a1c2da@freebsd.org> <20180708161415.GD18193@pesky> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:45:56 -0000 On Sun, 2018-07-08 at 12:14 -0400, Mark Johnston wrote: > On Sun, Jul 08, 2018 at 09:58:35AM -0600, Warner Losh wrote: > > > > On Sun, Jul 8, 2018 at 9:55 AM, Sean Bruno > > wrote: > > > > > > > > > > > > > > On 07/08/18 09:26, Mark Johnston wrote: > > > > > > > > On Sun, Jul 08, 2018 at 09:10:27AM -0600, Sean Bruno wrote: > > > > > > > > > > > > > > > > > > > > On 07/07/18 11:43, Mark Johnston wrote: > > > > > > > > > > > > On Sat, Jun 09, 2018 at 02:47:49PM +0000, Andrew Turner > > > > > > wrote: > > > > > > > > > > > > > > Author: andrew > > > > > > > Date: Sat Jun  9 14:47:49 2018 > > > > > > > New Revision: 334880 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/334880 > > > > > > > > > > > > > > Log: > > > > > > >   In the ThunderX BGX network driver we were skipping the > > > > > > > NULL > > > terminator > > > > > > > > > > > > > > > > > > > > > > > > > > > > >   when parsing the phy type, however this is included in > > > > > > > the length > > > returned > > > > > > > > > > > > > > > > > > > > > > > > > > > > >   by OF_getprop. To fix this stop ignoring the > > > > > > > terminator. > > > > > > > > > > > > > >   PR:              228828 > > > > > > >   Reported by:     sbruno > > > > > > >   Sponsored by:    DARPA, AFRL > > > > > > This seems to break vnic on packet.net ThunderXs.  In > > > > > > particular, VF > > > > > > creation fails.  It seems the problem in my case is that > > > > > > there are > > > > > > multiple PHY devices in the device tree, e.g., xfi@0, xfi@1 > > > > > > .  With > > > this > > > > > > > > > > > > > > > > > > > > > change, bgx_fdt_phy_name_match() fails to match against any > > > > > > device > > > > > > containing a unit address in the node name. > > > > > > > > > > > > > > > > Huh ... this was *required* to get the ThunderXs we have in > > > > > the FreeBSD > > > > > cluster to work at all.  o.0 > > > > > > > > > > I guess "someone" needs to contact "someone" to figure out > > > > > which is > > > > > correct or we need to replace our FreeBSD cluster machines > > > > > with ones > > > > > that work like the packet.net machines? > > > > I think the current code works fine if there's only one PHY > > > > device, so > > > > my problem is probably just the result of having a different > > > > hardware > > > > setup.  We can probably fix the code to handle both > > > > cases.  Could you > > > > mail me the output of "ofwdump -ap" from the cluster machine? > > > > > > > > > > > > > > I dropped the output here: > > > https://people.freebsd.org/~sbruno/ofwdump.txt > > > > Ian's method is better. But Ian's question is better: are there not > > phandles to find this stuff? Names in FDT are kinda meaningless > > most of the > > time (I say kinda here to gloss over a laundry list of exceptions > > that PHY > > finding typically does not fall into). > Sean's output shows why the current code works for him.  In my case > the > bgx subnodes don't contain a qlm-mode property, so we're falling back > to > name matching: > > Node 0x891c: bgx0 >   #address-cells: >     00 00 00 01  >   #size-cells: >     00 00 00 00  >   reg: >     00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >   Node 0x8ad8: xfi@0 >     reg: >       00 00 00 00  >     local-mac-address: >       fc 15 b4 97 48 b7  >     phy-handle: >       00 00 00 75  >   Node 0x8b34: xfi@1 >     reg: >       00 00 00 01  >     local-mac-address: >       fc 15 b4 97 48 b8  >     phy-handle: >       00 00 00 76  > > Being unfamiliar with FDT, could I ask you to explain how the code > could > be using phandles to find the PHYs? > In Sean's output, the phy nodes had multiple strings encoded in their qlm-mode properties (note the embedded 0 about 6-8 bytes in). Based on pure guesswork (because I can't find published fdt-bindings docs for any of this stuff), maybe the phy supports multiple modes, so the mac node has to have a property to say which mode is used. It may be that the property in the mac node is optional when the phy node only lists one qlm-mode, and maybe in that case the thing to do is retrieve the property from the phy node after using the xref-phandle to get to that node. -- Ian From owner-svn-src-head@freebsd.org Sun Jul 8 16:51:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46346103BCDC; Sun, 8 Jul 2018 16:51:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E94907E66D; Sun, 8 Jul 2018 16:51:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB3CAA34; Sun, 8 Jul 2018 16:51:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68GpsfQ074429; Sun, 8 Jul 2018 16:51:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Gpsde074428; Sun, 8 Jul 2018 16:51:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807081651.w68Gpsde074428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 8 Jul 2018 16:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336092 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 336092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 16:51:55 -0000 Author: alc Date: Sun Jul 8 16:51:54 2018 New Revision: 336092 URL: https://svnweb.freebsd.org/changeset/base/336092 Log: Invalidate the mapping before updating its physical address. Doing so ensures that all threads sharing the pmap have a consistent view of the mapping. This fixes the problem described in the commit log messages for r329254 without the overhead of an extra fault in the common case. Once other pmap_enter() implementations are similarly modified, the workaround added in r329254 can be removed, reducing the overhead of CoW faults. See also r335784 for amd64. The i386 implementation of pmap_enter() already reused the PV entry from the old mapping. Reviewed by: kib, markj Tested by: pho MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D16133 Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Jul 8 16:37:50 2018 (r336091) +++ head/sys/i386/i386/pmap.c Sun Jul 8 16:51:54 2018 (r336092) @@ -3636,7 +3636,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } pa = VM_PAGE_TO_PHYS(m); - om = NULL; origpte = *pte; opa = origpte & PG_FRAME; @@ -3661,10 +3660,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if (mpte) mpte->wire_count--; - if (origpte & PG_MANAGED) { - om = m; + if (origpte & PG_MANAGED) pa |= PG_MANAGED; - } goto validate; } @@ -3672,15 +3669,42 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v /* * Mapping has changed, invalidate old range and fall through to - * handle validating new mapping. + * handle validating new mapping. This ensures that all threads + * sharing the pmap keep a consistent view of the mapping, which is + * necessary for the correct handling of COW faults. It + * also permits reuse of the old mapping's PV entry, + * avoiding an allocation. + * + * For consistency, handle unmanaged mappings the same way. */ if (opa) { + origpte = pte_load_clear(pte); + KASSERT((origpte & PG_FRAME) == opa, + ("pmap_enter: unexpected pa update for %#x", va)); if (origpte & PG_W) pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); + + /* + * The pmap lock is sufficient to synchronize with + * concurrent calls to pmap_page_test_mappings() and + * pmap_ts_referenced(). + */ + if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + vm_page_dirty(om); + if ((origpte & PG_A) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); pv = pmap_pvh_remove(&om->md, pmap, va); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) + vm_page_aflag_clear(om, PGA_WRITEABLE); } + if ((origpte & PG_A) != 0) + pmap_invalidate_page(pmap, va); + origpte = 0; if (mpte != NULL) { mpte->wire_count--; KASSERT(mpte->wire_count > 0, @@ -3697,9 +3721,10 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v KASSERT(pmap != kernel_pmap || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - if (pv == NULL) + if (pv == NULL) { pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; + pv->pv_va = va; + } TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); pa |= PG_MANAGED; } else if (pv != NULL) @@ -3741,28 +3766,19 @@ validate: if (origpte & PG_V) { invlva = FALSE; origpte = pte_load_store(pte, newpte); - if (origpte & PG_A) { - if (origpte & PG_MANAGED) - vm_page_aflag_set(om, PGA_REFERENCED); - if (opa != VM_PAGE_TO_PHYS(m)) - invlva = TRUE; -#if defined(PAE) || defined(PAE_TABLES) - if ((origpte & PG_NX) == 0 && - (newpte & PG_NX) != 0) - invlva = TRUE; -#endif - } - if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { + KASSERT((origpte & PG_FRAME) == VM_PAGE_TO_PHYS(m), + ("pmap_enter: unexpected pa update for %#x", va)); + if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW) && + (newpte & PG_M) == 0) { if ((origpte & PG_MANAGED) != 0) - vm_page_dirty(om); - if ((prot & VM_PROT_WRITE) == 0) - invlva = TRUE; + vm_page_dirty(m); + invlva = TRUE; } - if ((origpte & PG_MANAGED) != 0 && - TAILQ_EMPTY(&om->md.pv_list) && - ((om->flags & PG_FICTITIOUS) != 0 || - TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) - vm_page_aflag_clear(om, PGA_WRITEABLE); +#if defined(PAE) || defined(PAE_TABLES) + else if ((origpte & (PG_A | PG_NX)) == PG_A && + (newpte & PG_NX) != 0) + invlva = TRUE; +#endif if (invlva) pmap_invalidate_page(pmap, va); } else From owner-svn-src-head@freebsd.org Sun Jul 8 18:15:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 895191044350; Sun, 8 Jul 2018 18:15:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3964381E7E; Sun, 8 Jul 2018 18:15:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19EA51895; Sun, 8 Jul 2018 18:15:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68IFtwF018132; Sun, 8 Jul 2018 18:15:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68IFtO8018130; Sun, 8 Jul 2018 18:15:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807081815.w68IFtO8018130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 8 Jul 2018 18:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336093 - head/sys/fs/nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsserver X-SVN-Commit-Revision: 336093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 18:15:56 -0000 Author: rmacklem Date: Sun Jul 8 18:15:55 2018 New Revision: 336093 URL: https://svnweb.freebsd.org/changeset/base/336093 Log: Fix the kernel part of pnfsdscopymr() to handle holes in the file being copied. If a mirrored DS is being recovered that has a lot of large sparse files, pnfsdscopymr(8) would use a lot of space on the recovered mirror since it would write the "holes" in the file being mirrored. This patch adds code to check for a "hole" and skip doing the write. The check is done on a "per PNFSDS_COPYSIZ size block", which is currently 64K. I think that most file server file systems will be using a blocksize at least this large. If the file server is using a smaller blocksize and smaller holes need to be preserved, PNFSDS_COPYSIZ could be decreased. The block of 0s is malloc()d, since pnfsdcopymr(8) should be an infrequent occurrence. Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun Jul 8 16:51:54 2018 (r336092) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun Jul 8 18:15:55 2018 (r336093) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); NFSDLOCKMUTEX; NFSV4ROOTLOCKMUTEX; struct nfsv4lock nfsd_suspend_lock; +char *nfsrv_zeropnfsdat = NULL; /* * Mapping of old NFS Version 2 RPC numbers to generic numbers. @@ -565,6 +566,8 @@ nfsrvd_init(int terminating) nfsrv_freealllayoutsanddevids(); nfsrv_freeallbackchannel_xprts(); svcpool_close(nfsrvd_pool); + free(nfsrv_zeropnfsdat, M_TEMP); + nfsrv_zeropnfsdat = NULL; NFSD_LOCK(); } else { NFSD_UNLOCK(); Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sun Jul 8 16:51:54 2018 (r336092) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sun Jul 8 18:15:55 2018 (r336093) @@ -60,6 +60,7 @@ NFSSTATESPINLOCK; extern struct nfsdontlisthead nfsrv_dontlisthead; extern volatile int nfsrv_devidcnt; extern struct nfslayouthead nfsrv_recalllisthead; +extern char *nfsrv_zeropnfsdat; SYSCTL_DECL(_vfs_nfsd); int nfsrv_statehashsize = NFSSTATEHASHSIZE; @@ -8124,9 +8125,15 @@ tryagain2: if (retacl != 0 && retacl != ENOATTR) NFSD_DEBUG(1, "nfsrv_copymr: vop_getacl=%d\n", retacl); dat = malloc(PNFSDS_COPYSIZ, M_TEMP, M_WAITOK); + /* Malloc a block of 0s used to check for holes. */ + if (nfsrv_zeropnfsdat == NULL) + nfsrv_zeropnfsdat = malloc(PNFSDS_COPYSIZ, M_TEMP, + M_WAITOK | M_ZERO); rdpos = wrpos = 0; mp = NULL; ret = vn_start_write(tvp, &mp, V_WAIT | PCATCH); + if (ret == 0) + ret = VOP_GETATTR(fvp, &va, cred); aresid = 0; while (ret == 0 && aresid == 0) { ret = vn_rdwr(UIO_READ, fvp, dat, PNFSDS_COPYSIZ, @@ -8135,9 +8142,16 @@ tryagain2: xfer = PNFSDS_COPYSIZ - aresid; if (ret == 0 && xfer > 0) { rdpos += xfer; - ret = vn_rdwr(UIO_WRITE, tvp, dat, xfer, - wrpos, UIO_SYSSPACE, IO_NODELOCKED, - cred, NULL, NULL, p); + /* + * Skip the write for holes, except for the + * last block. + */ + if (xfer < PNFSDS_COPYSIZ || rdpos == + va.va_size || NFSBCMP(dat, + nfsrv_zeropnfsdat, PNFSDS_COPYSIZ) != 0) + ret = vn_rdwr(UIO_WRITE, tvp, dat, xfer, + wrpos, UIO_SYSSPACE, IO_NODELOCKED, + cred, NULL, NULL, p); if (ret == 0) wrpos += xfer; } From owner-svn-src-head@freebsd.org Sun Jul 8 18:44:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAFA61046FDB; Sun, 8 Jul 2018 18:44:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 995268306C; Sun, 8 Jul 2018 18:44:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A6561DAF; Sun, 8 Jul 2018 18:44:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68IigbR033479; Sun, 8 Jul 2018 18:44:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68IigHp033478; Sun, 8 Jul 2018 18:44:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807081844.w68IigHp033478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 18:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336094 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 336094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 18:44:43 -0000 Author: ian Date: Sun Jul 8 18:44:42 2018 New Revision: 336094 URL: https://svnweb.freebsd.org/changeset/base/336094 Log: Catch up with improvements in RTC handling... It's no longer necessary to ignore the timestamp passed in to settime() due to inaccuracy, the core routines now pass in a nanosecond-accurate time freshly-obtained before calling each driver's settime() method. Also, add calls to the new debugging output helpers. Modified: head/sys/arm/freescale/imx/imx6_snvs.c Modified: head/sys/arm/freescale/imx/imx6_snvs.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_snvs.c Sun Jul 8 18:15:55 2018 (r336093) +++ head/sys/arm/freescale/imx/imx6_snvs.c Sun Jul 8 18:44:42 2018 (r336094) @@ -137,35 +137,33 @@ snvs_gettime(device_t dev, struct timespec *ts) *ts = sbttots(counter1); + clock_dbgprint_ts(sc->dev, CLOCK_DBG_READ, ts); + return (0); } static int -snvs_settime(device_t dev, struct timespec *unused) +snvs_settime(device_t dev, struct timespec *ts) { struct snvs_softc *sc; - struct bintime bt; sbintime_t sbt; sc = device_get_softc(dev); /* - * Ignore the inaccurate time passed in from the common clock code and - * obtain a time worthy of our 30us accuracy. + * The hardware format is the same as sbt (with fewer fractional bits), + * so first convert the time to sbt. It takes two clock cycles for the + * counter to start after setting the enable bit, so add two SBT_LSBs to + * what we're about to set. */ - bintime(&bt); - bt.sec -= utc_offset(); - sbt = bttosbt(bt); - - /* - * It takes two clock cycles for the counter to start after setting the - * enable bit, so add two SBT_LSBs to what we're about to set. - */ + sbt = tstosbt(*ts); sbt += 2 << SBT_LSB; snvs_rtc_enable(sc, false); WR4(sc, SNVS_LPSRTCMR, (uint32_t)(sbt >> (SBT_LSB + 32))); WR4(sc, SNVS_LPSRTCLR, (uint32_t)(sbt >> (SBT_LSB))); snvs_rtc_enable(sc, true); + + clock_dbgprint_ts(sc->dev, CLOCK_DBG_WRITE, ts); return (0); } From owner-svn-src-head@freebsd.org Sun Jul 8 19:28:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F6091025E52; Sun, 8 Jul 2018 19:28:25 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14AE284BA6; Sun, 8 Jul 2018 19:28:25 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) (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)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id CFDCE24210; Sun, 8 Jul 2018 19:28:24 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-io0-f174.google.com with SMTP id v26-v6so15186614iog.5; Sun, 08 Jul 2018 12:28:24 -0700 (PDT) X-Gm-Message-State: AOUpUlFNLO/bR+46j1DRQtw/y+ihNY3flQnrldyrG+kgOGoj9/52UbZ1 Nw3Z3VWQwkdkWkkjcBGDl6E0qiY37XEQbscKwno= X-Google-Smtp-Source: AAOMgpclZn/FE5kbGGKMttyIKdlxmVbedUIL4MbgRJ6Se6JMdyVV7ohmTxTl5N9jiHcxhFi2sIJXYtqs83nGikxbDtE= X-Received: by 2002:a6b:ed11:: with SMTP id n17-v6mr15092396iog.132.1531078103910; Sun, 08 Jul 2018 12:28:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:8d2:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 12:28:22 -0700 (PDT) In-Reply-To: <20180708142210.GA18193@pesky> References: <201807030155.w631tARo009470@repo.freebsd.org> <20180708142210.GA18193@pesky> From: Matthew Macy Date: Sun, 8 Jul 2018 12:28:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r335879 - in head/sys: conf kern sys To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 19:28:25 -0000 On Sun, Jul 8, 2018 at 7:22 AM, Mark Johnston wrote: > On Tue, Jul 03, 2018 at 01:55:10AM +0000, Matt Macy wrote: >> Author: mmacy >> Date: Tue Jul 3 01:55:09 2018 >> New Revision: 335879 >> URL: https://svnweb.freebsd.org/changeset/base/335879 >> >> Log: >> make critical_{enter, exit} inline >> >> Avoid pulling in all of the dependencies by >> automatically generating a stripped down thread_lite exporting >> only the fields of interest. The field declarations are type checked >> against the original and the offsets of the generated result is >> automatically checked. >> >> kib has expressed disagreement and would have preferred to simply >> use genassym style offsets (which loses type check enforcement). >> jhb has expressed dislike of it due to header pollution and a >> duplicate structure. He would have preferred to just have defined >> thread in _thread.h. Nonetheless, he admits that this is the only >> viable solution at the moment. >> >> The impetus for this came from mjg's D15331: >> "Inline critical_enter/exit for amd64" >> >> Reviewed by: jeff >> Differential Revision: https://reviews.freebsd.org/D16078 >> >> [...] >> +#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET) >> +#define critical_enter() critical_enter_KBI() >> +#define critical_exit() critical_exit_KBI() >> +#else >> +static __inline void >> +critical_enter(void) >> +{ >> + struct thread_lite *td; >> + >> + td = (struct thread_lite *)curthread; >> + td->td_critnest++; > > Don't we need a compiler barrier here? > We definitely do. Not sure how that got lost :( Will fix. -M From owner-svn-src-head@freebsd.org Sun Jul 8 19:35:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD1F1026D7F; Sun, 8 Jul 2018 19:35:30 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD98985332; Sun, 8 Jul 2018 19:35:29 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BADD625C8; Sun, 8 Jul 2018 19:35:29 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68JZTG9058929; Sun, 8 Jul 2018 19:35:29 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68JZTU4058928; Sun, 8 Jul 2018 19:35:29 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201807081935.w68JZTU4058928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 8 Jul 2018 19:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336095 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 336095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 19:35:30 -0000 Author: mmacy Date: Sun Jul 8 19:35:29 2018 New Revision: 336095 URL: https://svnweb.freebsd.org/changeset/base/336095 Log: critical_{enter, exit}: add missing compiler barrier Reported by: markj Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sun Jul 8 18:44:42 2018 (r336094) +++ head/sys/sys/systm.h Sun Jul 8 19:35:29 2018 (r336095) @@ -238,6 +238,7 @@ critical_enter(void) td = (struct thread_lite *)curthread; td->td_critnest++; + __compiler_membar(); } static __inline void @@ -248,6 +249,7 @@ critical_exit(void) td = (struct thread_lite *)curthread; KASSERT(td->td_critnest != 0, ("critical_exit: td_critnest == 0")); + __compiler_membar(); td->td_critnest--; __compiler_membar(); if (__predict_false(td->td_owepreempt)) From owner-svn-src-head@freebsd.org Sun Jul 8 19:35:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CCD41026E06; Sun, 8 Jul 2018 19:35:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1193185436; Sun, 8 Jul 2018 19:35:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E80AC25C9; Sun, 8 Jul 2018 19:35:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68JZgaX058983; Sun, 8 Jul 2018 19:35:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68JZf2x058975; Sun, 8 Jul 2018 19:35:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807081935.w68JZf2x058975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 19:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336096 - in head: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_snvs X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_snvs X-SVN-Commit-Revision: 336096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 19:35:43 -0000 Author: ian Date: Sun Jul 8 19:35:41 2018 New Revision: 336096 URL: https://svnweb.freebsd.org/changeset/base/336096 Log: Make the imx6_snvs driver usable as a module, add pnp info. Add a manpage. Added: head/share/man/man4/man4.arm/imx6_snvs.4 (contents, props changed) head/sys/modules/imx/imx6_snvs/ head/sys/modules/imx/imx6_snvs/Makefile (contents, props changed) Modified: head/share/man/man4/man4.arm/Makefile head/sys/arm/freescale/imx/imx6_snvs.c head/sys/modules/imx/Makefile Modified: head/share/man/man4/man4.arm/Makefile ============================================================================== --- head/share/man/man4/man4.arm/Makefile Sun Jul 8 19:35:29 2018 (r336095) +++ head/share/man/man4/man4.arm/Makefile Sun Jul 8 19:35:41 2018 (r336096) @@ -13,6 +13,7 @@ MAN= \ cgem.4 \ devcfg.4 \ imx6_ahci.4 \ + imx6_snvs.4 \ imx_wdog.4 \ mge.4 \ npe.4 \ Added: head/share/man/man4/man4.arm/imx6_snvs.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.arm/imx6_snvs.4 Sun Jul 8 19:35:41 2018 (r336096) @@ -0,0 +1,78 @@ +.\" +.\" Copyright (c) 2018 Ian Lepore +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 8, 2018 +.Dt IMX6_SNVS 4 +.Os +.Sh NAME +.Nm imx6_snvs +.Nd device driver for the NXP i.MX6 on-chip Realtime Clock +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device imx6_snvs" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +imx6_snvs_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +support for the i.MX6 on-chip realtime clock. +It provides the time of day with a resolution of approximately +30 microseconds. +.Pp +.Sq SNVS +stands for Secure Non-Volatile Storage, and refers to the subsystem +within the chip that (optionally) remains powered by a battery when +the rest of the system is powered down. +The on-chip realtime clock is part of that subsystem. +Other features of the SNVS subsystem are related to security, tamper +monitoring, and power control; the +.Nm +driver does not currently support those features. +.Pp +Many i.MX6 systems do not use a battery to provide power to the SNVS +due to its relatively high power draw. In such systems, this driver +is able to provide a very accurate time following a reboot, but cannot +provide time at all if the power is cycled. If the system provides an +i2c or other type of alternate realtime clock with lower resolution, +there is value in configuring both clock drivers. +Doing so allows SNVS to provide accurate time after a reboot, while the +external clock provides approximate time after power cycling. +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . Modified: head/sys/arm/freescale/imx/imx6_snvs.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_snvs.c Sun Jul 8 19:35:29 2018 (r336095) +++ head/sys/arm/freescale/imx/imx6_snvs.c Sun Jul 8 19:35:41 2018 (r336096) @@ -204,9 +204,21 @@ snvs_attach(device_t dev) return (0); } +static int +snvs_detach(device_t dev) +{ + struct snvs_softc *sc; + + sc = device_get_softc(dev); + clock_unregister(sc->dev); + bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres); + return (0); +} + static device_method_t snvs_methods[] = { DEVMETHOD(device_probe, snvs_probe), DEVMETHOD(device_attach, snvs_attach), + DEVMETHOD(device_detach, snvs_detach), /* clock_if methods */ DEVMETHOD(clock_gettime, snvs_gettime), @@ -224,3 +236,4 @@ static driver_t snvs_driver = { static devclass_t snvs_devclass; DRIVER_MODULE(snvs, simplebus, snvs_driver, snvs_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/modules/imx/Makefile ============================================================================== --- head/sys/modules/imx/Makefile Sun Jul 8 19:35:29 2018 (r336095) +++ head/sys/modules/imx/Makefile Sun Jul 8 19:35:41 2018 (r336096) @@ -4,6 +4,7 @@ SUBDIR = \ ../ffec \ imx6_ahci \ + imx6_snvs \ imx_i2c \ imx_spi \ imx_wdog \ Added: head/sys/modules/imx/imx6_snvs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/imx/imx6_snvs/Makefile Sun Jul 8 19:35:41 2018 (r336096) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm/freescale/imx + +KMOD= imx6_snvs +SRCS= imx6_snvs.c + +# Generated files... +SRCS+= \ + bus_if.h \ + clock_if.h \ + device_if.h \ + ofw_bus_if.h \ + +.include From owner-svn-src-head@freebsd.org Sun Jul 8 20:38:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E359C102DFD5; Sun, 8 Jul 2018 20:38:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71DDF8899E; Sun, 8 Jul 2018 20:38: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 530DE2F88; Sun, 8 Jul 2018 20:38: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 w68KclJY089685; Sun, 8 Jul 2018 20:38:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Kclbh089684; Sun, 8 Jul 2018 20:38:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807082038.w68Kclbh089684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Jul 2018 20:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336097 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 336097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:38:48 -0000 Author: markj Date: Sun Jul 8 20:38:46 2018 New Revision: 336097 URL: https://svnweb.freebsd.org/changeset/base/336097 Log: Reuse the PV entry when updating a mapping in pmap_enter(). This addresses a problem described in r335784, where memory pressure forces reclamation of a PV chunk and in rare cases leads to a use-after-free of a page table page. Reviewed by: alc, kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D16181 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jul 8 19:35:41 2018 (r336096) +++ head/sys/arm64/arm64/pmap.c Sun Jul 8 20:38:46 2018 (r336097) @@ -2875,6 +2875,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v new_l3 |= ATTR_SW_WIRED; if (va < VM_MAXUSER_ADDRESS) new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; + if ((m->oflags & VPO_UNMANAGED) == 0) + new_l3 |= ATTR_SW_MANAGED; CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); @@ -2920,7 +2922,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v * otherwise we will need to create the intermediate tables */ if (lvl < 2) { - switch(lvl) { + switch (lvl) { default: case -1: /* Get the l0 pde to update */ @@ -2974,11 +2976,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } } l3 = pmap_l2_to_l3(pde, va); -havel3: - om = NULL; +havel3: orig_l3 = pmap_load(l3); opa = orig_l3 & ~ATTR_MASK; + pv = NULL; /* * Is the specified virtual address already mapped? @@ -3015,7 +3017,6 @@ havel3: * No, might be a protection or wiring change. */ if ((orig_l3 & ATTR_SW_MANAGED) != 0) { - new_l3 |= ATTR_SW_MANAGED; if ((new_l3 & ATTR_AP(ATTR_AP_RW)) == ATTR_AP(ATTR_AP_RW)) { vm_page_aflag_set(m, PGA_WRITEABLE); @@ -3023,6 +3024,37 @@ havel3: } goto validate; } + + /* + * The physical page has changed. + */ + (void)pmap_load_clear(l3); + KASSERT((orig_l3 & ~ATTR_MASK) == opa, + ("pmap_enter: unexpected pa update for %#lx", va)); + if ((orig_l3 & ATTR_SW_MANAGED) != 0) { + om = PHYS_TO_VM_PAGE(opa); + + /* + * The pmap lock is sufficient to synchronize with + * concurrent calls to pmap_page_test_mappings() and + * pmap_ts_referenced(). + */ + if (pmap_page_dirty(orig_l3)) + vm_page_dirty(om); + if ((orig_l3 & ATTR_AF) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); + CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); + pv = pmap_pvh_remove(&om->md, pmap, va); + if ((m->oflags & VPO_UNMANAGED) != 0) + free_pv_entry(pmap, pv); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) + vm_page_aflag_clear(om, PGA_WRITEABLE); + } + pmap_invalidate_page(pmap, va); + orig_l3 = 0; } else { /* * Increment the counters. @@ -3035,9 +3067,10 @@ havel3: * Enter on the PV list if part of our managed memory. */ if ((m->oflags & VPO_UNMANAGED) == 0) { - new_l3 |= ATTR_SW_MANAGED; - pv = get_pv_entry(pmap, &lock); - pv->pv_va = va; + if (pv == NULL) { + pv = get_pv_entry(pmap, &lock); + pv->pv_va = va; + } CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; @@ -3066,24 +3099,8 @@ validate: * Update the L3 entry */ if (pmap_l3_valid(orig_l3)) { - if (opa != pa) { - /* different PA */ - pmap_update_entry(pmap, l3, new_l3, va, PAGE_SIZE); - if ((orig_l3 & ATTR_SW_MANAGED) != 0) { - om = PHYS_TO_VM_PAGE(opa); - if (pmap_page_dirty(orig_l3)) - vm_page_dirty(om); - if ((orig_l3 & ATTR_AF) != 0) - vm_page_aflag_set(om, PGA_REFERENCED); - CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); - pmap_pvh_free(&om->md, pmap, va); - if ((om->aflags & PGA_WRITEABLE) != 0 && - TAILQ_EMPTY(&om->md.pv_list) && - ((om->flags & PG_FICTITIOUS) != 0 || - TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) - vm_page_aflag_clear(om, PGA_WRITEABLE); - } - } else if ((orig_l3 & ~ATTR_AF) != (new_l3 & ~ATTR_AF)) { + KASSERT(opa == pa, ("pmap_enter: invalid update")); + if ((orig_l3 & ~ATTR_AF) != (new_l3 & ~ATTR_AF)) { /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); From owner-svn-src-head@freebsd.org Sun Jul 8 20:39:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69A2F102E167; Sun, 8 Jul 2018 20:39:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CEA988B0A; Sun, 8 Jul 2018 20:39:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F25CC2F91; Sun, 8 Jul 2018 20:39:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdNnb089754; Sun, 8 Jul 2018 20:39:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KdNtQ089753; Sun, 8 Jul 2018 20:39:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68KdNtQ089753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336098 - head/sys/dev/cas X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/cas X-SVN-Commit-Revision: 336098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:39:24 -0000 Author: imp Date: Sun Jul 8 20:39:23 2018 New Revision: 336098 URL: https://svnweb.freebsd.org/changeset/base/336098 Log: Add PNP info to PCI attachment of cas driver Move module delcaration to be after device table. The PNP_INFO must follow the module declaration. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/bsdimp/freebsd/pull/5 Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Sun Jul 8 20:38:46 2018 (r336097) +++ head/sys/dev/cas/if_cas.c Sun Jul 8 20:39:23 2018 (r336098) @@ -2603,10 +2603,6 @@ static driver_t cas_pci_driver = { sizeof(struct cas_softc) }; -DRIVER_MODULE(cas, pci, cas_pci_driver, cas_devclass, 0, 0); -DRIVER_MODULE(miibus, cas, miibus_driver, miibus_devclass, 0, 0); -MODULE_DEPEND(cas, pci, 1, 1, 1); - static const struct cas_pci_dev { uint32_t cpd_devid; uint8_t cpd_revid; @@ -2618,6 +2614,12 @@ static const struct cas_pci_dev { { 0xabba108e, 0x0, CAS_CAS, "Sun Cassini Gigabit Ethernet" }, { 0, 0, 0, NULL } }; + +DRIVER_MODULE(cas, pci, cas_pci_driver, cas_devclass, 0, 0); +MODULE_PNP_INFO("W32:vendor/device", pci, cas, cas_pci_devlist, + sizeof(cas_pci_devlist[0]), nitems(cas_pci_devlist) - 1); +DRIVER_MODULE(miibus, cas, miibus_driver, miibus_devclass, 0, 0); +MODULE_DEPEND(cas, pci, 1, 1, 1); static int cas_pci_probe(device_t dev) From owner-svn-src-head@freebsd.org Sun Jul 8 20:39:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DAF9102E1CF; Sun, 8 Jul 2018 20:39:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6EE88C1F; Sun, 8 Jul 2018 20:39:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C7432F92; Sun, 8 Jul 2018 20:39:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdcqY089815; Sun, 8 Jul 2018 20:39:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Kdcwo089814; Sun, 8 Jul 2018 20:39:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68Kdcwo089814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336099 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 336099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:39:39 -0000 Author: imp Date: Sun Jul 8 20:39:38 2018 New Revision: 336099 URL: https://svnweb.freebsd.org/changeset/base/336099 Log: Add PNP info to PCI attachment of ena driver Make unsigned values uint16_t for pnp table. They are properly uint16_t befause they are 16-bit PCI IDs. The PNP_INFO language has no type for bare unsigned. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/bsdimp/freebsd/pull/5 Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Sun Jul 8 20:39:23 2018 (r336098) +++ head/sys/dev/ena/ena.c Sun Jul 8 20:39:38 2018 (r336099) @@ -3947,6 +3947,8 @@ static driver_t ena_driver = { devclass_t ena_devclass; DRIVER_MODULE(ena, pci, ena_driver, ena_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor; U16:device", pci, ena, ena_vendor_info_array, + sizeof(ena_vendor_info_array[0]), nitems(ena_vendor_info_array) - 1); MODULE_DEPEND(ena, pci, 1, 1, 1); MODULE_DEPEND(ena, ether, 1, 1, 1); Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Sun Jul 8 20:39:23 2018 (r336098) +++ head/sys/dev/ena/ena.h Sun Jul 8 20:39:38 2018 (r336099) @@ -151,8 +151,8 @@ struct msix_entry { }; typedef struct _ena_vendor_info_t { - unsigned int vendor_id; - unsigned int device_id; + uint16_t vendor_id; + uint16_t device_id; unsigned int index; } ena_vendor_info_t; From owner-svn-src-head@freebsd.org Sun Jul 8 20:39:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1F6B102E237; Sun, 8 Jul 2018 20:39:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2840E88CC0; Sun, 8 Jul 2018 20:39:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAE5A2F93; Sun, 8 Jul 2018 20:39:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdhVr089869; Sun, 8 Jul 2018 20:39:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Kdh8X089868; Sun, 8 Jul 2018 20:39:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68Kdh8X089868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336100 - head/sys/dev/fxp X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/fxp X-SVN-Commit-Revision: 336100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:39:47 -0000 Author: imp Date: Sun Jul 8 20:39:43 2018 New Revision: 336100 URL: https://svnweb.freebsd.org/changeset/base/336100 Log: Add PNP info to PCI attachment of fxp driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/bsdimp/freebsd/pull/5 Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jul 8 20:39:38 2018 (r336099) +++ head/sys/dev/fxp/if_fxp.c Sun Jul 8 20:39:43 2018 (r336100) @@ -307,6 +307,8 @@ static devclass_t fxp_devclass; DRIVER_MODULE_ORDERED(fxp, pci, fxp_driver, fxp_devclass, NULL, NULL, SI_ORDER_ANY); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, fxp, fxp_ident_table, + sizeof(fxp_ident_table[0]), nitems(fxp_ident_table) - 1); DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, NULL, NULL); static struct resource_spec fxp_res_spec_mem[] = { From owner-svn-src-head@freebsd.org Sun Jul 8 20:39:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F4041102E254; Sun, 8 Jul 2018 20:39:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A65AF88D2A; Sun, 8 Jul 2018 20:39:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FF1E2F94; Sun, 8 Jul 2018 20:39:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdmXi089920; Sun, 8 Jul 2018 20:39:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KdmjA089919; Sun, 8 Jul 2018 20:39:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68KdmjA089919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336101 - head/sys/dev/gem X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/gem X-SVN-Commit-Revision: 336101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:39:49 -0000 Author: imp Date: Sun Jul 8 20:39:48 2018 New Revision: 336101 URL: https://svnweb.freebsd.org/changeset/base/336101 Log: Add PNP info to PCI attachment of gem driver Move device table earlier in the file so we can reference it in the PNP_INFO macro. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/bsdimp/freebsd/pull/5 Modified: head/sys/dev/gem/if_gem_pci.c Modified: head/sys/dev/gem/if_gem_pci.c ============================================================================== --- head/sys/dev/gem/if_gem_pci.c Sun Jul 8 20:39:43 2018 (r336100) +++ head/sys/dev/gem/if_gem_pci.c Sun Jul 8 20:39:48 2018 (r336101) @@ -74,6 +74,22 @@ static int gem_pci_probe(device_t dev); static int gem_pci_resume(device_t dev); static int gem_pci_suspend(device_t dev); +static const struct gem_pci_dev { + uint32_t gpd_devid; + int gpd_variant; + const char *gpd_desc; +} gem_pci_devlist[] = { + { 0x1101108e, GEM_SUN_ERI, "Sun ERI 10/100 Ethernet" }, + { 0x2bad108e, GEM_SUN_GEM, "Sun GEM Gigabit Ethernet" }, + { 0x0021106b, GEM_APPLE_GMAC, "Apple UniNorth GMAC Ethernet" }, + { 0x0024106b, GEM_APPLE_GMAC, "Apple Pangea GMAC Ethernet" }, + { 0x0032106b, GEM_APPLE_GMAC, "Apple UniNorth2 GMAC Ethernet" }, + { 0x004c106b, GEM_APPLE_K2_GMAC,"Apple K2 GMAC Ethernet" }, + { 0x0051106b, GEM_APPLE_GMAC, "Apple Shasta GMAC Ethernet" }, + { 0x006b106b, GEM_APPLE_GMAC, "Apple Intrepid 2 GMAC Ethernet" }, + { 0, 0, NULL } +}; + static device_method_t gem_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, gem_pci_probe), @@ -99,24 +115,10 @@ static driver_t gem_pci_driver = { }; DRIVER_MODULE(gem, pci, gem_pci_driver, gem_devclass, 0, 0); +MODULE_PNP_INFO("W32:vendor/device", pci, gem, gem_pci_devlist, + sizeof(gem_pci_devlist[0]), nitems(gem_pci_devlist) - 1); MODULE_DEPEND(gem, pci, 1, 1, 1); MODULE_DEPEND(gem, ether, 1, 1, 1); - -static const struct gem_pci_dev { - uint32_t gpd_devid; - int gpd_variant; - const char *gpd_desc; -} gem_pci_devlist[] = { - { 0x1101108e, GEM_SUN_ERI, "Sun ERI 10/100 Ethernet" }, - { 0x2bad108e, GEM_SUN_GEM, "Sun GEM Gigabit Ethernet" }, - { 0x0021106b, GEM_APPLE_GMAC, "Apple UniNorth GMAC Ethernet" }, - { 0x0024106b, GEM_APPLE_GMAC, "Apple Pangea GMAC Ethernet" }, - { 0x0032106b, GEM_APPLE_GMAC, "Apple UniNorth2 GMAC Ethernet" }, - { 0x004c106b, GEM_APPLE_K2_GMAC,"Apple K2 GMAC Ethernet" }, - { 0x0051106b, GEM_APPLE_GMAC, "Apple Shasta GMAC Ethernet" }, - { 0x006b106b, GEM_APPLE_GMAC, "Apple Intrepid 2 GMAC Ethernet" }, - { 0, 0, NULL } -}; static int gem_pci_probe(device_t dev) From owner-svn-src-head@freebsd.org Sun Jul 8 20:39:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2581E102E2B2; Sun, 8 Jul 2018 20:39:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C733D88E11; Sun, 8 Jul 2018 20:39:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BF2C2F95; Sun, 8 Jul 2018 20:39:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdrVS089974; Sun, 8 Jul 2018 20:39:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KdrOn089973; Sun, 8 Jul 2018 20:39:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68KdrOn089973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336102 - head/sys/dev/alc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/alc X-SVN-Commit-Revision: 336102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:39:55 -0000 Author: imp Date: Sun Jul 8 20:39:52 2018 New Revision: 336102 URL: https://svnweb.freebsd.org/changeset/base/336102 Log: Add PNP info to PCI attachment of alc driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Pull Request: https://github.com/bsdimp/freebsd/pull/4 Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Sun Jul 8 20:39:48 2018 (r336101) +++ head/sys/dev/alc/if_alc.c Sun Jul 8 20:39:52 2018 (r336102) @@ -243,6 +243,8 @@ static driver_t alc_driver = { static devclass_t alc_devclass; DRIVER_MODULE(alc, pci, alc_driver, alc_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, alc, alc_ident_table, + sizeof(alc_ident_table[0]), nitems(alc_ident_table) - 1); DRIVER_MODULE(miibus, alc, miibus_driver, miibus_devclass, 0, 0); static struct resource_spec alc_res_spec_mem[] = { From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B452102E314; Sun, 8 Jul 2018 20:40:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E912C88ED7; Sun, 8 Jul 2018 20:39:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E01F2F96; Sun, 8 Jul 2018 20:39:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KdvM7090028; Sun, 8 Jul 2018 20:39:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KdvsU090027; Sun, 8 Jul 2018 20:39:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082039.w68KdvsU090027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336103 - head/sys/dev/bfe X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/bfe X-SVN-Commit-Revision: 336103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:00 -0000 Author: imp Date: Sun Jul 8 20:39:57 2018 New Revision: 336103 URL: https://svnweb.freebsd.org/changeset/base/336103 Log: Add PNP info to PCI attachments of bfe driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Modified: head/sys/dev/bfe/if_bfe.c Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Sun Jul 8 20:39:52 2018 (r336102) +++ head/sys/dev/bfe/if_bfe.c Sun Jul 8 20:39:57 2018 (r336103) @@ -157,6 +157,8 @@ static driver_t bfe_driver = { static devclass_t bfe_devclass; DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bfe, bfe_devs, + sizeof(bfe_devs[0]), nitems(bfe_devs) - 1); DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0); /* From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4402B102E35C; Sun, 8 Jul 2018 20:40:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1DFA88F78; Sun, 8 Jul 2018 20:40:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B40D2F9A; Sun, 8 Jul 2018 20:40:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68Ke1X6090112; Sun, 8 Jul 2018 20:40:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Ke1S4090111; Sun, 8 Jul 2018 20:40:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68Ke1S4090111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336104 - head/sys/dev/bge X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/bge X-SVN-Commit-Revision: 336104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:05 -0000 Author: imp Date: Sun Jul 8 20:40:01 2018 New Revision: 336104 URL: https://svnweb.freebsd.org/changeset/base/336104 Log: Add PNP info to PCI attachments of bge driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Sun Jul 8 20:39:57 2018 (r336103) +++ head/sys/dev/bge/if_bge.c Sun Jul 8 20:40:01 2018 (r336104) @@ -547,6 +547,8 @@ static driver_t bge_driver = { static devclass_t bge_devclass; DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, bge, bge_devs, + sizeof(bge_devs), nitems(bge_devs) - 1); DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); static int bge_allow_asf = 1; From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F597102E3F9; Sun, 8 Jul 2018 20:40:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DDC08910B; Sun, 8 Jul 2018 20:40:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8F402F9C; Sun, 8 Jul 2018 20:40:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KeAUu090219; Sun, 8 Jul 2018 20:40:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KeAOY090218; Sun, 8 Jul 2018 20:40:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68KeAOY090218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336106 - head/sys/dev/ciss X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ciss X-SVN-Commit-Revision: 336106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:12 -0000 Author: imp Date: Sun Jul 8 20:40:10 2018 New Revision: 336106 URL: https://svnweb.freebsd.org/changeset/base/336106 Log: Add PNP info to PCI attachments of ciss driver Move the module declaration so that it's after the device table. The PNP_INFO must come after the module declaration. Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Modified: head/sys/dev/ciss/ciss.c Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Sun Jul 8 20:40:06 2018 (r336105) +++ head/sys/dev/ciss/ciss.c Sun Jul 8 20:40:10 2018 (r336106) @@ -222,11 +222,6 @@ static driver_t ciss_pci_driver = { sizeof(struct ciss_softc) }; -static devclass_t ciss_devclass; -DRIVER_MODULE(ciss, pci, ciss_pci_driver, ciss_devclass, 0, 0); -MODULE_DEPEND(ciss, cam, 1, 1, 1); -MODULE_DEPEND(ciss, pci, 1, 1, 1); - /* * Control device interface. */ @@ -271,6 +266,7 @@ TUNABLE_INT("hw.ciss.force_transport", &ciss_force_tra static int ciss_force_interrupt = 0; TUNABLE_INT("hw.ciss.force_interrupt", &ciss_force_interrupt); + /************************************************************************ * CISS adapters amazingly don't have a defined programming interface * value. (One could say some very despairing things about PCI and @@ -365,6 +361,13 @@ static struct { 0x103C, 0x21CE, CISS_BOARD_SA5, "HP Smart Array H240nr" }, { 0, 0, 0, NULL } }; + +static devclass_t ciss_devclass; +DRIVER_MODULE(ciss, pci, ciss_pci_driver, ciss_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device;", pci, ciss, ciss_vendor_data, + sizeof(ciss_vendor_data[0]), nitems(ciss_vendor_data) - 1); +MODULE_DEPEND(ciss, cam, 1, 1, 1); +MODULE_DEPEND(ciss, pci, 1, 1, 1); /************************************************************************ * Find a match for the device in our list of known adapters. From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49D82102E395; Sun, 8 Jul 2018 20:40:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD48189020; Sun, 8 Jul 2018 20:40:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B2E2F9B; Sun, 8 Jul 2018 20:40:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68Ke6ET090165; Sun, 8 Jul 2018 20:40:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68Ke6Ht090164; Sun, 8 Jul 2018 20:40:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68Ke6Ht090164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336105 - head/sys/dev/dc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/dc X-SVN-Commit-Revision: 336105 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:07 -0000 Author: imp Date: Sun Jul 8 20:40:06 2018 New Revision: 336105 URL: https://svnweb.freebsd.org/changeset/base/336105 Log: Add PNP info to PCI attachment of dc driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15995 Modified: head/sys/dev/dc/if_dc.c Modified: head/sys/dev/dc/if_dc.c ============================================================================== --- head/sys/dev/dc/if_dc.c Sun Jul 8 20:40:01 2018 (r336104) +++ head/sys/dev/dc/if_dc.c Sun Jul 8 20:40:06 2018 (r336105) @@ -359,6 +359,8 @@ static devclass_t dc_devclass; DRIVER_MODULE_ORDERED(dc, pci, dc_driver, dc_devclass, NULL, NULL, SI_ORDER_ANY); +MODULE_PNP_INFO("W32:vendor/device;U8:revision;D:#", pci, dc, dc_devs, + sizeof(dc_devs[0]), nitems(dc_devs) - 1); DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, NULL, NULL); #define DC_SETBIT(sc, reg, x) \ From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4605102E46B; Sun, 8 Jul 2018 20:40:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BDA4891B9; Sun, 8 Jul 2018 20:40:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A2B82F9D; Sun, 8 Jul 2018 20:40:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KeFZP090273; Sun, 8 Jul 2018 20:40:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KeFxL090272; Sun, 8 Jul 2018 20:40:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68KeFxL090272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336107 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 336107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:20 -0000 Author: imp Date: Sun Jul 8 20:40:14 2018 New Revision: 336107 URL: https://svnweb.freebsd.org/changeset/base/336107 Log: Add PNP info to PCI attachment of ix driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15979 Modified: head/sys/dev/ixgbe/if_ix.c Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Sun Jul 8 20:40:10 2018 (r336106) +++ head/sys/dev/ixgbe/if_ix.c Sun Jul 8 20:40:14 2018 (r336107) @@ -237,6 +237,8 @@ static driver_t ix_driver = { devclass_t ix_devclass; DRIVER_MODULE(ix, pci, ix_driver, ix_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, ix, ixgbe_vendor_info_array, + sizeof(ixgbe_vendor_info_array[0]), nitems(ixgbe_vendor_info_array) - 1); MODULE_DEPEND(ix, pci, 1, 1, 1); MODULE_DEPEND(ix, ether, 1, 1, 1); From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96BAA102E48E; Sun, 8 Jul 2018 20:40:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F6F4892CA; Sun, 8 Jul 2018 20:40:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0FD72F9E; Sun, 8 Jul 2018 20:40:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KeJbm090324; Sun, 8 Jul 2018 20:40:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KeJC1090323; Sun, 8 Jul 2018 20:40:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68KeJC1090323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336108 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 336108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:22 -0000 Author: imp Date: Sun Jul 8 20:40:19 2018 New Revision: 336108 URL: https://svnweb.freebsd.org/changeset/base/336108 Log: Add PNP info to PCI attachment of ixv driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15979 Modified: head/sys/dev/ixgbe/if_ixv.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Sun Jul 8 20:40:14 2018 (r336107) +++ head/sys/dev/ixgbe/if_ixv.c Sun Jul 8 20:40:19 2018 (r336108) @@ -143,6 +143,8 @@ static driver_t ixv_driver = { devclass_t ixv_devclass; DRIVER_MODULE(ixv, pci, ixv_driver, ixv_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device", pci, ixv, ixv_vendor_info_array, + sizeof(ixv_vendor_info_array[0]), nitems(ixv_vendor_info_array) - 1); MODULE_DEPEND(ixv, pci, 1, 1, 1); MODULE_DEPEND(ixv, ether, 1, 1, 1); #ifdef DEV_NETMAP From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9F3E102E50E; Sun, 8 Jul 2018 20:40:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A288F89361; Sun, 8 Jul 2018 20:40:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58E542F9F; Sun, 8 Jul 2018 20:40:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KeO2W090378; Sun, 8 Jul 2018 20:40:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KeOuq090377; Sun, 8 Jul 2018 20:40:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68KeOuq090377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336109 - head/sys/dev/ipw X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ipw X-SVN-Commit-Revision: 336109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:28 -0000 Author: imp Date: Sun Jul 8 20:40:23 2018 New Revision: 336109 URL: https://svnweb.freebsd.org/changeset/base/336109 Log: Add PNP info to PCI attachment of ipw driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15979 Modified: head/sys/dev/ipw/if_ipw.c Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Sun Jul 8 20:40:19 2018 (r336108) +++ head/sys/dev/ipw/if_ipw.c Sun Jul 8 20:40:23 2018 (r336109) @@ -202,6 +202,8 @@ static driver_t ipw_driver = { static devclass_t ipw_devclass; DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, NULL, NULL); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ipw, ipw_ident_table, + sizeof(ipw_ident_table[0]), nitems(ipw_ident_table) - 1); MODULE_VERSION(ipw, 1); From owner-svn-src-head@freebsd.org Sun Jul 8 20:40:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2A6D102E54A; Sun, 8 Jul 2018 20:40:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B441C89473; Sun, 8 Jul 2018 20:40:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 159F62FA4; Sun, 8 Jul 2018 20:40:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68KeSS3090432; Sun, 8 Jul 2018 20:40:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68KeSon090431; Sun, 8 Jul 2018 20:40:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082040.w68KeSon090431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 20:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336110 - head/sys/dev/et X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/et X-SVN-Commit-Revision: 336110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 20:40:33 -0000 Author: imp Date: Sun Jul 8 20:40:28 2018 New Revision: 336110 URL: https://svnweb.freebsd.org/changeset/base/336110 Log: Add PNP info to PCI attachment of et driver Reviewed by: imp, chuck Submitted by: Lakhan Shiva Kamireddy Sponsored by: Google, Inc. (GSoC 2018) Differential Revision: https://reviews.freebsd.org/D15979 Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Sun Jul 8 20:40:23 2018 (r336109) +++ head/sys/dev/et/if_et.c Sun Jul 8 20:40:28 2018 (r336110) @@ -188,6 +188,8 @@ static driver_t et_driver = { static devclass_t et_devclass; DRIVER_MODULE(et, pci, et_driver, et_devclass, 0, 0); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, et, et_devices, + sizeof(et_devices[0]), nitems(et_devices) - 1); DRIVER_MODULE(miibus, et, miibus_driver, miibus_devclass, 0, 0); static int et_rx_intr_npkts = 32; From owner-svn-src-head@freebsd.org Sun Jul 8 21:09:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D2B410325C5; Sun, 8 Jul 2018 21:09:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFDB8BC11; Sun, 8 Jul 2018 21:09:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AAC1347B; Sun, 8 Jul 2018 21:09:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68L9sIH006447; Sun, 8 Jul 2018 21:09:54 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68L9q9X006437; Sun, 8 Jul 2018 21:09:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807082109.w68L9q9X006437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 21:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336111 - in head/sys/arm: conf freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/arm: conf freescale/imx X-SVN-Commit-Revision: 336111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 21:09:55 -0000 Author: ian Date: Sun Jul 8 21:09:52 2018 New Revision: 336111 URL: https://svnweb.freebsd.org/changeset/base/336111 Log: Move device statements out of std.imx* and into kernel config files. In the armv4/5 world device statements in these files were common, but in the v6/7 world, other socs don't put device statements into those files, so this just brings imx5 and imx6 into line with the current conventions. Modified: head/sys/arm/conf/EFIKA_MX head/sys/arm/conf/GENERIC head/sys/arm/conf/IMX53 head/sys/arm/conf/IMX6 head/sys/arm/freescale/imx/std.imx51 head/sys/arm/freescale/imx/std.imx53 head/sys/arm/freescale/imx/std.imx6 Modified: head/sys/arm/conf/EFIKA_MX ============================================================================== --- head/sys/arm/conf/EFIKA_MX Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/conf/EFIKA_MX Sun Jul 8 21:09:52 2018 (r336111) @@ -121,6 +121,7 @@ device wlan_amrr # AMRR transmit rate control algori options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=efikamx.dts +device fdt_pinctrl # FDT pinmux driver # NOTE: serial console will be disabled if syscons enabled # Uncomment following lines for framebuffer/syscons support Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/conf/GENERIC Sun Jul 8 21:09:52 2018 (r336111) @@ -261,6 +261,9 @@ device cesa device crypto device cryptodev +# imx6 on-chip RTC +device imx_snvs # On-chip RTC + # Flattened Device Tree options FDT # Configure using FDT/DTB data makeoptions MODULES_EXTRA="dtb/allwinner dtb/am335x dtb/imx6 dtb/nvidia dtb/rpi dtb/zynq dtb/omap4" Modified: head/sys/arm/conf/IMX53 ============================================================================== --- head/sys/arm/conf/IMX53 Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/conf/IMX53 Sun Jul 8 21:09:52 2018 (r336111) @@ -118,5 +118,6 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data makeoptions MODULES_EXTRA="dtb/imx5 imx" +device fdt_pinctrl # FDT pinmux driver options INTRNG Modified: head/sys/arm/conf/IMX6 ============================================================================== --- head/sys/arm/conf/IMX6 Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/conf/IMX6 Sun Jul 8 21:09:52 2018 (r336111) @@ -118,11 +118,13 @@ device hdmi # Flattened Device Tree options FDT # Configure using FDT/DTB data makeoptions MODULES_EXTRA="dtb/imx6 imx" +device fdt_pinctrl # FDT pinmux driver # SoC-specific devices device ffec # Freescale Fast Ethernet Controller device fsliic # Freescale i2c/iic device iic # iic protocol device iicbus # iic bus +device imx_snvs # On-chip RTC device imxwdt # Watchdog. WARNING: can't be disabled!!! Modified: head/sys/arm/freescale/imx/std.imx51 ============================================================================== --- head/sys/arm/freescale/imx/std.imx51 Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/freescale/imx/std.imx51 Sun Jul 8 21:09:52 2018 (r336111) @@ -3,6 +3,4 @@ machine arm armv7 cpu CPU_CORTEXA makeoptions CONF_CFLAGS="-march=armv7a" -device fdt_pinctrl - files "../freescale/imx/files.imx5" Modified: head/sys/arm/freescale/imx/std.imx53 ============================================================================== --- head/sys/arm/freescale/imx/std.imx53 Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/freescale/imx/std.imx53 Sun Jul 8 21:09:52 2018 (r336111) @@ -3,6 +3,4 @@ machine arm armv7 cpu CPU_CORTEXA makeoptions CONF_CFLAGS="-march=armv7a" -device fdt_pinctrl - files "../freescale/imx/files.imx5" Modified: head/sys/arm/freescale/imx/std.imx6 ============================================================================== --- head/sys/arm/freescale/imx/std.imx6 Sun Jul 8 20:40:28 2018 (r336110) +++ head/sys/arm/freescale/imx/std.imx6 Sun Jul 8 21:09:52 2018 (r336111) @@ -6,8 +6,5 @@ makeoptions CONF_CFLAGS="-march=armv7a" options IPI_IRQ_START=0 options IPI_IRQ_END=15 -device fdt_pinctrl -device imx6_snvs - files "../freescale/imx/files.imx6" From owner-svn-src-head@freebsd.org Sun Jul 8 21:14:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0422310330D0; Sun, 8 Jul 2018 21:14:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ABEDD8C2CE; Sun, 8 Jul 2018 21:14:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EB043988; Sun, 8 Jul 2018 21:14:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68LEi2r011775; Sun, 8 Jul 2018 21:14:44 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68LEiDh011771; Sun, 8 Jul 2018 21:14:44 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807082114.w68LEiDh011771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Jul 2018 21:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336112 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 336112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 21:14:45 -0000 Author: ian Date: Sun Jul 8 21:14:43 2018 New Revision: 336112 URL: https://svnweb.freebsd.org/changeset/base/336112 Log: Oops, fix a typo: imx_snvs should be imx6_snvs. Modified: head/sys/arm/conf/GENERIC head/sys/arm/conf/IMX6 Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sun Jul 8 21:09:52 2018 (r336111) +++ head/sys/arm/conf/GENERIC Sun Jul 8 21:14:43 2018 (r336112) @@ -262,7 +262,7 @@ device crypto device cryptodev # imx6 on-chip RTC -device imx_snvs # On-chip RTC +device imx6_snvs # On-chip RTC # Flattened Device Tree options FDT # Configure using FDT/DTB data Modified: head/sys/arm/conf/IMX6 ============================================================================== --- head/sys/arm/conf/IMX6 Sun Jul 8 21:09:52 2018 (r336111) +++ head/sys/arm/conf/IMX6 Sun Jul 8 21:14:43 2018 (r336112) @@ -125,6 +125,6 @@ device ffec # Freescale Fast Ethernet Controller device fsliic # Freescale i2c/iic device iic # iic protocol device iicbus # iic bus -device imx_snvs # On-chip RTC +device imx6_snvs # On-chip RTC device imxwdt # Watchdog. WARNING: can't be disabled!!! From owner-svn-src-head@freebsd.org Sun Jul 8 22:39:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23E85103E013; Sun, 8 Jul 2018 22:39:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C1EFF7014A; Sun, 8 Jul 2018 22:39:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BC3D478E; Sun, 8 Jul 2018 22:39:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68MdXnG053622; Sun, 8 Jul 2018 22:39:33 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68MdXwD053621; Sun, 8 Jul 2018 22:39:33 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201807082239.w68MdXwD053621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 8 Jul 2018 22:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336113 - head/usr.bin/gzip X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.bin/gzip X-SVN-Commit-Revision: 336113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 22:39:34 -0000 Author: pfg Date: Sun Jul 8 22:39:33 2018 New Revision: 336113 URL: https://svnweb.freebsd.org/changeset/base/336113 Log: gzip: fix for undefined behavior. Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined: # progress -zf ./games.tgz tar -xp -C "./" -f - /public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of 251 by 24 places cannot be represented in type 'int' 100% |****************************************************************************************************************| 44500 KiB 119.69 MiB/s 00:00 ETA Refactor the following code into something that is more clear and fix signed integer shift, by casting all buf[] elements to (unsigned int): unsigned char buf[8]; uint32_t usize; [...] else { usize = buf[4] | buf[5] << 8 | buf[6] << 16 | buf[7] << 24; [...] New version: usize = buf[4]; usize |= (unsigned int)buf[5] << 8; usize |= (unsigned int)buf[6] << 16; usize |= (unsigned int)buf[7] << 24; Only the "<< 24" part needs explicit cast, but for consistency make the integer promotion explicit and clear to a code reader. Sponsored by Obtained from: NetBSD (CVS rev. 1.113) MFC after: 1 week Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Sun Jul 8 21:14:43 2018 (r336112) +++ head/usr.bin/gzip/gzip.c Sun Jul 8 22:39:33 2018 (r336113) @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.112 2017/08/23 13:04:17 christos Exp $ */ +/* $NetBSD: gzip.c,v 1.113 2018/06/12 00:42:17 kamil Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD @@ -2169,12 +2169,16 @@ print_list(int fd, off_t out, const char *outfile, tim maybe_warnx("read of uncompressed size"); else { - usize = buf[4] | buf[5] << 8 | - buf[6] << 16 | buf[7] << 24; + usize = buf[4]; + usize |= (unsigned int)buf[5] << 8; + usize |= (unsigned int)buf[6] << 16; + usize |= (unsigned int)buf[7] << 24; in = (off_t)usize; #ifndef SMALL - crc = buf[0] | buf[1] << 8 | - buf[2] << 16 | buf[3] << 24; + crc = buf[0]; + crc |= (unsigned int)buf[1] << 8; + crc |= (unsigned int)buf[2] << 16; + crc |= (unsigned int)buf[3] << 24; #endif } } From owner-svn-src-head@freebsd.org Sun Jul 8 22:45:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3174B103E9F1; Sun, 8 Jul 2018 22:45:22 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id BFE3070723; Sun, 8 Jul 2018 22:45:21 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 191FD14813; Sun, 8 Jul 2018 22:45:15 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w68MjETa038041 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 8 Jul 2018 22:45:14 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w68MjE2F038040; Sun, 8 Jul 2018 22:45:14 GMT (envelope-from phk) To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336113 - head/usr.bin/gzip In-reply-to: <201807082239.w68MdXwD053621@repo.freebsd.org> From: "Poul-Henning Kamp" References: <201807082239.w68MdXwD053621@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <38038.1531089914.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sun, 08 Jul 2018 22:45:14 +0000 Message-ID: <38039.1531089914@critter.freebsd.dk> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 22:45:22 -0000 -------- In message <201807082239.w68MdXwD053621@repo.freebsd.org>, "Pedro F. Giffu= ni" writes: > New version: > = > usize =3D buf[4]; > usize |=3D (unsigned int)buf[5] << 8; > usize |=3D (unsigned int)buf[6] << 16; > usize |=3D (unsigned int)buf[7] << 24; Why not use the functions in endian.h ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-head@freebsd.org Sun Jul 8 22:51:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42719103F4A6; Sun, 8 Jul 2018 22:51:50 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8513E70D26; Sun, 8 Jul 2018 22:51:49 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp59-167-167-3.static.internode.on.net [59.167.167.3]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id w68Mpafc054892 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 9 Jul 2018 08:51:42 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id w68MpU6J005232 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 9 Jul 2018 08:51:31 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id w68MpUkv005231; Mon, 9 Jul 2018 08:51:30 +1000 (AEST) (envelope-from peter) Date: Mon, 9 Jul 2018 08:51:30 +1000 From: Peter Jeremy To: Warner Losh Cc: "Rodney W. Grimes" , Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336025 - in head/sys: amd64/include i386/include Message-ID: <20180708225130.GD78412@server.rulingia.com> References: <201807061013.w66ADgbJ087546@repo.freebsd.org> <201807061532.w66FWPEN052842@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 22:51:50 -0000 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-Jul-06 09:47:00 -0600, Warner Losh wrote: >On UP systems, these additional opcodes are harmless. They take a few extra >cycles (since they lock an uncontested bus) and add a couple extra memory >barriers (which will be NOPs). On MP systems, atomics now work by default. Atomics in modules used to work by default (at least on x86) - they were explicitly not inlined so that modules on UP systems didn't have to include the lock and barrier instructions that were very expensive on some systems 20 years ago. That said, those systems are (hopefully) all dead now so moving to inlining SMP versions of atomic operations in modules is probably the correct decision now. --=20 Peter Jeremy --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAltClXJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzT7Kw/+PR9PTELv+1R/P4k+ZG9IRaG1CDcnodf+kvs/REVYV6VOYlKyuKepaBe4 OqwFd7h/7ws2myrjInl+REtHgKA5Le7voXK2ox0A8sGBxNTcebkQZwpEJhNqDy0O kUrKiJ3WoThoq0C3Wd2FgrXBvCLzn/qcwIFsQ679vOs7kl5bVUSUC8/3N9IpI/Gz Bks0wD3a6gV9YCil5MnsMUQMxwi39cKq47u4FWXSPEHpGx0MWkxXT7lLPFpaB4mB R67tkKC1V7qMzKWZu0POzQrWe0/z8CrempK7SKjPkHTeObMvTgjuZp5KWme591rE 1Wve9pbMpk995AoyjH2xoaucIdXxtm6vpmaEBYMKv4hEGj20i5lqrKW5F2eX4Nsu 0LOKN5Ri8xAkhOqF4VxZurtWpeTJDUjs2skPfdQq/gwWNSG2usVri3cvYigUpnYk ITSWrwXPRptw+9RtW/zsr+x2QoA3QvCbShsUjxE3RhlrmiPwDEex4mFNAizD2WBp ljvnYuEiTHWg3kMQwo+Z/fYU/dNZ1ff5VuT5O05wu/sq60NyuYRZgaTHghfaKZ0g QCWeBTaQ2PMvdIjV1Ym1ipJ5Osq7o17SXToLLZwJxE2Geycw6Ns8cYNkKvud1ew2 QRdxiBGXqjpTxzT41Nxcqb7zWZFARMpMlZsHyRa7aXS/KFVHdtE= =9XaV -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24-- From owner-svn-src-head@freebsd.org Sun Jul 8 23:12:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5053410419DE; Sun, 8 Jul 2018 23:12:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 035EB71DCA; Sun, 8 Jul 2018 23:12:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA1594E1A; Sun, 8 Jul 2018 23:12:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68NCRNv073815; Sun, 8 Jul 2018 23:12:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68NCRBp073814; Sun, 8 Jul 2018 23:12:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807082312.w68NCRBp073814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 8 Jul 2018 23:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336114 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 336114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 23:12:28 -0000 Author: imp Date: Sun Jul 8 23:12:27 2018 New Revision: 336114 URL: https://svnweb.freebsd.org/changeset/base/336114 Log: Remove stray space from PNP string. Modified: head/sys/dev/ena/ena.c Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Sun Jul 8 22:39:33 2018 (r336113) +++ head/sys/dev/ena/ena.c Sun Jul 8 23:12:27 2018 (r336114) @@ -3947,7 +3947,7 @@ static driver_t ena_driver = { devclass_t ena_devclass; DRIVER_MODULE(ena, pci, ena_driver, ena_devclass, 0, 0); -MODULE_PNP_INFO("U16:vendor; U16:device", pci, ena, ena_vendor_info_array, +MODULE_PNP_INFO("U16:vendor;U16:device", pci, ena, ena_vendor_info_array, sizeof(ena_vendor_info_array[0]), nitems(ena_vendor_info_array) - 1); MODULE_DEPEND(ena, pci, 1, 1, 1); MODULE_DEPEND(ena, ether, 1, 1, 1); From owner-svn-src-head@freebsd.org Sun Jul 8 23:22:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D62241042B53; Sun, 8 Jul 2018 23:22:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8397972765; Sun, 8 Jul 2018 23:22:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64EF14EA2; Sun, 8 Jul 2018 23:22:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w68NM5Ll076440; Sun, 8 Jul 2018 23:22:05 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w68NM5TO076439; Sun, 8 Jul 2018 23:22:05 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201807082322.w68NM5TO076439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 8 Jul 2018 23:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336115 - head/lib/libiconv_modules/mapper_std X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libiconv_modules/mapper_std X-SVN-Commit-Revision: 336115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 23:22:06 -0000 Author: pfg Date: Sun Jul 8 23:22:04 2018 New Revision: 336115 URL: https://svnweb.freebsd.org/changeset/base/336115 Log: libiconv: correct undefined behavior. Detected on NetBSD: # nm /usr/lib/libc.so|grep sanit /public/src.git/lib/libc/citrus/modules/citrus_mapper_std.c:173:8: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Obtained from: NetBSD (CVS Rev. 1.11) MFC after: 1 week Modified: head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c Modified: head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c ============================================================================== --- head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c Sun Jul 8 23:12:27 2018 (r336114) +++ head/lib/libiconv_modules/mapper_std/citrus_mapper_std.c Sun Jul 8 23:22:04 2018 (r336115) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $ */ +/* $NetBSD: citrus_mapper_std.c,v 1.11 2018/06/11 18:03:38 kamil Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -161,7 +161,7 @@ rowcol_parse_variable_compat(struct _citrus_mapper_std rc->rc_dst_invalid = be32toh(rcx->rcx_dst_invalid); rc->rc_dst_unit_bits = be32toh(rcx->rcx_dst_unit_bits); m = be32toh(rcx->rcx_src_col_bits); - n = 1 << (m - 1); + n = 1U << (m - 1); n |= n - 1; rc->rc_src_rowcol_bits = m; rc->rc_src_rowcol_mask = n; From owner-svn-src-head@freebsd.org Sun Jul 8 23:23:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 481E91042E09 for ; Sun, 8 Jul 2018 23:23:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic315-14.consmr.mail.bf2.yahoo.com (sonic315-14.consmr.mail.bf2.yahoo.com [74.6.134.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0B407297F for ; Sun, 8 Jul 2018 23:23:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1531092216; bh=M8mBr9w924MVOEs2+D3nwmv7T3lrJbpEZ7ryjCIG14E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=JBJKe/edlVR/YsVNoOyIddciCrz5GXs4afqD6eGqyPD5l4+yqUsFZvCOzvFX4S2t5Kt+gsMchfMC0sMiBSE0qzg+GJN5FIKzWSZlL0OgxNNex/cEVhQQy5+PrPyUuL08pTaoP8UE+qvSgSdtEntBhUJM+gSTbltGbJd9t67Svk2ukWXr8X8wEeWSGqobNVL+QHbJUzCSzkkkEmH766xMVoZmgTN/TiTLmTtgnfYJXJk8p5lsgISSsnVSrYWNW/rHT0AlcndxpD+Kiy5LDsnWEOvrwWBPeHC9Udym09T2StoHQGZQjq2LZmhcA4SjgL14y4CVaBzzUm1kzrtx6MdpeA== X-YMail-OSG: XT8tF9MVM1l9a4DiQxoxembXb7KANj4HSWrtz1M.0DOw91krEc9AgPkXyKJWeQq TU8p1UYb7flRD0Lc7J658gFr9zEfbRmu3YFAUCbPCiredwx2B6pK13PuyMr0hJBWz9LFR5jaif6w lOtmhulaGxwuYzDne43GOh3KDsGeg8KhiJWfzG47TJ4kJLkFVE1FNaY70kkI5dNyzT8J0jQwNtwy x8V4v3lep9aHO.QxGoL8OIBpWyc2chpaWwxtIhFll8hnUSf3ocIeJJnLIgVw2TK1Zn445Of032zg Mbyj6AthnDzYZIaPIxjfBN98ljMJvL9.poOdgsj3irAxeHXsfaHCnB_9cXVTPyxW.8D9lC2N0vUq x5vvnUO5M6V5DYuHSrLhVUP13DnJluSIGIgyfXZsF67WR9dNTbhh2N0w7XrAJ8lZlEKVNn7J5vXw kZ0IfVFgzMdOxmeM49G43.ssMQSt1Ii13G.5JafBEf3ayqSnTQ3GPE0jhzENEkSu_HICN1IiUDnJ Ezw3cIKkCOvgynvwTWtoHrRNxAHnZL7_0bH2IVCv5n.QCyjuq5pzz0_w2tTclGspYfYU1GWBFCjB eQhlEvzQG2kHmU_LO7g2fJbatBR4BYmA4rwdnjQaW7X.wNFfulcyuesZeGrPEO1BAmXdtkCuHpGq 2qI_5e.Bh7bv.lGeCIE.uSL4ye_EOMLT_J2Da0YyyBz0mJtLOEgJMyqtYo_Ltu3C7E80EyMdN3ct 7DYA2EmJTqi4SOu1IHz6L7A2P10_auWoCuTr4QTGE4PEa_POpS5dEuTAodp.KPXByEhbSuipdlEW sqshOvb4EhaFUQKSY6zS_H29tLvUhCtabhKRT_PJdU57fUlOIJ71B8wK5CAreZMUHfPXVlV5TFKx .5NjttjNzHb0zkHr1Qip8nt5gTed799eCbU6XpxNjhYlkKIweGSlCiefbZkbzDUJaItPmCV8Ae9u c8jHj.vNpzx7GU2xrDNH9P7rMINrngxXeoG7qGUjr Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Sun, 8 Jul 2018 23:23:36 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.5]) ([181.52.72.201]) by smtp419.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID b5105601ce084b92c36cfe54a01300ee; Sun, 08 Jul 2018 23:23:31 +0000 (UTC) Subject: Re: svn commit: r336113 - head/usr.bin/gzip To: Poul-Henning Kamp Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807082239.w68MdXwD053621@repo.freebsd.org> <38039.1531089914@critter.freebsd.dk> From: Pedro Giffuni Message-ID: Date: Sun, 8 Jul 2018 18:23:32 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <38039.1531089914@critter.freebsd.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 23:23:38 -0000 On 07/08/18 17:45, Poul-Henning Kamp wrote: > -------- > In message <201807082239.w68MdXwD053621@repo.freebsd.org>, "Pedro F. Giffuni" writes: > >> New version: >> >> usize = buf[4]; >> usize |= (unsigned int)buf[5] << 8; >> usize |= (unsigned int)buf[6] << 16; >> usize |= (unsigned int)buf[7] << 24; > Why not use the functions in endian.h ? > Hmm. .. I am just syncing with NetBSD, where this originated from :-/. But good point. Pedro. From owner-svn-src-head@freebsd.org Mon Jul 9 03:57:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 891C6103B71C; Mon, 9 Jul 2018 03:57:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35AE67DBF5; Mon, 9 Jul 2018 03:57:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F13647D2F; Mon, 9 Jul 2018 03:57:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w693vNS1018134; Mon, 9 Jul 2018 03:57:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w693vN7r018133; Mon, 9 Jul 2018 03:57:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807090357.w693vN7r018133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 9 Jul 2018 03:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336118 - in head/stand: zfs zfs32 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: zfs zfs32 X-SVN-Commit-Revision: 336118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 03:57:24 -0000 Author: imp Date: Mon Jul 9 03:57:23 2018 New Revision: 336118 URL: https://svnweb.freebsd.org/changeset/base/336118 Log: Remove dirs that git svn should have removed but didn't. Deleted: head/stand/zfs/ head/stand/zfs32/ From owner-svn-src-head@freebsd.org Mon Jul 9 06:19:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 012621048068; Mon, 9 Jul 2018 06:19:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7D4D83662; Mon, 9 Jul 2018 06:19:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84086113A8; Mon, 9 Jul 2018 06:19:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w696JXds089733; Mon, 9 Jul 2018 06:19:33 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w696JXOv089732; Mon, 9 Jul 2018 06:19:33 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201807090619.w696JXOv089732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 9 Jul 2018 06:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336121 - head/usr.bin/gzip X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/usr.bin/gzip X-SVN-Commit-Revision: 336121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 06:19:34 -0000 Author: delphij Date: Mon Jul 9 06:19:33 2018 New Revision: 336121 URL: https://svnweb.freebsd.org/changeset/base/336121 Log: Don't delete outfile unconditionally. MFC after: 1 month Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Mon Jul 9 06:02:45 2018 (r336120) +++ head/usr.bin/gzip/gzip.c Mon Jul 9 06:19:33 2018 (r336121) @@ -1429,6 +1429,7 @@ file_uncompress(char *file, char *outfile, size_t outs unsigned char header1[4]; enum filetype method; int fd, ofd, zfd = -1; + int err; size_t in_size; #ifndef SMALL ssize_t rv; @@ -1601,14 +1602,21 @@ file_uncompress(char *file, char *outfile, size_t outs size = zuncompress(in, out, NULL, 0, NULL); /* need to fclose() if ferror() is true... */ - if (ferror(in) | fclose(in)) { - maybe_warn("failed infile fclose"); - unlink(outfile); + err = ferror(in); + if (err | fclose(in)) { + if (err) + maybe_warn("failed infile"); + else + maybe_warn("failed infile fclose"); + if (cflag == 0) + unlink(outfile); (void)fclose(out); + goto lose; } if (fclose(out) != 0) { maybe_warn("failed outfile fclose"); - unlink(outfile); + if (cflag == 0) + unlink(outfile); goto lose; } break; From owner-svn-src-head@freebsd.org Mon Jul 9 07:21:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A8DA1028EBA; Mon, 9 Jul 2018 07:21:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA9E58675F; Mon, 9 Jul 2018 07:21:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BCDB11EA2; Mon, 9 Jul 2018 07:21:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w697Lepm022620; Mon, 9 Jul 2018 07:21:40 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w697Lctp022608; Mon, 9 Jul 2018 07:21:38 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090721.w697Lctp022608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 07:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336122 - in head/sys: crypto/aesni crypto/ccp crypto/via dev/cesa dev/safe dev/ubsec opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: crypto/aesni crypto/ccp crypto/via dev/cesa dev/safe dev/ubsec opencrypto X-SVN-Commit-Revision: 336122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 07:21:41 -0000 Author: cem Date: Mon Jul 9 07:21:37 2018 New Revision: 336122 URL: https://svnweb.freebsd.org/changeset/base/336122 Log: Remove "HMAC" from _HMAC_BLOCK_LEN macro names The block size is a property of the underlying hash algorithm, and has nothing to do with the HMAC construction. No functional change. Modified: head/sys/crypto/aesni/aesni.h head/sys/crypto/ccp/ccp.h head/sys/crypto/via/padlock_hash.c head/sys/dev/cesa/cesa.c head/sys/dev/safe/safe.c head/sys/dev/ubsec/ubsec.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/xform_md5.c head/sys/opencrypto/xform_rmd160.c head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/crypto/aesni/aesni.h Mon Jul 9 07:21:37 2018 (r336122) @@ -57,7 +57,7 @@ struct aesni_session { uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); /* Same as the SHA256 Blocksize. */ - uint8_t hmac_key[SHA1_HMAC_BLOCK_LEN] __aligned(16); + uint8_t hmac_key[SHA1_BLOCK_LEN] __aligned(16); int algo; int rounds; /* uint8_t *ses_ictx; */ Modified: head/sys/crypto/ccp/ccp.h ============================================================================== --- head/sys/crypto/ccp/ccp.h Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/crypto/ccp/ccp.h Mon Jul 9 07:21:37 2018 (r336122) @@ -35,7 +35,7 @@ * SHA3-224 is the next largest block size, at 1152 bits. However, crypto(4) * doesn't support any SHA3 hash, so SHA2 is the constraint: */ -#define CCP_HASH_MAX_BLOCK_SIZE (SHA2_512_HMAC_BLOCK_LEN) +#define CCP_HASH_MAX_BLOCK_SIZE (SHA2_512_BLOCK_LEN) #define CCP_AES_MAX_KEY_LEN (AES_XTS_MAX_KEY) #define CCP_MAX_CRYPTO_IV_LEN 32 /* GCM IV + GHASH context */ Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/crypto/via/padlock_hash.c Mon Jul 9 07:21:37 2018 (r336122) @@ -83,10 +83,10 @@ static void padlock_sha256_final(uint8_t *hash, struct static struct auth_hash padlock_hmac_sha1 = { .type = CRYPTO_SHA1_HMAC, .name = "HMAC-SHA1", - .keysize = SHA1_HMAC_BLOCK_LEN, + .keysize = SHA1_BLOCK_LEN, .hashsize = SHA1_HASH_LEN, .ctxsize = sizeof(struct padlock_sha_ctx), - .blocksize = SHA1_HMAC_BLOCK_LEN, + .blocksize = SHA1_BLOCK_LEN, .Init = (void (*)(void *))padlock_sha_init, .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, .Final = (void (*)(uint8_t *, void *))padlock_sha1_final, @@ -95,10 +95,10 @@ static struct auth_hash padlock_hmac_sha1 = { static struct auth_hash padlock_hmac_sha256 = { .type = CRYPTO_SHA2_256_HMAC, .name = "HMAC-SHA2-256", - .keysize = SHA2_256_HMAC_BLOCK_LEN, + .keysize = SHA2_256_BLOCK_LEN, .hashsize = SHA2_256_HASH_LEN, .ctxsize = sizeof(struct padlock_sha_ctx), - .blocksize = SHA2_256_HMAC_BLOCK_LEN, + .blocksize = SHA2_256_BLOCK_LEN, .Init = (void (*)(void *))padlock_sha_init, .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, .Final = (void (*)(uint8_t *, void *))padlock_sha256_final, Modified: head/sys/dev/cesa/cesa.c ============================================================================== --- head/sys/dev/cesa/cesa.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/dev/cesa/cesa.c Mon Jul 9 07:21:37 2018 (r336122) @@ -471,26 +471,26 @@ cesa_set_mkey(struct cesa_session *cs, int alg, const switch (alg) { case CRYPTO_MD5_HMAC: MD5Init(&md5ctx); - MD5Update(&md5ctx, ipad, MD5_HMAC_BLOCK_LEN); + MD5Update(&md5ctx, ipad, MD5_BLOCK_LEN); memcpy(hin, md5ctx.state, sizeof(md5ctx.state)); MD5Init(&md5ctx); - MD5Update(&md5ctx, opad, MD5_HMAC_BLOCK_LEN); + MD5Update(&md5ctx, opad, MD5_BLOCK_LEN); memcpy(hout, md5ctx.state, sizeof(md5ctx.state)); break; case CRYPTO_SHA1_HMAC: SHA1Init(&sha1ctx); - SHA1Update(&sha1ctx, ipad, SHA1_HMAC_BLOCK_LEN); + SHA1Update(&sha1ctx, ipad, SHA1_BLOCK_LEN); memcpy(hin, sha1ctx.h.b32, sizeof(sha1ctx.h.b32)); SHA1Init(&sha1ctx); - SHA1Update(&sha1ctx, opad, SHA1_HMAC_BLOCK_LEN); + SHA1Update(&sha1ctx, opad, SHA1_BLOCK_LEN); memcpy(hout, sha1ctx.h.b32, sizeof(sha1ctx.h.b32)); break; case CRYPTO_SHA2_256_HMAC: SHA256_Init(&sha256ctx); - SHA256_Update(&sha256ctx, ipad, SHA2_256_HMAC_BLOCK_LEN); + SHA256_Update(&sha256ctx, ipad, SHA2_256_BLOCK_LEN); memcpy(hin, sha256ctx.state, sizeof(sha256ctx.state)); SHA256_Init(&sha256ctx); - SHA256_Update(&sha256ctx, opad, SHA2_256_HMAC_BLOCK_LEN); + SHA256_Update(&sha256ctx, opad, SHA2_256_BLOCK_LEN); memcpy(hout, sha256ctx.state, sizeof(sha256ctx.state)); break; default: @@ -1684,7 +1684,7 @@ cesa_newsession(device_t dev, uint32_t *sidp, struct c cs->cs_config |= CESA_CSHD_MD5; break; case CRYPTO_MD5_HMAC: - cs->cs_mblen = MD5_HMAC_BLOCK_LEN; + cs->cs_mblen = MD5_BLOCK_LEN; cs->cs_hlen = (mac->cri_mlen == 0) ? MD5_HASH_LEN : mac->cri_mlen; cs->cs_config |= CESA_CSHD_MD5_HMAC; @@ -1698,7 +1698,7 @@ cesa_newsession(device_t dev, uint32_t *sidp, struct c cs->cs_config |= CESA_CSHD_SHA1; break; case CRYPTO_SHA1_HMAC: - cs->cs_mblen = SHA1_HMAC_BLOCK_LEN; + cs->cs_mblen = SHA1_BLOCK_LEN; cs->cs_hlen = (mac->cri_mlen == 0) ? SHA1_HASH_LEN : mac->cri_mlen; cs->cs_config |= CESA_CSHD_SHA1_HMAC; @@ -1706,7 +1706,7 @@ cesa_newsession(device_t dev, uint32_t *sidp, struct c cs->cs_config |= CESA_CSHD_96_BIT_HMAC; break; case CRYPTO_SHA2_256_HMAC: - cs->cs_mblen = SHA2_256_HMAC_BLOCK_LEN; + cs->cs_mblen = SHA2_256_BLOCK_LEN; cs->cs_hlen = (mac->cri_mlen == 0) ? SHA2_256_HASH_LEN : mac->cri_mlen; cs->cs_config |= CESA_CSHD_SHA2_256_HMAC; Modified: head/sys/dev/safe/safe.c ============================================================================== --- head/sys/dev/safe/safe.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/dev/safe/safe.c Mon Jul 9 07:21:37 2018 (r336122) @@ -655,13 +655,13 @@ safe_setup_mackey(struct safe_session *ses, int algo, if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_ipad_buffer, MD5_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); SHA1Update(&sha1ctx, hmac_ipad_buffer, - SHA1_HMAC_BLOCK_LEN - klen); + SHA1_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hminner, sizeof(sha1ctx.h.b32)); } @@ -671,13 +671,13 @@ safe_setup_mackey(struct safe_session *ses, int algo, if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_opad_buffer, MD5_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); SHA1Update(&sha1ctx, hmac_opad_buffer, - SHA1_HMAC_BLOCK_LEN - klen); + SHA1_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hmouter, sizeof(sha1ctx.h.b32)); } Modified: head/sys/dev/ubsec/ubsec.c ============================================================================== --- head/sys/dev/ubsec/ubsec.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/dev/ubsec/ubsec.c Mon Jul 9 07:21:37 2018 (r336122) @@ -859,13 +859,13 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_ipad_buffer, MD5_HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_ipad_buffer, MD5_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hminner, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); SHA1Update(&sha1ctx, hmac_ipad_buffer, - SHA1_HMAC_BLOCK_LEN - klen); + SHA1_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hminner, sizeof(sha1ctx.h.b32)); } @@ -875,13 +875,13 @@ ubsec_setup_mackey(struct ubsec_session *ses, int algo if (algo == CRYPTO_MD5_HMAC) { MD5Init(&md5ctx); MD5Update(&md5ctx, key, klen); - MD5Update(&md5ctx, hmac_opad_buffer, MD5_HMAC_BLOCK_LEN - klen); + MD5Update(&md5ctx, hmac_opad_buffer, MD5_BLOCK_LEN - klen); bcopy(md5ctx.state, ses->ses_hmouter, sizeof(md5ctx.state)); } else { SHA1Init(&sha1ctx); SHA1Update(&sha1ctx, key, klen); SHA1Update(&sha1ctx, hmac_opad_buffer, - SHA1_HMAC_BLOCK_LEN - klen); + SHA1_BLOCK_LEN - klen); bcopy(sha1ctx.h.b32, ses->ses_hmouter, sizeof(sha1ctx.h.b32)); } Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/opencrypto/cryptodev.h Mon Jul 9 07:21:37 2018 (r336122) @@ -83,16 +83,17 @@ /* Maximum hash algorithm result length */ #define HASH_MAX_LEN SHA2_512_HASH_LEN /* Keep this updated */ +#define MD5_BLOCK_LEN 64 +#define SHA1_BLOCK_LEN 64 +#define RIPEMD160_BLOCK_LEN 64 +#define SHA2_256_BLOCK_LEN 64 +#define SHA2_384_BLOCK_LEN 128 +#define SHA2_512_BLOCK_LEN 128 + /* HMAC values */ #define NULL_HMAC_BLOCK_LEN 64 -#define MD5_HMAC_BLOCK_LEN 64 -#define SHA1_HMAC_BLOCK_LEN 64 -#define RIPEMD160_HMAC_BLOCK_LEN 64 -#define SHA2_256_HMAC_BLOCK_LEN 64 -#define SHA2_384_HMAC_BLOCK_LEN 128 -#define SHA2_512_HMAC_BLOCK_LEN 128 /* Maximum HMAC block length */ -#define HMAC_MAX_BLOCK_LEN SHA2_512_HMAC_BLOCK_LEN /* Keep this updated */ +#define HMAC_MAX_BLOCK_LEN SHA2_512_BLOCK_LEN /* Keep this updated */ #define HMAC_IPAD_VAL 0x36 #define HMAC_OPAD_VAL 0x5C /* HMAC Key Length */ Modified: head/sys/opencrypto/xform_md5.c ============================================================================== --- head/sys/opencrypto/xform_md5.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/opencrypto/xform_md5.c Mon Jul 9 07:21:37 2018 (r336122) @@ -59,10 +59,10 @@ static int MD5Update_int(void *, const u_int8_t *, u_i struct auth_hash auth_hash_hmac_md5 = { .type = CRYPTO_MD5_HMAC, .name = "HMAC-MD5", - .keysize = MD5_HMAC_BLOCK_LEN, + .keysize = MD5_BLOCK_LEN, .hashsize = MD5_HASH_LEN, .ctxsize = sizeof(MD5_CTX), - .blocksize = MD5_HMAC_BLOCK_LEN, + .blocksize = MD5_BLOCK_LEN, .Init = (void (*) (void *)) MD5Init, .Update = MD5Update_int, .Final = (void (*) (u_int8_t *, void *)) MD5Final, Modified: head/sys/opencrypto/xform_rmd160.c ============================================================================== --- head/sys/opencrypto/xform_rmd160.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/opencrypto/xform_rmd160.c Mon Jul 9 07:21:37 2018 (r336122) @@ -59,10 +59,10 @@ static int RMD160Update_int(void *, const u_int8_t *, struct auth_hash auth_hash_hmac_ripemd_160 = { .type = CRYPTO_RIPEMD160_HMAC, .name = "HMAC-RIPEMD-160", - .keysize = RIPEMD160_HMAC_BLOCK_LEN, + .keysize = RIPEMD160_BLOCK_LEN, .hashsize = RIPEMD160_HASH_LEN, .ctxsize = sizeof(RMD160_CTX), - .blocksize = RIPEMD160_HMAC_BLOCK_LEN, + .blocksize = RIPEMD160_BLOCK_LEN, .Init = (void (*)(void *)) RMD160Init, .Update = RMD160Update_int, .Final = (void (*)(u_int8_t *, void *)) RMD160Final, Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/opencrypto/xform_sha1.c Mon Jul 9 07:21:37 2018 (r336122) @@ -61,10 +61,10 @@ static void SHA1Final_int(u_int8_t *, void *); struct auth_hash auth_hash_hmac_sha1 = { .type = CRYPTO_SHA1_HMAC, .name = "HMAC-SHA1", - .keysize = SHA1_HMAC_BLOCK_LEN, + .keysize = SHA1_BLOCK_LEN, .hashsize = SHA1_HASH_LEN, .ctxsize = sizeof(SHA1_CTX), - .blocksize = SHA1_HMAC_BLOCK_LEN, + .blocksize = SHA1_BLOCK_LEN, .Init = SHA1Init_int, .Update = SHA1Update_int, .Final = SHA1Final_int, Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Mon Jul 9 06:19:33 2018 (r336121) +++ head/sys/opencrypto/xform_sha2.c Mon Jul 9 07:21:37 2018 (r336122) @@ -63,10 +63,10 @@ static int SHA512Update_int(void *, const u_int8_t *, struct auth_hash auth_hash_hmac_sha2_256 = { .type = CRYPTO_SHA2_256_HMAC, .name = "HMAC-SHA2-256", - .keysize = SHA2_256_HMAC_BLOCK_LEN, + .keysize = SHA2_256_BLOCK_LEN, .hashsize = SHA2_256_HASH_LEN, .ctxsize = sizeof(SHA256_CTX), - .blocksize = SHA2_256_HMAC_BLOCK_LEN, + .blocksize = SHA2_256_BLOCK_LEN, .Init = (void (*)(void *)) SHA256_Init, .Update = SHA256Update_int, .Final = (void (*)(u_int8_t *, void *)) SHA256_Final, @@ -75,10 +75,10 @@ struct auth_hash auth_hash_hmac_sha2_256 = { struct auth_hash auth_hash_hmac_sha2_384 = { .type = CRYPTO_SHA2_384_HMAC, .name = "HMAC-SHA2-384", - .keysize = SHA2_384_HMAC_BLOCK_LEN, + .keysize = SHA2_384_BLOCK_LEN, .hashsize = SHA2_384_HASH_LEN, .ctxsize = sizeof(SHA384_CTX), - .blocksize = SHA2_384_HMAC_BLOCK_LEN, + .blocksize = SHA2_384_BLOCK_LEN, .Init = (void (*)(void *)) SHA384_Init, .Update = SHA384Update_int, .Final = (void (*)(u_int8_t *, void *)) SHA384_Final, @@ -87,10 +87,10 @@ struct auth_hash auth_hash_hmac_sha2_384 = { struct auth_hash auth_hash_hmac_sha2_512 = { .type = CRYPTO_SHA2_512_HMAC, .name = "HMAC-SHA2-512", - .keysize = SHA2_512_HMAC_BLOCK_LEN, + .keysize = SHA2_512_BLOCK_LEN, .hashsize = SHA2_512_HASH_LEN, .ctxsize = sizeof(SHA512_CTX), - .blocksize = SHA2_512_HMAC_BLOCK_LEN, + .blocksize = SHA2_512_BLOCK_LEN, .Init = (void (*)(void *)) SHA512_Init, .Update = SHA512Update_int, .Final = (void (*)(u_int8_t *, void *)) SHA512_Final, From owner-svn-src-head@freebsd.org Mon Jul 9 07:24:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A0821029229; Mon, 9 Jul 2018 07:24:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAFCE86B0C; Mon, 9 Jul 2018 07:24:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC0B511EDC; Mon, 9 Jul 2018 07:24:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w697O5V3024985; Mon, 9 Jul 2018 07:24:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w697O5p3024984; Mon, 9 Jul 2018 07:24:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090724.w697O5p3024984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 07:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336123 - head/sys/crypto/sha2 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/crypto/sha2 X-SVN-Commit-Revision: 336123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 07:24:06 -0000 Author: cem Date: Mon Jul 9 07:24:05 2018 New Revision: 336123 URL: https://svnweb.freebsd.org/changeset/base/336123 Log: Implement SHA2-224 submode of SHA2-256 Like SHA2-384:SHA2-512, SHA2-224 is simply a truncated SHA2-256 with a different initial vector. Add to round out the complete basic SHA2 family. Added: head/sys/crypto/sha2/sha224.h (contents, props changed) Modified: head/sys/crypto/sha2/sha256c.c Added: head/sys/crypto/sha2/sha224.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/sha2/sha224.h Mon Jul 9 07:24:05 2018 (r336123) @@ -0,0 +1,96 @@ +/*- + * Copyright 2005 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SHA224_H_ +#define _SHA224_H_ + +#ifndef _KERNEL +#include +#endif + +#define SHA224_BLOCK_LENGTH 64 +#define SHA224_DIGEST_LENGTH 28 +#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1) + +typedef struct SHA224Context { + uint32_t state[8]; + uint64_t count; + uint8_t buf[SHA224_BLOCK_LENGTH]; +} SHA224_CTX; + +__BEGIN_DECLS + +/* Ensure libmd symbols do not clash with libcrypto */ + +#ifndef SHA224_Init +#define SHA224_Init _libmd_SHA224_Init +#endif +#ifndef SHA224_Update +#define SHA224_Update _libmd_SHA224_Update +#endif +#ifndef SHA224_Final +#define SHA224_Final _libmd_SHA224_Final +#endif +#ifndef SHA224_End +#define SHA224_End _libmd_SHA224_End +#endif +#ifndef SHA224_Fd +#define SHA224_Fd _libmd_SHA224_Fd +#endif +#ifndef SHA224_FdChunk +#define SHA224_FdChunk _libmd_SHA224_FdChunk +#endif +#ifndef SHA224_File +#define SHA224_File _libmd_SHA224_File +#endif +#ifndef SHA224_FileChunk +#define SHA224_FileChunk _libmd_SHA224_FileChunk +#endif +#ifndef SHA224_Data +#define SHA224_Data _libmd_SHA224_Data +#endif + +#ifndef SHA224_version +#define SHA224_version _libmd_SHA224_version +#endif + +void SHA224_Init(SHA224_CTX *); +void SHA224_Update(SHA224_CTX *, const void *, size_t); +void SHA224_Final(unsigned char [__min_size(SHA224_DIGEST_LENGTH)], + SHA224_CTX *); +#ifndef _KERNEL +char *SHA224_End(SHA224_CTX *, char *); +char *SHA224_Data(const void *, unsigned int, char *); +char *SHA224_Fd(int, char *); +char *SHA224_FdChunk(int, char *, off_t, off_t); +char *SHA224_File(const char *, char *); +char *SHA224_FileChunk(const char *, char *, off_t, off_t); +#endif +__END_DECLS + +#endif /* !_SHA224_H_ */ Modified: head/sys/crypto/sha2/sha256c.c ============================================================================== --- head/sys/crypto/sha2/sha256c.c Mon Jul 9 07:21:37 2018 (r336122) +++ head/sys/crypto/sha2/sha256c.c Mon Jul 9 07:24:05 2018 (r336123) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "sha224.h" #include "sha256.h" #if BYTE_ORDER == BIG_ENDIAN @@ -300,6 +301,56 @@ SHA256_Final(unsigned char digest[static SHA256_DIGEST memset(ctx, 0, sizeof(*ctx)); } +/*** SHA-224: *********************************************************/ +/* + * the SHA224 and SHA256 transforms are identical + */ + +/* SHA-224 initialization. Begins a SHA-224 operation. */ +void +SHA224_Init(SHA224_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0xC1059ED8; + ctx->state[1] = 0x367CD507; + ctx->state[2] = 0x3070DD17; + ctx->state[3] = 0xF70E5939; + ctx->state[4] = 0xFFC00B31; + ctx->state[5] = 0x68581511; + ctx->state[6] = 0x64f98FA7; + ctx->state[7] = 0xBEFA4FA4; +} + +/* Add bytes into the SHA-224 hash */ +void +SHA224_Update(SHA224_CTX * ctx, const void *in, size_t len) +{ + + SHA256_Update((SHA256_CTX *)ctx, in, len); +} + +/* + * SHA-224 finalization. Pads the input data, exports the hash value, + * and clears the context state. + */ +void +SHA224_Final(unsigned char digest[static SHA224_DIGEST_LENGTH], SHA224_CTX *ctx) +{ + + /* Add padding */ + SHA256_Pad((SHA256_CTX *)ctx); + + /* Write the hash */ + be32enc_vect(digest, ctx->state, SHA224_DIGEST_LENGTH); + + /* Clear the context state */ + explicit_bzero(ctx, sizeof(*ctx)); +} + #ifdef WEAK_REFS /* When building libmd, provide weak references. Note: this is not activated in the context of compiling these sources for internal @@ -313,4 +364,11 @@ __weak_reference(_libmd_SHA256_Update, SHA256_Update); __weak_reference(_libmd_SHA256_Final, SHA256_Final); #undef SHA256_Transform __weak_reference(_libmd_SHA256_Transform, SHA256_Transform); + +#undef SHA224_Init +__weak_reference(_libmd_SHA224_Init, SHA224_Init); +#undef SHA224_Update +__weak_reference(_libmd_SHA224_Update, SHA224_Update); +#undef SHA224_Final +__weak_reference(_libmd_SHA224_Final, SHA224_Final); #endif From owner-svn-src-head@freebsd.org Mon Jul 9 07:26:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C75C1029517; Mon, 9 Jul 2018 07:26:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ADD3186CD4; Mon, 9 Jul 2018 07:26:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 758CF11EE2; Mon, 9 Jul 2018 07:26:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w697QE75025123; Mon, 9 Jul 2018 07:26:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w697QDfg025115; Mon, 9 Jul 2018 07:26:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090726.w697QDfg025115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 07:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336124 - in head: sys/opencrypto tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/opencrypto tools/tools/crypto X-SVN-Commit-Revision: 336124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 07:26:15 -0000 Author: cem Date: Mon Jul 9 07:26:12 2018 New Revision: 336124 URL: https://svnweb.freebsd.org/changeset/base/336124 Log: OCF: Add CRYPTO_SHA2_224_HMAC mode Round out the complete set of basic SHA2 HMAC modes with SHA2-224. Support is added to the cryptocheck test tool. Modified: head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform_auth.h head/sys/opencrypto/xform_sha2.c head/tools/tools/crypto/cryptocheck.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Mon Jul 9 07:24:05 2018 (r336123) +++ head/sys/opencrypto/cryptodev.c Mon Jul 9 07:26:12 2018 (r336124) @@ -460,6 +460,9 @@ cryptof_ioctl( case CRYPTO_SHA1_HMAC: thash = &auth_hash_hmac_sha1; break; + case CRYPTO_SHA2_224_HMAC: + thash = &auth_hash_hmac_sha2_224; + break; case CRYPTO_SHA2_256_HMAC: thash = &auth_hash_hmac_sha2_256; break; Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Mon Jul 9 07:24:05 2018 (r336123) +++ head/sys/opencrypto/cryptodev.h Mon Jul 9 07:26:12 2018 (r336124) @@ -74,6 +74,7 @@ #define MD5_HASH_LEN 16 #define SHA1_HASH_LEN 20 #define RIPEMD160_HASH_LEN 20 +#define SHA2_224_HASH_LEN 28 #define SHA2_256_HASH_LEN 32 #define SHA2_384_HASH_LEN 48 #define SHA2_512_HASH_LEN 64 @@ -86,6 +87,7 @@ #define MD5_BLOCK_LEN 64 #define SHA1_BLOCK_LEN 64 #define RIPEMD160_BLOCK_LEN 64 +#define SHA2_224_BLOCK_LEN 64 #define SHA2_256_BLOCK_LEN 64 #define SHA2_384_BLOCK_LEN 128 #define SHA2_512_BLOCK_LEN 128 @@ -183,7 +185,8 @@ #define CRYPTO_BLAKE2B 29 /* Blake2b hash */ #define CRYPTO_BLAKE2S 30 /* Blake2s hash */ #define CRYPTO_CHACHA20 31 /* Chacha20 stream cipher */ -#define CRYPTO_ALGORITHM_MAX 31 /* Keep updated - see below */ +#define CRYPTO_SHA2_224_HMAC 32 +#define CRYPTO_ALGORITHM_MAX 32 /* Keep updated - see below */ #define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ (x) <= CRYPTO_ALGORITHM_MAX) Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Mon Jul 9 07:24:05 2018 (r336123) +++ head/sys/opencrypto/cryptosoft.c Mon Jul 9 07:26:12 2018 (r336124) @@ -337,6 +337,7 @@ swcr_authprepare(struct auth_hash *axf, struct swcr_da switch (axf->type) { case CRYPTO_MD5_HMAC: case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_224_HMAC: case CRYPTO_SHA2_256_HMAC: case CRYPTO_SHA2_384_HMAC: case CRYPTO_SHA2_512_HMAC: @@ -422,6 +423,7 @@ swcr_authcompute(struct cryptodesc *crd, struct swcr_d switch (sw->sw_alg) { case CRYPTO_MD5_HMAC: case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_224_HMAC: case CRYPTO_SHA2_256_HMAC: case CRYPTO_SHA2_384_HMAC: case CRYPTO_SHA2_512_HMAC: @@ -853,6 +855,9 @@ swcr_newsession(device_t dev, u_int32_t *sid, struct c case CRYPTO_SHA1_HMAC: axf = &auth_hash_hmac_sha1; goto authcommon; + case CRYPTO_SHA2_224_HMAC: + axf = &auth_hash_hmac_sha2_224; + goto authcommon; case CRYPTO_SHA2_256_HMAC: axf = &auth_hash_hmac_sha2_256; goto authcommon; @@ -1069,6 +1074,7 @@ swcr_freesession_locked(device_t dev, u_int64_t tid) case CRYPTO_MD5_HMAC: case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_224_HMAC: case CRYPTO_SHA2_256_HMAC: case CRYPTO_SHA2_384_HMAC: case CRYPTO_SHA2_512_HMAC: @@ -1200,6 +1206,7 @@ swcr_process(device_t dev, struct cryptop *crp, int hi break; case CRYPTO_MD5_HMAC: case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_224_HMAC: case CRYPTO_SHA2_256_HMAC: case CRYPTO_SHA2_384_HMAC: case CRYPTO_SHA2_512_HMAC: @@ -1283,6 +1290,7 @@ swcr_attach(device_t dev) REGISTER(CRYPTO_NULL_CBC); REGISTER(CRYPTO_MD5_HMAC); REGISTER(CRYPTO_SHA1_HMAC); + REGISTER(CRYPTO_SHA2_224_HMAC); REGISTER(CRYPTO_SHA2_256_HMAC); REGISTER(CRYPTO_SHA2_384_HMAC); REGISTER(CRYPTO_SHA2_512_HMAC); Modified: head/sys/opencrypto/xform_auth.h ============================================================================== --- head/sys/opencrypto/xform_auth.h Mon Jul 9 07:24:05 2018 (r336123) +++ head/sys/opencrypto/xform_auth.h Mon Jul 9 07:26:12 2018 (r336124) @@ -69,6 +69,7 @@ extern struct auth_hash auth_hash_key_sha1; extern struct auth_hash auth_hash_hmac_md5; extern struct auth_hash auth_hash_hmac_sha1; extern struct auth_hash auth_hash_hmac_ripemd_160; +extern struct auth_hash auth_hash_hmac_sha2_224; extern struct auth_hash auth_hash_hmac_sha2_256; extern struct auth_hash auth_hash_hmac_sha2_384; extern struct auth_hash auth_hash_hmac_sha2_512; Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Mon Jul 9 07:24:05 2018 (r336123) +++ head/sys/opencrypto/xform_sha2.c Mon Jul 9 07:26:12 2018 (r336124) @@ -50,16 +50,30 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include +static int SHA224Update_int(void *, const u_int8_t *, u_int16_t); static int SHA256Update_int(void *, const u_int8_t *, u_int16_t); static int SHA384Update_int(void *, const u_int8_t *, u_int16_t); static int SHA512Update_int(void *, const u_int8_t *, u_int16_t); /* Authentication instances */ +struct auth_hash auth_hash_hmac_sha2_224 = { + .type = CRYPTO_SHA2_224_HMAC, + .name = "HMAC-SHA2-224", + .keysize = SHA2_224_BLOCK_LEN, + .hashsize = SHA2_224_HASH_LEN, + .ctxsize = sizeof(SHA224_CTX), + .blocksize = SHA2_224_BLOCK_LEN, + .Init = (void (*)(void *)) SHA224_Init, + .Update = SHA224Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA224_Final, +}; + struct auth_hash auth_hash_hmac_sha2_256 = { .type = CRYPTO_SHA2_256_HMAC, .name = "HMAC-SHA2-256", @@ -99,6 +113,13 @@ struct auth_hash auth_hash_hmac_sha2_512 = { /* * And now for auth. */ +static int +SHA224Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +{ + SHA224_Update(ctx, buf, len); + return 0; +} + static int SHA256Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) { Modified: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- head/tools/tools/crypto/cryptocheck.c Mon Jul 9 07:24:05 2018 (r336123) +++ head/tools/tools/crypto/cryptocheck.c Mon Jul 9 07:26:12 2018 (r336124) @@ -137,6 +137,8 @@ struct alg { } algs[] = { { .name = "sha1", .mac = CRYPTO_SHA1_HMAC, .type = T_HMAC, .evp_md = EVP_sha1 }, + { .name = "sha224", .mac = CRYPTO_SHA2_224_HMAC, .type = T_HMAC, + .evp_md = EVP_sha224 }, { .name = "sha256", .mac = CRYPTO_SHA2_256_HMAC, .type = T_HMAC, .evp_md = EVP_sha256 }, { .name = "sha384", .mac = CRYPTO_SHA2_384_HMAC, .type = T_HMAC, From owner-svn-src-head@freebsd.org Mon Jul 9 07:28:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 753E310297C3; Mon, 9 Jul 2018 07:28:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 265AB86EA8; Mon, 9 Jul 2018 07:28:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1E8811EE5; Mon, 9 Jul 2018 07:28:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w697SEjh025249; Mon, 9 Jul 2018 07:28:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w697SDGE025242; Mon, 9 Jul 2018 07:28:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090728.w697SDGE025242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 07:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336125 - in head: sys/opencrypto tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/opencrypto tools/tools/crypto X-SVN-Commit-Revision: 336125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 07:28:15 -0000 Author: cem Date: Mon Jul 9 07:28:13 2018 New Revision: 336125 URL: https://svnweb.freebsd.org/changeset/base/336125 Log: OCF: Add plain hash modes In part, to support OpenSSL's use of cryptodev, which puts the HMAC pieces in software and only offloads the raw hash primitive. The following cryptodev identifiers are added: * CRYPTO_RIPEMD160 (not hooked up) * CRYPTO_SHA2_224 * CRYPTO_SHA2_256 * CRYPTO_SHA2_384 * CRYPTO_SHA2_512 The plain SHA1 and 2 hashes are plumbed through cryptodev (feels like there is a lot of redundancy here...) and cryptosoft. This adds new auth_hash implementations for the plain hashes, as well as SHA1 (which had a cryptodev.h identifier, but no implementation). Add plain SHA 1 and 2 hash tests to the cryptocheck tool. Motivation stems from John Baldwin's earlier OCF email, https://lists.freebsd.org/pipermail/freebsd-arch/2018-January/018835.html . Modified: head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform_auth.h head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c head/tools/tools/crypto/cryptocheck.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/cryptodev.c Mon Jul 9 07:28:13 2018 (r336125) @@ -489,10 +489,23 @@ cryptof_ioctl( case CRYPTO_MD5: thash = &auth_hash_md5; break; +#endif case CRYPTO_SHA1: thash = &auth_hash_sha1; break; -#endif + case CRYPTO_SHA2_224: + thash = &auth_hash_sha2_224; + break; + case CRYPTO_SHA2_256: + thash = &auth_hash_sha2_256; + break; + case CRYPTO_SHA2_384: + thash = &auth_hash_sha2_384; + break; + case CRYPTO_SHA2_512: + thash = &auth_hash_sha2_512; + break; + case CRYPTO_NULL_HMAC: thash = &auth_hash_null; break; Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/cryptodev.h Mon Jul 9 07:28:13 2018 (r336125) @@ -186,7 +186,12 @@ #define CRYPTO_BLAKE2S 30 /* Blake2s hash */ #define CRYPTO_CHACHA20 31 /* Chacha20 stream cipher */ #define CRYPTO_SHA2_224_HMAC 32 -#define CRYPTO_ALGORITHM_MAX 32 /* Keep updated - see below */ +#define CRYPTO_RIPEMD160 33 +#define CRYPTO_SHA2_224 34 +#define CRYPTO_SHA2_256 35 +#define CRYPTO_SHA2_384 36 +#define CRYPTO_SHA2_512 37 +#define CRYPTO_ALGORITHM_MAX 37 /* Keep updated - see below */ #define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ (x) <= CRYPTO_ALGORITHM_MAX) Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/cryptosoft.c Mon Jul 9 07:28:13 2018 (r336125) @@ -421,6 +421,14 @@ swcr_authcompute(struct cryptodesc *crd, struct swcr_d return err; switch (sw->sw_alg) { + case CRYPTO_SHA1: + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_512: + axf->Final(aalg, &ctx); + break; + case CRYPTO_MD5_HMAC: case CRYPTO_SHA1_HMAC: case CRYPTO_SHA2_224_HMAC: @@ -934,9 +942,23 @@ swcr_newsession(device_t dev, u_int32_t *sid, struct c case CRYPTO_MD5: axf = &auth_hash_md5; goto auth3common; +#endif case CRYPTO_SHA1: axf = &auth_hash_sha1; + goto auth3common; + case CRYPTO_SHA2_224: + axf = &auth_hash_sha2_224; + goto auth3common; + case CRYPTO_SHA2_256: + axf = &auth_hash_sha2_256; + goto auth3common; + case CRYPTO_SHA2_384: + axf = &auth_hash_sha2_384; + goto auth3common; + case CRYPTO_SHA2_512: + axf = &auth_hash_sha2_512; + auth3common: (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); @@ -950,7 +972,6 @@ swcr_newsession(device_t dev, u_int32_t *sid, struct c (*swd)->sw_mlen = cri->cri_mlen; (*swd)->sw_axf = axf; break; -#endif case CRYPTO_AES_128_NIST_GMAC: axf = &auth_hash_nist_gmac_aes_128; @@ -1110,6 +1131,10 @@ swcr_freesession_locked(device_t dev, u_int64_t tid) case CRYPTO_BLAKE2S: case CRYPTO_MD5: case CRYPTO_SHA1: + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_512: axf = swd->sw_axf; if (swd->sw_ictx) { @@ -1216,6 +1241,10 @@ swcr_process(device_t dev, struct cryptop *crp, int hi case CRYPTO_SHA1_KPDK: case CRYPTO_MD5: case CRYPTO_SHA1: + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_512: case CRYPTO_BLAKE2B: case CRYPTO_BLAKE2S: if ((crp->crp_etype = swcr_authcompute(crd, sw, @@ -1300,6 +1329,10 @@ swcr_attach(device_t dev) REGISTER(CRYPTO_SHA1_KPDK); REGISTER(CRYPTO_MD5); REGISTER(CRYPTO_SHA1); + REGISTER(CRYPTO_SHA2_224); + REGISTER(CRYPTO_SHA2_256); + REGISTER(CRYPTO_SHA2_384); + REGISTER(CRYPTO_SHA2_512); REGISTER(CRYPTO_RIJNDAEL128_CBC); REGISTER(CRYPTO_AES_XTS); REGISTER(CRYPTO_AES_ICM); Modified: head/sys/opencrypto/xform_auth.h ============================================================================== --- head/sys/opencrypto/xform_auth.h Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/xform_auth.h Mon Jul 9 07:28:13 2018 (r336125) @@ -73,6 +73,11 @@ extern struct auth_hash auth_hash_hmac_sha2_224; extern struct auth_hash auth_hash_hmac_sha2_256; extern struct auth_hash auth_hash_hmac_sha2_384; extern struct auth_hash auth_hash_hmac_sha2_512; +extern struct auth_hash auth_hash_sha1; +extern struct auth_hash auth_hash_sha2_224; +extern struct auth_hash auth_hash_sha2_256; +extern struct auth_hash auth_hash_sha2_384; +extern struct auth_hash auth_hash_sha2_512; extern struct auth_hash auth_hash_nist_gmac_aes_128; extern struct auth_hash auth_hash_nist_gmac_aes_192; extern struct auth_hash auth_hash_nist_gmac_aes_256; Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/xform_sha1.c Mon Jul 9 07:28:13 2018 (r336125) @@ -57,6 +57,18 @@ static void SHA1Init_int(void *); static int SHA1Update_int(void *, const u_int8_t *, u_int16_t); static void SHA1Final_int(u_int8_t *, void *); +/* Plain hash */ +struct auth_hash auth_hash_sha1 = { + .type = CRYPTO_SHA1, + .name = "SHA1", + .hashsize = SHA1_HASH_LEN, + .ctxsize = sizeof(SHA1_CTX), + .blocksize = SHA1_BLOCK_LEN, + .Init = SHA1Init_int, + .Update = SHA1Update_int, + .Final = SHA1Final_int, +}; + /* Authentication instances */ struct auth_hash auth_hash_hmac_sha1 = { .type = CRYPTO_SHA1_HMAC, Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Mon Jul 9 07:26:12 2018 (r336124) +++ head/sys/opencrypto/xform_sha2.c Mon Jul 9 07:28:13 2018 (r336125) @@ -61,6 +61,54 @@ static int SHA256Update_int(void *, const u_int8_t *, static int SHA384Update_int(void *, const u_int8_t *, u_int16_t); static int SHA512Update_int(void *, const u_int8_t *, u_int16_t); +/* Plain hashes */ +struct auth_hash auth_hash_sha2_224 = { + .type = CRYPTO_SHA2_224, + .name = "SHA2-224", + .hashsize = SHA2_224_HASH_LEN, + .ctxsize = sizeof(SHA224_CTX), + .blocksize = SHA2_224_BLOCK_LEN, + .Init = (void (*)(void *)) SHA224_Init, + .Update = SHA224Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA224_Final, +}; + +struct auth_hash auth_hash_sha2_256 = { + .type = CRYPTO_SHA2_256, + .name = "SHA2-256", + .keysize = SHA2_256_BLOCK_LEN, + .hashsize = SHA2_256_HASH_LEN, + .ctxsize = sizeof(SHA256_CTX), + .blocksize = SHA2_256_BLOCK_LEN, + .Init = (void (*)(void *)) SHA256_Init, + .Update = SHA256Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA256_Final, +}; + +struct auth_hash auth_hash_sha2_384 = { + .type = CRYPTO_SHA2_384, + .name = "SHA2-384", + .keysize = SHA2_384_BLOCK_LEN, + .hashsize = SHA2_384_HASH_LEN, + .ctxsize = sizeof(SHA384_CTX), + .blocksize = SHA2_384_BLOCK_LEN, + .Init = (void (*)(void *)) SHA384_Init, + .Update = SHA384Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA384_Final, +}; + +struct auth_hash auth_hash_sha2_512 = { + .type = CRYPTO_SHA2_512, + .name = "SHA2-512", + .keysize = SHA2_512_BLOCK_LEN, + .hashsize = SHA2_512_HASH_LEN, + .ctxsize = sizeof(SHA512_CTX), + .blocksize = SHA2_512_BLOCK_LEN, + .Init = (void (*)(void *)) SHA512_Init, + .Update = SHA512Update_int, + .Final = (void (*)(u_int8_t *, void *)) SHA512_Final, +}; + /* Authentication instances */ struct auth_hash auth_hash_hmac_sha2_224 = { .type = CRYPTO_SHA2_224_HMAC, Modified: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- head/tools/tools/crypto/cryptocheck.c Mon Jul 9 07:26:12 2018 (r336124) +++ head/tools/tools/crypto/cryptocheck.c Mon Jul 9 07:28:13 2018 (r336125) @@ -131,20 +131,30 @@ struct alg { const char *name; int cipher; int mac; - enum { T_HMAC, T_BLKCIPHER, T_AUTHENC, T_GCM } type; + enum { T_HASH, T_HMAC, T_BLKCIPHER, T_AUTHENC, T_GCM } type; const EVP_CIPHER *(*evp_cipher)(void); const EVP_MD *(*evp_md)(void); } algs[] = { - { .name = "sha1", .mac = CRYPTO_SHA1_HMAC, .type = T_HMAC, + { .name = "sha1", .mac = CRYPTO_SHA1, .type = T_HASH, .evp_md = EVP_sha1 }, - { .name = "sha224", .mac = CRYPTO_SHA2_224_HMAC, .type = T_HMAC, + { .name = "sha224", .mac = CRYPTO_SHA2_224, .type = T_HASH, .evp_md = EVP_sha224 }, - { .name = "sha256", .mac = CRYPTO_SHA2_256_HMAC, .type = T_HMAC, + { .name = "sha256", .mac = CRYPTO_SHA2_256, .type = T_HASH, .evp_md = EVP_sha256 }, - { .name = "sha384", .mac = CRYPTO_SHA2_384_HMAC, .type = T_HMAC, + { .name = "sha384", .mac = CRYPTO_SHA2_384, .type = T_HASH, .evp_md = EVP_sha384 }, - { .name = "sha512", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, + { .name = "sha512", .mac = CRYPTO_SHA2_512, .type = T_HASH, .evp_md = EVP_sha512 }, + { .name = "sha1hmac", .mac = CRYPTO_SHA1_HMAC, .type = T_HMAC, + .evp_md = EVP_sha1 }, + { .name = "sha224hmac", .mac = CRYPTO_SHA2_224_HMAC, .type = T_HMAC, + .evp_md = EVP_sha224 }, + { .name = "sha256hmac", .mac = CRYPTO_SHA2_256_HMAC, .type = T_HMAC, + .evp_md = EVP_sha256 }, + { .name = "sha384hmac", .mac = CRYPTO_SHA2_384_HMAC, .type = T_HMAC, + .evp_md = EVP_sha384 }, + { .name = "sha512hmac", .mac = CRYPTO_SHA2_512_HMAC, .type = T_HMAC, + .evp_md = EVP_sha512 }, { .name = "blake2b", .mac = CRYPTO_BLAKE2B, .type = T_HMAC, .evp_md = EVP_blake2b512 }, { .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HMAC, @@ -352,6 +362,128 @@ generate_iv(size_t len, struct alg *alg) } static bool +ocf_hash(struct alg *alg, const char *buffer, size_t size, char *digest, + int *cridp) +{ + struct session2_op sop; + struct crypt_op cop; + int fd; + + memset(&sop, 0, sizeof(sop)); + memset(&cop, 0, sizeof(cop)); + sop.crid = crid; + sop.mac = alg->mac; + fd = crget(); + if (ioctl(fd, CIOCGSESSION2, &sop) < 0) { + warn("cryptodev %s HASH not supported for device %s", + alg->name, crfind(crid)); + close(fd); + return (false); + } + + cop.ses = sop.ses; + cop.op = 0; + cop.len = size; + cop.src = (char *)buffer; + cop.dst = NULL; + cop.mac = digest; + cop.iv = NULL; + + if (ioctl(fd, CIOCCRYPT, &cop) < 0) { + warn("cryptodev %s (%zu) HASH failed for device %s", alg->name, + size, crfind(crid)); + close(fd); + return (false); + } + + if (ioctl(fd, CIOCFSESSION, &sop.ses) < 0) + warn("ioctl(CIOCFSESSION)"); + + close(fd); + *cridp = sop.crid; + return (true); +} + +static void +openssl_hash(struct alg *alg, const EVP_MD *md, const void *buffer, + size_t size, void *digest_out, unsigned *digest_sz_out) +{ + EVP_MD_CTX *mdctx; + const char *errs; + int rc; + + errs = ""; + + mdctx = EVP_MD_CTX_create(); + if (mdctx == NULL) + goto err_out; + + rc = EVP_DigestInit_ex(mdctx, md, NULL); + if (rc != 1) + goto err_out; + + rc = EVP_DigestUpdate(mdctx, buffer, size); + if (rc != 1) + goto err_out; + + rc = EVP_DigestFinal_ex(mdctx, digest_out, digest_sz_out); + if (rc != 1) + goto err_out; + + EVP_MD_CTX_destroy(mdctx); + return; + +err_out: + errx(1, "OpenSSL %s HASH failed%s: %s", alg->name, errs, + ERR_error_string(ERR_get_error(), NULL)); +} + +static void +run_hash_test(struct alg *alg, size_t size) +{ + const EVP_MD *md; + char *buffer; + u_int digest_len; + int crid; + char control_digest[EVP_MAX_MD_SIZE], test_digest[EVP_MAX_MD_SIZE]; + + memset(control_digest, 0x3c, sizeof(control_digest)); + memset(test_digest, 0x3c, sizeof(test_digest)); + + md = alg->evp_md(); + assert(EVP_MD_size(md) <= sizeof(control_digest)); + + buffer = alloc_buffer(size); + + /* OpenSSL HASH. */ + digest_len = sizeof(control_digest); + openssl_hash(alg, md, buffer, size, control_digest, &digest_len); + + /* cryptodev HASH. */ + if (!ocf_hash(alg, buffer, size, test_digest, &crid)) + goto out; + if (memcmp(control_digest, test_digest, sizeof(control_digest)) != 0) { + if (memcmp(control_digest, test_digest, EVP_MD_size(md)) == 0) + printf("%s (%zu) mismatch in trailer:\n", + alg->name, size); + else + printf("%s (%zu) mismatch:\n", alg->name, size); + printf("control:\n"); + hexdump(control_digest, sizeof(control_digest), NULL, 0); + printf("test (cryptodev device %s):\n", crfind(crid)); + hexdump(test_digest, sizeof(test_digest), NULL, 0); + goto out; + } + + if (verbose) + printf("%s (%zu) matched (cryptodev device %s)\n", + alg->name, size, crfind(crid)); + +out: + free(buffer); +} + +static bool ocf_hmac(struct alg *alg, const char *buffer, size_t size, const char *key, size_t key_len, char *digest, int *cridp) { @@ -1031,6 +1163,9 @@ run_test(struct alg *alg, size_t size) { switch (alg->type) { + case T_HASH: + run_hash_test(alg, size); + break; case T_HMAC: run_hmac_test(alg, size); break; @@ -1056,6 +1191,16 @@ run_test_sizes(struct alg *alg, size_t *sizes, u_int n } static void +run_hash_tests(size_t *sizes, u_int nsizes) +{ + u_int i; + + for (i = 0; i < nitems(algs); i++) + if (algs[i].type == T_HASH) + run_test_sizes(&algs[i], sizes, nsizes); +} + +static void run_hmac_tests(size_t *sizes, u_int nsizes) { u_int i; @@ -1177,7 +1322,9 @@ main(int ac, char **av) } } - if (strcasecmp(algname, "hmac") == 0) + if (strcasecmp(algname, "hash") == 0) + run_hash_tests(sizes, nsizes); + else if (strcasecmp(algname, "hmac") == 0) run_hmac_tests(sizes, nsizes); else if (strcasecmp(algname, "blkcipher") == 0) run_blkcipher_tests(sizes, nsizes); @@ -1186,6 +1333,7 @@ main(int ac, char **av) else if (strcasecmp(algname, "aead") == 0) run_aead_tests(sizes, nsizes); else if (strcasecmp(algname, "all") == 0) { + run_hash_tests(sizes, nsizes); run_hmac_tests(sizes, nsizes); run_blkcipher_tests(sizes, nsizes); run_authenc_tests(sizes, nsizes); From owner-svn-src-head@freebsd.org Mon Jul 9 08:19:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2977F102E5E5; Mon, 9 Jul 2018 08:19:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD1288A059; Mon, 9 Jul 2018 08:19:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 935D012728; Mon, 9 Jul 2018 08:19:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w698J6x0051857; Mon, 9 Jul 2018 08:19:06 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w698J5tN051850; Mon, 9 Jul 2018 08:19:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090819.w698J5tN051850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 08:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336126 - in head: lib/libcrypt lib/libmd sbin/md5 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: lib/libcrypt lib/libmd sbin/md5 X-SVN-Commit-Revision: 336126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 08:19:07 -0000 Author: cem Date: Mon Jul 9 08:19:04 2018 New Revision: 336126 URL: https://svnweb.freebsd.org/changeset/base/336126 Log: Integrate SHA2-224 with userspace components The double compilation of the kernel sources in libmd and libcrypt is baffling, but add yet another define hack to prevent duplicate symbols. Add documentation and SHA2-224 test cases to libmd. Integrate with the md5(1) command, document, and add more test cases; self-tests pass. Modified: head/lib/libcrypt/Makefile head/lib/libmd/Makefile head/lib/libmd/sha256.3 head/lib/libmd/shadriver.c head/sbin/md5/Makefile head/sbin/md5/md5.1 head/sbin/md5/md5.c Modified: head/lib/libcrypt/Makefile ============================================================================== --- head/lib/libcrypt/Makefile Mon Jul 9 07:28:13 2018 (r336125) +++ head/lib/libcrypt/Makefile Mon Jul 9 08:19:04 2018 (r336126) @@ -31,6 +31,7 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ + SHA224_Init SHA224_Final SHA224_Update \ SHA256_Init SHA256_Final SHA256_Update \ SHA512_224_Init SHA512_224_Final SHA512_224_Update \ SHA512_256_Init SHA512_256_Final SHA512_256_Update \ Modified: head/lib/libmd/Makefile ============================================================================== --- head/lib/libmd/Makefile Mon Jul 9 07:28:13 2018 (r336125) +++ head/lib/libmd/Makefile Mon Jul 9 08:19:04 2018 (r336126) @@ -7,13 +7,13 @@ SHLIBDIR?= /lib SRCS= md4c.c md5c.c md4hl.c md5hl.c \ rmd160c.c rmd160hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ - sha256c.c sha256hl.c \ + sha224hl.c sha256c.c sha256hl.c \ sha384hl.c \ sha512c.c sha512hl.c sha512thl.c \ skein.c skein_block.c \ skein256hl.c skein512hl.c skein1024hl.c -INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h sha512t.h \ - skein.h skein_port.h skein_freebsd.h skein_iv.h +INCS= md4.h md5.h ripemd.h sha.h sha224.h sha256.h sha384.h sha512.h \ + sha512t.h skein.h skein_port.h skein_freebsd.h skein_iv.h WARNS?= 0 @@ -34,6 +34,10 @@ MLINKS+=sha.3 SHA_Data.3 MLINKS+=sha.3 SHA1_Init.3 sha.3 SHA1_Update.3 sha.3 SHA1_Final.3 MLINKS+=sha.3 SHA1_End.3 sha.3 SHA1_File.3 sha.3 SHA1_FileChunk.3 MLINKS+=sha.3 SHA1_Data.3 +MLINKS+=sha256.3 SHA224_Init.3 sha256.3 SHA224_Update.3 +MLINKS+=sha256.3 SHA224_Final.3 sha256.3 SHA224_End.3 +MLINKS+=sha256.3 SHA224_File.3 sha256.3 SHA224_FileChunk.3 +MLINKS+=sha256.3 SHA224_Data.3 MLINKS+=sha256.3 SHA256_Init.3 sha256.3 SHA256_Update.3 MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 @@ -66,7 +70,8 @@ MLINKS+=skein.3 SKEIN1024_Data.3 skein.3 skein1024.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ - sha256.ref sha256hl.c sha384hl.c sha384.ref \ + sha224.ref sha256.ref sha224hl.c sha256hl.c \ + sha384hl.c sha384.ref \ sha512.ref sha512hl.c sha512t256.ref sha512thl.c \ skein256hl.c skein512hl.c skein1024hl.c \ skein256.ref skein512.ref skein1024.ref \ @@ -130,6 +135,12 @@ sha1hl.c: mdXhl.c sed -e 's/mdX/sha/g' -e 's/MDX/SHA1_/g' -e 's/SHA1__/SHA1_/g' \ ${.ALLSRC}) > ${.TARGET} +sha224hl.c: mdXhl.c + (echo '#define LENGTH 28'; \ + sed -e 's/mdX/sha224/g' -e 's/MDX/SHA224_/g' \ + -e 's/SHA224__/SHA224_/g' \ + ${.ALLSRC}) > ${.TARGET} + sha256hl.c: mdXhl.c (echo '#define LENGTH 32'; \ sed -e 's/mdX/sha256/g' -e 's/MDX/SHA256_/g' \ @@ -234,6 +245,20 @@ sha1.ref: @echo 'SHA-1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ '50abf5706a150990a08b2c5ea40fa0e585554732' >> ${.TARGET} +sha224.ref: + echo 'SHA-224 test suite:' > ${.TARGET} + @echo 'SHA-224 ("") = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f' >> ${.TARGET} + @echo 'SHA-224 ("abc") =' \ + '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7' >> ${.TARGET} + @echo 'SHA-224 ("message digest") =' \ + '2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb' >> ${.TARGET} + @echo 'SHA-224 ("abcdefghijklmnopqrstuvwxyz") =' \ + '45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2' >> ${.TARGET} + @echo 'SHA-224 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9' >> ${.TARGET} + @echo 'SHA-224 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e' >> ${.TARGET} + sha256.ref: echo 'SHA-256 test suite:' > ${.TARGET} @echo 'SHA-256 ("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' >> ${.TARGET} @@ -349,7 +374,7 @@ skein1024.ref: @echo 'SKEIN1024 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ 'cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a' >> ${.TARGET} -test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \ +test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha224.ref sha256.ref sha384.ref \ sha512.ref sha512t256.ref skein256.ref skein512.ref skein1024.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. @@ -370,6 +395,9 @@ test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=1 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha1.ref - @${ECHO} SHA-1 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=224 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha224.ref - + @${ECHO} SHA-224 passed test ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test Modified: head/lib/libmd/sha256.3 ============================================================================== --- head/lib/libmd/sha256.3 Mon Jul 9 07:28:13 2018 (r336125) +++ head/lib/libmd/sha256.3 Mon Jul 9 08:19:04 2018 (r336126) @@ -9,10 +9,17 @@ .\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp .\" $FreeBSD$ .\" -.Dd April 26, 2016 +.Dd July 9, 2018 .Dt SHA256 3 .Os .Sh NAME +.Nm SHA224_Init , +.Nm SHA224_Update , +.Nm SHA224_Final , +.Nm SHA224_End , +.Nm SHA224_File , +.Nm SHA224_FileChunk , +.Nm SHA224_Data , .Nm SHA256_Init , .Nm SHA256_Update , .Nm SHA256_Final , @@ -20,11 +27,26 @@ .Nm SHA256_File , .Nm SHA256_FileChunk , .Nm SHA256_Data -.Nd calculate the FIPS 180-2 ``SHA-256'' message digest +.Nd calculate the FIPS 180-2 ``SHA-256'' (or SHA-224) message digest .Sh LIBRARY .Lb libmd .Sh SYNOPSIS .In sys/types.h +.In sha224.h +.Ft void +.Fn SHA224_Init "SHA224_CTX *context" +.Ft void +.Fn SHA224_Update "SHA224_CTX *context" "const unsigned char *data" "size_t len" +.Ft void +.Fn SHA224_Final "unsigned char digest[32]" "SHA224_CTX *context" +.Ft "char *" +.Fn SHA224_End "SHA224_CTX *context" "char *buf" +.Ft "char *" +.Fn SHA224_File "const char *filename" "char *buf" +.Ft "char *" +.Fn SHA224_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" +.Fn SHA224_Data "const unsigned char *data" "unsigned int len" "char *buf" .In sha256.h .Ft void .Fn SHA256_Init "SHA256_CTX *context" @@ -119,12 +141,14 @@ after use. If the .Fa buf argument is non-null it must point to at least 65 characters of buffer space. +.Pp +SHA224 is identical SHA256, except it has slightly different initialization +vectors, and is truncated to a shorter digest. .Sh SEE ALSO .Xr md4 3 , .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , -.Xr sha256 3 , .Xr sha512 3 , .Xr skein 3 .Sh HISTORY Modified: head/lib/libmd/shadriver.c ============================================================================== --- head/lib/libmd/shadriver.c Mon Jul 9 07:28:13 2018 (r336125) +++ head/lib/libmd/shadriver.c Mon Jul 9 08:19:04 2018 (r336126) @@ -24,6 +24,7 @@ __FBSDID("$FreeBSD$"); #include #include "sha.h" +#include "sha224.h" #include "sha256.h" #include "sha384.h" #include "sha512.h" @@ -38,6 +39,9 @@ __FBSDID("$FreeBSD$"); #if SHA == 1 #undef SHA_Data #define SHA_Data SHA1_Data +#elif SHA == 224 +#undef SHA_Data +#define SHA_Data SHA224_Data #elif SHA == 256 #undef SHA_Data #define SHA_Data SHA256_Data Modified: head/sbin/md5/Makefile ============================================================================== --- head/sbin/md5/Makefile Mon Jul 9 07:28:13 2018 (r336125) +++ head/sbin/md5/Makefile Mon Jul 9 08:19:04 2018 (r336126) @@ -6,6 +6,7 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ + ${BINDIR}/md5 ${BINDIR}/sha224 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ ${BINDIR}/md5 ${BINDIR}/sha384 \ ${BINDIR}/md5 ${BINDIR}/sha512 \ @@ -16,6 +17,7 @@ LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ + md5.1 sha224.1 \ md5.1 sha256.1 \ md5.1 sha384.1 \ md5.1 sha512.1 \ Modified: head/sbin/md5/md5.1 ============================================================================== --- head/sbin/md5/md5.1 Mon Jul 9 07:28:13 2018 (r336125) +++ head/sbin/md5/md5.1 Mon Jul 9 08:19:04 2018 (r336126) @@ -1,65 +1,22 @@ .\" $FreeBSD$ -.Dd March 2, 2017 +.Dd July 9, 2018 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , +.Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , .Nm skein256 , skein512 , skein1024 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS -.Nm md5 +.Nm .Op Fl pqrtx .Op Fl c Ar string .Op Fl s Ar string .Op Ar -.Nm sha1 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm sha256 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm sha384 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm sha512 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm sha512t256 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm rmd160 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm skein256 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm skein512 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar -.Nm skein1024 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar +.Pp +(All other hashes have the same options and usage.) .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160, +.Nm md5 , sha1 , sha224 , sha256 , sha384 , sha512, sha512t256, rmd160, .Nm skein256, skein512, and .Nm skein1024 @@ -73,7 +30,7 @@ It is conjectured that it is computationally infeasibl produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512, RIPEMD-160, +.Tn SHA-224 , SHA-256 , SHA-384 , SHA-512, RIPEMD-160, and .Tn SKEIN algorithms are intended for digital signature applications, where a @@ -89,8 +46,8 @@ The and .Tn SHA-1 algorithms have been proven to be vulnerable to practical collision -attacks and should not be relied upon to produce unique outputs, nor -should they be used as part of a cryptographic signature scheme. +attacks and should not be relied upon to produce unique outputs, +.Em nor should they be used as part of a cryptographic signature scheme. As of 2017-03-02, there is no publicly known method to .Em reverse either algorithm, i.e. to find an input that produces a specific @@ -143,8 +100,8 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 , sha512, sha512t256, rmd160, -.Nm skein256, skein512, +.Nm md5 , sha1 , sha224 , sha256 , sha512 , sha512t256 , rmd160 , +.Nm skein256 , skein512, and .Nm skein1024 utilities exit 0 on success, @@ -157,6 +114,7 @@ option. .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , +.Xr sha224 3 , .Xr sha256 3 , .Xr sha384 3 , .Xr sha512 3 , Modified: head/sbin/md5/md5.c ============================================================================== --- head/sbin/md5/md5.c Mon Jul 9 07:28:13 2018 (r336125) +++ head/sbin/md5/md5.c Mon Jul 9 08:19:04 2018 (r336126) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ typedef char *(DIGEST_End)(void *, char *); extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; +extern const char *SHA224_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; extern const char *SHA384_TestOutput[MDTESTCOUNT]; extern const char *SHA512_TestOutput[MDTESTCOUNT]; @@ -89,6 +91,7 @@ static void usage(const Algorithm_t *); typedef union { MD5_CTX md5; SHA1_CTX sha1; + SHA224_CTX sha224; SHA256_CTX sha256; SHA384_CTX sha384; SHA512_CTX sha512; @@ -112,6 +115,9 @@ static const struct Algorithm_t Algorithm[] = { { "sha1", "SHA1", &SHA1_TestOutput, (DIGEST_Init*)&SHA1_Init, (DIGEST_Update*)&SHA1_Update, (DIGEST_End*)&SHA1_End, &SHA1_Data, &SHA1_Fd }, + { "sha224", "SHA224", &SHA224_TestOutput, (DIGEST_Init*)&SHA224_Init, + (DIGEST_Update*)&SHA224_Update, (DIGEST_End*)&SHA224_End, + &SHA224_Data, &SHA224_Fd }, { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_Fd }, @@ -366,6 +372,17 @@ const char *SHA1_TestOutput[MDTESTCOUNT] = { "761c457bf73b14d27e9e9265c46f4b4dda11f940", "50abf5706a150990a08b2c5ea40fa0e585554732", "18eca4333979c4181199b7b4fab8786d16cf2846" +}; + +const char *SHA224_TestOutput[MDTESTCOUNT] = { + "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", + "abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5", + "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", + "2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb", + "45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2", + "bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9", + "b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e", + "5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470" }; const char *SHA256_TestOutput[MDTESTCOUNT] = { From owner-svn-src-head@freebsd.org Mon Jul 9 08:37:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E4101030184; Mon, 9 Jul 2018 08:37:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B45C28AF3A; Mon, 9 Jul 2018 08:37:55 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9590E12A76; Mon, 9 Jul 2018 08:37:55 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w698bthJ062178; Mon, 9 Jul 2018 08:37:55 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w698btiS062177; Mon, 9 Jul 2018 08:37:55 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807090837.w698btiS062177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 9 Jul 2018 08:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336127 - head/usr.bin/gzip X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/gzip X-SVN-Commit-Revision: 336127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 08:37:56 -0000 Author: cem Date: Mon Jul 9 08:37:55 2018 New Revision: 336127 URL: https://svnweb.freebsd.org/changeset/base/336127 Log: gzip(1): Don't shadow global 'err' Unbreak work build on ppc due to -Werror=shadow. Introduced in r336121. X-MFC-With: r336121 Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Mon Jul 9 08:19:04 2018 (r336126) +++ head/usr.bin/gzip/gzip.c Mon Jul 9 08:37:55 2018 (r336127) @@ -1429,7 +1429,7 @@ file_uncompress(char *file, char *outfile, size_t outs unsigned char header1[4]; enum filetype method; int fd, ofd, zfd = -1; - int err; + int error; size_t in_size; #ifndef SMALL ssize_t rv; @@ -1602,9 +1602,9 @@ file_uncompress(char *file, char *outfile, size_t outs size = zuncompress(in, out, NULL, 0, NULL); /* need to fclose() if ferror() is true... */ - err = ferror(in); - if (err | fclose(in)) { - if (err) + error = ferror(in); + if (error | fclose(in)) { + if (error) maybe_warn("failed infile"); else maybe_warn("failed infile fclose"); From owner-svn-src-head@freebsd.org Mon Jul 9 08:41:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6049E103079D; Mon, 9 Jul 2018 08:41:55 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11BAB8B51A; Mon, 9 Jul 2018 08:41:55 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E775F12BE2; Mon, 9 Jul 2018 08:41:54 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w698fsel073126; Mon, 9 Jul 2018 08:41:54 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w698fssE073125; Mon, 9 Jul 2018 08:41:54 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201807090841.w698fssE073125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 9 Jul 2018 08:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336128 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 336128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 08:41:55 -0000 Author: wma Date: Mon Jul 9 08:41:54 2018 New Revision: 336128 URL: https://svnweb.freebsd.org/changeset/base/336128 Log: ARM64: Add ThunderX2 CPU revision macro. Add ThunderX2 name in identcpu.c Submitted by: Patryk Duda Obtained from: Semihalf Sponsored by: Cavium Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/cpu.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Mon Jul 9 08:37:55 2018 (r336127) +++ head/sys/arm64/arm64/identcpu.c Mon Jul 9 08:41:54 2018 (r336128) @@ -134,6 +134,7 @@ static const struct cpu_parts cpu_parts_arm[] = { /* Cavium */ static const struct cpu_parts cpu_parts_cavium[] = { { CPU_PART_THUNDERX, "ThunderX" }, + { CPU_PART_THUNDERX2, "ThunderX2" }, CPU_PART_NONE, }; Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Mon Jul 9 08:37:55 2018 (r336127) +++ head/sys/arm64/include/cpu.h Mon Jul 9 08:41:54 2018 (r336128) @@ -97,6 +97,8 @@ #define CPU_REV_THUNDERX_1_0 0x00 #define CPU_REV_THUNDERX_1_1 0x01 +#define CPU_REV_THUNDERX2_0 0x00 + #define CPU_IMPL(midr) (((midr) >> 24) & 0xff) #define CPU_PART(midr) (((midr) >> 4) & 0xfff) #define CPU_VAR(midr) (((midr) >> 20) & 0xf) From owner-svn-src-head@freebsd.org Mon Jul 9 08:49:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E64310313BC for ; Mon, 9 Jul 2018 08:49:42 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C126B8BBF1; Mon, 9 Jul 2018 08:49:41 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 6544E5A9F17; Mon, 9 Jul 2018 08:49:35 +0000 (UTC) Date: Mon, 9 Jul 2018 08:49:35 +0000 From: Brooks Davis To: John Baldwin Cc: Brooks Davis , svn-src-head@freebsd.org Subject: Re: svn commit: r336023 - in head/sys: kern netinet Message-ID: <20180709084935.GA85898@spindle.one-eyed-alien.net> References: <201807061003.w66A3X6Z082209@repo.freebsd.org> <1e5035b3-3b4e-9095-50b9-6fed7be0181e@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <1e5035b3-3b4e-9095-50b9-6fed7be0181e@FreeBSD.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 08:49:42 -0000 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 06, 2018 at 09:24:22AM -0700, John Baldwin wrote: > On 7/6/18 3:03 AM, Brooks Davis wrote: > > Author: brooks > > Date: Fri Jul 6 10:03:33 2018 > > New Revision: 336023 > > URL: https://svnweb.freebsd.org/changeset/base/336023 > >=20 > > Log: > > Correct breakage on 32-bit platforms from r335979. >=20 > Do we still need the kvaddr_t casts after the uintptr_t cast? Are those > only required for CHERI (and perhaps if we change the default of how > uintptr_t gets converted to an int to default to the vaddr we may find > we won't need them at all even on CHERI)? The kvaddr_t casts are probably unnecessicary on FreeBSD. I'll look at removing them. The uintptr_t casts are currently harmless on CHERI in hybrid mode and broken in pure-capbiltiy mode until we change uintptr_t cast behavior. -- Brooks --zhXaljGHf11kAtnf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJbQyGeAAoJEKzQXbSebgfAzn0H+weX1F7OjikL74LM0Se+Ek4+ oWgqtAV9cpCPeLYtS6g0Bj8r7Jv17wQmhrHSo2Y9EwOLjRmmUIEJeagOg0RQ1+KR vOgRvslprZE8FyfFAUFZkojUNAQWiX0D0EZydFSIzEGHIAgyzA68IodnXnK6c/eD slDGPTBOKSCvGNQn/WSqFyVdd5eh5Ijy+rp6hdoPIQssElKBC+9bdmDT3TSlaL59 +qd6wFK301ZNSZQN4hRqCcXBUObAvMy9yUP3+zN8f/OYOpxf+bqSKfgb7CkYEZOJ DnlaA0EUjgXMEQwPusTKb42TiVlHXxYKYwVFkfrsikPtBwEKG2FYifwgBfWEEfk= =sZZI -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf-- From owner-svn-src-head@freebsd.org Mon Jul 9 08:55:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A49131031D79; Mon, 9 Jul 2018 08:55:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 551C28C0B9; Mon, 9 Jul 2018 08:55:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3648C12DCF; Mon, 9 Jul 2018 08:55:08 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w698t8mU081584; Mon, 9 Jul 2018 08:55:08 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w698t7AP081582; Mon, 9 Jul 2018 08:55:07 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201807090855.w698t7AP081582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 9 Jul 2018 08:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336129 - in head/sys/dev: acpica pci X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: in head/sys/dev: acpica pci X-SVN-Commit-Revision: 336129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 08:55:08 -0000 Author: wma Date: Mon Jul 9 08:55:07 2018 New Revision: 336129 URL: https://svnweb.freebsd.org/changeset/base/336129 Log: ARM64: Add support for ThunderX2 PCIe Submitted by: Patryk Duda Obtained from: Semihalf Sponsored by: Cavium Differential revision: https://reviews.freebsd.org/D15141 Modified: head/sys/dev/acpica/acpi_resource.c head/sys/dev/pci/pci_host_generic.c head/sys/dev/pci/pci_host_generic_acpi.c Modified: head/sys/dev/acpica/acpi_resource.c ============================================================================== --- head/sys/dev/acpica/acpi_resource.c Mon Jul 9 08:41:54 2018 (r336128) +++ head/sys/dev/acpica/acpi_resource.c Mon Jul 9 08:55:07 2018 (r336129) @@ -560,6 +560,9 @@ acpi_res_set_memory(device_t dev, void *context, uint6 if (cp == NULL) return; + while (bus_get_resource_start(dev, SYS_RES_MEMORY, cp->ar_nmem)) + cp->ar_nmem++; + bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length); } Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:41:54 2018 (r336128) +++ head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:55:07 2018 (r336129) @@ -107,7 +107,7 @@ pci_host_generic_core_attach(device_t dev) return (error); rid = 0; - sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_SHAREABLE); if (sc->res == NULL) { device_printf(dev, "could not map memory.\n"); return (ENXIO); Modified: head/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- head/sys/dev/pci/pci_host_generic_acpi.c Mon Jul 9 08:41:54 2018 (r336128) +++ head/sys/dev/pci/pci_host_generic_acpi.c Mon Jul 9 08:55:07 2018 (r336129) @@ -1,4 +1,5 @@ /*- + * Copyright (C) 2018 Cavium Inc. * Copyright (c) 2015 Ruslan Bukin * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. @@ -96,12 +97,8 @@ struct generic_pcie_acpi_softc { /* Forward prototypes */ static int generic_pcie_acpi_probe(device_t dev); -static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, - u_int func, u_int reg, int bytes); -static void generic_pcie_write_config(device_t dev, u_int bus, u_int slot, - u_int func, u_int reg, uint32_t val, int bytes); -static int generic_pcie_release_resource(device_t dev, device_t child, - int type, int rid, struct resource *res); +static ACPI_STATUS pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *, void *); +static int generic_pcie_acpi_read_ivar(device_t, device_t, int, uintptr_t *); static int generic_pcie_acpi_probe(device_t dev) @@ -127,6 +124,7 @@ pci_host_generic_acpi_attach(device_t dev) { struct generic_pcie_acpi_softc *sc; ACPI_HANDLE handle; + ACPI_STATUS status; int error; sc = device_get_softc(dev); @@ -138,46 +136,104 @@ pci_host_generic_acpi_attach(device_t dev) device_printf(dev, "Bus is%s cache-coherent\n", sc->base.coherent ? "" : " not"); + if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &sc->base.ecam))) + sc->base.ecam >>= 7; + else + sc->base.ecam = 0; + acpi_pcib_fetch_prt(dev, &sc->ap_prt); error = pci_host_generic_core_attach(dev); if (error != 0) return (error); + status = AcpiWalkResources(handle, "_CRS", + pci_host_generic_acpi_parse_resource, (void *)dev); + + if (ACPI_FAILURE(status)) + return (ENXIO); + device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } -static int -generic_pcie_acpi_route_interrupt(device_t bus, device_t dev, int pin) +static ACPI_STATUS +pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) { + device_t dev = (device_t)arg; struct generic_pcie_acpi_softc *sc; + rman_res_t min, max; + int error; - sc = device_get_softc(bus); + switch (res->Type) { + case ACPI_RESOURCE_TYPE_ADDRESS32: + min = (rman_res_t)res->Data.Address32.Address.Minimum; + max = (rman_res_t)res->Data.Address32.Address.Maximum; + break; + case ACPI_RESOURCE_TYPE_ADDRESS64: + min = (rman_res_t)res->Data.Address64.Address.Minimum; + max = (rman_res_t)res->Data.Address64.Address.Maximum; + break; + default: + return (AE_OK); + } - return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt)); + sc = device_get_softc(dev); + + error = rman_manage_region(&sc->base.mem_rman, min, max); + if (error) { + device_printf(dev, "unable to allocate %lx-%lx range\n", min, max); + return (AE_NOT_FOUND); + } + device_printf(dev, "allocating %lx-%lx range\n", min, max); + + return (AE_OK); } -static struct rman * -generic_pcie_acpi_rman(struct generic_pcie_acpi_softc *sc, int type) +static int +generic_pcie_acpi_read_ivar(device_t dev, device_t child, int index, + uintptr_t *result) { + ACPI_HANDLE handle; + struct generic_pcie_acpi_softc *sc; + int secondary_bus; - switch (type) { - case SYS_RES_IOPORT: - return (&sc->base.io_rman); - case SYS_RES_MEMORY: - return (&sc->base.mem_rman); - default: - break; + sc = device_get_softc(dev); + + if (index == PCIB_IVAR_BUS) { + handle = acpi_get_handle(dev); + if (ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &secondary_bus))) + secondary_bus = sc->base.ecam * 0x80; + *result = secondary_bus; + return (0); } - return (NULL); + if (index == PCIB_IVAR_DOMAIN) { + *result = sc->base.ecam; + return (0); + } + + if (bootverbose) + device_printf(dev, "ERROR: Unknown index %d.\n", index); + return (ENOENT); } +static int +generic_pcie_acpi_route_interrupt(device_t bus, device_t dev, int pin) +{ + struct generic_pcie_acpi_softc *sc; + + sc = device_get_softc(bus); + + return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt)); +} + static struct resource * pci_host_generic_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { + struct resource *res = NULL; + #if defined(NEW_PCIB) && defined(PCI_RES_BUS) struct generic_pcie_acpi_softc *sc; @@ -188,8 +244,15 @@ pci_host_generic_acpi_alloc_resource(device_t dev, dev } #endif - return (bus_generic_alloc_resource(dev, child, type, rid, start, end, - count, flags)); + if (type == SYS_RES_MEMORY) + res = pci_host_generic_core_alloc_resource(dev, child, type, + rid, start, end, count, flags); + + if (res == NULL) + res = bus_generic_alloc_resource(dev, child, type, rid, start, end, + count, flags); + + return (res); } static int @@ -308,6 +371,7 @@ static device_method_t generic_pcie_acpi_methods[] = { DEVMETHOD(bus_alloc_resource, pci_host_generic_acpi_alloc_resource), DEVMETHOD(bus_activate_resource, generic_pcie_acpi_activate_resource), DEVMETHOD(bus_deactivate_resource, generic_pcie_acpi_deactivate_resource), + DEVMETHOD(bus_read_ivar, generic_pcie_acpi_read_ivar), /* pcib interface */ DEVMETHOD(pcib_route_interrupt, generic_pcie_acpi_route_interrupt), From owner-svn-src-head@freebsd.org Mon Jul 9 09:00:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ED791032773; Mon, 9 Jul 2018 09:00:17 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 180568C4EC; Mon, 9 Jul 2018 09:00:17 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC1E212DE5; Mon, 9 Jul 2018 09:00:16 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6990Ghq081982; Mon, 9 Jul 2018 09:00:16 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6990GCZ081981; Mon, 9 Jul 2018 09:00:16 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201807090900.w6990GCZ081981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 9 Jul 2018 09:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336130 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 336130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 09:00:17 -0000 Author: wma Date: Mon Jul 9 09:00:16 2018 New Revision: 336130 URL: https://svnweb.freebsd.org/changeset/base/336130 Log: ARM64: Add quirk mechanism to pci_host_generic_acpi Add few quirks which are necessary to use AHCI on ThX2 Submitted by: Patryk Duda Obtained from: Semihalf Sponsored by: Cavium Differential revision: https://reviews.freebsd.org/D15929 Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:55:07 2018 (r336129) +++ head/sys/dev/pci/pci_host_generic.c Mon Jul 9 09:00:16 2018 (r336130) @@ -69,6 +69,25 @@ __FBSDID("$FreeBSD$"); (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \ ((reg) & PCIE_REG_MASK)) +typedef void (*pci_host_generic_quirk_function)(device_t); + +struct pci_host_generic_quirk_entry { + int impl; + int part; + int var; + int rev; + pci_host_generic_quirk_function func; +}; + +struct pci_host_generic_block_entry { + int impl; + int part; + int var; + int rev; + int bus; + int slot; +}; + /* Forward prototypes */ static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, @@ -80,7 +99,22 @@ static int generic_pcie_read_ivar(device_t dev, device uintptr_t *result); static int generic_pcie_write_ivar(device_t dev, device_t child, int index, uintptr_t value); +static void pci_host_generic_apply_quirks(device_t); +static void thunderx2_ahci_bar_quirk(device_t); +struct pci_host_generic_quirk_entry pci_host_generic_quirks[] = +{ + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, thunderx2_ahci_bar_quirk}, + {0, 0, 0, 0, NULL} +}; + +struct pci_host_generic_block_entry pci_host_generic_blocked[] = +{ + /* ThunderX2 AHCI on second socket */ + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, + {0, 0, 0, 0, 0, 0} +}; + int pci_host_generic_core_attach(device_t dev) { @@ -134,9 +168,30 @@ pci_host_generic_core_attach(device_t dev) return (error); } + pci_host_generic_apply_quirks(dev); + return (0); } +static void +pci_host_generic_apply_quirks(device_t dev) +{ + struct pci_host_generic_quirk_entry *quirk; + + quirk = pci_host_generic_quirks; + while (1) { + if (quirk->impl == 0) + break; + + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, + quirk->impl, quirk->part, quirk->var, quirk->rev) && + quirk->func != NULL) + quirk->func(dev); + + quirk++; + } +} + static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, int bytes) @@ -146,11 +201,25 @@ generic_pcie_read_config(device_t dev, u_int bus, u_in bus_space_tag_t t; uint64_t offset; uint32_t data; + struct pci_host_generic_block_entry *block; if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) return (~0U); + block = pci_host_generic_blocked; + while (1) { + if (block->impl == 0) + break; + + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, + block->impl, block->part, block->var, block->rev) && + block->bus == bus && block->slot == slot) + return (~0); + + block++; + } + sc = device_get_softc(dev); offset = PCIE_ADDR_OFFSET(bus, slot, func, reg); @@ -392,3 +461,20 @@ static device_method_t generic_pcie_methods[] = { DEFINE_CLASS_0(pcib, generic_pcie_core_driver, generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); + +static void thunderx2_ahci_bar_quirk(device_t dev) +{ + + /* + * XXX: + * On ThunderX2, AHCI BAR2 address is wrong. It needs to precisely + * match the one described in datasheet. Fixup it unconditionally. + */ + if (device_get_unit(dev) == 0) { + device_printf(dev, "running AHCI BAR fixup\n"); + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x18, 0x01440000, 4); + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x1c, 0x40, 4); + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x18, 0x01450000, 4); + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); + } +} From owner-svn-src-head@freebsd.org Mon Jul 9 09:23:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D8451034A78; Mon, 9 Jul 2018 09:23:28 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD62C8D78B; Mon, 9 Jul 2018 09:23:27 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 0F9245A9F17; Mon, 9 Jul 2018 09:23:27 +0000 (UTC) Date: Mon, 9 Jul 2018 09:23:27 +0000 From: Brooks Davis To: Alexey Dokuchaev Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys Message-ID: <20180709092327.GB85898@spindle.one-eyed-alien.net> References: <201807061950.w66JoP2F081328@repo.freebsd.org> <20180706195237.GS5562@kib.kiev.ua> <20180707021856.GA80349@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline In-Reply-To: <20180707021856.GA80349@FreeBSD.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 09:23:28 -0000 --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 07, 2018 at 02:18:56AM +0000, Alexey Dokuchaev wrote: > On Fri, Jul 06, 2018 at 10:52:37PM +0300, Konstantin Belousov wrote: > > On Fri, Jul 06, 2018 at 07:50:25PM +0000, Konstantin Belousov wrote: > > > New Revision: 336046 > > > URL: https://svnweb.freebsd.org/changeset/base/336046 > > >=20 > > > Log: > > > Revert to recommit with the proper message. > >=20 > > I am sorry for the second mistake of the same sort in the day. >=20 > It would be much easier if we'd allowed "svn propedit --revprop svn:log". Not going to happen. That would completely trash the ability to use git exports. -- Brooks --IiVenqGWf+H9Y6IX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJbQymOAAoJEKzQXbSebgfAu+cH/RCdWJ+D7UT2Li1zDtI6hP06 M2AiVd13ZbwLGE1OrSBIAin/TfY41XX5v7ASit6pcbGiLrOgN8uNGnYCasNSF2Q/ ovX3ptid9N5xxmjtMcMq7ICpvlS/qJalfwpDVjYe+UTf3bayB+J61KysJau2pHiu lKp/X9TsdcjFozaNWYyh2Wu0t/3FJ0RmhgrSOTxqB3O/xKZQvKqaweLaSdlwcpYo qqBTvFuNjgL6zlrhznahJM1EQW/+lePicNcf/vYaFDo/WOc/VSrjkzM6/TrwJZrT ixxbSNjNVMXBGxudJKBdi5tGgUIA+be2KZEq1dNaPK8DRUHFS5FFBjjYIgodhgc= =5Thq -----END PGP SIGNATURE----- --IiVenqGWf+H9Y6IX-- From owner-svn-src-head@freebsd.org Mon Jul 9 11:03:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 179EC103EE9F; Mon, 9 Jul 2018 11:03:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD29D91527; Mon, 9 Jul 2018 11:03:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E0EE142FF; Mon, 9 Jul 2018 11:03:29 +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 w69B3T3k048528; Mon, 9 Jul 2018 11:03:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69B3Ste048521; Mon, 9 Jul 2018 11:03:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201807091103.w69B3Ste048521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 9 Jul 2018 11:03:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336131 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 336131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 11:03:30 -0000 Author: ae Date: Mon Jul 9 11:03:28 2018 New Revision: 336131 URL: https://svnweb.freebsd.org/changeset/base/336131 Log: Deduplicate the code. Add generic function if_tunnel_check_nesting() that does check for allowed nesting level for tunneling interfaces and also does loop detection. Use it in gif(4), gre(4) and me(4) interfaces. Differential Revision: https://reviews.freebsd.org/D16162 Modified: head/sys/net/if.c head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_me.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jul 9 09:00:16 2018 (r336130) +++ head/sys/net/if.c Mon Jul 9 11:03:28 2018 (r336131) @@ -3903,6 +3903,44 @@ if_requestencap_default(struct ifnet *ifp, struct if_e } /* + * Tunnel interfaces can nest, also they may cause infinite recursion + * calls when misconfigured. We'll prevent this by detecting loops. + * High nesting level may cause stack exhaustion. We'll prevent this + * by introducing upper limit. + * + * Return 0, if tunnel nesting count is equal or less than limit. + */ +int +if_tunnel_check_nesting(struct ifnet *ifp, struct mbuf *m, uint32_t cookie, + int limit) +{ + struct m_tag *mtag; + int count; + + count = 1; + mtag = NULL; + while ((mtag = m_tag_locate(m, cookie, 0, mtag)) != NULL) { + if (*(struct ifnet **)(mtag + 1) == ifp) { + log(LOG_NOTICE, "%s: loop detected\n", if_name(ifp)); + return (EIO); + } + count++; + } + if (count > limit) { + log(LOG_NOTICE, + "%s: if_output recursively called too many times(%d)\n", + if_name(ifp), count); + return (EIO); + } + mtag = m_tag_alloc(cookie, 0, sizeof(struct ifnet *), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + *(struct ifnet **)(mtag + 1) = ifp; + m_tag_prepend(m, mtag); + return (0); +} + +/* * Get the link layer address that was read from the hardware at attach. * * This is only set by Ethernet NICs (IFT_ETHER), but laggX interfaces re-type Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Mon Jul 9 09:00:16 2018 (r336130) +++ head/sys/net/if_gif.c Mon Jul 9 11:03:28 2018 (r336131) @@ -104,7 +104,6 @@ void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struc void (*ng_gif_attach_p)(struct ifnet *ifp); void (*ng_gif_detach_p)(struct ifnet *ifp); -static int gif_check_nesting(struct ifnet *, struct mbuf *); static void gif_delete_tunnel(struct gif_softc *); static int gif_ioctl(struct ifnet *, u_long, caddr_t); static int gif_transmit(struct ifnet *, struct mbuf *); @@ -256,6 +255,7 @@ gif_hashdestroy(struct gif_list *hash) free(hash, M_GIF); } +#define MTAG_GIF 1080679712 static int gif_transmit(struct ifnet *ifp, struct mbuf *m) { @@ -285,7 +285,8 @@ gif_transmit(struct ifnet *ifp, struct mbuf *m) if ((ifp->if_flags & IFF_MONITOR) != 0 || (ifp->if_flags & IFF_UP) == 0 || sc->gif_family == 0 || - (error = gif_check_nesting(ifp, m)) != 0) { + (error = if_tunnel_check_nesting(ifp, m, MTAG_GIF, + V_max_gif_nesting)) != 0) { m_freem(m); goto err; } @@ -378,42 +379,6 @@ gif_qflush(struct ifnet *ifp __unused) } -#define MTAG_GIF 1080679712 -static int -gif_check_nesting(struct ifnet *ifp, struct mbuf *m) -{ - struct m_tag *mtag; - int count; - - /* - * gif may cause infinite recursion calls when misconfigured. - * We'll prevent this by detecting loops. - * - * High nesting level may cause stack exhaustion. - * We'll prevent this by introducing upper limit. - */ - count = 1; - mtag = NULL; - while ((mtag = m_tag_locate(m, MTAG_GIF, 0, mtag)) != NULL) { - if (*(struct ifnet **)(mtag + 1) == ifp) { - log(LOG_NOTICE, "%s: loop detected\n", if_name(ifp)); - return (EIO); - } - count++; - } - if (count > V_max_gif_nesting) { - log(LOG_NOTICE, - "%s: if_output recursively called too many times(%d)\n", - if_name(ifp), count); - return (EIO); - } - mtag = m_tag_alloc(MTAG_GIF, 0, sizeof(struct ifnet *), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - *(struct ifnet **)(mtag + 1) = ifp; - m_tag_prepend(m, mtag); - return (0); -} int gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Mon Jul 9 09:00:16 2018 (r336130) +++ head/sys/net/if_gre.c Mon Jul 9 11:03:28 2018 (r336131) @@ -503,37 +503,7 @@ drop: return (IPPROTO_DONE); } -#define MTAG_GRE 1307983903 static int -gre_check_nesting(struct ifnet *ifp, struct mbuf *m) -{ - struct m_tag *mtag; - int count; - - count = 1; - mtag = NULL; - while ((mtag = m_tag_locate(m, MTAG_GRE, 0, mtag)) != NULL) { - if (*(struct ifnet **)(mtag + 1) == ifp) { - log(LOG_NOTICE, "%s: loop detected\n", ifp->if_xname); - return (EIO); - } - count++; - } - if (count > V_max_gre_nesting) { - log(LOG_NOTICE, - "%s: if_output recursively called too many times(%d)\n", - ifp->if_xname, count); - return (EIO); - } - mtag = m_tag_alloc(MTAG_GRE, 0, sizeof(struct ifnet *), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - *(struct ifnet **)(mtag + 1) = ifp; - m_tag_prepend(m, mtag); - return (0); -} - -static int gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro) { @@ -569,6 +539,7 @@ gre_setseqn(struct grehdr *gh, uint32_t seq) *opts = htonl(seq); } +#define MTAG_GRE 1307983903 static int gre_transmit(struct ifnet *ifp, struct mbuf *m) { @@ -592,7 +563,8 @@ gre_transmit(struct ifnet *ifp, struct mbuf *m) if ((ifp->if_flags & IFF_MONITOR) != 0 || (ifp->if_flags & IFF_UP) == 0 || sc->gre_family == 0 || - (error = gre_check_nesting(ifp, m)) != 0) { + (error = if_tunnel_check_nesting(ifp, m, MTAG_GRE, + V_max_gre_nesting)) != 0) { m_freem(m); goto drop; } Modified: head/sys/net/if_me.c ============================================================================== --- head/sys/net/if_me.c Mon Jul 9 09:00:16 2018 (r336130) +++ head/sys/net/if_me.c Mon Jul 9 11:03:28 2018 (r336131) @@ -455,37 +455,7 @@ drop: return (IPPROTO_DONE); } -#define MTAG_ME 1414491977 static int -me_check_nesting(struct ifnet *ifp, struct mbuf *m) -{ - struct m_tag *mtag; - int count; - - count = 1; - mtag = NULL; - while ((mtag = m_tag_locate(m, MTAG_ME, 0, mtag)) != NULL) { - if (*(struct ifnet **)(mtag + 1) == ifp) { - log(LOG_NOTICE, "%s: loop detected\n", ifp->if_xname); - return (EIO); - } - count++; - } - if (count > V_max_me_nesting) { - log(LOG_NOTICE, - "%s: if_output recursively called too many times(%d)\n", - ifp->if_xname, count); - return (EIO); - } - mtag = m_tag_alloc(MTAG_ME, 0, sizeof(struct ifnet *), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); - *(struct ifnet **)(mtag + 1) = ifp; - m_tag_prepend(m, mtag); - return (0); -} - -static int me_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro __unused) { @@ -499,6 +469,7 @@ me_output(struct ifnet *ifp, struct mbuf *m, const str return (ifp->if_transmit(ifp, m)); } +#define MTAG_ME 1414491977 static int me_transmit(struct ifnet *ifp, struct mbuf *m) { @@ -519,7 +490,8 @@ me_transmit(struct ifnet *ifp, struct mbuf *m) if (sc == NULL || !ME_READY(sc) || (ifp->if_flags & IFF_MONITOR) != 0 || (ifp->if_flags & IFF_UP) == 0 || - (error = me_check_nesting(ifp, m) != 0)) { + (error = if_tunnel_check_nesting(ifp, m, MTAG_ME, + V_max_me_nesting)) != 0) { m_freem(m); goto drop; } Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Jul 9 09:00:16 2018 (r336130) +++ head/sys/net/if_var.h Mon Jul 9 11:03:28 2018 (r336131) @@ -644,6 +644,7 @@ int if_printf(struct ifnet *, const char *, ...) __pri void if_ref(struct ifnet *); void if_rele(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); +int if_tunnel_check_nesting(struct ifnet *, struct mbuf *, uint32_t, int); void if_up(struct ifnet *); int ifioctl(struct socket *, u_long, caddr_t, struct thread *); int ifpromisc(struct ifnet *, int); From owner-svn-src-head@freebsd.org Mon Jul 9 11:21:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 278AF10406E5; Mon, 9 Jul 2018 11:21:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (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 B1CCF921D1; Mon, 9 Jul 2018 11:21:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f50.google.com with SMTP id p4-v6so24857307itf.2; Mon, 09 Jul 2018 04:21:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=jcok0ap8e2JC1azH7ZuORSHCR6cTsx0h47Aw0v1TotQ=; b=BFf+GtTfi4ULNjke8dZQmQiUKQ6SLgIL9pHIuhO64Z9/W1GxuRFSIOrWw4juhhvJSq DLWvjPQ9NRy3oiYu0CytqVPWn9C85LbJfb4DTtRbmRUotWEEJMWibEnxClIs+W/VoXpe NtBIS78lamqU/GstmFV9V/9JpPssnzNiIevFVlw+vsXVsrcpeE7OGmjMbfa6/jY3nLzf BxX1nHQ46GETWFI8FfKeuIYKh9rUS/DmL27Y064P4Xylu1fARt6FiFH+sndQkonMnKUs UIr0DBfvDgUv5lp8N3Y/E4QZInaYS3j+Nn5uCrfyMPCU9i2TzvX1mpHfOZZGXbrEQEgU PB1A== X-Gm-Message-State: APt69E3yU7F4c0SZlri+uDKuPTlG1XuEVx8XwxZ99qe5+sHStRZda+Kt 1yWFoKdPrIzXNXbpdBzwtmnGfuvE X-Google-Smtp-Source: AAOMgpdV3OTiuPoKy+ZCEwEv9YeWaJJsrU2DUfloDcpyRP23VbNeE8pslka04ysUEcLDLKAbjuuXlA== X-Received: by 2002:a24:ad28:: with SMTP id c40-v6mr15141858itf.36.1531125642537; Mon, 09 Jul 2018 01:40:42 -0700 (PDT) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id v199-v6sm7220404itb.18.2018.07.09.01.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 01:40:42 -0700 (PDT) Received: by mail-it0-f52.google.com with SMTP id j185-v6so25001549ite.1; Mon, 09 Jul 2018 01:40:42 -0700 (PDT) X-Received: by 2002:a02:954d:: with SMTP id y71-v6mr16746744jah.19.1531125641988; Mon, 09 Jul 2018 01:40:41 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:7e0a:0:0:0:0:0 with HTTP; Mon, 9 Jul 2018 01:40:41 -0700 (PDT) In-Reply-To: <201807090837.w698btiS062177@repo.freebsd.org> References: <201807090837.w698btiS062177@repo.freebsd.org> From: Conrad Meyer Date: Mon, 9 Jul 2018 01:40:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r336127 - head/usr.bin/gzip To: svn-src-all@freebsd.org Cc: src-committers , svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 11:21:38 -0000 On Mon, Jul 9, 2018 at 1:37 AM, Conrad Meyer wrote: > Author: cem > Date: Mon Jul 9 08:37:55 2018 > New Revision: 336127 > URL: https://svnweb.freebsd.org/changeset/base/336127 > > Log: > gzip(1): Don't shadow global 'err' > > Unbreak work build on ppc due to -Werror=shadow. Introduced in r336121. Oops: "Unbreak world build." From owner-svn-src-head@freebsd.org Mon Jul 9 11:35:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5E9E1041966; Mon, 9 Jul 2018 11:35:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A49F92A52; Mon, 9 Jul 2018 11:35:19 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57271147E3; Mon, 9 Jul 2018 11:35:19 +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 w69BZJRf063878; Mon, 9 Jul 2018 11:35:19 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69BZI8k063873; Mon, 9 Jul 2018 11:35:18 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201807091135.w69BZI8k063873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 9 Jul 2018 11:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336132 - in head: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Commit-Revision: 336132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 11:35:20 -0000 Author: ae Date: Mon Jul 9 11:35:18 2018 New Revision: 336132 URL: https://svnweb.freebsd.org/changeset/base/336132 Log: Add "record-state", "set-limit" and "defer-action" rule options to ipfw. "record-state" is similar to "keep-state", but it doesn't produce implicit O_PROBE_STATE opcode in a rule. "set-limit" is like "limit", but it has the same feature as "record-state", it is single opcode without implicit O_PROBE_STATE opcode. "defer-action" is targeted to be used with dynamic states. When rule with this opcode is matched, the rule's action will not be executed, instead dynamic state will be created. And when this state will be matched by "check-state", then rule action will be executed. This allows create a more complicated rulesets. Submitted by: lev MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D1776 Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sys/netinet/ip_fw.h head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Jul 9 11:03:28 2018 (r336131) +++ head/sbin/ipfw/ipfw.8 Mon Jul 9 11:35:18 2018 (r336132) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2018 +.Dd July 9, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -212,9 +212,11 @@ or depending on how the kernel is configured. .Pp If the ruleset includes one or more rules with the -.Cm keep-state -or +.Cm keep-state , +.Cm record-state , .Cm limit +or +.Cm set-limit option, the firewall will have a .Em stateful @@ -231,6 +233,18 @@ or .Cm limit rule, and are typically used to open the firewall on-demand to legitimate traffic only. +Please, note, that +.Cm keep-state +amd +.Cm limit +imply implicit +.Cm check-state +for all packets (not only these matched by the rule) but +.Cm record-state +and +.Cm set-limit +have no implicit +.Cm check-state . See the .Sx STATEFUL FIREWALL and @@ -628,7 +642,12 @@ to simulate the effect of multiple paths leading to ou packet delivery. .Pp Note: this condition is checked before any other condition, including -ones such as keep-state or check-state which might have side effects. +ones such as +.Cm keep-state +or +.Cm check-state +which might have +side effects. .It Cm log Op Cm logamount Ar number Packets matching a rule with the .Cm log @@ -1462,6 +1481,21 @@ action followed by the comment. .It Cm bridged Alias for .Cm layer2 . +.It Cm defer-immediate-action | defer-action +A rule with this option will not perform normal action +upon a match. This option is intended to be used with +.Cm record-state +or +.Cm keep-state +as the dynamic rule, created but ignored on match, will work +as intended. +Rules with both +.Cm record-state +and +.Cm defer-immediate-action +create a dynamic rule and continue with the next rule without actually +performing the action part of this rule. When the rule is later activated +via the state table, the action is performed as usual. .It Cm diverted Matches only packets generated by a divert socket. .It Cm diverted-loopback @@ -1780,6 +1814,14 @@ and they are always printed as hexadecimal (unless the option is used, in which case symbolic resolution will be attempted). .It Cm proto Ar protocol Matches packets with the corresponding IP protocol. +.It Cm record-state +Upon a match, the firewall will create a dynamic rule as if +.Cm keep-state +was specified. +However, this option doesn't imply an implicit +.Cm check-state +in contrast to +.Cm keep-state . .It Cm recv | xmit | via Brq Ar ifX | Ar if Ns Cm * | Ar table Ns Po Ar name Ns Oo , Ns Ar value Oc Pc | Ar ipno | Ar any Matches packets received, transmitted or going through, respectively, the interface specified by exact name @@ -1828,6 +1870,12 @@ A packet might not have a receive or transmit interfac originating from the local host have no receive interface, while packets destined for the local host have no transmit interface. +.It Cm set-limit Bro Cm src-addr | src-port | dst-addr | dst-port Brc Ar N +Works like +.Cm limit +but does not have an implicit +.Cm check-state +attached to it. .It Cm setup Matches TCP packets that have the SYN bit set but no ACK bit. This is the short form of @@ -2284,16 +2332,18 @@ create rules for specific flows when packets that match a given pattern are detected. Support for stateful operation comes through the -.Cm check-state , keep-state +.Cm check-state , keep-state , record-state , limit and -.Cm limit +.Cm set-limit options of .Nm rules . .Pp Dynamic rules are created when a packet matches a -.Cm keep-state -or +.Cm keep-state , +.Cm record-state , .Cm limit +or +.Cm set-limit rule, causing the creation of a .Em dynamic rule which will match all and only packets with @@ -3665,6 +3715,15 @@ rule should usually be placed near the beginning of th ruleset to minimize the amount of work scanning the ruleset. Your mileage may vary. .Pp +For more complex scenarios with dynamic rules +.Cm record-state +and +.Cm defer-action +can be used to precisely control creation and checking of dynamic rules. +Example of usage of these options are provided in +.Sx NETWORK ADDRESS TRANSLATION (NAT) +Section. +.Pp To limit the number of connections a user can open you can use the following type of rules: .Pp @@ -3931,6 +3990,40 @@ or it could be split in: .Dl " 10.0.0.100" .Dl "ipfw nat 5 config redirect_port tcp" .Dl " 192.168.0.1:80,192.168.0.10:22,192.168.0.20:25 500" +.Pp +Sometimes you may want to mix NAT and dynamic rules. It could be achived with +.Cm record-state +and +.Cm defer-action +options. Problem is, you need to create dynamic rule before NAT and check it +after NAT actions (or vice versa) to have consistent addresses and ports. +Rule with +.Cm keep-state +option will trigger activation of existing dynamic state, and action of such +rule will be performed as soon as rule is matched. In case of NAT and +.Cm allow +rule packet need to be passed to NAT, not allowed as soon is possible. +.Pp +There is example of set of rules to achive this. Bear in mind that this +is exmaple only and it is not very usefult by itself. +.Pp +On way out, after all checks place this rules: +.Pp +.Dl "ipfw add allow record-state skip-action" +.Dl "ipfw add nat 1" +.Pp +And on way in there should be something like this: +.Pp +.Dl "ipfw add nat 1" +.Dl "ipfw add check-state" +.Pp +Please note, that first rule on way out doesn't allow packet and doesn't +execute existing dynamic rules. All it does, create new dynamic rule with +.Cm allow +action, if it is not created yet. Later, this dynamic rule is used on way +in by +.Cm check-state +rule. .Sh SEE ALSO .Xr cpp 1 , .Xr m4 1 , Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jul 9 11:03:28 2018 (r336131) +++ head/sbin/ipfw/ipfw2.c Mon Jul 9 11:35:18 2018 (r336132) @@ -305,7 +305,9 @@ static struct _s_x rule_options[] = { { "jail", TOK_JAIL }, { "in", TOK_IN }, { "limit", TOK_LIMIT }, + { "set-limit", TOK_SETLIMIT }, { "keep-state", TOK_KEEPSTATE }, + { "record-state", TOK_RECORDSTATE }, { "bridged", TOK_LAYER2 }, { "layer2", TOK_LAYER2 }, { "out", TOK_OUT }, @@ -368,6 +370,8 @@ static struct _s_x rule_options[] = { { "src-ip6", TOK_SRCIP6}, { "lookup", TOK_LOOKUP}, { "flow", TOK_FLOW}, + { "defer-action", TOK_SKIPACTION }, + { "defer-immediate-action", TOK_SKIPACTION }, { "//", TOK_COMMENT }, { "not", TOK_NOT }, /* pseudo option */ @@ -1371,9 +1375,10 @@ struct show_state { const ipfw_insn *eaction; uint8_t *printed; int flags; -#define HAVE_PROTO 0x0001 -#define HAVE_SRCIP 0x0002 -#define HAVE_DSTIP 0x0004 +#define HAVE_PROTO 0x0001 +#define HAVE_SRCIP 0x0002 +#define HAVE_DSTIP 0x0004 +#define HAVE_PROBE_STATE 0x0008 int proto; int or_block; }; @@ -1415,13 +1420,12 @@ mark_printed(struct show_state *state, const ipfw_insn } static void -print_limit(struct buf_pr *bp, const ipfw_insn_limit *limit) +print_limit_mask(struct buf_pr *bp, const ipfw_insn_limit *limit) { struct _s_x *p = limit_masks; char const *comma = " "; uint8_t x; - bprintf(bp, " limit"); for (x = limit->limit_mask; p->x != 0; p++) { if ((x & p->x) == p->x) { x &= ~p->x; @@ -1455,6 +1459,7 @@ print_instruction(struct buf_pr *bp, const struct form bprintf(bp, "prob %f ", d); break; case O_PROBE_STATE: /* no need to print anything here */ + state->flags |= HAVE_PROBE_STATE; break; case O_IP_SRC: case O_IP_SRC_LOOKUP: @@ -1661,13 +1666,20 @@ print_instruction(struct buf_pr *bp, const struct form bprintf(bp, " // %s", (char *)(cmd + 1)); break; case O_KEEP_STATE: - bprintf(bp, " keep-state"); + if (state->flags & HAVE_PROBE_STATE) + bprintf(bp, " keep-state"); + else + bprintf(bp, " record-state"); bprintf(bp, " :%s", object_search_ctlv(fo->tstate, cmd->arg1, IPFW_TLV_STATE_NAME)); break; case O_LIMIT: - print_limit(bp, insntod(cmd, limit)); + if (state->flags & HAVE_PROBE_STATE) + bprintf(bp, " limit"); + else + bprintf(bp, " set-limit"); + print_limit_mask(bp, insntod(cmd, limit)); bprintf(bp, " :%s", object_search_ctlv(fo->tstate, cmd->arg1, IPFW_TLV_STATE_NAME)); @@ -1691,6 +1703,9 @@ print_instruction(struct buf_pr *bp, const struct form print_newports(bp, insntod(cmd, u16), 0, O_TAGGED); break; + case O_SKIP_ACTION: + bprintf(bp, " defer-immediate-action"); + break; default: bprintf(bp, " [opcode %d len %d]", cmd->opcode, cmd->len); @@ -3706,8 +3721,10 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize /* * various flags used to record that we entered some fields. */ - ipfw_insn *have_state = NULL; /* check-state or keep-state */ + ipfw_insn *have_state = NULL; /* any state-related option */ + int have_rstate = 0; ipfw_insn *have_log = NULL, *have_altq = NULL, *have_tag = NULL; + ipfw_insn *have_skipcmd = NULL; size_t len; int i; @@ -4647,15 +4664,16 @@ read_options: av++; break; - case TOK_KEEPSTATE: { + case TOK_KEEPSTATE: + case TOK_RECORDSTATE: { uint16_t uidx; if (open_par) - errx(EX_USAGE, "keep-state cannot be part " + errx(EX_USAGE, "keep-state or record-state cannot be part " "of an or block"); if (have_state) - errx(EX_USAGE, "only one of keep-state " - "and limit is allowed"); + errx(EX_USAGE, "only one of keep-state, record-state, " + " limit and set-limit is allowed"); if (*av != NULL && *av[0] == ':') { if (state_check_name(*av + 1) != 0) errx(EX_DATAERR, @@ -4667,21 +4685,24 @@ read_options: uidx = pack_object(tstate, default_state_name, IPFW_TLV_STATE_NAME); have_state = cmd; + have_rstate = i == TOK_RECORDSTATE; fill_cmd(cmd, O_KEEP_STATE, 0, uidx); break; } - case TOK_LIMIT: { + case TOK_LIMIT: + case TOK_SETLIMIT: { ipfw_insn_limit *c = (ipfw_insn_limit *)cmd; int val; if (open_par) errx(EX_USAGE, - "limit cannot be part of an or block"); + "limit or set-limit cannot be part of an or block"); if (have_state) - errx(EX_USAGE, "only one of keep-state and " - "limit is allowed"); + errx(EX_USAGE, "only one of keep-state, record-state, " + " limit and set-limit is allowed"); have_state = cmd; + have_rstate = i == TOK_SETLIMIT; cmd->len = F_INSN_SIZE(ipfw_insn_limit); CHECK_CMDLEN; @@ -4884,6 +4905,14 @@ read_options: av++; break; + case TOK_SKIPACTION: + if (have_skipcmd) + errx(EX_USAGE, "only one defer-action " + "is allowed"); + have_skipcmd = cmd; + fill_cmd(cmd, O_SKIP_ACTION, 0, 0); + break; + default: errx(EX_USAGE, "unrecognised option [%d] %s\n", i, s); } @@ -4894,6 +4923,11 @@ read_options: } done: + + if (!have_state && have_skipcmd) + warnx("Rule contains \"defer-immediate-action\" " + "and doesn't contain any state-related options."); + /* * Now copy stuff into the rule. * If we have a keep-state option, the first instruction @@ -4916,12 +4950,15 @@ done: /* * generate O_PROBE_STATE if necessary */ - if (have_state && have_state->opcode != O_CHECK_STATE) { + if (have_state && have_state->opcode != O_CHECK_STATE && !have_rstate) { fill_cmd(dst, O_PROBE_STATE, 0, have_state->arg1); dst = next_cmd(dst, &rblen); } - /* copy all commands but O_LOG, O_KEEP_STATE, O_LIMIT, O_ALTQ, O_TAG */ + /* + * copy all commands but O_LOG, O_KEEP_STATE, O_LIMIT, O_ALTQ, O_TAG, + * O_SKIP_ACTION + */ for (src = (ipfw_insn *)cmdbuf; src != cmd; src += i) { i = F_LEN(src); CHECK_RBUFLEN(i); @@ -4932,6 +4969,7 @@ done: case O_LIMIT: case O_ALTQ: case O_TAG: + case O_SKIP_ACTION: break; default: bcopy(src, dst, i * sizeof(uint32_t)); @@ -4948,6 +4986,17 @@ done: bcopy(have_state, dst, i * sizeof(uint32_t)); dst += i; } + + /* + * put back the have_skipcmd command as very last opcode + */ + if (have_skipcmd) { + i = F_LEN(have_skipcmd); + CHECK_RBUFLEN(i); + bcopy(have_skipcmd, dst, i * sizeof(uint32_t)); + dst += i; + } + /* * start action section */ Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Jul 9 11:03:28 2018 (r336131) +++ head/sbin/ipfw/ipfw2.h Mon Jul 9 11:35:18 2018 (r336132) @@ -124,7 +124,9 @@ enum tokens { TOK_JAIL, TOK_IN, TOK_LIMIT, + TOK_SETLIMIT, TOK_KEEPSTATE, + TOK_RECORDSTATE, TOK_LAYER2, TOK_OUT, TOK_DIVERTED, @@ -294,6 +296,8 @@ enum tokens { TOK_PREFIXLEN, TOK_TCPSETMSS, + + TOK_SKIPACTION, }; /* Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Jul 9 11:03:28 2018 (r336131) +++ head/sys/netinet/ip_fw.h Mon Jul 9 11:35:18 2018 (r336132) @@ -285,6 +285,8 @@ enum ipfw_opcodes { /* arguments (4 byte each) */ O_EXTERNAL_INSTANCE, /* arg1=id of eaction handler instance */ O_EXTERNAL_DATA, /* variable length data */ + O_SKIP_ACTION, /* none */ + O_LAST_OPCODE /* not an opcode! */ }; Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Mon Jul 9 11:03:28 2018 (r336131) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Jul 9 11:35:18 2018 (r336132) @@ -2584,7 +2584,9 @@ do { \ * * O_LIMIT and O_KEEP_STATE: these opcodes are * not real 'actions', and are stored right - * before the 'action' part of the rule. + * before the 'action' part of the rule (one + * exception is O_SKIP_ACTION which could be + * between these opcodes and 'action' one). * These opcodes try to install an entry in the * state tables; if successful, we continue with * the next opcode (match=1; break;), otherwise @@ -2601,6 +2603,16 @@ do { \ * further instances of these opcodes become NOPs. * The jump to the next rule is done by setting * l=0, cmdlen=0. + * + * O_SKIP_ACTION: this opcode is not a real 'action' + * either, and is stored right before the 'action' + * part of the rule, right after the O_KEEP_STATE + * opcode. It causes match failure so the real + * 'action' could be executed only if the rule + * is checked via dynamic rule from the state + * table, as in such case execution starts + * from the true 'action' opcode directly. + * */ case O_LIMIT: case O_KEEP_STATE: @@ -2651,6 +2663,11 @@ do { \ if (cmd->opcode == O_CHECK_STATE) l = 0; /* exit inner loop */ match = 1; + break; + + case O_SKIP_ACTION: + match = 0; /* skip to the next rule */ + l = 0; /* exit inner loop */ break; case O_ACCEPT: Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Jul 9 11:03:28 2018 (r336131) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Jul 9 11:35:18 2018 (r336132) @@ -1750,6 +1750,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int cmd_len, stru #endif case O_IP4: case O_TAG: + case O_SKIP_ACTION: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; break; From owner-svn-src-head@freebsd.org Mon Jul 9 14:18:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CDC1102A048; Mon, 9 Jul 2018 14:18:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE894718C7; Mon, 9 Jul 2018 14:18:03 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA691161CB; Mon, 9 Jul 2018 14:18:03 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69EI3wq046427; Mon, 9 Jul 2018 14:18:03 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69EI3VA046426; Mon, 9 Jul 2018 14:18:03 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807091418.w69EI3VA046426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 9 Jul 2018 14:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336134 - head/sys/modules/amdsbwd X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/modules/amdsbwd X-SVN-Commit-Revision: 336134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 14:18:04 -0000 Author: ian Date: Mon Jul 9 14:18:03 2018 New Revision: 336134 URL: https://svnweb.freebsd.org/changeset/base/336134 Log: Add missing generated header file. Reported by: Julian H. Stacey Modified: head/sys/modules/amdsbwd/Makefile Modified: head/sys/modules/amdsbwd/Makefile ============================================================================== --- head/sys/modules/amdsbwd/Makefile Mon Jul 9 13:38:19 2018 (r336133) +++ head/sys/modules/amdsbwd/Makefile Mon Jul 9 14:18:03 2018 (r336134) @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/dev/amdsbwd KMOD = amdsbwd SRCS = amdsbwd.c -SRCS += device_if.h bus_if.h pci_if.h isa_if.h +SRCS += device_if.h bus_if.h pci_if.h isa_if.h opt_amdsbwd.h .include From owner-svn-src-head@freebsd.org Mon Jul 9 14:58:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0704102DEBB; Mon, 9 Jul 2018 14:58:40 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806D873624; Mon, 9 Jul 2018 14:58:40 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 784361C529; Mon, 9 Jul 2018 14:58:40 +0000 (UTC) Date: Mon, 9 Jul 2018 14:58:40 +0000 From: Alexey Dokuchaev To: Brooks Davis Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys Message-ID: <20180709145840.GA9417@FreeBSD.org> References: <201807061950.w66JoP2F081328@repo.freebsd.org> <20180706195237.GS5562@kib.kiev.ua> <20180707021856.GA80349@FreeBSD.org> <20180709092327.GB85898@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709092327.GB85898@spindle.one-eyed-alien.net> User-Agent: Mutt/1.9.5 (2018-04-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 14:58:41 -0000 On Mon, Jul 09, 2018 at 09:23:27AM +0000, Brooks Davis wrote: > On Sat, Jul 07, 2018 at 02:18:56AM +0000, Alexey Dokuchaev wrote: > > On Fri, Jul 06, 2018 at 10:52:37PM +0300, Konstantin Belousov wrote: > > > On Fri, Jul 06, 2018 at 07:50:25PM +0000, Konstantin Belousov wrote: > > > > New Revision: 336046 > > > > URL: https://svnweb.freebsd.org/changeset/base/336046 > > > > > > > > Log: > > > > Revert to recommit with the proper message. > > > > > > I am sorry for the second mistake of the same sort in the day. > > > > It would be much easier if we'd allowed "svn propedit --revprop svn:log". > > Not going to happen. That would completely trash the ability to use git > exports. Yeah, I've heard of it. It's a pity that SVN users have to suffer for the benefit of some obscure, unofficial VCS. :-( ./danfe From owner-svn-src-head@freebsd.org Mon Jul 9 15:08:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D580A102EE96 for ; Mon, 9 Jul 2018 15:08:55 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EA117407C for ; Mon, 9 Jul 2018 15:08:54 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: f99c4568-8389-11e8-8837-614b7c574d04 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id f99c4568-8389-11e8-8837-614b7c574d04; Mon, 09 Jul 2018 15:08:46 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w69F8jMC033631; Mon, 9 Jul 2018 09:08:45 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1531148925.1336.26.camel@freebsd.org> Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys From: Ian Lepore To: Alexey Dokuchaev , Brooks Davis Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 09 Jul 2018 09:08:45 -0600 In-Reply-To: <20180709145840.GA9417@FreeBSD.org> References: <201807061950.w66JoP2F081328@repo.freebsd.org> <20180706195237.GS5562@kib.kiev.ua> <20180707021856.GA80349@FreeBSD.org> <20180709092327.GB85898@spindle.one-eyed-alien.net> <20180709145840.GA9417@FreeBSD.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 15:08:56 -0000 On Mon, 2018-07-09 at 14:58 +0000, Alexey Dokuchaev wrote: > On Mon, Jul 09, 2018 at 09:23:27AM +0000, Brooks Davis wrote: > > > > On Sat, Jul 07, 2018 at 02:18:56AM +0000, Alexey Dokuchaev wrote: > > > > > > On Fri, Jul 06, 2018 at 10:52:37PM +0300, Konstantin Belousov wrote: > > > > > > > > On Fri, Jul 06, 2018 at 07:50:25PM +0000, Konstantin Belousov wrote: > > > > > > > > > > New Revision: 336046 > > > > > URL: https://svnweb.freebsd.org/changeset/base/336046 > > > > > > > > > > Log: > > > > >   Revert to recommit with the proper message. > > > > I am sorry for the second mistake of the same sort in the day. > > > It would be much easier if we'd allowed "svn propedit --revprop svn:log". > > Not going to happen.  That would completely trash the ability to use git > > exports. > Yeah, I've heard of it.  It's a pity that SVN users have to suffer for the > benefit of some obscure, unofficial VCS. :-( > > ./danfe > I think if git weren't in the way, what you would hear instead would be arguments against doing so from those who believe that a version control system exists to maintain an *immutable* history of changes to the source base. My voice might be one of those, unless there were some very tight controls on who could use such a feature and under what conditions. -- Ian From owner-svn-src-head@freebsd.org Mon Jul 9 15:30:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19E58103093F for ; Mon, 9 Jul 2018 15:30:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-20.consmr.mail.gq1.yahoo.com (sonic306-20.consmr.mail.gq1.yahoo.com [98.137.68.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 910C974FE4 for ; Mon, 9 Jul 2018 15:30:26 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: PzidxlIVM1nv0AFLCBRy6kWJSVxrCDt0DHWEPRV0QQ.mEooEaaYBMFYM9ulXGzn i6Wh6GlIbBkbjOY4yTYXzo7lsMPb4gZlJeeLxDy_Nx9b_vbYQZkiek20P2E7Y.B4IG63lXDMdHf4 JTkjasRL5hRWmjwA4teXksbzdZvYzlLl_1u83Y8hzrG_i6eq2UMcPRm8zr.AsjH1W7j4aQXcThLW JQqqoLgk4fYMPj0uW44x5ZCj6mAtMmdd.n5RIKrCclzXCJslgHfErh9I3DJXBOEZ_p_XL5KXuSLA 4XXiPMLXmq_aMgo3_uHdg9rAU18IFjTeFvKnd0440uZ4YL9Txnq6zwcPoZ3ceW28Z9hSmTDGc5PP vnkfp2bPmuKTL6rMUgsjo8H3dZvzaQJBuiX67DOXbuWEtBLD1zuH5DaRp2fgdi6ZXcwxTWVYCXgQ liRAkiZCM0Dxkkmp54LCcWkRFI7sYjIVjHFPI2zJ3mQ1hize50GW7ceqKOUESG24s_M9KaYeH9L5 kBWXNdZqv4uTWiJnUUdUD5EVWS9fjEjbmYm3DQHyge7wZIyLc6s6RwJcpcO91s6MpFeZkfcU0tKF nU3o_W6wJ0dePwYg1_iykVaWSGnCaIdzhQuBG6.oeFUFE2.2OAg37pKfILPqdSC5moPiZ3yR1fYy xQ0DPNUdARlCwwH_o_C5JLqq9I2BEir1eRq5OWMIZjOy7.canDHzRmPVi0ED2MOiju4ZyqO4x0N9 2uDIsBYEbyWa4SHAkQ0AYJ1CzA5ODFgAzrjWcce.QZPZs4ynw0cbIe.h_BS3WIYJ9vhcpa5.zptx O_979lr1BQlpcCKK71gciA0PV5MkST1nLiIY.fq_2JVGB2L_CZ6S53H5kwS1upRWm3ahuh0TOq6Q iBXe6FBHgyINhv5YA8As5fY1yVxIbkCBdkY7EyacnK_uF2LOfTwU3sVKVzQMfDKhevxacIEpbSAc lj3NDDNNUBMmf8Dn2BRd4RaCzC8MOUFN7bI6ftwFMcZSaHbVhNg0LQlhaT5XxZ8I- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.gq1.yahoo.com with HTTP; Mon, 9 Jul 2018 15:30:19 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp402.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 6b892dd1b11d957405cffe1e5ca10616; Mon, 09 Jul 2018 15:30:17 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: svn commit: r336130 - head/sys/dev/pci [-r336129 too?] broke ci.freebsd.org 's FreeBSD-head-{armv7,armv6}-build Message-Id: <832D15A5-839F-4618-AE96-0F4B57B9F4EA@yahoo.com> Date: Mon, 9 Jul 2018 08:30:15 -0700 To: wma@FreeBSD.org, freebsd-arm , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3445.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 15:30:27 -0000 Using armv7 as an example . . . https://ci.freebsd.org/job/FreeBSD-head-armv7-build/616/consoleText = shows: --- pci_host_generic.o --- /usr/src/sys/dev/pci/pci_host_generic.c:107:3: error: use of undeclared = identifier 'CPU_IMPL_CAVIUM' {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, = thunderx2_ahci_bar_quirk}, ^ /usr/src/sys/dev/pci/pci_host_generic.c:107:20: error: use of undeclared = identifier 'CPU_PART_THUNDERX2' {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, = thunderx2_ahci_bar_quirk}, ^ /usr/src/sys/dev/pci/pci_host_generic.c:114:3: error: use of undeclared = identifier 'CPU_IMPL_CAVIUM' {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, ^ /usr/src/sys/dev/pci/pci_host_generic.c:114:20: error: use of undeclared = identifier 'CPU_PART_THUNDERX2' {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, ^ /usr/src/sys/dev/pci/pci_host_generic.c:186:7: error: implicit = declaration of function 'CPU_MATCH' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ /usr/src/sys/dev/pci/pci_host_generic.c:186:7: error: this function = declaration is not a prototype [-Werror,-Wstrict-prototypes] /usr/src/sys/dev/pci/pci_host_generic.c:186:17: error: use of undeclared = identifier 'CPU_IMPL_MASK' if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ /usr/src/sys/dev/pci/pci_host_generic.c:186:33: error: use of undeclared = identifier 'CPU_PART_MASK' if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ /usr/src/sys/dev/pci/pci_host_generic.c:215:7: error: implicit = declaration of function 'CPU_MATCH' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ /usr/src/sys/dev/pci/pci_host_generic.c:215:17: error: use of undeclared = identifier 'CPU_IMPL_MASK' if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ /usr/src/sys/dev/pci/pci_host_generic.c:215:33: error: use of undeclared = identifier 'CPU_PART_MASK' if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, ^ 11 errors generated. *** [pci_host_generic.o] Error code 1 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Mon Jul 9 16:01:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C049103396C; Mon, 9 Jul 2018 16:01:29 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id A3E7B765FA; Mon, 9 Jul 2018 16:01:27 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:3c5f:69bd:a723:4940] (unknown [IPv6:2001:630:212:2a8:3c5f:69bd:a723:4940]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id F27894E777; Mon, 9 Jul 2018 16:00:49 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: svn commit: r336130 - head/sys/dev/pci From: Andrew Turner In-Reply-To: <201807090900.w6990GCZ081981@repo.freebsd.org> Date: Mon, 9 Jul 2018 17:00:48 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201807090900.w6990GCZ081981@repo.freebsd.org> To: Wojciech Macek X-Mailer: Apple Mail (2.3445.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:01:29 -0000 This breaks at least armv7. Please either fix, or revert this. I have some comments below I was planning on adding to the review, but = you committed before I had the time to do so. > On 9 Jul 2018, at 10:00, Wojciech Macek wrote: >=20 > Author: wma > Date: Mon Jul 9 09:00:16 2018 > New Revision: 336130 > URL: https://svnweb.freebsd.org/changeset/base/336130 >=20 > Log: > ARM64: Add quirk mechanism to pci_host_generic_acpi >=20 > Add few quirks which are necessary to use AHCI on ThX2 >=20 > Submitted by: Patryk Duda > Obtained from: Semihalf > Sponsored by: Cavium > Differential revision: https://reviews.freebsd.org/D15929 >=20 > Modified: > head/sys/dev/pci/pci_host_generic.c >=20 > Modified: head/sys/dev/pci/pci_host_generic.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:55:07 2018 = (r336129) > +++ head/sys/dev/pci/pci_host_generic.c Mon Jul 9 09:00:16 2018 = (r336130) > @@ -69,6 +69,25 @@ __FBSDID("$FreeBSD$"); > (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \ > ((reg) & PCIE_REG_MASK)) >=20 > +typedef void (*pci_host_generic_quirk_function)(device_t); > + > +struct pci_host_generic_quirk_entry { > + int impl; > + int part; > + int var; > + int rev; > + pci_host_generic_quirk_function func; > +}; > + > +struct pci_host_generic_block_entry { > + int impl; > + int part; > + int var; > + int rev; > + int bus; > + int slot; > +}; > + > /* Forward prototypes */ >=20 > static uint32_t generic_pcie_read_config(device_t dev, u_int bus, = u_int slot, > @@ -80,7 +99,22 @@ static int generic_pcie_read_ivar(device_t dev, = device > uintptr_t *result); > static int generic_pcie_write_ivar(device_t dev, device_t child, int = index, > uintptr_t value); > +static void pci_host_generic_apply_quirks(device_t); > +static void thunderx2_ahci_bar_quirk(device_t); >=20 > +struct pci_host_generic_quirk_entry pci_host_generic_quirks[] =3D > +{ > + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, = thunderx2_ahci_bar_quirk}, > + {0, 0, 0, 0, NULL} This breaks non-arm64, please fix. > +}; > + > +struct pci_host_generic_block_entry pci_host_generic_blocked[] =3D > +{ > + /* ThunderX2 AHCI on second socket */ > + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, > + {0, 0, 0, 0, 0, 0} And this. > +}; > + > int > pci_host_generic_core_attach(device_t dev) > { > @@ -134,9 +168,30 @@ pci_host_generic_core_attach(device_t dev) > return (error); > } >=20 > + pci_host_generic_apply_quirks(dev); > + > return (0); > } >=20 > +static void > +pci_host_generic_apply_quirks(device_t dev) > +{ > + struct pci_host_generic_quirk_entry *quirk; > + > + quirk =3D pci_host_generic_quirks; > + while (1) { > + if (quirk->impl =3D=3D 0) > + break; > + > + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, > + quirk->impl, quirk->part, quirk->var, quirk->rev) && > + quirk->func !=3D NULL) This is arm64 specific. > + quirk->func(dev); > + > + quirk++; > + } > +} > + > static uint32_t > generic_pcie_read_config(device_t dev, u_int bus, u_int slot, > u_int func, u_int reg, int bytes) > @@ -146,11 +201,25 @@ generic_pcie_read_config(device_t dev, u_int = bus, u_in > bus_space_tag_t t; > uint64_t offset; > uint32_t data; > + struct pci_host_generic_block_entry *block; >=20 > if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || > (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) > return (~0U); >=20 > + block =3D pci_host_generic_blocked; > + while (1) { > + if (block->impl =3D=3D 0) > + break; > + > + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, > + block->impl, block->part, block->var, block->rev) && > + block->bus =3D=3D bus && block->slot =3D=3D slot) This is also arm64 specific. > + return (~0); > + > + block++; > + } > + > sc =3D device_get_softc(dev); >=20 > offset =3D PCIE_ADDR_OFFSET(bus, slot, func, reg); > @@ -392,3 +461,20 @@ static device_method_t generic_pcie_methods[] =3D = { >=20 > DEFINE_CLASS_0(pcib, generic_pcie_core_driver, > generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); > + > +static void thunderx2_ahci_bar_quirk(device_t dev) This should be dependent on arm64 and an appropriate SOC_ check. > +{ > + > + /* > + * XXX: > + * On ThunderX2, AHCI BAR2 address is wrong. It needs to = precisely > + * match the one described in datasheet. Fixup it = unconditionally. > + */ > + if (device_get_unit(dev) =3D=3D 0) { > + device_printf(dev, "running AHCI BAR fixup\n"); > + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x18, 0x01440000, 4); > + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x1c, 0x40, 4); > + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x18, 0x01450000, 4); > + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); > + } > +} Andrew From owner-svn-src-head@freebsd.org Mon Jul 9 16:09:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9874F10346F6; Mon, 9 Jul 2018 16:09:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F8F876B18; Mon, 9 Jul 2018 16:09:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (unknown [IPv6:2601:648:8880:1e30:8e7:68a6:558a:7a6]) by mail.baldwin.cx (Postfix) with ESMTPSA id B2C3C10AFD4; Mon, 9 Jul 2018 12:09:41 -0400 (EDT) Subject: Re: svn commit: r336066 - in head/sys: compat/linsysfs dev/pci To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807071525.w67FPBNO088877@repo.freebsd.org> From: John Baldwin Message-ID: <319074e8-e317-ce3c-3a92-94923fb55052@FreeBSD.org> Date: Mon, 9 Jul 2018 09:09:40 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201807071525.w67FPBNO088877@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 09 Jul 2018 12:09:42 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:09:43 -0000 On 7/7/18 8:25 AM, Warner Losh wrote: > Author: imp > Date: Sat Jul 7 15:25:11 2018 > New Revision: 336066 > URL: https://svnweb.freebsd.org/changeset/base/336066 > > Log: > Create PCI_MATCH and pci_match_device > > Create a covenience function to match PCI device IDs. It's about 15 > years overdue. > > Differential Revision: https://reviews.freebsd.org/D15999 > > Modified: > head/sys/compat/linsysfs/linsysfs.c > head/sys/dev/pci/pci.c > head/sys/dev/pci/pcivar.h > > Modified: head/sys/dev/pci/pcivar.h > ============================================================================== > --- head/sys/dev/pci/pcivar.h Sat Jul 7 15:25:06 2018 (r336065) > +++ head/sys/dev/pci/pcivar.h Sat Jul 7 15:25:11 2018 (r336066) > @@ -259,6 +259,66 @@ typedef struct { > > extern uint32_t pci_numdevs; > > +struct pci_device_table { > +#if BYTE_ORDER == LITTLE_ENDIAN > + uint16_t > + match_flag_vendor:1, > + match_flag_device:1, > + match_flag_subvendor:1, > + match_flag_subdevice:1, > + match_flag_class:1, > + match_flag_subclass:1, > + match_flag_revid:1, > + match_flag_unused:9; > +#else > + uint16_t > + match_flag_unused:9, > + match_flag_revid:1, > + match_flag_subclass:1, > + match_flag_class:1, > + match_flag_subdevice:1, > + match_flag_subvendor:1, > + match_flag_device:1, > + match_flag_vendor:1; > +#endif > + uint16_t vendor; > + uint16_t device; > + uint16_t subvendor; > + uint16_t subdevice; > + uint16_t class_id; > + uint16_t subclass; > + uint16_t revid; > + uint16_t unused; > + uintptr_t driver_data; > + char *descr; This should probably be 'const char *'? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Jul 9 16:13:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 684D51034C57; Mon, 9 Jul 2018 16:13:01 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B460176FA7; Mon, 9 Jul 2018 16:13:00 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w69GCxWK066790; Mon, 9 Jul 2018 09:12:59 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w69GCxkN066789; Mon, 9 Jul 2018 09:12:59 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201807091612.w69GCxkN066789@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys In-Reply-To: <1531148925.1336.26.camel@freebsd.org> To: Ian Lepore Date: Mon, 9 Jul 2018 09:12:58 -0700 (PDT) CC: Alexey Dokuchaev , Brooks Davis , Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:13:01 -0000 [ Charset ISO-8859-1 unsupported, converting... ] > On Mon, 2018-07-09 at 14:58 +0000, Alexey Dokuchaev wrote: > > On Mon, Jul 09, 2018 at 09:23:27AM +0000, Brooks Davis wrote: > > > > > > On Sat, Jul 07, 2018 at 02:18:56AM +0000, Alexey Dokuchaev wrote: > > > > > > > > On Fri, Jul 06, 2018 at 10:52:37PM +0300, Konstantin Belousov wrote: > > > > > > > > > > On Fri, Jul 06, 2018 at 07:50:25PM +0000, Konstantin Belousov wrote: > > > > > > > > > > > > New Revision: 336046 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/336046 > > > > > > > > > > > > Log: > > > > > > ? Revert to recommit with the proper message. > > > > > I am sorry for the second mistake of the same sort in the day. > > > > It would be much easier if we'd allowed "svn propedit --revprop svn:log". > > > Not going to happen.??That would completely trash the ability to use git > > > exports. > > Yeah, I've heard of it.??It's a pity that SVN users have to suffer for the > > benefit of some obscure, unofficial VCS. :-( > > > > ./danfe > > > > I think if git weren't in the way, what you would hear instead would be > arguments against doing so from those who believe that a version > control system exists to maintain an *immutable* history of changes to > the source base. My voice might be one of those, unless there were some > very tight controls on who could use such a feature and under what > conditions. Or svn could grow the proper features to have immutability, you just have to revision control the log entry, something that is at least 40 year old technology in the paper world of document control. I have never understood why this feature is missing from every automated VCS system I have seen. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon Jul 9 16:21:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40ED51035820; Mon, 9 Jul 2018 16:21:42 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2EFE7744F; Mon, 9 Jul 2018 16:21:41 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (cpe-75-82-218-62.socal.res.rr.com [75.82.218.62]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id w69GAwuX021397 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 9 Jul 2018 09:10:58 -0700 Subject: Re: svn commit: r336130 - head/sys/dev/pci To: Andrew Turner , Wojciech Macek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807090900.w6990GCZ081981@repo.freebsd.org> From: Nathan Whitehorn Message-ID: Date: Mon, 9 Jul 2018 09:10:57 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Sonic-CAuth: UmFuZG9tSVaVP8i3gdygQhPdvHuLFztAh0FmWSa9UYAjRwgSjEgJZ6TXt23aSfBTl1TTUUC6y30kefmnM5pPR7qtuqsnHHQ2uY8ALt90xQI= X-Sonic-ID: C;2uJWqpKD6BGRw/Mw1zjrCw== M;/prUqpKD6BGRw/Mw1zjrCw== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:21:42 -0000 Maybe this file should be renamed and/or split anyway? It's not actually very generic and is used only on (some) ARM systems. -Nathan On 07/09/18 09:00, Andrew Turner wrote: > This breaks at least armv7. Please either fix, or revert this. > > I have some comments below I was planning on adding to the review, but you committed before I had the time to do so. > >> On 9 Jul 2018, at 10:00, Wojciech Macek wrote: >> >> Author: wma >> Date: Mon Jul 9 09:00:16 2018 >> New Revision: 336130 >> URL: https://svnweb.freebsd.org/changeset/base/336130 >> >> Log: >> ARM64: Add quirk mechanism to pci_host_generic_acpi >> >> Add few quirks which are necessary to use AHCI on ThX2 >> >> Submitted by: Patryk Duda >> Obtained from: Semihalf >> Sponsored by: Cavium >> Differential revision: https://reviews.freebsd.org/D15929 >> >> Modified: >> head/sys/dev/pci/pci_host_generic.c >> >> Modified: head/sys/dev/pci/pci_host_generic.c >> ============================================================================== >> --- head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:55:07 2018 (r336129) >> +++ head/sys/dev/pci/pci_host_generic.c Mon Jul 9 09:00:16 2018 (r336130) >> @@ -69,6 +69,25 @@ __FBSDID("$FreeBSD$"); >> (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \ >> ((reg) & PCIE_REG_MASK)) >> >> +typedef void (*pci_host_generic_quirk_function)(device_t); >> + >> +struct pci_host_generic_quirk_entry { >> + int impl; >> + int part; >> + int var; >> + int rev; >> + pci_host_generic_quirk_function func; >> +}; >> + >> +struct pci_host_generic_block_entry { >> + int impl; >> + int part; >> + int var; >> + int rev; >> + int bus; >> + int slot; >> +}; >> + >> /* Forward prototypes */ >> >> static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, >> @@ -80,7 +99,22 @@ static int generic_pcie_read_ivar(device_t dev, device >> uintptr_t *result); >> static int generic_pcie_write_ivar(device_t dev, device_t child, int index, >> uintptr_t value); >> +static void pci_host_generic_apply_quirks(device_t); >> +static void thunderx2_ahci_bar_quirk(device_t); >> >> +struct pci_host_generic_quirk_entry pci_host_generic_quirks[] = >> +{ >> + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, thunderx2_ahci_bar_quirk}, >> + {0, 0, 0, 0, NULL} > This breaks non-arm64, please fix. > >> +}; >> + >> +struct pci_host_generic_block_entry pci_host_generic_blocked[] = >> +{ >> + /* ThunderX2 AHCI on second socket */ >> + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, >> + {0, 0, 0, 0, 0, 0} > And this. > >> +}; >> + >> int >> pci_host_generic_core_attach(device_t dev) >> { >> @@ -134,9 +168,30 @@ pci_host_generic_core_attach(device_t dev) >> return (error); >> } >> >> + pci_host_generic_apply_quirks(dev); >> + >> return (0); >> } >> >> +static void >> +pci_host_generic_apply_quirks(device_t dev) >> +{ >> + struct pci_host_generic_quirk_entry *quirk; >> + >> + quirk = pci_host_generic_quirks; >> + while (1) { >> + if (quirk->impl == 0) >> + break; >> + >> + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, >> + quirk->impl, quirk->part, quirk->var, quirk->rev) && >> + quirk->func != NULL) > This is arm64 specific. > >> + quirk->func(dev); >> + >> + quirk++; >> + } >> +} >> + >> static uint32_t >> generic_pcie_read_config(device_t dev, u_int bus, u_int slot, >> u_int func, u_int reg, int bytes) >> @@ -146,11 +201,25 @@ generic_pcie_read_config(device_t dev, u_int bus, u_in >> bus_space_tag_t t; >> uint64_t offset; >> uint32_t data; >> + struct pci_host_generic_block_entry *block; >> >> if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || >> (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) >> return (~0U); >> >> + block = pci_host_generic_blocked; >> + while (1) { >> + if (block->impl == 0) >> + break; >> + >> + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, >> + block->impl, block->part, block->var, block->rev) && >> + block->bus == bus && block->slot == slot) > This is also arm64 specific. > >> + return (~0); >> + >> + block++; >> + } >> + >> sc = device_get_softc(dev); >> >> offset = PCIE_ADDR_OFFSET(bus, slot, func, reg); >> @@ -392,3 +461,20 @@ static device_method_t generic_pcie_methods[] = { >> >> DEFINE_CLASS_0(pcib, generic_pcie_core_driver, >> generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); >> + >> +static void thunderx2_ahci_bar_quirk(device_t dev) > This should be dependent on arm64 and an appropriate SOC_ check. > >> +{ >> + >> + /* >> + * XXX: >> + * On ThunderX2, AHCI BAR2 address is wrong. It needs to precisely >> + * match the one described in datasheet. Fixup it unconditionally. >> + */ >> + if (device_get_unit(dev) == 0) { >> + device_printf(dev, "running AHCI BAR fixup\n"); >> + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x18, 0x01440000, 4); >> + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x1c, 0x40, 4); >> + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x18, 0x01450000, 4); >> + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); >> + } >> +} > Andrew > > > From owner-svn-src-head@freebsd.org Mon Jul 9 16:26:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A2711037193; Mon, 9 Jul 2018 16:26:45 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38B757793A; Mon, 9 Jul 2018 16:26:45 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.4] (c-71-198-162-232.hsd1.ca.comcast.net [71.198.162.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 425E0C241; Mon, 9 Jul 2018 16:26:44 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.e.1.180613 Date: Mon, 09 Jul 2018 09:26:39 -0700 Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys From: Ravi Pokala To: , Ian Lepore CC: Alexey Dokuchaev , Brooks Davis , Konstantin Belousov , , , Message-ID: Thread-Topic: svn commit: r336046 - in head/sys: amd64/include i386/include sys References: <1531148925.1336.26.camel@freebsd.org> <201807091612.w69GCxkN066789@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201807091612.w69GCxkN066789@pdx.rh.CN85.dnsmgr.net> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:26:45 -0000 -----Original Message----- From: on behalf of "Rodney W. Grimes" Reply-To: Date: 2018-07-09, Monday at 09:12 To: Ian Lepore Cc: Alexey Dokuchaev , Brooks Davis , Konstantin Belousov , , , Subject: Re: svn commit: r336046 - in head/sys: amd64/include i386/include sys > Or svn could grow the proper features to have immutability, you just > have to revision control the log entry, something that is at least > 40 year old technology in the paper world of document control. > > I have never understood why this feature is missing from every > automated VCS system I have seen. > > -- > Rod Grimes rgrimes@freebsd.org FWIW, Perforce allows the log entry to be changed after the submit, and I'm 98% sure it's versioned. -Ravi (rpokala@) From owner-svn-src-head@freebsd.org Mon Jul 9 16:42:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E530E1038DC1 for ; Mon, 9 Jul 2018 16:42:47 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77A2D78666 for ; Mon, 9 Jul 2018 16:42:47 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-it0-x22f.google.com with SMTP id p4-v6so26293859itf.2 for ; Mon, 09 Jul 2018 09:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=F0EI7XeJLYxcCmk9urcO76/dY23VbaYiwcGxyMbhqpg=; b=AvA2u7KHbsBg4RyLGuGDwIB8CSR9G3hOhCJShYfly1ecjaMsqV8wqSiIXAyg+tPqym SaoeDxXdw9vybGjnOUWl7fd1NIi3uXVkeRtrEUlA0qL843t2IwX7Pz5JOQHjQW3rGKuC jGZN1wzwsS18u012JNUkaxZ71FlAOCtK1Z9FtQKRNwQo79thzHRvQEP6qzHayuvJ7KQ7 5lNLb3J5HJJtaMuLdtKzxszK5VOJuS2kb8JjlDVV/gRQd3m/glRJKdldnB8QloF1WE59 zjHLtpslmO0i6+YhmUsBgvQmTpKlhCRcSJlX0MVbZ0GeXMb0Q9jLFPQy938TwIKtVyIE g/RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=F0EI7XeJLYxcCmk9urcO76/dY23VbaYiwcGxyMbhqpg=; b=FC1Snwb3Dmnoy34L1Z4gnm/2oBUdtrwsB01lmxjgXhIRk/UORawRxam6e5MqECANvk XLFOlbUnXTJ0H+LY0O4HA0WrjBYVT8PmMbAH0lTAJ/6xNvLrMEsGe0be/u5D6eqeN2SX TV/zBROcIjKGEk9Nvo0CCMqEXPbfxFoCmBjJFfkDnBwj+0Al9apITJSBdjg1aoyfWS/U sUU0nkUSjVQ/T8BvNSEAjXs42sqwCDx1Rqewlk11CpRS1fPIqTqrKDfTn7R/C9/J0DFR 1Fwc3sGUoowmVLPfMdriqZ0654v0hAtNKF5seP/kRnZleBVl9pCBjQ0GCygPCeZs4ZM/ c3wQ== X-Gm-Message-State: APt69E0xtwK2TmiSaS3RgUJw9aZTav0asy6qHuzXC9Q0qHOJeEFBkUiF XQ8hh3x0Qv3yG3KbvXQV1G0OWfl5UrtCQ7vDrkQc2g== X-Google-Smtp-Source: AAOMgpd/l5kvuKJNwSWioZH7NFb2gWhvy44vyVzPGhvCzQXu+LLnw5rGIGrtv2swsEk7ciMFTuFrog1WjcSxVf2GlV8= X-Received: by 2002:a24:9bc2:: with SMTP id o185-v6mr16714365itd.77.1531154566742; Mon, 09 Jul 2018 09:42:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:91c6:0:0:0:0:0 with HTTP; Mon, 9 Jul 2018 09:42:26 -0700 (PDT) In-Reply-To: References: <201807090900.w6990GCZ081981@repo.freebsd.org> From: Wojciech Macek Date: Mon, 9 Jul 2018 18:42:26 +0200 Message-ID: Subject: Re: svn commit: r336130 - head/sys/dev/pci To: Nathan Whitehorn Cc: Andrew Turner , Wojciech Macek , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Patryk Duda Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 16:42:48 -0000 We will fix it, sorry for troubles. @wma 2018-07-09 18:10 GMT+02:00 Nathan Whitehorn : > Maybe this file should be renamed and/or split anyway? It's not actually > very generic and is used only on (some) ARM systems. > -Nathan > > > On 07/09/18 09:00, Andrew Turner wrote: > >> This breaks at least armv7. Please either fix, or revert this. >> >> I have some comments below I was planning on adding to the review, but >> you committed before I had the time to do so. >> >> On 9 Jul 2018, at 10:00, Wojciech Macek wrote: >>> >>> Author: wma >>> Date: Mon Jul 9 09:00:16 2018 >>> New Revision: 336130 >>> URL: https://svnweb.freebsd.org/changeset/base/336130 >>> >>> Log: >>> ARM64: Add quirk mechanism to pci_host_generic_acpi >>> >>> Add few quirks which are necessary to use AHCI on ThX2 >>> >>> Submitted by: Patryk Duda >>> Obtained from: Semihalf >>> Sponsored by: Cavium >>> Differential revision: https://reviews.freebsd.org/D15929 >>> >>> Modified: >>> head/sys/dev/pci/pci_host_generic.c >>> >>> Modified: head/sys/dev/pci/pci_host_generic.c >>> ============================================================ >>> ================== >>> --- head/sys/dev/pci/pci_host_generic.c Mon Jul 9 08:55:07 2018 >>> (r336129) >>> +++ head/sys/dev/pci/pci_host_generic.c Mon Jul 9 09:00:16 2018 >>> (r336130) >>> @@ -69,6 +69,25 @@ __FBSDID("$FreeBSD$"); >>> (((func) & PCIE_FUNC_MASK) << PCIE_FUNC_SHIFT) | \ >>> ((reg) & PCIE_REG_MASK)) >>> >>> +typedef void (*pci_host_generic_quirk_function)(device_t); >>> + >>> +struct pci_host_generic_quirk_entry { >>> + int impl; >>> + int part; >>> + int var; >>> + int rev; >>> + pci_host_generic_quirk_function func; >>> +}; >>> + >>> +struct pci_host_generic_block_entry { >>> + int impl; >>> + int part; >>> + int var; >>> + int rev; >>> + int bus; >>> + int slot; >>> +}; >>> + >>> /* Forward prototypes */ >>> >>> static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int >>> slot, >>> @@ -80,7 +99,22 @@ static int generic_pcie_read_ivar(device_t dev, >>> device >>> uintptr_t *result); >>> static int generic_pcie_write_ivar(device_t dev, device_t child, int >>> index, >>> uintptr_t value); >>> +static void pci_host_generic_apply_quirks(device_t); >>> +static void thunderx2_ahci_bar_quirk(device_t); >>> >>> +struct pci_host_generic_quirk_entry pci_host_generic_quirks[] = >>> +{ >>> + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, >>> thunderx2_ahci_bar_quirk}, >>> + {0, 0, 0, 0, NULL} >>> >> This breaks non-arm64, please fix. >> >> +}; >>> + >>> +struct pci_host_generic_block_entry pci_host_generic_blocked[] = >>> +{ >>> + /* ThunderX2 AHCI on second socket */ >>> + {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, >>> + {0, 0, 0, 0, 0, 0} >>> >> And this. >> >> +}; >>> + >>> int >>> pci_host_generic_core_attach(device_t dev) >>> { >>> @@ -134,9 +168,30 @@ pci_host_generic_core_attach(device_t dev) >>> return (error); >>> } >>> >>> + pci_host_generic_apply_quirks(dev); >>> + >>> return (0); >>> } >>> >>> +static void >>> +pci_host_generic_apply_quirks(device_t dev) >>> +{ >>> + struct pci_host_generic_quirk_entry *quirk; >>> + >>> + quirk = pci_host_generic_quirks; >>> + while (1) { >>> + if (quirk->impl == 0) >>> + break; >>> + >>> + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, >>> + quirk->impl, quirk->part, quirk->var, quirk->rev) && >>> + quirk->func != NULL) >>> >> This is arm64 specific. >> >> + quirk->func(dev); >>> + >>> + quirk++; >>> + } >>> +} >>> + >>> static uint32_t >>> generic_pcie_read_config(device_t dev, u_int bus, u_int slot, >>> u_int func, u_int reg, int bytes) >>> @@ -146,11 +201,25 @@ generic_pcie_read_config(device_t dev, u_int bus, >>> u_in >>> bus_space_tag_t t; >>> uint64_t offset; >>> uint32_t data; >>> + struct pci_host_generic_block_entry *block; >>> >>> if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || >>> (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) >>> return (~0U); >>> >>> + block = pci_host_generic_blocked; >>> + while (1) { >>> + if (block->impl == 0) >>> + break; >>> + >>> + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, >>> + block->impl, block->part, block->var, block->rev) && >>> + block->bus == bus && block->slot == slot) >>> >> This is also arm64 specific. >> >> + return (~0); >>> + >>> + block++; >>> + } >>> + >>> sc = device_get_softc(dev); >>> >>> offset = PCIE_ADDR_OFFSET(bus, slot, func, reg); >>> @@ -392,3 +461,20 @@ static device_method_t generic_pcie_methods[] = { >>> >>> DEFINE_CLASS_0(pcib, generic_pcie_core_driver, >>> generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); >>> + >>> +static void thunderx2_ahci_bar_quirk(device_t dev) >>> >> This should be dependent on arm64 and an appropriate SOC_ check. >> >> +{ >>> + >>> + /* >>> + * XXX: >>> + * On ThunderX2, AHCI BAR2 address is wrong. It needs to >>> precisely >>> + * match the one described in datasheet. Fixup it >>> unconditionally. >>> + */ >>> + if (device_get_unit(dev) == 0) { >>> + device_printf(dev, "running AHCI BAR fixup\n"); >>> + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x18, 0x01440000, 4); >>> + PCIB_WRITE_CONFIG(dev, 0, 16, 0, 0x1c, 0x40, 4); >>> + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x18, 0x01450000, 4); >>> + PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); >>> + } >>> +} >>> >> Andrew >> >> >> >> > From owner-svn-src-head@freebsd.org Mon Jul 9 18:02:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C92010414AB; Mon, 9 Jul 2018 18:02:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39F967C7B7; Mon, 9 Jul 2018 18:02:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B63F18653; Mon, 9 Jul 2018 18:02:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69I2N2L064310; Mon, 9 Jul 2018 18:02:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69I2N2D064309; Mon, 9 Jul 2018 18:02:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807091802.w69I2N2D064309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 9 Jul 2018 18:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336135 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 18:02:24 -0000 Author: imp Date: Mon Jul 9 18:02:23 2018 New Revision: 336135 URL: https://svnweb.freebsd.org/changeset/base/336135 Log: Remove armeb from the list of architectures we build for the boot laoder testing scripts. It just adds to the build time, and will be retired soon anyway, per discussions in freebsd-arch@ last month. Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Mon Jul 9 14:18:03 2018 (r336134) +++ head/tools/boot/universe.sh Mon Jul 9 18:02:23 2018 (r336135) @@ -65,7 +65,7 @@ done # Default build for a goodly selection of architectures for i in \ amd64/amd64 \ - arm/arm arm/armeb arm/armv7 \ + arm/arm arm/armv7 \ arm64/aarch64 \ i386/i386 \ mips/mips mips/mips64 \ @@ -79,7 +79,7 @@ done # Default build for a goodly selection of architectures with Lua for i in \ amd64/amd64 \ - arm/arm arm/armeb arm/armv7 \ + arm/arm arm/armv7 \ arm64/aarch64 \ i386/i386 \ mips/mips mips/mips64 \ From owner-svn-src-head@freebsd.org Mon Jul 9 18:02:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B62F51041503; Mon, 9 Jul 2018 18:02:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F5DA7C8D7; Mon, 9 Jul 2018 18:02:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E54D71866A; Mon, 9 Jul 2018 18:02:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69I2Z7j065149; Mon, 9 Jul 2018 18:02:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69I2ZiD065148; Mon, 9 Jul 2018 18:02:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807091802.w69I2ZiD065148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 9 Jul 2018 18:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336136 - in head/tools/tools/nanobsd: embedded gateworks gateworks/Files/root gateworks/cfg gateworks/cfg/ssh X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/tools/tools/nanobsd: embedded gateworks gateworks/Files/root gateworks/cfg gateworks/cfg/ssh X-SVN-Commit-Revision: 336136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 18:02:36 -0000 Author: imp Date: Mon Jul 9 18:02:35 2018 New Revision: 336136 URL: https://svnweb.freebsd.org/changeset/base/336136 Log: Remove gateworks nanobsd support. A quick test of this shows multiple problems. Rather than fix the problems, just retire this board's support. It's for a 12 year old board that's been out of production for at least 7 years and generally lacks the memory to run even a stripped down NanoBSD image well. It's not really relevant anymore. Deleted: head/tools/tools/nanobsd/gateworks/Files/root/.profile head/tools/tools/nanobsd/gateworks/Files/root/updatep1 head/tools/tools/nanobsd/gateworks/Files/root/updatep2 head/tools/tools/nanobsd/gateworks/G2348 head/tools/tools/nanobsd/gateworks/G2358 head/tools/tools/nanobsd/gateworks/avila head/tools/tools/nanobsd/gateworks/cambria head/tools/tools/nanobsd/gateworks/cfg/motd head/tools/tools/nanobsd/gateworks/cfg/rc.conf head/tools/tools/nanobsd/gateworks/cfg/ssh/sshd_config head/tools/tools/nanobsd/gateworks/common Modified: head/tools/tools/nanobsd/embedded/common Modified: head/tools/tools/nanobsd/embedded/common ============================================================================== --- head/tools/tools/nanobsd/embedded/common Mon Jul 9 18:02:23 2018 (r336135) +++ head/tools/tools/nanobsd/embedded/common Mon Jul 9 18:02:35 2018 (r336136) @@ -528,10 +528,6 @@ std_amd64 ( ) { std_arm ( ) { } -std_armeb ( ) { - NANO_ENDIAN=big -} - std_armv6 ( ) { } From owner-svn-src-head@freebsd.org Mon Jul 9 19:00:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 535BF1046D60; Mon, 9 Jul 2018 19:00:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 008857F5C9; Mon, 9 Jul 2018 19:00:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D593418E80; Mon, 9 Jul 2018 19:00:13 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69J0DYT091774; Mon, 9 Jul 2018 19:00:13 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69J0D9h091773; Mon, 9 Jul 2018 19:00:13 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807091900.w69J0D9h091773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 9 Jul 2018 19:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336137 - head/share/man/man4/man4.arm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/share/man/man4/man4.arm X-SVN-Commit-Revision: 336137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 19:00:14 -0000 Author: ian Date: Mon Jul 9 19:00:13 2018 New Revision: 336137 URL: https://svnweb.freebsd.org/changeset/base/336137 Log: Add a manpage for the imx_spi driver. Added: head/share/man/man4/man4.arm/imx_spi.4 (contents, props changed) Added: head/share/man/man4/man4.arm/imx_spi.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.arm/imx_spi.4 Mon Jul 9 19:00:13 2018 (r336137) @@ -0,0 +1,90 @@ +.\" +.\" Copyright (c) 2018 Ian Lepore +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2018 +.Dt IMX_SPI 4 +.Os +.Sh NAME +.Nm imx_spi +.Nd device driver for the NXP i.MX family Serial Peripheral Interface (SPI) +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device imx_spi" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +imx_spi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the +.Sq ECSPI +(Enhanced Configurable SPI) hardware present on the NXP i.MX family +of processors. +While the ECSPI hardware supports both master and slave mode, +this driver currently operates only in master mode. +.Pp +Due to hardware quirks, the +.Nm +driver requires that all chip select pins be configured as GPIO pins. +Use the FDT property +.Sq cs-gpios +to specify which pins to use as chip selects. +You may use any GPIO pins, including the ones that the hardware would +normally use as SPI select pins; just configure them as GPIO in the +.Xr fdt_pinctrl 4 +data. +.Pp +.Sh SYSCTL VARIABLES +The following variables are available via +.Xr sysctl 8 , +and as +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va dev.imx_spi.%d.debug +Output debugging info when non-zero. +A value of 1 displays information about bus transfers, +2 adds information about bus clock frequency and chip select activity, +and 3 adds information about interrupt handling. +.El +.Sh SEE ALSO +.Xr fdt 4 , +.Xr fdt_pinctrl 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . From owner-svn-src-head@freebsd.org Mon Jul 9 19:00:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 611941046DEF; Mon, 9 Jul 2018 19:00:40 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 177747F717; Mon, 9 Jul 2018 19:00:40 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECB9618E8C; Mon, 9 Jul 2018 19:00:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69J0dNZ092782; Mon, 9 Jul 2018 19:00:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69J0dcF092766; Mon, 9 Jul 2018 19:00:39 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807091900.w69J0dcF092766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 9 Jul 2018 19:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336138 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 336138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 19:00:40 -0000 Author: ian Date: Mon Jul 9 19:00:39 2018 New Revision: 336138 URL: https://svnweb.freebsd.org/changeset/base/336138 Log: Add pnp info to the imx_spi driver. Modified: head/sys/arm/freescale/imx/imx_spi.c Modified: head/sys/arm/freescale/imx/imx_spi.c ============================================================================== --- head/sys/arm/freescale/imx/imx_spi.c Mon Jul 9 19:00:13 2018 (r336137) +++ head/sys/arm/freescale/imx/imx_spi.c Mon Jul 9 19:00:39 2018 (r336138) @@ -609,3 +609,4 @@ static devclass_t spi_devclass; DRIVER_MODULE(imx_spi, simplebus, spi_driver, spi_devclass, 0, 0); DRIVER_MODULE(ofw_spibus, imx_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); MODULE_DEPEND(imx_spi, ofw_spibus, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); From owner-svn-src-head@freebsd.org Mon Jul 9 19:02:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 788C21047134; Mon, 9 Jul 2018 19:02:06 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 294617FACA; Mon, 9 Jul 2018 19:02:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF5F18FF6; Mon, 9 Jul 2018 19:02:06 +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 w69J25uL095095; Mon, 9 Jul 2018 19:02:05 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69J25t0095094; Mon, 9 Jul 2018 19:02:05 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201807091902.w69J25t0095094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 9 Jul 2018 19:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336139 - head/usr.bin/truncate X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/truncate X-SVN-Commit-Revision: 336139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 19:02:06 -0000 Author: manu Date: Mon Jul 9 19:02:05 2018 New Revision: 336139 URL: https://svnweb.freebsd.org/changeset/base/336139 Log: truncate: style(9) some parts Modified: head/usr.bin/truncate/truncate.c Modified: head/usr.bin/truncate/truncate.c ============================================================================== --- head/usr.bin/truncate/truncate.c Mon Jul 9 19:00:39 2018 (r336138) +++ head/usr.bin/truncate/truncate.c Mon Jul 9 19:02:05 2018 (r336139) @@ -46,23 +46,23 @@ static const char rcsid[] = static void usage(void); -static int no_create; -static int do_relative; -static int do_refer; -static int got_size; - int main(int argc, char **argv) { - struct stat sb; - mode_t omode; - off_t oflow, rsize, sz, tsize; + struct stat sb; + mode_t omode; + off_t oflow, rsize, sz, tsize; uint64_t usz; - int ch, error, fd, oflags; - char *fname, *rname; + int ch, error, fd, oflags; + int no_create; + int do_relative; + int do_refer; + int got_size; + char *fname, *rname; fd = -1; rsize = tsize = sz = 0; + no_create = do_relative = do_refer = got_size = 0; error = 0; rname = NULL; while ((ch = getopt(argc, argv, "cr:s:")) != -1) From owner-svn-src-head@freebsd.org Mon Jul 9 19:03:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B191E1047345; Mon, 9 Jul 2018 19:03:31 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62E377FEBA; Mon, 9 Jul 2018 19:03:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43F1419017; Mon, 9 Jul 2018 19:03:31 +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 w69J3VRu096807; Mon, 9 Jul 2018 19:03:31 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69J3Uha096804; Mon, 9 Jul 2018 19:03:30 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201807091903.w69J3Uha096804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 9 Jul 2018 19:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336140 - in head/usr.bin/truncate: . tests X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/usr.bin/truncate: . tests X-SVN-Commit-Revision: 336140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 19:03:31 -0000 Author: manu Date: Mon Jul 9 19:03:30 2018 New Revision: 336140 URL: https://svnweb.freebsd.org/changeset/base/336140 Log: truncate: Add support for -s % and / % round up to the multiple size and / round down This is compatible with gnu truncate. Add tests and document in the man page. Modified: head/usr.bin/truncate/tests/truncate_test.sh head/usr.bin/truncate/truncate.1 head/usr.bin/truncate/truncate.c Modified: head/usr.bin/truncate/tests/truncate_test.sh ============================================================================== --- head/usr.bin/truncate/tests/truncate_test.sh Mon Jul 9 19:02:05 2018 (r336139) +++ head/usr.bin/truncate/tests/truncate_test.sh Mon Jul 9 19:03:30 2018 (r336140) @@ -57,7 +57,7 @@ create_stderr_usage_file() _custom_create_file creat _custom_create_file print "${1}" _custom_create_file print \ - "usage: truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ..." + "usage: truncate [-c] -s [+|-|%|/]size[K|k|M|m|G|g|T|t] file ..." _custom_create_file print " truncate [-c] -r rfile file ..." } @@ -378,6 +378,66 @@ negative_body() [ ${st_size} -eq 0 ] || atf_fail "new file should now be zero bytes" } +atf_test_case roundup +roundup_head() +{ + atf_set "descr" "Verifies truncate round up" +} +roundup_body() +{ + # Create a 5 byte file. + printf "abcd\n" > afile + eval $(stat -s afile) + [ ${st_size} -eq 5 ] || atf_fail "afile file should be 5 bytes" + + create_stderr_file + + # Create a new file and do a 100 byte roundup. + atf_check -e file:stderr.txt truncate -s%100 afile + eval $(stat -s afile) + [ ${st_size} -eq 100 ] || atf_fail "new file should now be 100 bytes" +} + +atf_test_case rounddown +rounddown_head() +{ + atf_set "descr" "Verifies truncate round down" +} +rounddown_body() +{ + # Create a 5 byte file. + printf "abcd\n" > afile + eval $(stat -s afile) + [ ${st_size} -eq 5 ] || atf_fail "afile file should be 5 bytes" + + create_stderr_file + + # Create a new file and do a 2 byte roundup. + atf_check -e file:stderr.txt truncate -s/2 afile + eval $(stat -s afile) + [ ${st_size} -eq 4 ] || atf_fail "new file should now be 4 bytes" +} + +atf_test_case rounddown_zero +rounddown_zero_head() +{ + atf_set "descr" "Verifies truncate round down to zero" +} +rounddown_zero_body() +{ + # Create a 5 byte file. + printf "abcd\n" > afile + eval $(stat -s afile) + [ ${st_size} -eq 5 ] || atf_fail "afile file should be 5 bytes" + + create_stderr_file + + # Create a new file and do a 10 byte roundup. + atf_check -e file:stderr.txt truncate -s/10 afile + eval $(stat -s afile) + [ ${st_size} -eq 0 ] || atf_fail "new file should now be 0 bytes" +} + atf_init_test_cases() { atf_add_test_case illegal_option @@ -396,4 +456,7 @@ atf_init_test_cases() atf_add_test_case reference atf_add_test_case new_zero atf_add_test_case negative + atf_add_test_case roundup + atf_add_test_case rounddown + atf_add_test_case rounddown_zero } Modified: head/usr.bin/truncate/truncate.1 ============================================================================== --- head/usr.bin/truncate/truncate.1 Mon Jul 9 19:02:05 2018 (r336139) +++ head/usr.bin/truncate/truncate.1 Mon Jul 9 19:03:30 2018 (r336140) @@ -37,7 +37,7 @@ .Bk -words .Fl s Xo .Sm off -.Op Cm + | - +.Op Cm + | - | % | / .Ar size .Op Cm K | k | M | m | G | g | T | t .Sm on @@ -69,7 +69,7 @@ Truncate or extend files to the length of the file .Ar rfile . .It Fl s Xo .Sm off -.Op Cm + | - +.Op Cm + | - | % | / .Ar size .Op Cm K | k | M | m | G | g | T | t .Sm on @@ -84,6 +84,17 @@ If the argument is preceded by a dash .Pq Cm - , file lengths will be reduced by no more than this number of bytes, +to a minimum length of zero bytes. +If the +.Ar size +argument is preceded by a percent sign +.Pq Cm % , +files will be round up to a multiple of this number of bytes. +If the +.Ar size +argument is preceded by a slash sign +.Pq Cm / , +files will be round down to a multiple of this number of bytes, to a minimum length of zero bytes. Otherwise, the .Ar size Modified: head/usr.bin/truncate/truncate.c ============================================================================== --- head/usr.bin/truncate/truncate.c Mon Jul 9 19:02:05 2018 (r336139) +++ head/usr.bin/truncate/truncate.c Mon Jul 9 19:03:30 2018 (r336140) @@ -56,13 +56,15 @@ main(int argc, char **argv) int ch, error, fd, oflags; int no_create; int do_relative; + int do_round; int do_refer; int got_size; + int round; char *fname, *rname; fd = -1; rsize = tsize = sz = 0; - no_create = do_relative = do_refer = got_size = 0; + no_create = do_relative = do_round = do_refer = got_size = 0; error = 0; rname = NULL; while ((ch = getopt(argc, argv, "cr:s:")) != -1) @@ -75,13 +77,19 @@ main(int argc, char **argv) rname = optarg; break; case 's': - do_relative = *optarg == '+' || *optarg == '-'; - if (expand_number(do_relative ? optarg + 1 : optarg, + if (*optarg == '+' || *optarg == '-') { + do_relative = 1; + } else if (*optarg == '%' || *optarg == '/') { + do_round = 1; + } + if (expand_number(do_relative || do_round ? + optarg + 1 : optarg, &usz) == -1 || (off_t)usz < 0) errx(EXIT_FAILURE, "invalid size argument `%s'", optarg); - sz = (*optarg == '-') ? -(off_t)usz : (off_t)usz; + sz = (*optarg == '-' || *optarg == '/') ? + -(off_t)usz : (off_t)usz; got_size = 1; break; default: @@ -103,7 +111,7 @@ main(int argc, char **argv) if (stat(rname, &sb) == -1) err(EXIT_FAILURE, "%s", rname); tsize = sb.st_size; - } else if (do_relative) + } else if (do_relative || do_round) rsize = sz; else tsize = sz; @@ -139,6 +147,25 @@ main(int argc, char **argv) } tsize = oflow; } + if (do_round) { + if (fstat(fd, &sb) == -1) { + warn("%s", fname); + error++; + continue; + } + sz = rsize; + if (sz < 0) + sz = -sz; + if (sb.st_size % sz) { + round = sb.st_size / sz; + if (round != sz && rsize < 0) + round--; + else if (rsize > 0) + round++; + tsize = (round < 0 ? 0 : round) * sz; + } else + tsize = sb.st_size; + } if (tsize < 0) tsize = 0; @@ -158,7 +185,7 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n", - "usage: truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ...", + "usage: truncate [-c] -s [+|-|%|/]size[K|k|M|m|G|g|T|t] file ...", " truncate [-c] -r rfile file ..."); exit(EXIT_FAILURE); } From owner-svn-src-head@freebsd.org Mon Jul 9 19:58:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A92D10289B9; Mon, 9 Jul 2018 19:58:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDFED83628; Mon, 9 Jul 2018 19:58:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD7D719893; Mon, 9 Jul 2018 19:58:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69Jw2KT025133; Mon, 9 Jul 2018 19:58:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69Jw1uY025128; Mon, 9 Jul 2018 19:58:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807091958.w69Jw1uY025128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 9 Jul 2018 19:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336141 - in head/sys/fs: nfs nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 336141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 19:58:03 -0000 Author: rmacklem Date: Mon Jul 9 19:58:01 2018 New Revision: 336141 URL: https://svnweb.freebsd.org/changeset/base/336141 Log: Add support for a "forced" pnfsdskill to the pNFS server kernel code. The pnfsdskill(8) command will normally fail if there is no valid mirror for the DS to be disabled. However, a system administrator may need to disable a DS which does not have a valid mirror so that the nfsd threads can be terminated. This patch adds the kernel code needed by pnfsdskill(8) to implement this "forced" case of disabling a DS. This patch only affects the pNFS server. Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Mon Jul 9 19:03:30 2018 (r336140) +++ head/sys/fs/nfs/nfs.h Mon Jul 9 19:58:01 2018 (r336141) @@ -207,6 +207,7 @@ struct nfsd_pnfsd_args { #define PNFSDOP_DELDSSERVER 1 #define PNFSDOP_COPYMR 2 +#define PNFSDOP_FORCEDELDS 3 /* Old version. */ struct nfsd_nfsd_oargs { Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Mon Jul 9 19:03:30 2018 (r336140) +++ head/sys/fs/nfs/nfs_var.h Mon Jul 9 19:58:01 2018 (r336141) @@ -159,8 +159,8 @@ int nfsrv_getdevinfo(char *, int, uint32_t *, uint32_t void nfsrv_freeonedevid(struct nfsdevice *); void nfsrv_freealllayoutsanddevids(void); void nfsrv_freefilelayouts(fhandle_t *); -int nfsrv_deldsserver(char *, NFSPROC_T *); -struct nfsdevice *nfsrv_deldsnmp(struct nfsmount *, NFSPROC_T *); +int nfsrv_deldsserver(int, char *, NFSPROC_T *); +struct nfsdevice *nfsrv_deldsnmp(int, struct nfsmount *, NFSPROC_T *); int nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *); int nfsrv_checkdsattr(struct nfsrv_descript *, vnode_t, NFSPROC_T *); int nfsrv_copymr(vnode_t, vnode_t, vnode_t, struct nfsdevice *, Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 9 19:03:30 2018 (r336140) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 9 19:58:01 2018 (r336141) @@ -3433,12 +3433,13 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap free(nfsdarg.mdspath, M_TEMP); } else if (uap->flag & NFSSVC_PNFSDS) { error = copyin(uap->argp, &pnfsdarg, sizeof(pnfsdarg)); - if (error == 0 && pnfsdarg.op == PNFSDOP_DELDSSERVER) { + if (error == 0 && (pnfsdarg.op == PNFSDOP_DELDSSERVER || + pnfsdarg.op == PNFSDOP_FORCEDELDS)) { cp = malloc(PATH_MAX + 1, M_TEMP, M_WAITOK); error = copyinstr(pnfsdarg.dspath, cp, PATH_MAX + 1, NULL); if (error == 0) - error = nfsrv_deldsserver(cp, td); + error = nfsrv_deldsserver(pnfsdarg.op, cp, td); free(cp, M_TEMP); } else if (error == 0 && pnfsdarg.op == PNFSDOP_COPYMR) { cp = malloc(PATH_MAX + 1, M_TEMP, M_WAITOK); @@ -4014,7 +4015,7 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, NFSMNTP_CANCELRPCS)) == 0) { nmp->nm_privflag |= NFSMNTP_CANCELRPCS; NFSUNLOCKMNT(nmp); - ds = nfsrv_deldsnmp(nmp, p); + ds = nfsrv_deldsnmp(PNFSDOP_DELDSSERVER, nmp, p); NFSD_DEBUG(4, "dscreatfail fail=%d ds=%p\n", failpos, ds); if (ds != NULL) @@ -4248,7 +4249,7 @@ nfsrv_pnfsremove(struct vnode **dvp, int mirrorcnt, ch NFSMNTP_CANCELRPCS)) == 0) { nmp->nm_privflag |= NFSMNTP_CANCELRPCS; NFSUNLOCKMNT(nmp); - ds = nfsrv_deldsnmp(nmp, p); + ds = nfsrv_deldsnmp(PNFSDOP_DELDSSERVER, nmp, p); NFSD_DEBUG(4, "dsremovefail fail=%d ds=%p\n", failpos, ds); if (ds != NULL) @@ -4463,7 +4464,8 @@ tryagain: NFSMNTP_CANCELRPCS)) == 0) { failnmp->nm_privflag |= NFSMNTP_CANCELRPCS; NFSUNLOCKMNT(failnmp); - ds = nfsrv_deldsnmp(failnmp, p); + ds = nfsrv_deldsnmp(PNFSDOP_DELDSSERVER, + failnmp, p); NFSD_DEBUG(4, "dsldsnmp fail=%d ds=%p\n", failpos, ds); if (ds != NULL) Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jul 9 19:03:30 2018 (r336140) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jul 9 19:58:01 2018 (r336141) @@ -7482,7 +7482,7 @@ out: * Look up the mount path for the DS server and delete it. */ int -nfsrv_deldsserver(char *dspathp, NFSPROC_T *p) +nfsrv_deldsserver(int op, char *dspathp, NFSPROC_T *p) { struct mount *mp; struct nfsmount *nmp; @@ -7524,7 +7524,7 @@ nfsrv_deldsserver(char *dspathp, NFSPROC_T *p) mtx_unlock(&mountlist_mtx); if (nmp != NULL) { - ds = nfsrv_deldsnmp(nmp, p); + ds = nfsrv_deldsnmp(op, nmp, p); NFSD_DEBUG(4, "deldsnmp=%p\n", ds); if (ds != NULL) { nfsrv_killrpcs(nmp); @@ -7544,20 +7544,26 @@ nfsrv_deldsserver(char *dspathp, NFSPROC_T *p) * Search for and remove a DS entry which matches the "nmp" argument. * The nfsdevice structure pointer is returned so that the caller can * free it via nfsrv_freeonedevid(). + * For the forced case, do not try to do LayoutRecalls, since the server + * must be shut down now anyhow. */ struct nfsdevice * -nfsrv_deldsnmp(struct nfsmount *nmp, NFSPROC_T *p) +nfsrv_deldsnmp(int op, struct nfsmount *nmp, NFSPROC_T *p) { struct nfsdevice *fndds; NFSD_DEBUG(4, "deldsdvp\n"); NFSDDSLOCK(); - fndds = nfsrv_findmirroredds(nmp); + if (op == PNFSDOP_FORCEDELDS) + fndds = nfsv4_findmirror(nmp); + else + fndds = nfsrv_findmirroredds(nmp); if (fndds != NULL) nfsrv_deleteds(fndds); NFSDDSUNLOCK(); if (fndds != NULL) { - nfsrv_flexmirrordel(fndds->nfsdev_deviceid, p); + if (op != PNFSDOP_FORCEDELDS) + nfsrv_flexmirrordel(fndds->nfsdev_deviceid, p); printf("pNFS server: mirror %s failed\n", fndds->nfsdev_host); } return (fndds); From owner-svn-src-head@freebsd.org Mon Jul 9 20:00:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 433571028FD0; Mon, 9 Jul 2018 20:00:46 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E506E8386E; Mon, 9 Jul 2018 20:00:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C62FC198A8; Mon, 9 Jul 2018 20:00:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69K0jnI026806; Mon, 9 Jul 2018 20:00:45 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69K0jXN026805; Mon, 9 Jul 2018 20:00:45 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201807092000.w69K0jXN026805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 9 Jul 2018 20:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336142 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 336142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 20:00:46 -0000 Author: gonzo Date: Mon Jul 9 20:00:45 2018 New Revision: 336142 URL: https://svnweb.freebsd.org/changeset/base/336142 Log: ig4(4): add devmatch(8) PNP info Now that we have all devices ids in a table add MODULE_PNP_INFO macro to let devmatch autoload module Modified: head/sys/dev/ichiic/ig4_pci.c Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Mon Jul 9 19:58:01 2018 (r336141) +++ head/sys/dev/ichiic/ig4_pci.c Mon Jul 9 20:00:45 2018 (r336142) @@ -117,8 +117,7 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", IG4_APL}, { PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", IG4_APL}, { PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", IG4_APL}, - { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL}, - { 0, NULL, 0 }, + { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL} }; static int @@ -129,7 +128,7 @@ ig4iic_pci_probe(device_t dev) int i; devid = pci_get_devid(dev); - for (i = 0; ig4iic_pci_devices[i].devid != 0; i++) { + for (i = 0; i < nitems(ig4iic_pci_devices); i++) { if (ig4iic_pci_devices[i].devid == devid) { device_set_desc(dev, ig4iic_pci_devices[i].desc); sc->version = ig4iic_pci_devices[i].version; @@ -229,3 +228,5 @@ DRIVER_MODULE_ORDERED(ig4iic_pci, pci, ig4iic_pci_driv MODULE_DEPEND(ig4iic_pci, pci, 1, 1, 1); MODULE_DEPEND(ig4iic_pci, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(ig4iic_pci, 1); +MODULE_PNP_INFO("W32:vendor/device", pci, ig4iic_pci, ig4iic_pci_devices, + sizeof(ig4iic_pci_devices[0]), nitems(ig4iic_pci_devices)); From owner-svn-src-head@freebsd.org Mon Jul 9 20:27:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8129102B90C; Mon, 9 Jul 2018 20:27:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B30084E4E; Mon, 9 Jul 2018 20:27:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C3B619DDC; Mon, 9 Jul 2018 20:27:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69KRWM9040532; Mon, 9 Jul 2018 20:27:32 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69KRWfX040530; Mon, 9 Jul 2018 20:27:32 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201807092027.w69KRWfX040530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 9 Jul 2018 20:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336143 - head/usr.bin/sed X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.bin/sed X-SVN-Commit-Revision: 336143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 20:27:33 -0000 Author: pfg Date: Mon Jul 9 20:27:31 2018 New Revision: 336143 URL: https://svnweb.freebsd.org/changeset/base/336143 Log: sed(1): Suppress implicit-fallthrough. Apparently some tools are not able to determine if all the cases of a switch are covered. Make use of the attribute for cases like this. Hinted by: DragonFlyBSD GGC8 (but fixed differently) CID: 976552 Modified: head/usr.bin/sed/main.c Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Mon Jul 9 20:00:45 2018 (r336142) +++ head/usr.bin/sed/main.c Mon Jul 9 20:27:31 2018 (r336143) @@ -250,6 +250,8 @@ again: s = script->s; state = ST_STRING; goto again; + default: + __unreachable(); } case ST_FILE: if ((p = fgets(buf, n, f)) != NULL) { From owner-svn-src-head@freebsd.org Mon Jul 9 20:33:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE38F102C68E; Mon, 9 Jul 2018 20:33:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FFF6858B2; Mon, 9 Jul 2018 20:33:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36DF219F6D; Mon, 9 Jul 2018 20:33:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69KXnTN045502; Mon, 9 Jul 2018 20:33:49 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69KXnqw045501; Mon, 9 Jul 2018 20:33:49 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201807092033.w69KXnqw045501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 9 Jul 2018 20:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336144 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 336144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 20:33:50 -0000 Author: jhibbits Date: Mon Jul 9 20:33:48 2018 New Revision: 336144 URL: https://svnweb.freebsd.org/changeset/base/336144 Log: powerpc/powernv: Make opal_i2c driver work with attached i2c drivers * FreeBSD stores addresses in 8 bit format, but the OPAL API requires the 7-bit address, and encodes the direction elsewhere. Behave like other i2c drivers, and shift accordingly. * The OPAL API can already handle multiple requests in flight. Change the async token to be private to the thread, so as not to stomp across i2c accesses, remove the limitation error message, and use the correct message index to transfer all messages in the list. * Micro-optimize the async handler to not continuously call pmap_kextract() when spin-waiting for the operation to complete. This has been tested by hexdumping an EEPROM attached via the icee(4) driver. Modified: head/sys/powerpc/powernv/opal_i2c.c Modified: head/sys/powerpc/powernv/opal_i2c.c ============================================================================== --- head/sys/powerpc/powernv/opal_i2c.c Mon Jul 9 20:27:31 2018 (r336143) +++ head/sys/powerpc/powernv/opal_i2c.c Mon Jul 9 20:33:48 2018 (r336144) @@ -167,16 +167,19 @@ static int i2c_opal_send_request(uint32_t bus_id, struct opal_i2c_request *req) { struct opal_msg msg; - int token, rc; + uint64_t token; + uint64_t msg_addr; + int rc; /* * XXX: - * Async tokens should be managed globally. Since there is - * only one place now, use hardcoded value. + * Async tokens should be managed globally. Since there are only a very + * few places now, use a punning of the stack address of the message. */ - token = 0x112233; + token = (uintptr_t)&msg; memset(&msg, 0, sizeof(msg)); + msg_addr = pmap_kextract((vm_offset_t)&msg); rc = opal_call(OPAL_I2C_REQUEST, token, bus_id, pmap_kextract((uint64_t)req)); @@ -185,7 +188,7 @@ i2c_opal_send_request(uint32_t bus_id, struct opal_i2c do { rc = opal_call(OPAL_CHECK_ASYNC_COMPLETION, - pmap_kextract((uint64_t)&msg), sizeof(msg), token); + msg_addr, sizeof(msg), token); } while (rc == OPAL_BUSY); if (rc != OPAL_SUCCESS) @@ -207,20 +210,13 @@ opal_i2c_transfer(device_t dev, struct iic_msg *msgs, memset(&req, 0, sizeof(req)); - /* XXX: Currently OPAL can parse only 1 message */ - if (nmsgs > 1) { - device_printf(dev, - "trying to parse %d messages, while only 1 is supported\n", nmsgs); - return (ENOMEM); - } - I2C_LOCK(sc); for (i = 0; i < nmsgs; i++) { req.type = (msgs[i].flags & IIC_M_RD) ? OPAL_I2C_RAW_READ : OPAL_I2C_RAW_WRITE; - req.addr = htobe16(msgs[0].slave); - req.size = htobe32(msgs[0].len); - req.buffer_pa = htobe64(pmap_kextract((uint64_t)msgs[0].buf)); + req.addr = htobe16(msgs[i].slave >> 1); + req.size = htobe32(msgs[i].len); + req.buffer_pa = htobe64(pmap_kextract((uint64_t)msgs[i].buf)); err = i2c_opal_send_request(sc->opal_id, &req); } From owner-svn-src-head@freebsd.org Mon Jul 9 20:38:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8205B102D0C0; Mon, 9 Jul 2018 20:38:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32A5C85CDA; Mon, 9 Jul 2018 20:38:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F3FF19F6E; Mon, 9 Jul 2018 20:38:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w69Kcl68045758; Mon, 9 Jul 2018 20:38:47 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w69KclPG045756; Mon, 9 Jul 2018 20:38:47 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201807092038.w69KclPG045756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 9 Jul 2018 20:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336145 - head/usr.bin/localedef X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.bin/localedef X-SVN-Commit-Revision: 336145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 20:38:48 -0000 Author: pfg Date: Mon Jul 9 20:38:47 2018 New Revision: 336145 URL: https://svnweb.freebsd.org/changeset/base/336145 Log: localedef(1): remove duplicated includes. Hinted by: DragonFlyBSD Modified: head/usr.bin/localedef/charmap.c head/usr.bin/localedef/localedef.c Modified: head/usr.bin/localedef/charmap.c ============================================================================== --- head/usr.bin/localedef/charmap.c Mon Jul 9 20:33:48 2018 (r336144) +++ head/usr.bin/localedef/charmap.c Mon Jul 9 20:38:47 2018 (r336145) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include "localedef.h" Modified: head/usr.bin/localedef/localedef.c ============================================================================== --- head/usr.bin/localedef/localedef.c Mon Jul 9 20:33:48 2018 (r336144) +++ head/usr.bin/localedef/localedef.c Mon Jul 9 20:38:47 2018 (r336145) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@freebsd.org Mon Jul 9 21:12:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4501F1030952; Mon, 9 Jul 2018 21:12:13 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEBE0875CE; Mon, 9 Jul 2018 21:12:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.41] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4AE34DF86; Mon, 9 Jul 2018 21:12:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.e.1.180613 Date: Mon, 09 Jul 2018 14:12:08 -0700 Subject: Re: svn commit: r336144 - head/sys/powerpc/powernv From: Ravi Pokala To: Justin Hibbits , , , Message-ID: <40FE6456-9543-461F-AD9A-1F974D13F190@panasas.com> Thread-Topic: svn commit: r336144 - head/sys/powerpc/powernv References: <201807092033.w69KXnqw045501@repo.freebsd.org> In-Reply-To: <201807092033.w69KXnqw045501@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 21:12:13 -0000 -----Original Message----- From: on behalf of Justin Hibbits Date: 2018-07-09, Monday at 13:33 To: , , Subject: svn commit: r336144 - head/sys/powerpc/powernv > Author: jhibbits > Date: Mon Jul 9 20:33:48 2018 > New Revision: 336144 > URL: https://svnweb.freebsd.org/changeset/base/336144 > > Log: > powerpc/powernv: Make opal_i2c driver work with attached i2c drivers > > * FreeBSD stores addresses in 8 bit format, but the OPAL API requires the 7-bit > address, and encodes the direction elsewhere. Behave like other i2c drivers, > and shift accordingly. You got seven contiguous address bits? LUXURY! Look for "slave" and "write_op" in sys/dev/imcsmb.c:imcsmb_transfer(); it's "hilarious". -Ravi From owner-svn-src-head@freebsd.org Tue Jul 10 00:01:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 686361043268; Tue, 10 Jul 2018 00:01:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A9878E9D8; Tue, 10 Jul 2018 00:01:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFC511C0E2; Tue, 10 Jul 2018 00:01:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A01Eu9048989; Tue, 10 Jul 2018 00:01:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A01E3F048987; Tue, 10 Jul 2018 00:01:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807100001.w6A01E3F048987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 10 Jul 2018 00:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336148 - in head: lib/libc/sys sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: lib/libc/sys sys/sys X-SVN-Commit-Revision: 336148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:01:15 -0000 Author: imp Date: Tue Jul 10 00:01:14 2018 New Revision: 336148 URL: https://svnweb.freebsd.org/changeset/base/336148 Log: Tweak documentation to RB_ constants to reflect current use RB_ASKNAME is no longer instructions to the boot loader to request a prompt for which kernel to boot. Instead, it asks for what the root file system to use. RB_INITNAME is unused, and never has been in FreeBSD as far as I can tell. Remove it from the documentation and fix comment. RB_SELFTEST and RB_MINIROOT likewise (though they were completely undocumented). These last three constants can likely just be deleted as nothing references them (even to set useless bits). RB_ASKNAME doesn't actually survive reboot, however, so needs to be communicated to the bootloader via other means. If the bootloader sets it, though, it will be honored. Modified: head/lib/libc/sys/reboot.2 head/sys/sys/reboot.h Modified: head/lib/libc/sys/reboot.2 ============================================================================== --- head/lib/libc/sys/reboot.2 Mon Jul 9 21:29:23 2018 (r336147) +++ head/lib/libc/sys/reboot.2 Tue Jul 10 00:01:14 2018 (r336148) @@ -28,7 +28,7 @@ .\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 24, 2017 +.Dd July 10, 2018 .Dt REBOOT 2 .Os .Sh NAME @@ -58,18 +58,13 @@ options, defined in the include file .In sys/reboot.h , to be passed to the new kernel or the new bootstrap and init programs. -.Bl -tag -width RB_INITNAMEA +.Bl -tag -width RB_POWERCYCLE .It Dv RB_AUTOBOOT The default, causing the system to reboot in its usual fashion. .It Dv RB_ASKNAME -Interpreted by the bootstrap program itself, causing it to -prompt on the console as to what file should be booted. -Normally, the system is booted from the file -.Dq Ar xx Ns No (0,0)kernel , -where -.Ar xx -is the default disk name, -without prompting for the file name. +Normally the system only prompts the user if the loader specified root +file system has an error. +This flag forces it to always prompt the user for the root partition. .It Dv RB_DFLTROOT Use the compiled in root device. Normally, the system uses the device from which it was booted @@ -96,13 +91,6 @@ driver implements this feature. After halting, the shutdown code will do what it can to turn off the power. This requires hardware support. -.It Dv RB_INITNAME -An option allowing the specification of an init program (see -.Xr init 8 ) -other than -.Pa /sbin/init -to be run when the system reboots. -This switch is not currently available. .It Dv RB_KDB Load the symbol table and enable a built-in debugger in the system. This option will have no useful function if the kernel is not configured Modified: head/sys/sys/reboot.h ============================================================================== --- head/sys/sys/reboot.h Mon Jul 9 21:29:23 2018 (r336147) +++ head/sys/sys/reboot.h Tue Jul 10 00:01:14 2018 (r336148) @@ -41,23 +41,23 @@ */ #define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ -#define RB_ASKNAME 0x001 /* ask for file name to reboot from */ +#define RB_ASKNAME 0x001 /* force prompt of device of root filesystem */ #define RB_SINGLE 0x002 /* reboot to single user only */ #define RB_NOSYNC 0x004 /* dont sync before reboot */ #define RB_HALT 0x008 /* don't reboot, just halt */ -#define RB_INITNAME 0x010 /* name given for /etc/init (unused) */ +#define RB_INITNAME 0x010 /* Unused placeholder to specify init path */ #define RB_DFLTROOT 0x020 /* use compiled-in rootdev */ #define RB_KDB 0x040 /* give control to kernel debugger */ #define RB_RDONLY 0x080 /* mount root fs read-only */ #define RB_DUMP 0x100 /* dump kernel memory before reboot */ -#define RB_MINIROOT 0x200 /* mini-root present in memory at boot time */ +#define RB_MINIROOT 0x200 /* Unused placeholder */ #define RB_VERBOSE 0x800 /* print all potentially useful info */ #define RB_SERIAL 0x1000 /* use serial port as console */ #define RB_CDROM 0x2000 /* use cdrom as root */ #define RB_POWEROFF 0x4000 /* turn the power off if possible */ #define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ #define RB_MUTE 0x10000 /* start up with the console muted */ -#define RB_SELFTEST 0x20000 /* don't complete the boot; do selftest */ +#define RB_SELFTEST 0x20000 /* unused placeholder */ #define RB_RESERVED1 0x40000 /* reserved for internal use of boot blocks */ #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ From owner-svn-src-head@freebsd.org Tue Jul 10 00:18:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC9F91044E42; Tue, 10 Jul 2018 00:18:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A9928F4D4; Tue, 10 Jul 2018 00:18:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B8B81C2DE; Tue, 10 Jul 2018 00:18:13 +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 w6A0ID5j058178; Tue, 10 Jul 2018 00:18:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0ID7V058177; Tue, 10 Jul 2018 00:18:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807100018.w6A0ID7V058177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 10 Jul 2018 00:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336149 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 336149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:18:14 -0000 Author: markj Date: Tue Jul 10 00:18:12 2018 New Revision: 336149 URL: https://svnweb.freebsd.org/changeset/base/336149 Log: Fix pre-SI_SUB_CPU initialization of per-CPU counters. r336020 introduced pcpu_page_alloc(), replacing page_alloc() as the backend allocator for PCPU UMA zones. Unlike page_alloc(), it does not honour malloc(9) flags such as M_ZERO or M_NODUMP, so fix that. r336020 also changed counter(9) to initialize each counter using a CPU_FOREACH() loop instead of an SMP rendezvous. Before SI_SUB_CPU, smp_rendezvous() will only execute the callback on the current CPU (i.e., CPU 0), so only one counter gets zeroed. The rest are zeroed by virtue of the fact that UMA gratuitously zeroes slabs when importing them into a zone. Prior to SI_SUB_CPU, all_cpus is clear, so with r336020 we weren't zeroing vm_cnt counters during boot: the CPU_FOREACH() loop had no effect, and pcpu_page_alloc() didn't honour M_ZERO. Fix this by iterating over the full range of CPU IDs when zeroing counters, ignoring whether the corresponding bits in all_cpus are set. Reported and tested by: pho (previous version) Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D16190 Modified: head/sys/kern/subr_counter.c head/sys/vm/uma_core.c Modified: head/sys/kern/subr_counter.c ============================================================================== --- head/sys/kern/subr_counter.c Tue Jul 10 00:01:14 2018 (r336148) +++ head/sys/kern/subr_counter.c Tue Jul 10 00:18:12 2018 (r336149) @@ -43,15 +43,6 @@ __FBSDID("$FreeBSD$"); #define IN_SUBR_COUNTER_C #include -static void -counter_u64_zero_sync(counter_u64_t c) -{ - int cpu; - - CPU_FOREACH(cpu) - *(uint64_t*)zpcpu_get_cpu(c, cpu) = 0; -} - void counter_u64_zero(counter_u64_t c) { @@ -69,13 +60,8 @@ counter_u64_fetch(counter_u64_t c) counter_u64_t counter_u64_alloc(int flags) { - counter_u64_t r; - r = uma_zalloc_pcpu(pcpu_zone_64, flags); - if (r != NULL) - counter_u64_zero_sync(r); - - return (r); + return (uma_zalloc_pcpu(pcpu_zone_64, flags | M_ZERO)); } void Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Jul 10 00:01:14 2018 (r336148) +++ head/sys/vm/uma_core.c Tue Jul 10 00:18:12 2018 (r336149) @@ -1186,13 +1186,12 @@ pcpu_page_alloc(uma_zone_t zone, vm_size_t bytes, int struct pcpu *pc; #endif - TAILQ_INIT(&alloctail); - MPASS(bytes == (mp_maxid+1)*PAGE_SIZE); - *pflag = UMA_SLAB_KERNEL; + MPASS(bytes == (mp_maxid + 1) * PAGE_SIZE); + TAILQ_INIT(&alloctail); flags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ | - ((wait & M_WAITOK) != 0 ? VM_ALLOC_WAITOK : - VM_ALLOC_NOWAIT); + malloc2vm_flags(wait); + *pflag = UMA_SLAB_KERNEL; for (cpu = 0; cpu <= mp_maxid; cpu++) { if (CPU_ABSENT(cpu)) { p = vm_page_alloc(NULL, 0, flags); @@ -2328,10 +2327,10 @@ uma_zalloc_pcpu_arg(uma_zone_t zone, void *udata, int MPASS(zone->uz_flags & UMA_ZONE_PCPU); #endif - item = uma_zalloc_arg(zone, udata, flags &~ M_ZERO); + item = uma_zalloc_arg(zone, udata, flags & ~M_ZERO); if (item != NULL && (flags & M_ZERO)) { #ifdef SMP - CPU_FOREACH(i) + for (i = 0; i <= mp_maxid; i++) bzero(zpcpu_get_cpu(item, i), zone->uz_size); #else bzero(item, zone->uz_size); From owner-svn-src-head@freebsd.org Tue Jul 10 00:19:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB262104517F; Tue, 10 Jul 2018 00:19:53 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A8078F6D5; Tue, 10 Jul 2018 00:19:53 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B8061C2EA; Tue, 10 Jul 2018 00:19:53 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A0JriS058280; Tue, 10 Jul 2018 00:19:53 GMT (envelope-from daichi@FreeBSD.org) Received: (from daichi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0JrxD058279; Tue, 10 Jul 2018 00:19:53 GMT (envelope-from daichi@FreeBSD.org) Message-Id: <201807100019.w6A0JrxD058279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: daichi set sender to daichi@FreeBSD.org using -f From: Daichi GOTO Date: Tue, 10 Jul 2018 00:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336150 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: daichi X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 336150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:19:54 -0000 Author: daichi Date: Tue Jul 10 00:19:52 2018 New Revision: 336150 URL: https://svnweb.freebsd.org/changeset/base/336150 Log: top(1): Fix the prompt bug and core dump problem in o / p mode that occurred by r336028 Reviewed by: cy Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D16174 Modified: head/usr.bin/top/display.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Tue Jul 10 00:18:12 2018 (r336149) +++ head/usr.bin/top/display.c Tue Jul 10 00:19:52 2018 (r336150) @@ -703,6 +703,7 @@ u_swap(int *stats) * respect to screen updates). */ +#define NEXT_MSG_ADDLEN 5 static char *next_msg = NULL; static int msglen = 0; /* Invariant: msglen is always the length of the message currently displayed @@ -711,7 +712,7 @@ static int msglen = 0; void i_message(void) { - next_msg = setup_buffer(next_msg, 5); + next_msg = setup_buffer(next_msg, NEXT_MSG_ADDLEN); while (lastline < y_message) { @@ -960,7 +961,8 @@ new_message(int type, const char *msgfmt, ...) va_start(args, msgfmt); /* first, format the message */ - vsnprintf(next_msg, strlen(next_msg), msgfmt, args); + vsnprintf(next_msg, setup_buffer_bufsiz + NEXT_MSG_ADDLEN, + msgfmt, args); va_end(args); @@ -1343,6 +1345,8 @@ i_uptime(struct timeval *bt, time_t *tod) } } +#define SETUPBUFFER_REQUIRED_ADDBUFSIZ 2 + static char * setup_buffer(char *buffer, int addlen) { @@ -1350,12 +1354,15 @@ setup_buffer(char *buffer, int addlen) if (NULL == buffer) { setup_buffer_bufsiz = screen_width; - b = calloc(setup_buffer_bufsiz + addlen, sizeof(char)); + b = calloc(setup_buffer_bufsiz + addlen + + SETUPBUFFER_REQUIRED_ADDBUFSIZ, + sizeof(char)); } else { if (screen_width > setup_buffer_bufsiz) { setup_buffer_bufsiz = screen_width; free(buffer); - b = calloc(setup_buffer_bufsiz + addlen, + b = calloc(setup_buffer_bufsiz + addlen + + SETUPBUFFER_REQUIRED_ADDBUFSIZ, sizeof(char)); } else { b = buffer; From owner-svn-src-head@freebsd.org Tue Jul 10 00:26:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 046BD1045AE4; Tue, 10 Jul 2018 00:26:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A65598FC60; Tue, 10 Jul 2018 00:26:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 842681C47F; Tue, 10 Jul 2018 00:26:13 +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 w6A0QDrJ063195; Tue, 10 Jul 2018 00:26:13 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0QDNl063194; Tue, 10 Jul 2018 00:26:13 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201807100026.w6A0QDNl063194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 10 Jul 2018 00:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336151 - head/kerberos5/usr.bin/verify_krb5_conf X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/usr.bin/verify_krb5_conf X-SVN-Commit-Revision: 336151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:26:14 -0000 Author: cy Date: Tue Jul 10 00:26:13 2018 New Revision: 336151 URL: https://svnweb.freebsd.org/changeset/base/336151 Log: Remove redundant space. MFC after: 3 days Modified: head/kerberos5/usr.bin/verify_krb5_conf/Makefile Modified: head/kerberos5/usr.bin/verify_krb5_conf/Makefile ============================================================================== --- head/kerberos5/usr.bin/verify_krb5_conf/Makefile Tue Jul 10 00:19:52 2018 (r336150) +++ head/kerberos5/usr.bin/verify_krb5_conf/Makefile Tue Jul 10 00:26:13 2018 (r336151) @@ -3,7 +3,7 @@ PROG= verify_krb5_conf MAN= verify_krb5_conf.8 CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/roken -LIBADD= krb5 roken vers +LIBADD= krb5 roken vers .include From owner-svn-src-head@freebsd.org Tue Jul 10 00:33:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D52E1046706; Tue, 10 Jul 2018 00:33:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14A2770273; Tue, 10 Jul 2018 00:33:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9E2E1C628; Tue, 10 Jul 2018 00:33:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A0XVhu068062; Tue, 10 Jul 2018 00:33:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0XVlZ068061; Tue, 10 Jul 2018 00:33:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807100033.w6A0XVlZ068061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Jul 2018 00:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336152 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:33:32 -0000 Author: kevans Date: Tue Jul 10 00:33:31 2018 New Revision: 336152 URL: https://svnweb.freebsd.org/changeset/base/336152 Log: subr_hints: Use goto/label instead of series of conditionals Modified: head/sys/kern/subr_hints.c Modified: head/sys/kern/subr_hints.c ============================================================================== --- head/sys/kern/subr_hints.c Tue Jul 10 00:26:13 2018 (r336151) +++ head/sys/kern/subr_hints.c Tue Jul 10 00:33:31 2018 (r336152) @@ -124,7 +124,7 @@ res_find(char **hintp_cookie, int *line, int *startln, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value) { - int dyn_used = 0, fbacklvl = FBACK_MDENV, hit, i = 0, n = 0; + int dyn_used = 0, fbacklvl = FBACK_MDENV, i = 0, n = 0; char r_name[32]; int r_unit; char r_resname[32]; @@ -217,34 +217,30 @@ found: cp = hintp; while (cp) { - hit = 1; (*line)++; if (strncmp(cp, "hint.", 5) != 0) - hit = 0; - else - n = sscanf(cp, "hint.%32[^.].%d.%32[^=]=%127s", - r_name, &r_unit, r_resname, r_value); - /* We'll circumvent all of the checks if we already know */ - if (hit) { - if (n != 4) { - printf("CONFIG: invalid hint '%s'\n", cp); - p = strchr(cp, 'h'); - *p = 'H'; - hit = 0; - } - if (hit && startln && *startln >= 0 && *line < *startln) - hit = 0; - if (hit && name && strcmp(name, r_name) != 0) - hit = 0; - if (hit && unit && *unit != r_unit) - hit = 0; - if (hit && resname && strcmp(resname, r_resname) != 0) - hit = 0; - if (hit && value && strcmp(value, r_value) != 0) - hit = 0; - if (hit) - break; + goto nexthint; + n = sscanf(cp, "hint.%32[^.].%d.%32[^=]=%127s", r_name, &r_unit, + r_resname, r_value); + if (n != 4) { + printf("CONFIG: invalid hint '%s'\n", cp); + p = strchr(cp, 'h'); + *p = 'H'; + goto nexthint; } + if (startln && *startln >= 0 && *line < *startln) + goto nexthint; + if (name && strcmp(name, r_name) != 0) + goto nexthint; + if (unit && *unit != r_unit) + goto nexthint; + if (resname && strcmp(resname, r_resname) != 0) + goto nexthint; + if (value && strcmp(value, r_value) != 0) + goto nexthint; + /* Successfully found a hint matching all criteria */ + break; +nexthint: if (dyn_used) { cp = kenvp[++i]; if (cp == NULL) From owner-svn-src-head@freebsd.org Tue Jul 10 00:34:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB3710468A2; Tue, 10 Jul 2018 00:34:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4A7E703E5; Tue, 10 Jul 2018 00:34:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B73551C62A; Tue, 10 Jul 2018 00:34:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A0YJ13068137; Tue, 10 Jul 2018 00:34:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0YJa1068136; Tue, 10 Jul 2018 00:34:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807100034.w6A0YJa1068136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Jul 2018 00:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336153 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:34:20 -0000 Author: kevans Date: Tue Jul 10 00:34:19 2018 New Revision: 336153 URL: https://svnweb.freebsd.org/changeset/base/336153 Log: subr_hints: Convert some bool-like ints to bools Modified: head/sys/kern/subr_hints.c Modified: head/sys/kern/subr_hints.c ============================================================================== --- head/sys/kern/subr_hints.c Tue Jul 10 00:33:31 2018 (r336152) +++ head/sys/kern/subr_hints.c Tue Jul 10 00:34:19 2018 (r336153) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); * has already been setup (dynamic_kenv) and that we have added any supplied * static_hints to the dynamic environment. */ -static int hintenv_merged; +static bool hintenv_merged; /* * Access functions for device resources. @@ -84,7 +84,7 @@ static_hints_to_env(void *data __unused) free(line, M_TEMP); cp += i + 1; } - hintenv_merged = 1; + hintenv_merged = true; } /* Any time after dynamic env is setup */ @@ -124,13 +124,14 @@ res_find(char **hintp_cookie, int *line, int *startln, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value) { - int dyn_used = 0, fbacklvl = FBACK_MDENV, i = 0, n = 0; + int fbacklvl = FBACK_MDENV, i = 0, n = 0; char r_name[32]; int r_unit; char r_resname[32]; char r_value[128]; const char *s, *cp; char *hintp, *p; + bool dyn_used = false; /* @@ -157,7 +158,7 @@ res_find(char **hintp_cookie, int *line, int *startln, } } mtx_unlock(&kenv_lock); - dyn_used = 1; + dyn_used = true; } else { /* * We'll have a chance to keep coming back here until @@ -199,7 +200,7 @@ found: } else { hintp = *hintp_cookie; if (hintenv_merged && hintp == kenvp[0]) - dyn_used = 1; + dyn_used = true; else /* * If we aren't using the dynamic environment, we need From owner-svn-src-head@freebsd.org Tue Jul 10 00:36:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27B041046BB0; Tue, 10 Jul 2018 00:36:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D12D7705D9; Tue, 10 Jul 2018 00:36:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B25771C62D; Tue, 10 Jul 2018 00:36:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A0abN7068284; Tue, 10 Jul 2018 00:36:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A0abAQ068283; Tue, 10 Jul 2018 00:36:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807100036.w6A0abAQ068283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Jul 2018 00:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336154 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 00:36:38 -0000 Author: kevans Date: Tue Jul 10 00:36:37 2018 New Revision: 336154 URL: https://svnweb.freebsd.org/changeset/base/336154 Log: subr_hints: Skip static_env and static_hints if they don't contain hints This is possible because, well, they're static. Both the dynamic environment and the MD-environment (generally loader(8) environment) can potentially have room for new variables to be set, and thus do not receive this treatment. Modified: head/sys/kern/subr_hints.c Modified: head/sys/kern/subr_hints.c ============================================================================== --- head/sys/kern/subr_hints.c Tue Jul 10 00:34:19 2018 (r336153) +++ head/sys/kern/subr_hints.c Tue Jul 10 00:36:37 2018 (r336154) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); * static_hints to the dynamic environment. */ static bool hintenv_merged; - +/* Static environment and static hints cannot change, so we'll skip known bad */ +static bool stenv_skip; +static bool sthints_skip; /* * Access functions for device resources. */ @@ -179,17 +181,21 @@ fallback: } fbacklvl++; - if (fbacklvl <= FBACK_STENV && + if (!stenv_skip && fbacklvl <= FBACK_STENV && _res_checkenv(kern_envp)) { hintp = kern_envp; goto found; - } + } else + stenv_skip = true; + fbacklvl++; /* We'll fallback to static_hints if needed/can */ - if (fbacklvl <= FBACK_STATIC && + if (!sthints_skip && fbacklvl <= FBACK_STATIC && _res_checkenv(static_hints)) hintp = static_hints; + else + sthints_skip = true; found: fbacklvl++; } From owner-svn-src-head@freebsd.org Tue Jul 10 01:07:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DAAF1049837; Tue, 10 Jul 2018 01:07:31 +0000 (UTC) (envelope-from daichigoto@icloud.com) Received: from mr22p34im-asmtp002.me.com (mr22p34im-asmtp002.me.com [17.111.211.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 122ED71FFE; Tue, 10 Jul 2018 01:07:31 +0000 (UTC) (envelope-from daichigoto@icloud.com) Received: from process-dkim-sign-daemon.mr22p34im-asmtp002.me.com by mr22p34im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0PBM00I00LHCL200@mr22p34im-asmtp002.me.com>; Tue, 10 Jul 2018 01:07:30 +0000 (GMT) Received: from icloud.com ([127.0.0.1]) by mr22p34im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0PBM0012VLSAIM20@mr22p34im-asmtp002.me.com>; Tue, 10 Jul 2018 01:07:29 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-07-09_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1807100012 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: svn commit: r335836 - head/usr.bin/top From: =?utf-8?B?5b6M6Jek5aSn5Zyw?= In-reply-to: <20180705.013715.810854236306970666.hrs@allbsd.org> Date: Tue, 10 Jul 2018 10:07:22 +0900 Cc: Daichi GOTO , Eitan Adler , gnn@FreeBSD.org, cem@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-transfer-encoding: quoted-printable Message-id: References: <20180702.155529.1102410939281120947.hrs@allbsd.org> <459BD898-8072-426E-A968-96C1382AC616@icloud.com> <20180703.020956.859981414196673670.hrs@allbsd.org> <20180705.013715.810854236306970666.hrs@allbsd.org> To: Hiroki Sato X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 01:07:31 -0000 I summarized in the Phabricator. Check it out please. https://reviews.freebsd.org/D16203 > 2018/07/05 1:37=E3=80=81Hiroki Sato =E3=81=AE=E3=83=A1=E3= =83=BC=E3=83=AB: >=20 > Hiroki Sato wrote > in <20180703.020956.859981414196673670.hrs@allbsd.org>: >=20 > hr> =E5=BE=8C=E8=97=A4=E5=A4=A7=E5=9C=B0 wrote > hr> in <459BD898-8072-426E-A968-96C1382AC616@icloud.com>: > hr> > hr> da> > hr> da> > hr> da> > 2018/07/02 15:55=E3=80=81Hiroki Sato = =E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB: > hr> da> > > hr> da> > Eitan Adler wrote > hr> da> > in = : > hr> da> > > hr> da> > li> On 1 July 2018 at 10:08, Conrad Meyer = wrote: > hr> da> > li> > Hi Daichi, > hr> da> > li> > > hr> da> > li> > > hr> da> > li> > > hr> da> > li> > I don't think code to decode UTF-8 belongs in top(1). = I don't know > hr> da> > li> > what the goal of this routine is, but I doubt this is = the right way to > hr> da> > li> > accomplish it. > hr> da> > li> > hr> da> > li> For the record, I agree. This is why I didn't click = "accept" on the > hr> da> > li> revision. I don't fully oppose leaving it in top(1) for = now as we work > hr> da> > li> out the API, but long term its the wrong place. > hr> da> > li> > hr> da> > li> https://reviews.freebsd.org/D16058 is the review. > hr> da> > > hr> da> > I strongly object this kind of encoding-specific routine. = Please > hr> da> > back out it. The problem is that top(1) does not support = multibyte > hr> da> > encoding in functions for printing, and using C99 = wide/multibyte > hr> da> > character manipulation API such as iswprint(3) is the way to = solve > hr> da> > it. Doing getenv("LANG") and assuming an encoding based on = it is a > hr> da> > very bad practice to internationalize software. > hr> da> > > hr> da> > -- Hiroki > hr> da> > hr> da> I respect what you mean. > hr> da> > hr> da> Once I back out, I will begin implementing it in a different = way. > hr> da> Please advise which function should be used for implementation > hr> da> (iswprint (3) and what other functions should be used?) > hr> > hr> Roughly speaking, POSIX/XPG/C99 I18N model requires the following > hr> steps: > (snip) >=20 > Are you going to back out r335836, or disagree about it? >=20 > If there is no objection in the next 24 hours, I will commit the > attached patch. This should be a minimal change to support multibyte > characters in ARGV array depending on LC_CTYPE, not limited to UTF-8. >=20 > -- Hiroki > Index: usr.bin/top/display.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/display.c (revision 335957) > +++ usr.bin/top/display.c (working copy) > @@ -1248,55 +1248,6 @@ > } > } >=20 > -/* > - * printable(str) - make the string pointed to by "str" into one = that is > - * printable (i.e.: all ascii), by converting all non-printable > - * characters into '?'. Replacements are done in place and a = pointer > - * to the original buffer is returned. > - */ > - > -char * > -printable(char str[]) > -{ > - char *ptr; > - char ch; > - > - ptr =3D str; > - if (utf8flag) { > - while ((ch =3D *ptr) !=3D '\0') { > - if (0x00 =3D=3D (0x80 & ch)) { > - if (!isprint(ch)) { > - *ptr =3D '?'; > - } > - ++ptr; > - } else if (0xC0 =3D=3D (0xE0 & ch)) { > - ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - } else if (0xE0 =3D=3D (0xF0 & ch)) { > - ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - } else if (0xF0 =3D=3D (0xF8 & ch)) { > - ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - if ('\0' !=3D *ptr) ++ptr; > - } else { > - *ptr =3D '?'; > - ++ptr; > - } > - } > - } else { > - while ((ch =3D *ptr) !=3D '\0') { > - if (!isprint(ch)) { > - *ptr =3D '?'; > - } > - ptr++; > - } > - } > - return(str); > -} > - > void > i_uptime(struct timeval *bt, time_t *tod) > { > Index: usr.bin/top/display.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/display.h (revision 335957) > +++ usr.bin/top/display.h (working copy) > @@ -11,7 +11,6 @@ > void clear_message(void); > int display_resize(void); > void i_header(const char *text); > -char *printable(char *string); > void display_header(int t); > int display_init(struct statics *statics); > void i_arc(int *stats); > Index: usr.bin/top/machine.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/machine.c (revision 335957) > +++ usr.bin/top/machine.c (working copy) > @@ -986,13 +986,8 @@ > if (*src =3D=3D '\0') > continue; > len =3D (argbuflen - (dst - argbuf) - 1) = / 4; > - if (utf8flag) { > - utf8strvisx(dst, src, = MIN(strlen(src), len)); > - } else { > - strvisx(dst, src, > - MIN(strlen(src), len), > - VIS_NL | VIS_CSTYLE); > - } > + strvisx(dst, src, MIN(strlen(src), len), > + VIS_NL | VIS_CSTYLE | VIS_OCTAL); > while (*dst !=3D '\0') > dst++; > if ((argbuflen - (dst - argbuf) - 1) / 4 = > 0) > @@ -1089,7 +1084,7 @@ > sbuf_printf(procbuf, "%6s ", format_time(cputime)); > sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * = weighted_cpu(PCTCPU(pp), pp) : 100.0 * PCTCPU(pp)); > } > - sbuf_printf(procbuf, "%s", printable(cmdbuf)); > + sbuf_printf(procbuf, "%s", cmdbuf); > free(cmdbuf); > return (sbuf_data(procbuf)); > } > Index: usr.bin/top/top.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/top.c (revision 335957) > +++ usr.bin/top/top.c (working copy) > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -69,7 +70,6 @@ > struct process_select ps; > const char * myname =3D "top"; > pid_t mypid; > -bool utf8flag =3D false; >=20 > /* pointers to display routines */ > static void (*d_loadave)(int mpid, double *avenrun) =3D i_loadave; > @@ -276,6 +276,11 @@ > } > } >=20 > + if (setlocale(LC_ALL, "") =3D=3D NULL) { > + fprintf(stderr, "%s: invalid locale.\n", myname); > + exit(1); > + } > + > mypid =3D getpid(); >=20 > /* get our name */ > @@ -607,14 +612,6 @@ > fputc('\n', stderr); > } >=20 > - /* check if you are using UTF-8 */ > - char *env_lang; > - if (NULL !=3D (env_lang =3D getenv("LANG")) && > - 0 !=3D strcmp(env_lang, "") && > - NULL !=3D strstr(env_lang, "UTF-8")) { > - utf8flag =3D true; > - } > - > restart: >=20 > /* > Index: usr.bin/top/top.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/top.h (revision 335957) > +++ usr.bin/top/top.h (working copy) > @@ -8,7 +8,6 @@ > #define TOP_H >=20 > #include > -#include >=20 > /* Number of lines of header information on the standard screen */ > extern int Header_lines; > @@ -38,7 +37,6 @@ > extern int pcpu_stats; > extern int overstrike; > extern pid_t mypid; > -extern bool utf8flag; >=20 > extern const char * myname; >=20 > Index: usr.bin/top/utils.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/utils.c (revision 335957) > +++ usr.bin/top/utils.c (working copy) > @@ -2,7 +2,6 @@ > * This program may be freely redistributed, > * but this entire comment MUST remain intact. > * > - * Copyright (c) 2018, Daichi Goto > * Copyright (c) 2018, Eitan Adler > * Copyright (c) 1984, 1989, William LeFebvre, Rice University > * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern = University > @@ -329,61 +328,3 @@ > kvm_close(kd); > return ret; > } > - > -/* > - * utf8strvisx(dst,src,src_len) > - * strvisx(dst,src,src_len,VIS_NL|VIS_CSTYLE) coresponding to = UTF-8. > - */ > -static const char *vis_encodes[] =3D { > - "\\0", "\\^A", "\\^B", "\\^C", "\\^D", "\\^E", "\\^F", "\\a", > - "\\b", "\t", "\\n", "\\v", "\\f", "\\r", "\\^N", "\\^O", "\\^P", > - "\\^Q", "\\^R", "\\^S", "\\^T", "\\^U", "\\^V", "\\^W", "\\^X", > - "\\^Y", "\\^Z", "\\^[", "\\^\\", "\\^]", "\\^^", "\\^_" > -}; > - > -int > -utf8strvisx(char *dst, const char *src, size_t src_len) > -{ > - const signed char *src_p; > - char *dst_p; > - int i, j, olen, len; > - > - src_p =3D src; > - dst_p =3D dst; > - i =3D olen =3D 0; > - len =3D (int)src_len; > - while (i < len) { > - if (0x00 =3D=3D (0x80 & *src_p)) { > - if (0 <=3D *src_p && *src_p <=3D 31) { > - j =3D strlen(vis_encodes[(int)*src_p]); > - strcpy(dst_p, vis_encodes[(int)*src_p]); > - dst_p +=3D j; > - olen +=3D j; > - } else if (127 =3D=3D *src_p) { > - strcpy(dst_p, "\\^?"); > - olen +=3D 3; > - } else { > - *dst_p++ =3D *src_p; > - ++olen; > - } > - ++i; > - ++src_p; > - } else if (0xC0 =3D=3D (0xE0 & *src_p)) { > - *dst_p++ =3D *src_p++; ++i; ++olen; > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - } else if (0xE0 =3D=3D (0xF0 & *src_p)) { > - *dst_p++ =3D *src_p++; ++i; ++olen; > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - } else if (0xF0 =3D=3D (0xF8 & *src_p)) { > - *dst_p++ =3D *src_p++; ++i; ++olen; > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - if (i < len) { *dst_p++ =3D *src_p++; ++i; = ++olen; } > - } else { > - *dst_p++ =3D '?'; ++i; ++olen; > - } > - } > - > - return olen; > -} > Index: usr.bin/top/utils.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- usr.bin/top/utils.h (revision 335957) > +++ usr.bin/top/utils.h (working copy) > @@ -22,5 +22,4 @@ > char *format_k(int64_t); > int string_index(const char *string, const char * const *array); > int find_pid(pid_t pid); > -int utf8strvisx(char *, const char *, size_t); >=20 From owner-svn-src-head@freebsd.org Tue Jul 10 01:42:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4522A102A515; Tue, 10 Jul 2018 01:42:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAE457461B; Tue, 10 Jul 2018 01:42:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B482A1D2A4; Tue, 10 Jul 2018 01:42:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A1gSEI004833; Tue, 10 Jul 2018 01:42:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A1gSfh004832; Tue, 10 Jul 2018 01:42:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201807100142.w6A1gSfh004832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 10 Jul 2018 01:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336156 - head/usr.bin/gzip X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/usr.bin/gzip X-SVN-Commit-Revision: 336156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 01:42:29 -0000 Author: delphij Date: Tue Jul 10 01:42:28 2018 New Revision: 336156 URL: https://svnweb.freebsd.org/changeset/base/336156 Log: Use endian.h le32dec() instead of rolling our own. Suggested by: phk Reviewed by: imp, pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16192 Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Tue Jul 10 01:06:43 2018 (r336155) +++ head/usr.bin/gzip/gzip.c Tue Jul 10 01:42:28 2018 (r336156) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); * - make bzip2/compress -v/-t/-l support work as well as possible */ +#include #include #include #include @@ -1016,10 +1017,7 @@ gz_uncompress(int in, int out, char *pre, size_t prele maybe_warnx("truncated input"); goto stop_and_fail; } - origcrc = ((unsigned)z.next_in[0] & 0xff) | - ((unsigned)z.next_in[1] & 0xff) << 8 | - ((unsigned)z.next_in[2] & 0xff) << 16 | - ((unsigned)z.next_in[3] & 0xff) << 24; + origcrc = le32dec(&z.next_in[0]); if (origcrc != crc) { maybe_warnx("invalid compressed" " data--crc error"); @@ -1047,10 +1045,7 @@ gz_uncompress(int in, int out, char *pre, size_t prele maybe_warnx("truncated input"); goto stop_and_fail; } - origlen = ((unsigned)z.next_in[0] & 0xff) | - ((unsigned)z.next_in[1] & 0xff) << 8 | - ((unsigned)z.next_in[2] & 0xff) << 16 | - ((unsigned)z.next_in[3] & 0xff) << 24; + origlen = le32dec(&z.next_in[0]); if (origlen != out_sub_tot) { maybe_warnx("invalid compressed" @@ -1497,7 +1492,7 @@ file_uncompress(char *file, char *outfile, size_t outs goto lose; } infile_newdata(rv); - timestamp = ts[3] << 24 | ts[2] << 16 | ts[1] << 8 | ts[0]; + timestamp = le32dec(&ts[0]); if (header1[3] & ORIG_NAME) { rbytes = pread(fd, name, sizeof(name) - 1, GZIP_ORIGNAME); @@ -2177,16 +2172,10 @@ print_list(int fd, off_t out, const char *outfile, tim maybe_warnx("read of uncompressed size"); else { - usize = buf[4]; - usize |= (unsigned int)buf[5] << 8; - usize |= (unsigned int)buf[6] << 16; - usize |= (unsigned int)buf[7] << 24; + usize = le32dec(&buf[4]); in = (off_t)usize; #ifndef SMALL - crc = buf[0]; - crc |= (unsigned int)buf[1] << 8; - crc |= (unsigned int)buf[2] << 16; - crc |= (unsigned int)buf[3] << 24; + crc = le32dec(&buf[0]); #endif } } From owner-svn-src-head@freebsd.org Tue Jul 10 02:43:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43B1310327B5; Tue, 10 Jul 2018 02:43:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFA3F77ABA; Tue, 10 Jul 2018 02:43:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 916EB1DD98; Tue, 10 Jul 2018 02:43:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A2hNtO035291; Tue, 10 Jul 2018 02:43:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A2hN5M035290; Tue, 10 Jul 2018 02:43:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807100243.w6A2hN5M035290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Jul 2018 02:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336157 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 336157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 02:43:24 -0000 Author: kevans Date: Tue Jul 10 02:43:22 2018 New Revision: 336157 URL: https://svnweb.freebsd.org/changeset/base/336157 Log: kern_environment: bool'itize dynamic_kenv; fix small style(9) nit Modified: head/sys/kern/kern_environment.c head/sys/sys/systm.h Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Tue Jul 10 01:42:28 2018 (r336156) +++ head/sys/kern/kern_environment.c Tue Jul 10 02:43:22 2018 (r336157) @@ -39,7 +39,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -81,7 +80,7 @@ struct mtx kenv_lock; /* * No need to protect this with a mutex since SYSINITS are single threaded. */ -int dynamic_kenv = 0; +bool dynamic_kenv; #define KENV_CHECK if (!dynamic_kenv) \ panic("%s: called before SI_SUB_KMEM", __func__) @@ -100,7 +99,7 @@ sys_kenv(td, uap) size_t len, done, needed, buflen; int error, i; - KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0")); + KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = false")); error = 0; if (uap->what == KENV_DUMP) { @@ -344,7 +343,7 @@ init_dynamic_kenv(void *data __unused) kenvp[dynamic_envpos] = NULL; mtx_init(&kenv_lock, "kernel environment", NULL, MTX_DEF); - dynamic_kenv = 1; + dynamic_kenv = true; } SYSINIT(kenv, SI_SUB_KMEM + 1, SI_ORDER_FIRST, init_dynamic_kenv, NULL); @@ -498,7 +497,7 @@ kern_setenv(const char *name, const char *value) char *buf, *cp, *oldenv; int namelen, vallen, i; - if (dynamic_kenv == 0 && md_env_len > 0) + if (!dynamic_kenv && md_env_len > 0) return (setenv_static(name, value)); KENV_CHECK; Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Jul 10 01:42:28 2018 (r336156) +++ head/sys/sys/systm.h Tue Jul 10 02:43:22 2018 (r336157) @@ -156,7 +156,7 @@ void kassert_panic(const char *fmt, ...) __printflike * XXX most of these variables should be const. */ extern int osreldate; -extern int dynamic_kenv; +extern bool dynamic_kenv; extern struct mtx kenv_lock; extern char *kern_envp; extern char *md_envp; From owner-svn-src-head@freebsd.org Tue Jul 10 03:03:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 534CF10352FC; Tue, 10 Jul 2018 03:03:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07D70793E5; Tue, 10 Jul 2018 03:03:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C30D11E198; Tue, 10 Jul 2018 03:03:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A33Amo046381; Tue, 10 Jul 2018 03:03:10 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A33APc046380; Tue, 10 Jul 2018 03:03:10 GMT (envelope-from np@FreeBSD.org) Message-Id: <201807100303.w6A33APc046380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 10 Jul 2018 03:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336159 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 336159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 03:03:11 -0000 Author: np Date: Tue Jul 10 03:03:10 2018 New Revision: 336159 URL: https://svnweb.freebsd.org/changeset/base/336159 Log: cxgbe(4): Add a sysctl to report the chip's microprocessor's load averages. This works with debug or custom firmwares only. sysctl dev...loadavg sysctl dev.t6nex.0.loadavg MFC after: 1 month Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 10 02:46:31 2018 (r336158) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 10 03:03:10 2018 (r336159) @@ -559,6 +559,7 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS); static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); +static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); static int sysctl_cim_la(SYSCTL_HANDLER_ARGS); @@ -5542,6 +5543,10 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RD, sc, 0, sysctl_temperature, "I", "chip temperature (in Celsius)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "loadavg", CTLTYPE_STRING | + CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", + "microprocessor load averages (debug firmwares only)"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, &sc->params.core_vdd, 0, "core Vdd (in mV)"); @@ -6606,6 +6611,45 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) t = val == 0 ? -1 : val; rc = sysctl_handle_int(oidp, &t, 0, req); + return (rc); +} + +static int +sysctl_loadavg(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct sbuf *sb; + int rc; + uint32_t param, val; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4lavg"); + if (rc) + return (rc); + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_LOAD); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + if (sb == NULL) + return (ENOMEM); + + if (val == 0xffffffff) { + /* Only debug and custom firmwares report load averages. */ + sbuf_printf(sb, "not available"); + } else { + sbuf_printf(sb, "%d %d %d", val & 0xff, (val >> 8) & 0xff, + (val >> 16) & 0xff); + } + rc = sbuf_finish(sb); + sbuf_delete(sb); + return (rc); } From owner-svn-src-head@freebsd.org Tue Jul 10 03:49:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAD2F103CAE7; Tue, 10 Jul 2018 03:49:50 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E4A17BFFE; Tue, 10 Jul 2018 03:49:50 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F6211E963; Tue, 10 Jul 2018 03:49:50 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A3noZ5068094; Tue, 10 Jul 2018 03:49:50 GMT (envelope-from daichi@FreeBSD.org) Received: (from daichi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A3nnUi068089; Tue, 10 Jul 2018 03:49:49 GMT (envelope-from daichi@FreeBSD.org) Message-Id: <201807100349.w6A3nnUi068089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: daichi set sender to daichi@FreeBSD.org using -f From: Daichi GOTO Date: Tue, 10 Jul 2018 03:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336160 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: daichi X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 336160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 03:49:51 -0000 Author: daichi Date: Tue Jul 10 03:49:48 2018 New Revision: 336160 URL: https://svnweb.freebsd.org/changeset/base/336160 Log: top(1): rollback r335836 Encoding-specific processing introduced in r335836 is not recommended. And doing getenv("LANG") and assuming an encoding based on it is a very bad practice to internationalize software. Submitted by: hrs Differential Revision: https://reviews.freebsd.org/D16203 Modified: head/usr.bin/top/display.c head/usr.bin/top/machine.c head/usr.bin/top/top.c head/usr.bin/top/top.h head/usr.bin/top/utils.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Tue Jul 10 03:03:10 2018 (r336159) +++ head/usr.bin/top/display.c Tue Jul 10 03:49:48 2018 (r336160) @@ -1275,43 +1275,19 @@ line_update(char *old, char *new, int start, int line) char * printable(char str[]) { - char *ptr; - char ch; + char *ptr; + char ch; - ptr = str; - if (utf8flag) { - while ((ch = *ptr) != '\0') { - if (0x00 == (0x80 & ch)) { - if (!isprint(ch)) { - *ptr = '?'; - } - ++ptr; - } else if (0xC0 == (0xE0 & ch)) { - ++ptr; - if ('\0' != *ptr) ++ptr; - } else if (0xE0 == (0xF0 & ch)) { - ++ptr; - if ('\0' != *ptr) ++ptr; - if ('\0' != *ptr) ++ptr; - } else if (0xF0 == (0xF8 & ch)) { - ++ptr; - if ('\0' != *ptr) ++ptr; - if ('\0' != *ptr) ++ptr; - if ('\0' != *ptr) ++ptr; - } else { - *ptr = '?'; - ++ptr; - } - } - } else { - while ((ch = *ptr) != '\0') { - if (!isprint(ch)) { - *ptr = '?'; - } - ptr++; - } + ptr = str; + while ((ch = *ptr) != '\0') + { + if (!isprint(ch)) + { + *ptr = '?'; } - return(str); + ptr++; + } + return(str); } void Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Tue Jul 10 03:03:10 2018 (r336159) +++ head/usr.bin/top/machine.c Tue Jul 10 03:49:48 2018 (r336160) @@ -985,13 +985,9 @@ format_next_process(struct handle * xhandle, char *(*g if (*src == '\0') continue; len = (argbuflen - (dst - argbuf) - 1) / 4; - if (utf8flag) { - utf8strvisx(dst, src, MIN(strlen(src), len)); - } else { - strvisx(dst, src, - MIN(strlen(src), len), - VIS_NL | VIS_CSTYLE); - } + strvisx(dst, src, + MIN(strlen(src), len), + VIS_NL | VIS_CSTYLE); while (*dst != '\0') dst++; if ((argbuflen - (dst - argbuf) - 1) / 4 > 0) Modified: head/usr.bin/top/top.c ============================================================================== --- head/usr.bin/top/top.c Tue Jul 10 03:03:10 2018 (r336159) +++ head/usr.bin/top/top.c Tue Jul 10 03:49:48 2018 (r336160) @@ -69,7 +69,6 @@ static int max_topn; /* maximum displayable processes struct process_select ps; const char * myname = "top"; pid_t mypid; -bool utf8flag = false; /* pointers to display routines */ static void (*d_loadave)(int mpid, double *avenrun) = i_loadave; @@ -606,14 +605,6 @@ main(int argc, char *argv[]) sleep(3 * warnings); fputc('\n', stderr); } - - /* check if you are using UTF-8 */ - char *env_lang; - if (NULL != (env_lang = getenv("LANG")) && - 0 != strcmp(env_lang, "") && - NULL != strstr(env_lang, "UTF-8")) { - utf8flag = true; - } restart: Modified: head/usr.bin/top/top.h ============================================================================== --- head/usr.bin/top/top.h Tue Jul 10 03:03:10 2018 (r336159) +++ head/usr.bin/top/top.h Tue Jul 10 03:49:48 2018 (r336160) @@ -8,7 +8,6 @@ #define TOP_H #include -#include /* Number of lines of header information on the standard screen */ extern int Header_lines; @@ -35,7 +34,6 @@ extern enum displaymodes displaymode; extern int pcpu_stats; extern int overstrike; extern pid_t mypid; -extern bool utf8flag; extern const char * myname; Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Tue Jul 10 03:03:10 2018 (r336159) +++ head/usr.bin/top/utils.c Tue Jul 10 03:49:48 2018 (r336160) @@ -2,7 +2,6 @@ * This program may be freely redistributed, * but this entire comment MUST remain intact. * - * Copyright (c) 2018, Daichi Goto * Copyright (c) 2018, Eitan Adler * Copyright (c) 1984, 1989, William LeFebvre, Rice University * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University @@ -328,62 +327,4 @@ find_pid(pid_t pid) done: kvm_close(kd); return ret; -} - -/* - * utf8strvisx(dst,src,src_len) - * strvisx(dst,src,src_len,VIS_NL|VIS_CSTYLE) coresponding to UTF-8. - */ -static const char *vis_encodes[] = { - "\\0", "\\^A", "\\^B", "\\^C", "\\^D", "\\^E", "\\^F", "\\a", - "\\b", "\t", "\\n", "\\v", "\\f", "\\r", "\\^N", "\\^O", "\\^P", - "\\^Q", "\\^R", "\\^S", "\\^T", "\\^U", "\\^V", "\\^W", "\\^X", - "\\^Y", "\\^Z", "\\^[", "\\^\\", "\\^]", "\\^^", "\\^_" -}; - -int -utf8strvisx(char *dst, const char *src, size_t src_len) -{ - const signed char *src_p; - char *dst_p; - int i, j, olen, len; - - src_p = src; - dst_p = dst; - i = olen = 0; - len = (int)src_len; - while (i < len) { - if (0x00 == (0x80 & *src_p)) { - if (0 <= *src_p && *src_p <= 31) { - j = strlen(vis_encodes[(int)*src_p]); - strcpy(dst_p, vis_encodes[(int)*src_p]); - dst_p += j; - olen += j; - } else if (127 == *src_p) { - strcpy(dst_p, "\\^?"); - olen += 3; - } else { - *dst_p++ = *src_p; - ++olen; - } - ++i; - ++src_p; - } else if (0xC0 == (0xE0 & *src_p)) { - *dst_p++ = *src_p++; ++i; ++olen; - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - } else if (0xE0 == (0xF0 & *src_p)) { - *dst_p++ = *src_p++; ++i; ++olen; - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - } else if (0xF0 == (0xF8 & *src_p)) { - *dst_p++ = *src_p++; ++i; ++olen; - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - if (i < len) { *dst_p++ = *src_p++; ++i; ++olen; } - } else { - *dst_p++ = '?'; ++i; ++olen; - } - } - - return olen; } From owner-svn-src-head@freebsd.org Tue Jul 10 05:36:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA76A1047E2C; Tue, 10 Jul 2018 05:36:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8CC81F9B; Tue, 10 Jul 2018 05:36:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 607ED1FCFF; Tue, 10 Jul 2018 05:36:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A5aXis025189; Tue, 10 Jul 2018 05:36:33 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A5aXkT025188; Tue, 10 Jul 2018 05:36:33 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201807100536.w6A5aXkT025188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 10 Jul 2018 05:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336162 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 336162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 05:36:34 -0000 Author: araujo Date: Tue Jul 10 05:36:32 2018 New Revision: 336162 URL: https://svnweb.freebsd.org/changeset/base/336162 Log: Fix style(9) space and tab. Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Tue Jul 10 04:26:32 2018 (r336161) +++ head/usr.sbin/bhyve/pci_virtio_block.c Tue Jul 10 05:36:32 2018 (r336162) @@ -109,7 +109,7 @@ struct virtio_blk_hdr { #define VBH_OP_WRITE 1 #define VBH_OP_FLUSH 4 #define VBH_OP_FLUSH_OUT 5 -#define VBH_OP_IDENT 8 +#define VBH_OP_IDENT 8 #define VBH_FLAG_BARRIER 0x80000000 /* OR'ed into vbh_type */ uint32_t vbh_type; uint32_t vbh_ioprio; @@ -151,7 +151,7 @@ static int pci_vtblk_cfgwrite(void *, int, int, uint32 static struct virtio_consts vtblk_vi_consts = { "vtblk", /* our name */ 1, /* we support 1 virtqueue */ - sizeof(struct vtblk_config), /* config reg size */ + sizeof(struct vtblk_config), /* config reg size */ pci_vtblk_reset, /* reset */ pci_vtblk_notify, /* device-wide qnotify */ pci_vtblk_cfgread, /* read PCI config */ @@ -249,7 +249,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vque } io->io_req.br_resid = iolen; - DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", + DPRINTF(("virtio-block: %s op, %zd bytes, %d segs, offset %ld\n\r", writeop ? "write" : "read/ident", iolen, i - 1, io->io_req.br_offset)); @@ -309,7 +309,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * */ snprintf(bident, sizeof(bident), "%d:%d", pi->pi_slot, pi->pi_func); bctxt = blockif_open(opts, bident); - if (bctxt == NULL) { + if (bctxt == NULL) { perror("Could not open backing file"); return (1); } @@ -343,7 +343,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * */ MD5Init(&mdctx); MD5Update(&mdctx, opts, strlen(opts)); - MD5Final(digest, &mdctx); + MD5Final(digest, &mdctx); sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); From owner-svn-src-head@freebsd.org Tue Jul 10 06:09:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24918104A53A; Tue, 10 Jul 2018 06:09:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAA2083222; Tue, 10 Jul 2018 06:09:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A739C201EF; Tue, 10 Jul 2018 06:09:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A69PXR040249; Tue, 10 Jul 2018 06:09:25 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A69PSV040248; Tue, 10 Jul 2018 06:09:25 GMT (envelope-from np@FreeBSD.org) Message-Id: <201807100609.w6A69PSV040248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 10 Jul 2018 06:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336163 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 336163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 06:09:26 -0000 Author: np Date: Tue Jul 10 06:09:25 2018 New Revision: 336163 URL: https://svnweb.freebsd.org/changeset/base/336163 Log: Fix vertical whitespace nit in cxgbe. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 10 05:36:32 2018 (r336162) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 10 06:09:25 2018 (r336163) @@ -8692,7 +8692,6 @@ sysctl_cpus(SYSCTL_HANDLER_ARGS) sbuf_delete(sb); return (rc); - } #ifdef TCP_OFFLOAD From owner-svn-src-head@freebsd.org Tue Jul 10 07:52:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76A7C102CBF3 for ; Tue, 10 Jul 2018 07:52:17 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 0064D87239 for ; Tue, 10 Jul 2018 07:52:16 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-ed1-x52f.google.com with SMTP id v22-v6so15863944edq.4 for ; Tue, 10 Jul 2018 00:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=mPFbbUnzghFWB+cwzy/4GWELN5lcTAdjhJGi/v++qZE=; b=XD8wYDuvhRtbPsaXgG+GDIpz0+WwkUs90aQrzmtyCmqKS8gtUZ/QTTmTCtrb4aazEO qcb3VeYiaNRPoI4xPWt1w6cbZlDMr+Du7avcqb0bHi/6qCjXiOgkcnxWqEqfPbqIHLAK KilB3lMkruOrEarTtWmXcqHoc5v1CRWG9VRKTNzkJWJLo1+QrgjWFyGtInL8/idzR4HQ KxsyAPRmCRNi+w3Vy8n6YkUONBs/dTLad0LiYNBHEkhqwnjtZPvOJwhdmnVQgraO82lu pN8UBlR5RZN3x/cAgp/bxWgy0ZzkRcEuMkgfJFLm5nJEkOj+tjE19qteZX/+r3HzrJqW PacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=mPFbbUnzghFWB+cwzy/4GWELN5lcTAdjhJGi/v++qZE=; b=rXoqVkCN2LgQjuyto2IVhjfAuYXuy1fu8VVHIpLHaWfWbaduZ5VJ8ZUMZkB3Jz6Tjt mkRy/sREwcO92Eubo/PSALIS989jAbJbvq25jGqOyIflL8MOvTUayq+jgFa4qXalUHGE yBbko6tEc1vfK1q+n3ulXDrdYbEbzNL8guJLjhq1dJz8KjuU+WWJGptrj3TIuvx2gQl5 b3l6CRZNtZ0wuNtGmbqikjJLeR5fqmKFS7G3wjX1I1530SJ6zIdak08R+eCMDGpa6GXV Ju2L4bNRS3ujYTQY2rqnIoi5BOSWttqjz6sgC5KlyQEEdxFv0utpppCwfTktHW2ysgyu 8EWQ== X-Gm-Message-State: APt69E04KO1mPxx+yDTezv7HUPn6seLrwbBk/eINTUaJXZ9g0DKZmHHn /GjwPnCL74FcEZ3SFE62cRFi+MmV47I= X-Google-Smtp-Source: AAOMgpfna/adlUKh+jnzKo3HI8DGWIy36pYIRohuPTpyrjtHF1n3pZIppkmRm5zZjuXzu8VzNDPpDg== X-Received: by 2002:a50:a9e2:: with SMTP id n89-v6mr11025005edc.158.1531209135422; Tue, 10 Jul 2018 00:52:15 -0700 (PDT) Received: from [10.44.128.75] ([161.12.40.153]) by smtp.gmail.com with ESMTPSA id s21-v6sm7719556edr.62.2018.07.10.00.52.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 00:52:13 -0700 (PDT) Subject: Re: svn commit: r335856 - in head/sys: netinet sys To: rgrimes@freebsd.org, "Jonathan T. Looney" Cc: Matt Macy , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807021630.w62GUVEQ034521@pdx.rh.CN85.dnsmgr.net> From: Steven Hartland Message-ID: <796f5a04-a4a5-372d-d2ed-4b36d6b04392@multiplay.co.uk> Date: Tue, 10 Jul 2018 08:52:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201807021630.w62GUVEQ034521@pdx.rh.CN85.dnsmgr.net> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 07:52:17 -0000 Sorry guys I didn't spot it was just a revert as it was tagged on to the end of the description, I would have expected that to be in the subject. What do others think, is there an recommend style for revert commit messages?     Regards     Steve On 02/07/2018 17:30, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> On Mon, Jul 2, 2018 at 10:44 AM Steven Hartland < >> steven.hartland@multiplay.co.uk> wrote: >>> You have M_WAITOK and a null check in this change >> And, that's the same as the way it was before his commits. So, he did >> exactly what he said he was doing and reverted his commits. I don't think >> it is good practice to mix reverts with other changes. > It is a very bad practive to mix a revert with anything. > >> Since you've noticed this, I think you should feel free to make the change. >> Jonathan From owner-svn-src-head@freebsd.org Tue Jul 10 08:05:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94F4F102E330; Tue, 10 Jul 2018 08:05:33 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 411688840E; Tue, 10 Jul 2018 08:05:33 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22134214F8; Tue, 10 Jul 2018 08:05:33 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A85Wht001038; Tue, 10 Jul 2018 08:05:32 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A85Wg0001037; Tue, 10 Jul 2018 08:05:32 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201807100805.w6A85Wg0001037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 10 Jul 2018 08:05:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336165 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: smh X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 336165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 08:05:33 -0000 Author: smh Date: Tue Jul 10 08:05:32 2018 New Revision: 336165 URL: https://svnweb.freebsd.org/changeset/base/336165 Log: Removed pointless NULL check Removed pointless NULL check after malloc with M_WAITOK which can never return NULL. Sponsored by: Multiplay Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Tue Jul 10 07:29:51 2018 (r336164) +++ head/sys/netinet/raw_ip.c Tue Jul 10 08:05:32 2018 (r336165) @@ -1069,8 +1069,6 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) return (error); inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - if (inp_list == NULL) - return (ENOMEM); INP_INFO_RLOCK_ET(&V_ripcbinfo, et); for (inp = CK_LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp && i < n; From owner-svn-src-head@freebsd.org Tue Jul 10 09:49:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB3291039A1B; Tue, 10 Jul 2018 09:49:28 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D47B8D109; Tue, 10 Jul 2018 09:49:28 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4055222530; Tue, 10 Jul 2018 09:49:28 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6A9nSeh054147; Tue, 10 Jul 2018 09:49:28 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6A9nShj054146; Tue, 10 Jul 2018 09:49:28 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201807100949.w6A9nShj054146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 10 Jul 2018 09:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336166 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 336166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 09:49:29 -0000 Author: wma Date: Tue Jul 10 09:49:27 2018 New Revision: 336166 URL: https://svnweb.freebsd.org/changeset/base/336166 Log: Fix build broken by r336130 Add ifdef's to compile parts of pci_host_generic only on armv8 Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Tue Jul 10 08:05:32 2018 (r336165) +++ head/sys/dev/pci/pci_host_generic.c Tue Jul 10 09:49:27 2018 (r336166) @@ -99,6 +99,8 @@ static int generic_pcie_read_ivar(device_t dev, device uintptr_t *result); static int generic_pcie_write_ivar(device_t dev, device_t child, int index, uintptr_t value); + +#if defined(__aarch64__) static void pci_host_generic_apply_quirks(device_t); static void thunderx2_ahci_bar_quirk(device_t); @@ -114,6 +116,7 @@ struct pci_host_generic_block_entry pci_host_generic_b {CPU_IMPL_CAVIUM, CPU_PART_THUNDERX2, 0, 0, 0x80, 0x10}, {0, 0, 0, 0, 0, 0} }; +#endif int pci_host_generic_core_attach(device_t dev) @@ -168,11 +171,14 @@ pci_host_generic_core_attach(device_t dev) return (error); } +#if defined(__aarch64__) pci_host_generic_apply_quirks(dev); +#endif return (0); } +#if defined(__aarch64__) static void pci_host_generic_apply_quirks(device_t dev) { @@ -191,6 +197,7 @@ pci_host_generic_apply_quirks(device_t dev) quirk++; } } +#endif static uint32_t generic_pcie_read_config(device_t dev, u_int bus, u_int slot, @@ -201,12 +208,15 @@ generic_pcie_read_config(device_t dev, u_int bus, u_in bus_space_tag_t t; uint64_t offset; uint32_t data; +#if defined(__aarch64__) struct pci_host_generic_block_entry *block; +#endif if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) return (~0U); +#if defined(__aarch64__) block = pci_host_generic_blocked; while (1) { if (block->impl == 0) @@ -219,6 +229,7 @@ generic_pcie_read_config(device_t dev, u_int bus, u_in block++; } +#endif sc = device_get_softc(dev); @@ -462,6 +473,7 @@ static device_method_t generic_pcie_methods[] = { DEFINE_CLASS_0(pcib, generic_pcie_core_driver, generic_pcie_methods, sizeof(struct generic_pcie_core_softc)); +#if defined(__aarch64__) static void thunderx2_ahci_bar_quirk(device_t dev) { @@ -478,3 +490,4 @@ static void thunderx2_ahci_bar_quirk(device_t dev) PCIB_WRITE_CONFIG(dev, 0, 16, 1, 0x1c, 0x40, 4); } } +#endif From owner-svn-src-head@freebsd.org Tue Jul 10 10:42:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E367103E41B; Tue, 10 Jul 2018 10:42:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DE198F8A3; Tue, 10 Jul 2018 10:42:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C58222EC5; Tue, 10 Jul 2018 10:42:49 +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 w6AAgnEs084230; Tue, 10 Jul 2018 10:42:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AAgm1c084227; Tue, 10 Jul 2018 10:42:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807101042.w6AAgm1c084227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 10 Jul 2018 10:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336167 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 336167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 10:42:49 -0000 Author: tuexen Date: Tue Jul 10 10:42:48 2018 New Revision: 336167 URL: https://svnweb.freebsd.org/changeset/base/336167 Log: Use appropriate MSS value when populating the TCP FO client cookie cache When a client receives a SYN-ACK segment with a TFP fast open cookie, but without an MSS option, an MSS value from uninitialised stack memory is used. This patch ensures that in case no MSS option is included in the SYN-ACK, the appropriate value as given in RFC 7413 is used. Reviewed by: kbowling@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16175 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Jul 10 09:49:27 2018 (r336166) +++ head/sys/netinet/tcp_input.c Tue Jul 10 10:42:48 2018 (r336167) @@ -1674,10 +1674,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; if (IS_FASTOPEN(tp->t_flags)) { - if (to.to_flags & TOF_FASTOPEN) - tcp_fastopen_update_cache(tp, to.to_mss, + if (to.to_flags & TOF_FASTOPEN) { + uint16_t mss; + + if (to.to_flags & TOF_MSS) + mss = to.to_mss; + else + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) + mss = TCP6_MSS; + else + mss = TCP_MSS; + tcp_fastopen_update_cache(tp, mss, to.to_tfo_len, to.to_tfo_cookie); - else + } else tcp_fastopen_disable_path(tp); } } Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Tue Jul 10 09:49:27 2018 (r336166) +++ head/sys/netinet/tcp_stacks/fastpath.c Tue Jul 10 10:42:48 2018 (r336167) @@ -1763,10 +1763,19 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; if (IS_FASTOPEN(tp->t_flags)) { - if (to.to_flags & TOF_FASTOPEN) - tcp_fastopen_update_cache(tp, to.to_mss, + if (to.to_flags & TOF_FASTOPEN) { + uint16_t mss; + + if (to.to_flags & TOF_MSS) + mss = to.to_mss; + else + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) + mss = TCP6_MSS; + else + mss = TCP_MSS; + tcp_fastopen_update_cache(tp, mss, to.to_tfo_len, to.to_tfo_cookie); - else + } else tcp_fastopen_disable_path(tp); } } @@ -2220,10 +2229,19 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr * (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; if (IS_FASTOPEN(tp->t_flags)) { - if (to.to_flags & TOF_FASTOPEN) - tcp_fastopen_update_cache(tp, to.to_mss, + if (to.to_flags & TOF_FASTOPEN) { + uint16_t mss; + + if (to.to_flags & TOF_MSS) + mss = to.to_mss; + else + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) + mss = TCP6_MSS; + else + mss = TCP_MSS; + tcp_fastopen_update_cache(tp, mss, to.to_tfo_len, to.to_tfo_cookie); - else + } else tcp_fastopen_disable_path(tp); } } Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Tue Jul 10 09:49:27 2018 (r336166) +++ head/sys/netinet/tcp_stacks/rack.c Tue Jul 10 10:42:48 2018 (r336167) @@ -6657,10 +6657,19 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; if (IS_FASTOPEN(tp->t_flags)) { - if (to.to_flags & TOF_FASTOPEN) - tcp_fastopen_update_cache(tp, to.to_mss, + if (to.to_flags & TOF_FASTOPEN) { + uint16_t mss; + + if (to.to_flags & TOF_MSS) + mss = to.to_mss; + else + if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) + mss = TCP6_MSS; + else + mss = TCP_MSS; + tcp_fastopen_update_cache(tp, mss, to.to_tfo_len, to.to_tfo_cookie); - else + } else tcp_fastopen_disable_path(tp); } } From owner-svn-src-head@freebsd.org Tue Jul 10 10:50:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D69D103ED71; Tue, 10 Jul 2018 10:50:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D94538FE26; Tue, 10 Jul 2018 10:50:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA1C422EF2; Tue, 10 Jul 2018 10:50:43 +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 w6AAohft084640; Tue, 10 Jul 2018 10:50:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AAohxh084639; Tue, 10 Jul 2018 10:50:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807101050.w6AAohxh084639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 10 Jul 2018 10:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336168 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 336168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 10:50:44 -0000 Author: tuexen Date: Tue Jul 10 10:50:43 2018 New Revision: 336168 URL: https://svnweb.freebsd.org/changeset/base/336168 Log: Add support for printing the TCP FO client-side cookie cache via the sysctl interface. This is similar to the TCP host cache. Reviewed by: pkelsey@, kbowling@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D14554 Modified: head/sys/netinet/tcp_fastopen.c Modified: head/sys/netinet/tcp_fastopen.c ============================================================================== --- head/sys/netinet/tcp_fastopen.c Tue Jul 10 10:42:48 2018 (r336167) +++ head/sys/netinet/tcp_fastopen.c Tue Jul 10 10:50:43 2018 (r336168) @@ -81,6 +81,9 @@ * (RDTUN, default TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT) * The number of client cookie cache buckets. * + * net.inet.tcp.fastopen.ccache_list (RO) + * Print the client cookie cache. + * * net.inet.tcp.fastopen.client_enable (RW, default 0) * When zero, no new active (i.e., client) TFO connections can be * created. On the transition from enabled to disabled, the client @@ -166,11 +169,14 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include +#include #include #include #include #include +#include #include +#include #include #include #include @@ -343,6 +349,12 @@ SYSCTL_PROC(_net_inet_tcp_fastopen, OID_AUTO, setpsk, &sysctl_net_inet_tcp_fastopen_setpsk, "", "Install a new pre-shared key"); +static int sysctl_net_inet_tcp_fastopen_ccache_list(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_net_inet_tcp_fastopen, OID_AUTO, ccache_list, + CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_SKIP, NULL, 0, + sysctl_net_inet_tcp_fastopen_ccache_list, "A", + "List of all client cookie cache entries"); + static VNET_DEFINE(struct rmlock, tcp_fastopen_keylock); #define V_tcp_fastopen_keylock VNET(tcp_fastopen_keylock) @@ -1133,5 +1145,81 @@ tcp_fastopen_ccache_entry_drop(struct tcp_fastopen_cca TAILQ_REMOVE(&ccb->ccb_entries, cce, cce_link); ccb->ccb_num_entries--; uma_zfree(V_tcp_fastopen_ccache.zone, cce); +} + +static int +sysctl_net_inet_tcp_fastopen_ccache_list(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sb; + struct tcp_fastopen_ccache_bucket *ccb; + struct tcp_fastopen_ccache_entry *cce; + sbintime_t now, duration, limit; + const int linesize = 128; + int i, error, num_entries; + unsigned int j; +#ifdef INET6 + char clt_buf[INET6_ADDRSTRLEN], srv_buf[INET6_ADDRSTRLEN]; +#else + char clt_buf[INET_ADDRSTRLEN], srv_buf[INET_ADDRSTRLEN]; +#endif + + if (jailed_without_vnet(curthread->td_ucred) != 0) + return (EPERM); + + /* Only allow root to read the client cookie cache */ + if (curthread->td_ucred->cr_uid != 0) + return (EPERM); + + num_entries = 0; + for (i = 0; i < V_tcp_fastopen_ccache.buckets; i++) { + ccb = &V_tcp_fastopen_ccache.base[i]; + CCB_LOCK(ccb); + if (ccb->ccb_num_entries > 0) + num_entries += ccb->ccb_num_entries; + CCB_UNLOCK(ccb); + } + sbuf_new(&sb, NULL, linesize * (num_entries + 1), SBUF_INCLUDENUL); + + sbuf_printf(&sb, + "\nLocal IP address Remote IP address Port MSS" + " Disabled Cookie\n"); + + now = getsbinuptime(); + limit = (sbintime_t)V_tcp_fastopen_path_disable_time << 32; + for (i = 0; i < V_tcp_fastopen_ccache.buckets; i++) { + ccb = &V_tcp_fastopen_ccache.base[i]; + CCB_LOCK(ccb); + TAILQ_FOREACH(cce, &ccb->ccb_entries, cce_link) { + if (cce->disable_time != 0) { + duration = now - cce->disable_time; + if (limit >= duration) + duration = limit - duration; + else + duration = 0; + } else + duration = 0; + sbuf_printf(&sb, + "%-20s %-20s %5u %5u ", + inet_ntop(cce->af, &cce->cce_client_ip, + clt_buf, sizeof(clt_buf)), + inet_ntop(cce->af, &cce->cce_server_ip, + srv_buf, sizeof(srv_buf)), + ntohs(cce->server_port), + cce->server_mss); + if (duration > 0) + sbuf_printf(&sb, "%7ds ", sbintime_getsec(duration)); + else + sbuf_printf(&sb, "%8s ", "No"); + for (j = 0; j < cce->cookie_len; j++) + sbuf_printf(&sb, "%02x", cce->cookie[j]); + sbuf_putc(&sb, '\n'); + } + CCB_UNLOCK(ccb); + } + error = sbuf_finish(&sb); + if (error == 0) + error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb)); + sbuf_delete(&sb); + return (error); } From owner-svn-src-head@freebsd.org Tue Jul 10 11:33:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8007C1042956; Tue, 10 Jul 2018 11:33:38 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 327AC71AAC; Tue, 10 Jul 2018 11:33:38 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13A0A236E1; Tue, 10 Jul 2018 11:33:38 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ABXbeq009955; Tue, 10 Jul 2018 11:33:37 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ABXbEU009954; Tue, 10 Jul 2018 11:33:37 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201807101133.w6ABXbEU009954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 10 Jul 2018 11:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336169 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: garga X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 336169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 11:33:38 -0000 Author: garga (ports committer) Date: Tue Jul 10 11:33:37 2018 New Revision: 336169 URL: https://svnweb.freebsd.org/changeset/base/336169 Log: A direct call to echo was intruduced in r333407, which made messages to be displayed when make is called with -s. Replace it by ${ECHO}. Reviewed by: brd, bdrewery Approved by: brd, bdrewery Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D16195 Modified: head/share/mk/bsd.files.mk Modified: head/share/mk/bsd.files.mk ============================================================================== --- head/share/mk/bsd.files.mk Tue Jul 10 10:50:43 2018 (r336168) +++ head/share/mk/bsd.files.mk Tue Jul 10 11:33:37 2018 (r336169) @@ -80,7 +80,7 @@ _${group}FILES+= ${file} installdirs-${group}: - @echo installing dirs ${group}DIR ${${group}DIR} + @${ECHO} installing dirs ${group}DIR ${${group}DIR} .for dir in ${${group}DIR} .if defined(NO_ROOT) ${INSTALL} ${${group}TAG_ARGS} -d ${DESTDIR}${dir} From owner-svn-src-head@freebsd.org Tue Jul 10 13:03:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0A641049FCA; Tue, 10 Jul 2018 13:03:10 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CFCF75837; Tue, 10 Jul 2018 13:03:10 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EF9824528; Tue, 10 Jul 2018 13:03:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AD38Sp057021; Tue, 10 Jul 2018 13:03:08 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AD37gZ057013; Tue, 10 Jul 2018 13:03:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201807101303.w6AD37gZ057013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Jul 2018 13:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336170 - in head: sys/kern sys/netinet usr.bin/netstat usr.sbin/tcpdrop X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: sys/kern sys/netinet usr.bin/netstat usr.sbin/tcpdrop X-SVN-Commit-Revision: 336170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 13:03:11 -0000 Author: brooks Date: Tue Jul 10 13:03:06 2018 New Revision: 336170 URL: https://svnweb.freebsd.org/changeset/base/336170 Log: Use uintptr_t alone when assigning to kvaddr_t variables. Suggested by: jhb Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_socket.c head/sys/kern/uipc_usrreq.c head/sys/netinet/in_pcb.c head/sys/netinet/sctp_sysctl.c head/usr.bin/netstat/inet.c head/usr.bin/netstat/unix.c head/usr.sbin/tcpdrop/tcpdrop.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/sys/kern/kern_descrip.c Tue Jul 10 13:03:06 2018 (r336170) @@ -3362,10 +3362,10 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) if ((fp = fdp->fd_ofiles[n].fde_file) == NULL) continue; xf.xf_fd = n; - xf.xf_file = (kvaddr_t)(uintptr_t)fp; - xf.xf_data = (kvaddr_t)(uintptr_t)fp->f_data; - xf.xf_vnode = (kvaddr_t)(uintptr_t)fp->f_vnode; - xf.xf_type = (kvaddr_t)(uintptr_t)fp->f_type; + xf.xf_file = (uintptr_t)fp; + xf.xf_data = (uintptr_t)fp->f_data; + xf.xf_vnode = (uintptr_t)fp->f_vnode; + xf.xf_type = (uintptr_t)fp->f_type; xf.xf_count = fp->f_count; xf.xf_msgcount = 0; xf.xf_offset = foffset_get(fp); Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/sys/kern/uipc_socket.c Tue Jul 10 13:03:06 2018 (r336170) @@ -3985,12 +3985,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso) { xso->xso_len = sizeof *xso; - xso->xso_so = (kvaddr_t)(uintptr_t)so; + xso->xso_so = (uintptr_t)so; xso->so_type = so->so_type; xso->so_options = so->so_options; xso->so_linger = so->so_linger; xso->so_state = so->so_state; - xso->so_pcb = (kvaddr_t)(uintptr_t)so->so_pcb; + xso->so_pcb = (uintptr_t)so->so_pcb; xso->xso_protocol = so->so_proto->pr_protocol; xso->xso_family = so->so_proto->pr_domain->dom_family; xso->so_timeo = so->so_timeo; Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/sys/kern/uipc_usrreq.c Tue Jul 10 13:03:06 2018 (r336170) @@ -1853,7 +1853,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) if (freeunp == 0 && unp->unp_gencnt <= gencnt) { xu->xu_len = sizeof *xu; - xu->xu_unpp = (kvaddr_t)(uintptr_t)unp; + xu->xu_unpp = (uintptr_t)unp; /* * XXX - need more locking here to protect against * connect/disconnect races for SMP. @@ -1870,12 +1870,10 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) unp->unp_conn->unp_addr->sun_len); else bzero(&xu->xu_caddr, sizeof(xu->xu_caddr)); - xu->unp_vnode = (kvaddr_t)(uintptr_t)unp->unp_vnode; - xu->unp_conn = (kvaddr_t)(uintptr_t)unp->unp_conn; - xu->xu_firstref = - (kvaddr_t)(uintptr_t)LIST_FIRST(&unp->unp_refs); - xu->xu_nextref = - (kvaddr_t)(uintptr_t)LIST_NEXT(unp, unp_reflink); + xu->unp_vnode = (uintptr_t)unp->unp_vnode; + xu->unp_conn = (uintptr_t)unp->unp_conn; + xu->xu_firstref = (uintptr_t)LIST_FIRST(&unp->unp_refs); + xu->xu_nextref = (uintptr_t)LIST_NEXT(unp, unp_reflink); xu->unp_gencnt = unp->unp_gencnt; sotoxsocket(unp->unp_socket, &xu->xu_socket); UNP_PCB_UNLOCK(unp); Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/sys/netinet/in_pcb.c Tue Jul 10 13:03:06 2018 (r336170) @@ -2906,7 +2906,7 @@ in_pcbtoxinpcb(const struct inpcb *inp, struct xinpcb bzero(&xi->xi_socket, sizeof(struct xsocket)); bcopy(&inp->inp_inc, &xi->inp_inc, sizeof(struct in_conninfo)); xi->inp_gencnt = inp->inp_gencnt; - xi->inp_ppcb = (kvaddr_t)(uintptr_t)inp->inp_ppcb; + xi->inp_ppcb = (uintptr_t)inp->inp_ppcb; xi->inp_flow = inp->inp_flow; xi->inp_flowid = inp->inp_flowid; xi->inp_flowtype = inp->inp_flowtype; Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/sys/netinet/sctp_sysctl.c Tue Jul 10 13:03:06 2018 (r336170) @@ -409,7 +409,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xinpcb.total_recvs = inp->total_recvs; xinpcb.total_nospaces = inp->total_nospaces; xinpcb.fragmentation_point = inp->sctp_frag_point; - xinpcb.socket = (kvaddr_t)(uintptr_t)inp->sctp_socket; + xinpcb.socket = (uintptr_t)inp->sctp_socket; so = inp->sctp_socket; if ((so == NULL) || (!SCTP_IS_LISTENING(inp)) || Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/usr.bin/netstat/inet.c Tue Jul 10 13:03:06 2018 (r336170) @@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso) bzero(xso, sizeof *xso); xso->xso_len = sizeof *xso; - xso->xso_so = (kvaddr_t)(long)so; + xso->xso_so = (uintptr_t)so; xso->so_type = so->so_type; xso->so_options = so->so_options; xso->so_linger = so->so_linger; xso->so_state = so->so_state; - xso->so_pcb = (kvaddr_t)(long)so->so_pcb; + xso->so_pcb = (uintptr_t)so->so_pcb; if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0) return (-1); xso->xso_protocol = proto.pr_protocol; Modified: head/usr.bin/netstat/unix.c ============================================================================== --- head/usr.bin/netstat/unix.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/usr.bin/netstat/unix.c Tue Jul 10 13:03:06 2018 (r336170) @@ -153,7 +153,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_lon xu.xu_len = sizeof xu; KREAD(head_off, &head, sizeof(head)); LIST_FOREACH(unp, &head, unp_link) { - xu.xu_unpp = (kvaddr_t)(long)unp; + xu.xu_unpp = (uintptr_t)unp; KREAD(unp, &unp0, sizeof (*unp)); unp = &unp0; Modified: head/usr.sbin/tcpdrop/tcpdrop.c ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.c Tue Jul 10 11:33:37 2018 (r336169) +++ head/usr.sbin/tcpdrop/tcpdrop.c Tue Jul 10 13:03:06 2018 (r336170) @@ -235,7 +235,7 @@ tcpdropall(const char *stack, int state) head = getxpcblist("net.inet.tcp.pcblist"); #define XINP_NEXT(xinp) \ - ((struct xinpgen *)(long)((uintptr_t)(xinp) + (xinp)->xig_len)) + ((struct xinpgen *)(uintptr_t)((uintptr_t)(xinp) + (xinp)->xig_len)) for (xinp = XINP_NEXT(head); xinp->xig_len > sizeof *xinp; xinp = XINP_NEXT(xinp)) { From owner-svn-src-head@freebsd.org Tue Jul 10 13:32:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1D7D1026C0A; Tue, 10 Jul 2018 13:32:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A160076C55; Tue, 10 Jul 2018 13:32:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81B99249DC; Tue, 10 Jul 2018 13:32:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ADW5cx070799; Tue, 10 Jul 2018 13:32:05 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ADW4Mv070794; Tue, 10 Jul 2018 13:32:04 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201807101332.w6ADW4Mv070794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Jul 2018 13:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336171 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: lib/libc/sys sys/compat/freebsd32 sys/kern X-SVN-Commit-Revision: 336171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 13:32:06 -0000 Author: brooks Date: Tue Jul 10 13:32:04 2018 New Revision: 336171 URL: https://svnweb.freebsd.org/changeset/base/336171 Log: Get rid of netbsd_lchown and netbsd_msync syscall entries. No valid FreeBSD binary very called them (they would call lchown and msync directly) and we haven't supported NetBSD binaries in ages. This is a respin of r335983 with a workaround for the ancient BFD linker in the libc stubs. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16193 Added: head/lib/libc/sys/compat-stub.c (contents, props changed) Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Jul 10 13:03:06 2018 (r336170) +++ head/lib/libc/sys/Makefile.inc Tue Jul 10 13:32:04 2018 (r336171) @@ -48,6 +48,8 @@ SRCS+= brk.c SRCS+= pipe.c SRCS+= vadvise.c +SRCS+= compat-stub.c + INTERPOSED = \ accept \ accept4 \ Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Tue Jul 10 13:03:06 2018 (r336170) +++ head/lib/libc/sys/Symbol.map Tue Jul 10 13:32:04 2018 (r336171) @@ -179,8 +179,6 @@ FBSD_1.0 { munlockall; munmap; nanosleep; - netbsd_lchown; - netbsd_msync; nfssvc; nmount; ntp_adjtime; @@ -777,10 +775,6 @@ FBSDprivate_1.0 { __sys_munmap; _nanosleep; __sys_nanosleep; - _netbsd_lchown; - __sys_netbsd_lchown; - _netbsd_msync; - __sys_netbsd_msync; _nfssvc; __sys_nfssvc; _nmount; Added: head/lib/libc/sys/compat-stub.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/compat-stub.c Tue Jul 10 13:32:04 2018 (r336171) @@ -0,0 +1,56 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +/* + * XXX: Ideally we'd use a common function rather than generating one + * for each compat symbol, but the bfd linker in base rejects that. + * This should be revisited once we're using only modern linkers. + */ +#define __compat_nosys(symbol, version) \ +int __compat_enosys ## symbol(void); \ +int \ +__compat_enosys ## symbol(void) \ +{ \ + \ + return (ENOSYS); \ +} \ +__sym_compat(symbol, __compat_enosys ## symbol, version) + +__compat_nosys(netbsd_lchown, FBSD_1.0); +__compat_nosys(netbsd_msync, FBSD_1.0); Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Jul 10 13:03:06 2018 (r336170) +++ head/sys/compat/freebsd32/syscalls.master Tue Jul 10 13:32:04 2018 (r336171) @@ -499,13 +499,10 @@ int count); } 273 AUE_NULL UNIMPL nosys 274 AUE_LCHMOD NOPROTO { int lchmod(char *path, mode_t mode); } -275 AUE_LCHOWN NOPROTO { int lchown(char *path, uid_t uid, \ - gid_t gid); } netbsd_lchown \ - lchown_args int +275 AUE_NULL OBSOL netbsd_lchown 276 AUE_LUTIMES STD { int freebsd32_lutimes(char *path, \ struct timeval32 *tptr); } -277 AUE_MSYNC NOPROTO { int msync(void *addr, size_t len, \ - int flags); } netbsd_msync msync_args int +277 AUE_NULL OBSOL netbsd_msync 278 AUE_STAT COMPAT11|NOPROTO { int nstat(char *path, struct nstat *ub); } 279 AUE_FSTAT COMPAT11|NOPROTO { int nfstat(int fd, struct nstat *sb); } 280 AUE_LSTAT COMPAT11|NOPROTO { int nlstat(char *path, struct nstat *ub); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Jul 10 13:03:06 2018 (r336170) +++ head/sys/kern/syscalls.master Tue Jul 10 13:32:04 2018 (r336171) @@ -630,13 +630,10 @@ size_t count); } 273 AUE_NULL UNIMPL nosys 274 AUE_LCHMOD STD { int lchmod(_In_z_ char *path, mode_t mode); } -275 AUE_LCHOWN NOPROTO { int lchown(char *path, uid_t uid, \ - gid_t gid); } netbsd_lchown lchown_args \ - int +275 AUE_NULL OBSOL netbsd_lchown 276 AUE_LUTIMES STD { int lutimes(_In_z_ char *path, \ _In_ struct timeval *tptr); } -277 AUE_MSYNC NOPROTO { int msync(_In_ void *addr, size_t len, \ - int flags); } netbsd_msync msync_args int +277 AUE_NULL OBSOL netbsd_msync 278 AUE_STAT COMPAT11 { int nstat(_In_z_ char *path, \ _Out_ struct nstat *ub); } 279 AUE_FSTAT COMPAT11 { int nfstat(int fd, _Out_ struct nstat *sb); } From owner-svn-src-head@freebsd.org Tue Jul 10 14:04:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CB501029FF6; Tue, 10 Jul 2018 14:04:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F8D47869B; Tue, 10 Jul 2018 14:04:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1104C24EDA; Tue, 10 Jul 2018 14:04:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AE4sTl089366; Tue, 10 Jul 2018 14:04:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AE4qUK089357; Tue, 10 Jul 2018 14:04:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201807101404.w6AE4qUK089357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 10 Jul 2018 14:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336172 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 336172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 14:04:55 -0000 Author: brooks Date: Tue Jul 10 14:04:52 2018 New Revision: 336172 URL: https://svnweb.freebsd.org/changeset/base/336172 Log: Regen after r336171. Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Tue Jul 10 14:04:52 2018 (r336172) @@ -226,9 +226,9 @@ #define FREEBSD32_SYS_freebsd32_lio_listio 257 #define FREEBSD32_SYS_freebsd11_freebsd32_getdents 272 #define FREEBSD32_SYS_lchmod 274 -#define FREEBSD32_SYS_netbsd_lchown 275 + /* 275 is obsolete netbsd_lchown */ #define FREEBSD32_SYS_freebsd32_lutimes 276 -#define FREEBSD32_SYS_netbsd_msync 277 + /* 277 is obsolete netbsd_msync */ #define FREEBSD32_SYS_freebsd11_nstat 278 #define FREEBSD32_SYS_freebsd11_nfstat 279 #define FREEBSD32_SYS_freebsd11_nlstat 280 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jul 10 14:04:52 2018 (r336172) @@ -284,9 +284,9 @@ const char *freebsd32_syscallnames[] = { "compat11.freebsd32_getdents", /* 272 = freebsd11 freebsd32_getdents */ "#273", /* 273 = nosys */ "lchmod", /* 274 = lchmod */ - "netbsd_lchown", /* 275 = netbsd_lchown */ + "obs_netbsd_lchown", /* 275 = obsolete netbsd_lchown */ "freebsd32_lutimes", /* 276 = freebsd32_lutimes */ - "netbsd_msync", /* 277 = netbsd_msync */ + "obs_netbsd_msync", /* 277 = obsolete netbsd_msync */ "compat11.nstat", /* 278 = freebsd11 nstat */ "compat11.nfstat", /* 279 = freebsd11 nfstat */ "compat11.nlstat", /* 280 = freebsd11 nlstat */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Tue Jul 10 14:04:52 2018 (r336172) @@ -331,9 +331,9 @@ struct sysent freebsd32_sysent[] = { { compat11(AS(freebsd11_freebsd32_getdents_args),freebsd32_getdents), AUE_O_GETDENTS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 272 = freebsd11 freebsd32_getdents */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 273 = nosys */ { AS(lchmod_args), (sy_call_t *)sys_lchmod, AUE_LCHMOD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 274 = lchmod */ - { AS(lchown_args), (sy_call_t *)sys_lchown, AUE_LCHOWN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 275 = netbsd_lchown */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 275 = obsolete netbsd_lchown */ { AS(freebsd32_lutimes_args), (sy_call_t *)freebsd32_lutimes, AUE_LUTIMES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 276 = freebsd32_lutimes */ - { AS(msync_args), (sy_call_t *)sys_msync, AUE_MSYNC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 277 = netbsd_msync */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 277 = obsolete netbsd_msync */ { compat11(AS(freebsd11_nstat_args),nstat), AUE_STAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 278 = freebsd11 nstat */ { compat11(AS(freebsd11_nfstat_args),nfstat), AUE_FSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 279 = freebsd11 nfstat */ { compat11(AS(freebsd11_nlstat_args),nlstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 280 = freebsd11 nlstat */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Jul 10 14:04:52 2018 (r336172) @@ -1292,15 +1292,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* lchown */ - case 275: { - struct lchown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = p->uid; /* uid_t */ - iarg[2] = p->gid; /* gid_t */ - *n_args = 3; - break; - } /* freebsd32_lutimes */ case 276: { struct freebsd32_lutimes_args *p = params; @@ -1309,15 +1300,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* msync */ - case 277: { - struct msync_args *p = params; - uarg[0] = (intptr_t) p->addr; /* void * */ - uarg[1] = p->len; /* size_t */ - iarg[2] = p->flags; /* int */ - *n_args = 3; - break; - } /* freebsd32_preadv */ case 289: { struct freebsd32_preadv_args *p = params; @@ -5316,22 +5298,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* lchown */ - case 275: - switch(ndx) { - case 0: - p = "userland char *"; - break; - case 1: - p = "uid_t"; - break; - case 2: - p = "gid_t"; - break; - default: - break; - }; - break; /* freebsd32_lutimes */ case 276: switch(ndx) { @@ -5345,22 +5311,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* msync */ - case 277: - switch(ndx) { - case 0: - p = "userland void *"; - break; - case 1: - p = "size_t"; - break; - case 2: - p = "int"; - break; - default: - break; - }; - break; /* freebsd32_preadv */ case 289: switch(ndx) { @@ -9557,18 +9507,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* lchown */ - case 275: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* freebsd32_lutimes */ case 276: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* msync */ - case 277: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/kern/init_sysent.c Tue Jul 10 14:04:52 2018 (r336172) @@ -324,9 +324,9 @@ struct sysent sysent[] = { { compat11(AS(freebsd11_getdents_args),getdents), AUE_O_GETDENTS, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 272 = freebsd11 getdents */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 273 = nosys */ { AS(lchmod_args), (sy_call_t *)sys_lchmod, AUE_LCHMOD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 274 = lchmod */ - { AS(lchown_args), (sy_call_t *)sys_lchown, AUE_LCHOWN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 275 = netbsd_lchown */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 275 = obsolete netbsd_lchown */ { AS(lutimes_args), (sy_call_t *)sys_lutimes, AUE_LUTIMES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 276 = lutimes */ - { AS(msync_args), (sy_call_t *)sys_msync, AUE_MSYNC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 277 = netbsd_msync */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 277 = obsolete netbsd_msync */ { compat11(AS(freebsd11_nstat_args),nstat), AUE_STAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 278 = freebsd11 nstat */ { compat11(AS(freebsd11_nfstat_args),nfstat), AUE_FSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 279 = freebsd11 nfstat */ { compat11(AS(freebsd11_nlstat_args),nlstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 280 = freebsd11 nlstat */ Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/kern/syscalls.c Tue Jul 10 14:04:52 2018 (r336172) @@ -281,9 +281,9 @@ const char *syscallnames[] = { "compat11.getdents", /* 272 = freebsd11 getdents */ "#273", /* 273 = nosys */ "lchmod", /* 274 = lchmod */ - "netbsd_lchown", /* 275 = netbsd_lchown */ + "obs_netbsd_lchown", /* 275 = obsolete netbsd_lchown */ "lutimes", /* 276 = lutimes */ - "netbsd_msync", /* 277 = netbsd_msync */ + "obs_netbsd_msync", /* 277 = obsolete netbsd_msync */ "compat11.nstat", /* 278 = freebsd11 nstat */ "compat11.nfstat", /* 279 = freebsd11 nfstat */ "compat11.nlstat", /* 280 = freebsd11 nlstat */ Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/kern/systrace_args.c Tue Jul 10 14:04:52 2018 (r336172) @@ -1328,15 +1328,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* lchown */ - case 275: { - struct lchown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = p->uid; /* uid_t */ - iarg[2] = p->gid; /* gid_t */ - *n_args = 3; - break; - } /* lutimes */ case 276: { struct lutimes_args *p = params; @@ -1345,15 +1336,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* msync */ - case 277: { - struct msync_args *p = params; - uarg[0] = (intptr_t) p->addr; /* void * */ - uarg[1] = p->len; /* size_t */ - iarg[2] = p->flags; /* int */ - *n_args = 3; - break; - } /* preadv */ case 289: { struct preadv_args *p = params; @@ -5383,22 +5365,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* lchown */ - case 275: - switch(ndx) { - case 0: - p = "userland char *"; - break; - case 1: - p = "uid_t"; - break; - case 2: - p = "gid_t"; - break; - default: - break; - }; - break; /* lutimes */ case 276: switch(ndx) { @@ -5412,22 +5378,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* msync */ - case 277: - switch(ndx) { - case 0: - p = "userland void *"; - break; - case 1: - p = "size_t"; - break; - case 2: - p = "int"; - break; - default: - break; - }; - break; /* preadv */ case 289: switch(ndx) { @@ -9531,18 +9481,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* lchown */ - case 275: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* lutimes */ case 276: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* msync */ - case 277: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/sys/syscall.h Tue Jul 10 14:04:52 2018 (r336172) @@ -231,9 +231,9 @@ #define SYS_lio_listio 257 #define SYS_freebsd11_getdents 272 #define SYS_lchmod 274 -#define SYS_netbsd_lchown 275 + /* 275 is obsolete netbsd_lchown */ #define SYS_lutimes 276 -#define SYS_netbsd_msync 277 + /* 277 is obsolete netbsd_msync */ #define SYS_freebsd11_nstat 278 #define SYS_freebsd11_nfstat 279 #define SYS_freebsd11_nlstat 280 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Tue Jul 10 13:32:04 2018 (r336171) +++ head/sys/sys/syscall.mk Tue Jul 10 14:04:52 2018 (r336172) @@ -170,9 +170,7 @@ MIASM = \ lio_listio.o \ freebsd11_getdents.o \ lchmod.o \ - netbsd_lchown.o \ lutimes.o \ - netbsd_msync.o \ freebsd11_nstat.o \ freebsd11_nfstat.o \ freebsd11_nlstat.o \ From owner-svn-src-head@freebsd.org Tue Jul 10 15:28:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F00B1030BC5 for ; Tue, 10 Jul 2018 15:28:15 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-20.consmr.mail.gq1.yahoo.com (sonic309-20.consmr.mail.gq1.yahoo.com [98.137.65.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F91F7BBA2 for ; Tue, 10 Jul 2018 15:28:14 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 76qu4mEVM1kK0LPIAN8TXbHxcZYaDgQuenUL0n6joNe4tvo4.RAlzBEyVqQY3RJ j9j2CjOUfh1kG62oE_JY82EacpJAe2328ixigG5ucWjqaEs5VsMuw7E3mVH1ztAxaMAKjFKXk1.7 uPaqRtfQeCkMFlBKEaWzmncmnb1oArc5ivEHL2Bs_f44fs1Qn6CuSR9FyL3q5opPA8apqHqHD0HP I54_M7W3zvD609xoOEzM4piUGt4mHr5GKm8Fv7Gz1SXFAASKe_mx0ugfdjX5Dh_uh46tQyMbpG0Z MI1zZr57IB7K86I6AA.UF107L.W0VXXGuBo8J6NuzU92_FudWJvw_Lo4hP_gGgUKsyDUipFSXuWz dOlmixnSTCb6noZaLzchKlULI0ld1HeefRW_ia8lUvbSC21f4.3KeNfoj0tcGPjZQ4A8UdDzLsT. XvzxWi86f7uVX_yrzuqCOb8UkQ3iKM1vr_bksuaa.vM4lEk9AqcDKbamW2zsZ8gufcPK3VcGqkXB TdfHt9FukXss_KbQfODpoCDRtCH1doJ17TCZmFuV4r39r5G0HyHbIIQxR9c44kX2wBEac74nQZHX fpfIN0nfjmvENJ41U5lJPU5MbVabNoaqBmHtp7Lpo.Ui6jejs7KC4ZRc84pwoANbV0b9UcgWd5kL Sruhv3KI6wtlxkjzoZBwZHITqWZDQT8ODJZ_E5PW2Dc6Vz7yQIHMMXWTbYyxtW7jyfh1evImIBp8 shXaoRykLvNBfSlcWFMYd5NC1C0WVXz3SPjec4njoFR64hZLGOnD8RFGu5ziJV8rNUdEDGp_bpdP FzkdJLY3_dJSLrl4ZUyOe_fYX1g1a3kKMH.bqskh7klzgoHukIwfv0yq37JZiVNzeiGRZZcgCN99 gbdto0MEGm8WC_ZwBUkIW_RnUy0V7uv5zwTH8BAMT.YqFzR6COMEk4UA81MWLGcBI6wNbCryPq6. afj6JsaHyvfgxDvQ7mZUxPb0pzodAieNowK51Qx631JUqCaiSpXVBTwnT5leGrVGKuKotAAngwA- - Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Tue, 10 Jul 2018 15:28:08 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp416.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 1f633149f47a2b2e7fdd9c7be98422cd; Tue, 10 Jul 2018 15:28:04 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: All the builds on arthur.nyi.freebsd.org seem to be getting PostBuildScript having: . . . libpython3.6m.so.1.0: Undefined symbol "getrandom@FBSD_1.5" Message-Id: <01DBB928-E9E1-4E10-933C-B000C3ABF5FE@yahoo.com> Date: Tue, 10 Jul 2018 08:28:03 -0700 To: FreeBSD Current , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 15:28:15 -0000 [PostBuildScript] - Executing post build scripts. [FreeBSD-head-armv6-build] $ /bin/sh -xe /tmp/jenkins5219713071838772045.sh + ./freebsd-ci/artifact/post-link.py /usr/local/lib/libpython3.6m.so.1.0: Undefined symbol "getrandom@FBSD_1.5" Build step 'Execute Scripts' changed build result to UNSTABLE I looked around at a bunch of yellow-status vs. green-status builds and yellow was always from arthur.nyi.freebsd.org in what I looked at. But I did not eliminate all others in the process. Everything that I found from arthur.nyi.freebsd.org was yellow-status. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Tue Jul 10 17:01:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8744103C5BA; Tue, 10 Jul 2018 17:01:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A8C48038B; Tue, 10 Jul 2018 17:01:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BB4026B4F; Tue, 10 Jul 2018 17:01:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AH1KSq079758; Tue, 10 Jul 2018 17:01:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AH1JkO079757; Tue, 10 Jul 2018 17:01:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201807101701.w6AH1JkO079757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 10 Jul 2018 17:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336173 - head/sys/contrib/octeon-sdk X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/contrib/octeon-sdk X-SVN-Commit-Revision: 336173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 17:01:20 -0000 Author: jhibbits Date: Tue Jul 10 17:01:19 2018 New Revision: 336173 URL: https://svnweb.freebsd.org/changeset/base/336173 Log: Correct the identifier for the Unifi Security Gateway The USG is really E120, not E110. Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h head/sys/contrib/octeon-sdk/cvmx-helper-board.c Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-app-init.h Tue Jul 10 14:04:52 2018 (r336172) +++ head/sys/contrib/octeon-sdk/cvmx-app-init.h Tue Jul 10 17:01:19 2018 (r336173) @@ -311,7 +311,7 @@ enum cvmx_board_types_enum { #endif #if defined(OCTEON_VENDOR_UBIQUITI) CVMX_BOARD_TYPE_CUST_UBIQUITI_E100=20002, - CVMX_BOARD_TYPE_CUST_UBIQUITI_E110= 20004, + CVMX_BOARD_TYPE_CUST_UBIQUITI_E120= 20004, #endif #if defined(OCTEON_VENDOR_RADISYS) CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002, @@ -458,7 +458,7 @@ static inline const char *cvmx_board_type_to_string(en #endif #if defined(OCTEON_VENDOR_UBIQUITI) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E100) - ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E110) + ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E120) #endif #if defined(OCTEON_VENDOR_RADISYS) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE) Modified: head/sys/contrib/octeon-sdk/cvmx-helper-board.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-helper-board.c Tue Jul 10 14:04:52 2018 (r336172) +++ head/sys/contrib/octeon-sdk/cvmx-helper-board.c Tue Jul 10 17:01:19 2018 (r336173) @@ -598,7 +598,7 @@ int cvmx_helper_board_get_mii_address(int ipd_port) #endif #if defined(OCTEON_VENDOR_UBIQUITI) case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: - case CVMX_BOARD_TYPE_CUST_UBIQUITI_E110: + case CVMX_BOARD_TYPE_CUST_UBIQUITI_E120: if (ipd_port > 2) return -1; return (7 - ipd_port); @@ -1501,7 +1501,7 @@ int __cvmx_helper_board_hardware_enable(int interface) } #if defined(OCTEON_VENDOR_UBIQUITI) else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E100 || - cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E110) + cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E120) { /* Configure ASX cloks for all ports on interface 0. */ if (interface == 0) @@ -1592,7 +1592,7 @@ cvmx_helper_board_usb_clock_types_t __cvmx_helper_boar #endif #if defined(OCTEON_VENDOR_UBIQUITI) case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: - case CVMX_BOARD_TYPE_CUST_UBIQUITI_E110: + case CVMX_BOARD_TYPE_CUST_UBIQUITI_E120: #endif #if defined(OCTEON_BOARD_CAPK_0100ND) case CVMX_BOARD_TYPE_CN3010_EVB_HS5: From owner-svn-src-head@freebsd.org Tue Jul 10 17:20:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 691EB103DF2F; Tue, 10 Jul 2018 17:20:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A789813D7; Tue, 10 Jul 2018 17:20: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFB7B26D51; Tue, 10 Jul 2018 17:20:27 +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 w6AHKR7A089601; Tue, 10 Jul 2018 17:20:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AHKRiV089600; Tue, 10 Jul 2018 17:20:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807101720.w6AHKRiV089600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 10 Jul 2018 17:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336174 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 336174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 17:20:28 -0000 Author: markj Date: Tue Jul 10 17:20:27 2018 New Revision: 336174 URL: https://svnweb.freebsd.org/changeset/base/336174 Log: Fix thread state summary line display after r334918. Modified: head/usr.bin/top/display.c Modified: head/usr.bin/top/display.c ============================================================================== --- head/usr.bin/top/display.c Tue Jul 10 17:01:19 2018 (r336173) +++ head/usr.bin/top/display.c Tue Jul 10 17:20:27 2018 (r336174) @@ -347,12 +347,12 @@ i_procstates(int total, int *brkdn) procstates_buffer = setup_buffer(procstates_buffer, 0); /* write current number of processes and remember the value */ - printf("%d %s:", total, (ps.thread) ? "threads" :"processes"); + printf("%d %s:", total, ps.thread ? "threads" : "processes"); ltotal = total; /* put out enough spaces to get to column 15 */ i = digits(total); - while (i++ < 4) + while (i++ < (ps.thread ? 6 : 4)) { putchar(' '); } @@ -389,10 +389,10 @@ else { /* if number of digits differs, rewrite the label */ if (digits(total) != digits(ltotal)) { - fputs(" processes:", stdout); + printf(" %s:", ps.thread ? "threads" : "processes"); /* put out enough spaces to get to column 15 */ i = digits(total); - while (i++ < 4) + while (i++ < (ps.thread ? 6 : 4)) { putchar(' '); } From owner-svn-src-head@freebsd.org Tue Jul 10 18:00:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7F671041CCD; Tue, 10 Jul 2018 18:00:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A471833C5; Tue, 10 Jul 2018 18:00:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CCF6273EB; Tue, 10 Jul 2018 18:00:56 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AI0uxj011096; Tue, 10 Jul 2018 18:00:56 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AI0uTJ011095; Tue, 10 Jul 2018 18:00:56 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807101800.w6AI0uTJ011095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 10 Jul 2018 18:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336175 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 336175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 18:00:57 -0000 Author: alc Date: Tue Jul 10 18:00:55 2018 New Revision: 336175 URL: https://svnweb.freebsd.org/changeset/base/336175 Log: Eliminate unnecessary differences between i386's pmap_enter() and amd64's. For example, fully construct the new PTE before entering the critical section. This change is a stepping stone to psind == 1 support on i386. Reviewed by: kib, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D16188 Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Jul 10 17:20:27 2018 (r336174) +++ head/sys/i386/i386/pmap.c Tue Jul 10 18:00:55 2018 (r336175) @@ -3575,20 +3575,41 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pv_entry_t pv; vm_paddr_t opa, pa; vm_page_t mpte, om; - boolean_t invlva, wired; + int rv; va = trunc_page(va); - mpte = NULL; - wired = (flags & PMAP_ENTER_WIRED) != 0; - KASSERT((pmap == kernel_pmap && va < VM_MAX_KERNEL_ADDRESS) || (pmap != kernel_pmap && va < VM_MAXUSER_ADDRESS), ("pmap_enter: toobig k%d %#x", pmap == kernel_pmap, va)); KASSERT(va < PMAP_TRM_MIN_ADDRESS, ("pmap_enter: invalid to pmap_enter into trampoline (va: 0x%x)", va)); + KASSERT(pmap != kernel_pmap || (m->oflags & VPO_UNMANAGED) != 0 || + va < kmi.clean_sva || va >= kmi.clean_eva, + ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) VM_OBJECT_ASSERT_LOCKED(m->object); + KASSERT((flags & PMAP_ENTER_RESERVED) == 0, + ("pmap_enter: flags %u has reserved bits set", flags)); + pa = VM_PAGE_TO_PHYS(m); + newpte = (pt_entry_t)(pa | PG_A | PG_V); + if ((flags & VM_PROT_WRITE) != 0) + newpte |= PG_M; + if ((prot & VM_PROT_WRITE) != 0) + newpte |= PG_RW; + KASSERT((newpte & (PG_M | PG_RW)) != PG_M, + ("pmap_enter: flags includes VM_PROT_WRITE but prot doesn't")); +#if defined(PAE) || defined(PAE_TABLES) + if ((prot & VM_PROT_EXECUTE) == 0) + newpte |= pg_nx; +#endif + if ((flags & PMAP_ENTER_WIRED) != 0) + newpte |= PG_W; + if (pmap != kernel_pmap) + newpte |= PG_U; + newpte |= pmap_cache_bits(m->md.pat_mode, psind > 0); + if ((m->oflags & VPO_UNMANAGED) == 0) + newpte |= PG_MANAGED; rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); @@ -3606,10 +3627,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if (mpte == NULL) { KASSERT((flags & PMAP_ENTER_NOSLEEP) != 0, ("pmap_allocpte failed with sleep allowed")); - sched_unpin(); - rw_wunlock(&pvh_global_lock); - PMAP_UNLOCK(pmap); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + goto out; } } else { /* @@ -3617,6 +3636,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v * to install a page table page. PG_V is also * asserted by pmap_demote_pde(). */ + mpte = NULL; KASSERT(pde != NULL && (*pde & PG_V) != 0, ("KVA %#x invalid pde pdir %#jx", va, (uintmax_t)pmap->pm_pdir[PTDPTDI])); @@ -3635,55 +3655,64 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v (uintmax_t)pmap->pm_pdir[PTDPTDI], va); } - pa = VM_PAGE_TO_PHYS(m); origpte = *pte; - opa = origpte & PG_FRAME; + pv = NULL; /* - * Mapping has not changed, must be protection or wiring change. + * Is the specified virtual address already mapped? */ - if (origpte && (opa == pa)) { + if ((origpte & PG_V) != 0) { /* * Wiring change, just update stats. We don't worry about * wiring PT pages as they remain resident as long as there * are valid mappings in them. Hence, if a user page is wired, * the PT page will be also. */ - if (wired && ((origpte & PG_W) == 0)) + if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0) pmap->pm_stats.wired_count++; - else if (!wired && (origpte & PG_W)) + else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count--; /* - * Remove extra pte reference + * Remove the extra PT page reference. */ - if (mpte) + if (mpte != NULL) { mpte->wire_count--; + KASSERT(mpte->wire_count > 0, + ("pmap_enter: missing reference to page table page," + " va: 0x%x", va)); + } - if (origpte & PG_MANAGED) - pa |= PG_MANAGED; - goto validate; - } + /* + * Has the physical page changed? + */ + opa = origpte & PG_FRAME; + if (opa == pa) { + /* + * No, might be a protection or wiring change. + */ + if ((origpte & PG_MANAGED) != 0 && + (newpte & PG_RW) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); + if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) + goto unchanged; + goto validate; + } - pv = NULL; - - /* - * Mapping has changed, invalidate old range and fall through to - * handle validating new mapping. This ensures that all threads - * sharing the pmap keep a consistent view of the mapping, which is - * necessary for the correct handling of COW faults. It - * also permits reuse of the old mapping's PV entry, - * avoiding an allocation. - * - * For consistency, handle unmanaged mappings the same way. - */ - if (opa) { + /* + * The physical page has changed. Temporarily invalidate + * the mapping. This ensures that all threads sharing the + * pmap keep a consistent view of the mapping, which is + * necessary for the correct handling of COW faults. It + * also permits reuse of the old mapping's PV entry, + * avoiding an allocation. + * + * For consistency, handle unmanaged mappings the same way. + */ origpte = pte_load_clear(pte); KASSERT((origpte & PG_FRAME) == opa, ("pmap_enter: unexpected pa update for %#x", va)); - if (origpte & PG_W) - pmap->pm_stats.wired_count--; - if (origpte & PG_MANAGED) { + if ((origpte & PG_MANAGED) != 0) { om = PHYS_TO_VM_PAGE(opa); /* @@ -3696,6 +3725,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if ((origpte & PG_A) != 0) vm_page_aflag_set(om, PGA_REFERENCED); pv = pmap_pvh_remove(&om->md, pmap, va); + if ((newpte & PG_MANAGED) == 0) + free_pv_entry(pmap, pv); if ((om->aflags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || @@ -3705,86 +3736,62 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if ((origpte & PG_A) != 0) pmap_invalidate_page(pmap, va); origpte = 0; - if (mpte != NULL) { - mpte->wire_count--; - KASSERT(mpte->wire_count > 0, - ("pmap_enter: missing reference to page table page," - " va: 0x%x", va)); - } - } else + } else { + /* + * Increment the counters. + */ + if ((newpte & PG_W) != 0) + pmap->pm_stats.wired_count++; pmap->pm_stats.resident_count++; + } /* * Enter on the PV list if part of our managed memory. */ - if ((m->oflags & VPO_UNMANAGED) == 0) { - KASSERT(pmap != kernel_pmap || va < kmi.clean_sva || - va >= kmi.clean_eva, - ("pmap_enter: managed mapping within the clean submap")); + if ((newpte & PG_MANAGED) != 0) { if (pv == NULL) { pv = get_pv_entry(pmap, FALSE); pv->pv_va = va; } TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); - pa |= PG_MANAGED; - } else if (pv != NULL) - free_pv_entry(pmap, pv); - - /* - * Increment counters - */ - if (wired) - pmap->pm_stats.wired_count++; - -validate: - /* - * Now validate mapping with desired protection/wiring. - */ - newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); - if ((prot & VM_PROT_WRITE) != 0) { - newpte |= PG_RW; - if ((newpte & PG_MANAGED) != 0) + if ((newpte & PG_RW) != 0) vm_page_aflag_set(m, PGA_WRITEABLE); } -#if defined(PAE) || defined(PAE_TABLES) - if ((prot & VM_PROT_EXECUTE) == 0) - newpte |= pg_nx; -#endif - if (wired) - newpte |= PG_W; - if (pmap != kernel_pmap) - newpte |= PG_U; /* - * if the mapping or permission bits are different, we need - * to update the pte. + * Update the PTE. */ - if ((origpte & ~(PG_M|PG_A)) != newpte) { - newpte |= PG_A; - if ((flags & VM_PROT_WRITE) != 0) - newpte |= PG_M; - if (origpte & PG_V) { - invlva = FALSE; - origpte = pte_load_store(pte, newpte); - KASSERT((origpte & PG_FRAME) == VM_PAGE_TO_PHYS(m), - ("pmap_enter: unexpected pa update for %#x", va)); - if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW) && - (newpte & PG_M) == 0) { - if ((origpte & PG_MANAGED) != 0) - vm_page_dirty(m); - invlva = TRUE; - } + if ((origpte & PG_V) != 0) { +validate: + origpte = pte_load_store(pte, newpte); + KASSERT((origpte & PG_FRAME) == pa, + ("pmap_enter: unexpected pa update for %#x", va)); + if ((newpte & PG_M) == 0 && (origpte & (PG_M | PG_RW)) == + (PG_M | PG_RW)) { + if ((origpte & PG_MANAGED) != 0) + vm_page_dirty(m); + + /* + * Although the PTE may still have PG_RW set, TLB + * invalidation may nonetheless be required because + * the PTE no longer has PG_M set. + */ + } #if defined(PAE) || defined(PAE_TABLES) - else if ((origpte & (PG_A | PG_NX)) == PG_A && - (newpte & PG_NX) != 0) - invlva = TRUE; + else if ((origpte & PG_NX) != 0 || (newpte & PG_NX) == 0) { + /* + * This PTE change does not require TLB invalidation. + */ + goto unchanged; + } #endif - if (invlva) - pmap_invalidate_page(pmap, va); - } else - pte_store(pte, newpte); - } + if ((origpte & PG_A) != 0) + pmap_invalidate_page(pmap, va); + } else + pte_store(pte, newpte); +unchanged: + #if VM_NRESERVLEVEL > 0 /* * If both the page table page and the reservation are fully @@ -3796,10 +3803,12 @@ validate: pmap_promote_pde(pmap, pde, va); #endif + rv = KERN_SUCCESS; +out: sched_unpin(); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); - return (KERN_SUCCESS); + return (rv); } /* From owner-svn-src-head@freebsd.org Tue Jul 10 18:41:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE8291045152; Tue, 10 Jul 2018 18:41:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F777856E2; Tue, 10 Jul 2018 18:41:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 409BC27A70; Tue, 10 Jul 2018 18:41:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AIfHUw031244; Tue, 10 Jul 2018 18:41:17 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AIfHeM031229; Tue, 10 Jul 2018 18:41:17 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807101841.w6AIfHeM031229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 10 Jul 2018 18:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336176 - head/usr.sbin/pnfsdskill X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/pnfsdskill X-SVN-Commit-Revision: 336176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 18:41:17 -0000 Author: rmacklem Date: Tue Jul 10 18:41:16 2018 New Revision: 336176 URL: https://svnweb.freebsd.org/changeset/base/336176 Log: Add a "-f" option to pnfsdskill(8) to force disabling of a DS. The pnfsdskill(8) command will normally fail if there is no valid mirror for the DS to be disabled. However, a system administrator may need to disable a DS which does not have a valid mirror so that the nfsd threads can be terminated. This patch adds a "-f" option to pnfsdskill(8) that uses the kernel changes made by r336141 to implement this "forced" case of disabling a DS. This patch only affects the pNFS server. Modified: head/usr.sbin/pnfsdskill/pnfsdskill.c Modified: head/usr.sbin/pnfsdskill/pnfsdskill.c ============================================================================== --- head/usr.sbin/pnfsdskill/pnfsdskill.c Tue Jul 10 18:00:55 2018 (r336175) +++ head/usr.sbin/pnfsdskill/pnfsdskill.c Tue Jul 10 18:41:16 2018 (r336176) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -44,6 +45,11 @@ __FBSDID("$FreeBSD$"); static void usage(void); +static struct option longopts[] = { + { "force", no_argument, NULL, 'f' }, + { NULL, 0, NULL, 0 } +}; + /* * This program disables use of a DS mirror. The "dspath" command line * argument must be an exact match for the mounted-on path of the DS. @@ -54,23 +60,39 @@ int main(int argc, char *argv[]) { struct nfsd_pnfsd_args pnfsdarg; + int ch, force; - if (argc != 2) - usage(); if (geteuid() != 0) errx(1, "Must be run as root/su"); + force = 0; + while ((ch = getopt_long(argc, argv, "f", longopts, NULL)) != -1) { + switch (ch) { + case 'f': + force = 1; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + if (argc != 1) + usage(); - pnfsdarg.op = PNFSDOP_DELDSSERVER; - pnfsdarg.dspath = argv[1]; + if (force != 0) + pnfsdarg.op = PNFSDOP_FORCEDELDS; + else + pnfsdarg.op = PNFSDOP_DELDSSERVER; + pnfsdarg.dspath = *argv; if (nfssvc(NFSSVC_PNFSDS, &pnfsdarg) < 0) - err(1, "Can't kill %s", argv[1]); + err(1, "Can't kill %s", *argv); } static void usage(void) { - fprintf(stderr, "pnfsdsfile [filepath]\n"); + fprintf(stderr, "pnfsdsfile [-f] mounted-on-DS-dir\n"); exit(1); } From owner-svn-src-head@freebsd.org Tue Jul 10 18:44:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B813E10457E8; Tue, 10 Jul 2018 18:44:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DEF285A2F; Tue, 10 Jul 2018 18:44:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4558927BC8; Tue, 10 Jul 2018 18:44:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AIijVi036066; Tue, 10 Jul 2018 18:44:45 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AIij3d036065; Tue, 10 Jul 2018 18:44:45 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807101844.w6AIij3d036065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 10 Jul 2018 18:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336177 - head/usr.sbin/pnfsdskill X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/pnfsdskill X-SVN-Commit-Revision: 336177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 18:44:45 -0000 Author: rmacklem Date: Tue Jul 10 18:44:44 2018 New Revision: 336177 URL: https://svnweb.freebsd.org/changeset/base/336177 Log: Document the "-f" option added to pnfsdskill(8) by r336176. This is a content change. Modified: head/usr.sbin/pnfsdskill/pnfsdskill.8 Modified: head/usr.sbin/pnfsdskill/pnfsdskill.8 ============================================================================== --- head/usr.sbin/pnfsdskill/pnfsdskill.8 Tue Jul 10 18:41:16 2018 (r336176) +++ head/usr.sbin/pnfsdskill/pnfsdskill.8 Tue Jul 10 18:44:44 2018 (r336177) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2018 +.Dd July 9, 2018 .Dt PNFSDSKILL 8 .Os .Sh NAME @@ -32,6 +32,7 @@ disables a pNFS data storage server (DS) .Sh SYNOPSIS .Nm +.Op Fl f .Ar mounted-on-DS-dir .Sh DESCRIPTION The @@ -42,6 +43,18 @@ may use this command on the metadata server (MDS) to d This command must be used on the MDS and the .Ar mounted-on-DS-dir must be the exact pathname used when mounting the DS on the MDS. +Normally this command will fail if there is no valid mirror for the DS +available. +.Pp +The following option is available: +.Bl -tag -width Ds +.It Fl f +This option forces the DS to be disabled even if there is no valid mirror +for the DS available. +It should only be used to allow the +.Xr nfsd 8 +threads to be terminated. +.El .Pp If this command fails with .Dq Device not configured From owner-svn-src-head@freebsd.org Tue Jul 10 20:11:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1D0D10267B4; Tue, 10 Jul 2018 20:11:33 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54AD089D4E; Tue, 10 Jul 2018 20:11:33 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19318A0B; Tue, 10 Jul 2018 20:11:33 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AKBWE4078587; Tue, 10 Jul 2018 20:11:32 GMT (envelope-from sef@FreeBSD.org) Received: (from sef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AKBWe5078586; Tue, 10 Jul 2018 20:11:32 GMT (envelope-from sef@FreeBSD.org) Message-Id: <201807102011.w6AKBWe5078586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sef set sender to sef@FreeBSD.org using -f From: Sean Eric Fagan Date: Tue, 10 Jul 2018 20:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336180 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: sef X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 336180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 20:11:33 -0000 Author: sef Date: Tue Jul 10 20:11:32 2018 New Revision: 336180 URL: https://svnweb.freebsd.org/changeset/base/336180 Log: Fix up some missed and mis-merges from the sequential scan code (r334844). Most of the changes involve moving some code around to reduce conflicts with future merges. One of the missing changes included a notification on scrub cancellation. Approved by: mav Sponsored by: iXsystems Inc Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Jul 10 19:37:52 2018 (r336179) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Jul 10 20:11:32 2018 (r336180) @@ -739,14 +739,15 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); - if (err == 0) + if (err == 0) { + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); - + } return (SET_ERROR(err)); } return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check, - dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_NONE)); + dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); } /* ARGSUSED */ @@ -2110,7 +2111,6 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ { dsl_pool_t *dp = scn->scn_dp; dsl_dataset_t *ds; - objset_t *os; VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds)); @@ -2154,9 +2154,6 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ goto out; } - if (dmu_objset_from_ds(ds, &os)) - goto out; - /* * Only the ZIL in the head (non-snapshot) is valid. Even though * snapshots can have ZIL block pointers (which may be the same @@ -2166,8 +2163,14 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ * rather than in scan_recurse(), because the regular snapshot * block-sharing rules don't apply to it. */ - if (!ds->ds_is_snapshot) + if (DSL_SCAN_IS_SCRUB_RESILVER(scn) && !dsl_dataset_is_snapshot(ds) && + ds->ds_dir != dp->dp_origin_snap->ds_dir) { + objset_t *os; + if (dmu_objset_from_ds(ds, &os) != 0) { + goto out; + } dsl_scan_zil(dp, &os->os_zil_header); + } /* * Iterate over the bps in this ds. @@ -2878,22 +2881,6 @@ dsl_scan_free_block_cb(void *arg, const blkptr_t *bp, return (0); } -static int -dsl_scan_obsolete_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) -{ - dsl_scan_t *scn = arg; - const dva_t *dva = &bp->blk_dva[0]; - - if (dsl_scan_async_block_should_pause(scn)) - return (SET_ERROR(ERESTART)); - - spa_vdev_indirect_mark_obsolete(scn->scn_dp->dp_spa, - DVA_GET_VDEV(dva), DVA_GET_OFFSET(dva), - DVA_GET_ASIZE(dva), tx); - scn->scn_visited_this_txg++; - return (0); -} - static void dsl_scan_update_stats(dsl_scan_t *scn) { @@ -2929,6 +2916,22 @@ dsl_scan_update_stats(dsl_scan_t *scn) scn->scn_zios_this_txg = zio_count_total; } +static int +dsl_scan_obsolete_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + dsl_scan_t *scn = arg; + const dva_t *dva = &bp->blk_dva[0]; + + if (dsl_scan_async_block_should_pause(scn)) + return (SET_ERROR(ERESTART)); + + spa_vdev_indirect_mark_obsolete(scn->scn_dp->dp_spa, + DVA_GET_VDEV(dva), DVA_GET_OFFSET(dva), + DVA_GET_ASIZE(dva), tx); + scn->scn_visited_this_txg++; + return (0); +} + boolean_t dsl_scan_active(dsl_scan_t *scn) { @@ -2950,12 +2953,51 @@ dsl_scan_active(dsl_scan_t *scn) return (used != 0); } +static boolean_t +dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, size_t psize, + uint64_t phys_birth) +{ + vdev_t *vd; + + if (DVA_GET_GANG(dva)) { + /* + * Gang members may be spread across multiple + * vdevs, so the best estimate we have is the + * scrub range, which has already been checked. + * XXX -- it would be better to change our + * allocation policy to ensure that all + * gang members reside on the same vdev. + */ + return (B_TRUE); + } + + vd = vdev_lookup_top(spa, DVA_GET_VDEV(dva)); + + /* + * Check if the txg falls within the range which must be + * resilvered. DVAs outside this range can always be skipped. + */ + if (!vdev_dtl_contains(vd, DTL_PARTIAL, phys_birth, 1)) + return (B_FALSE); + + /* + * Check if the top-level vdev must resilver this offset. + * When the offset does not intersect with a dirty leaf DTL + * then it may be possible to skip the resilver IO. The psize + * is provided instead of asize to simplify the check for RAIDZ. + */ + if (!vdev_dtl_need_resilver(vd, DVA_GET_OFFSET(dva), psize)) + return (B_FALSE); + + return (B_TRUE); +} + static int dsl_process_async_destroys(dsl_pool_t *dp, dmu_tx_t *tx) { + int err = 0; dsl_scan_t *scn = dp->dp_scan; spa_t *spa = dp->dp_spa; - int err = 0; if (spa_suspend_async_destroy(spa)) return (0); @@ -3092,45 +3134,6 @@ dsl_process_async_destroys(dsl_pool_t *dp, dmu_tx_t *t return (0); } -static boolean_t -dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, size_t psize, - uint64_t phys_birth) -{ - vdev_t *vd; - - if (DVA_GET_GANG(dva)) { - /* - * Gang members may be spread across multiple - * vdevs, so the best estimate we have is the - * scrub range, which has already been checked. - * XXX -- it would be better to change our - * allocation policy to ensure that all - * gang members reside on the same vdev. - */ - return (B_TRUE); - } - - vd = vdev_lookup_top(spa, DVA_GET_VDEV(dva)); - - /* - * Check if the txg falls within the range which must be - * resilvered. DVAs outside this range can always be skipped. - */ - if (!vdev_dtl_contains(vd, DTL_PARTIAL, phys_birth, 1)) - return (B_FALSE); - - /* - * Check if the top-level vdev must resilver this offset. - * When the offset does not intersect with a dirty leaf DTL - * then it may be possible to skip the resilver IO. The psize - * is provided instead of asize to simplify the check for RAIDZ. - */ - if (!vdev_dtl_need_resilver(vd, DVA_GET_OFFSET(dva), psize)) - return (B_FALSE); - - return (B_TRUE); -} - /* * This is the primary entry point for scans that is called from syncing * context. Scans must happen entirely during syncing context so that we @@ -3142,9 +3145,9 @@ dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, s void dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) { - int err = 0; dsl_scan_t *scn = dp->dp_scan; spa_t *spa = dp->dp_spa; + int err = 0; state_sync_type_t sync_type = SYNC_OPTIONAL; /* From owner-svn-src-head@freebsd.org Tue Jul 10 21:20:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CB37102D9E3; Tue, 10 Jul 2018 21:20:50 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBF2E8CDAB; Tue, 10 Jul 2018 21:20:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD167146C; Tue, 10 Jul 2018 21:20:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ALKnWN017896; Tue, 10 Jul 2018 21:20:49 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ALKnwj017895; Tue, 10 Jul 2018 21:20:49 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201807102120.w6ALKnwj017895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 10 Jul 2018 21:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336181 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 336181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 21:20:50 -0000 Author: bdrewery Date: Tue Jul 10 21:20:49 2018 New Revision: 336181 URL: https://svnweb.freebsd.org/changeset/base/336181 Log: Fix parsing of create-kernel-packages MFC after: 3 days Reported by: rene Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 10 20:11:32 2018 (r336180) +++ head/Makefile.inc1 Tue Jul 10 21:20:49 2018 (r336181) @@ -1798,12 +1798,12 @@ create-world-package-${pkgname}: .PHONY -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} .endfor -create-kernel-packages: .PHONY _default_flavor= -default .if make(*package*) && exists(${KSTAGEDIR}/kernel.meta) . if ${MK_DEBUG_FILES} != "no" _debug=-debug . endif +create-kernel-packages: .PHONY . for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY From owner-svn-src-head@freebsd.org Tue Jul 10 21:50:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B9A0103079C; Tue, 10 Jul 2018 21:50:16 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F13978DDAA; Tue, 10 Jul 2018 21:50:15 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id c13-v6so16066828wrt.1; Tue, 10 Jul 2018 14:50:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kU86yxQuAJPEbqbg+RILW+NVkd3RBvuyVOXePYnWnE4=; b=CaP7qhZasWwuSyqR4NpwbeyHEpMVNYP0mPYR4CtroOBAMvNbC3Fh7aLIfYQiVufQPq 6RdXFEYxY9jAj+I1jTkde7TuzchdAINI6AzwliJr5m/F7rfTRmRDKRcaGBYILSPv0vYm I7KzWT1NyZ1DkeiMGGPY3SmVtCBCYITAf/3Xq1/4NbM4e5KjmY1lc5zT0k23zJUMOkvn L8gfocVeUJxfx/JovrqgYb8JA5jMmvH5iCib6B/5EaOMvBe5VCPx0NvDRoIi+rcMw8oo XojYqwWg8AMwfIfUdxXAIJJ4bFeDwxqRHv5upbN6Q9iLgyH3TgS2g3j3O4udunCP+D9a aHcQ== X-Gm-Message-State: APt69E0hlO1+rh37jpDHBsxGmodn0EwHu9hK3CiebG8j9QZ61Gp0U1a+ ykqjBqQ84D3L2S/kXsujTs9z6VrFit7AtzGf02c= X-Google-Smtp-Source: AAOMgpde/8QiLRe9buQRO44ldaqc6XHnWenBfsRiPt9QSTCN6pnE1mk/aegyB7GzUVfJAUNeB7kOUXiYiFxnz7X8K80= X-Received: by 2002:adf:d842:: with SMTP id k2-v6mr18505232wrl.26.1531259408667; Tue, 10 Jul 2018 14:50:08 -0700 (PDT) MIME-Version: 1.0 References: <01DBB928-E9E1-4E10-933C-B000C3ABF5FE@yahoo.com> In-Reply-To: <01DBB928-E9E1-4E10-933C-B000C3ABF5FE@yahoo.com> From: Li-Wen Hsu Date: Wed, 11 Jul 2018 05:49:58 +0800 Message-ID: Subject: Re: All the builds on arthur.nyi.freebsd.org seem to be getting PostBuildScript having: . . . libpython3.6m.so.1.0: Undefined symbol "getrandom@FBSD_1.5" To: Mark Millard Cc: FreeBSD Current , svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 21:50:16 -0000 On Tue, Jul 10, 2018 at 11:30 PM Mark Millard wrote: > > > [PostBuildScript] - Executing post build scripts. > [FreeBSD-head-armv6-build] $ /bin/sh -xe /tmp/jenkins5219713071838772045.sh > + ./freebsd-ci/artifact/post-link.py > /usr/local/lib/libpython3.6m.so.1.0: Undefined symbol "getrandom@FBSD_1.5" > Build step 'Execute Scripts' changed build result to UNSTABLE > > > > I looked around at a bunch of yellow-status vs. green-status builds and > yellow was always from arthur.nyi.freebsd.org in what I looked at. But > I did not eliminate all others in the process. Everything that I found > from arthur.nyi.freebsd.org was yellow-status. > This is because of the ABI incompatible between different versions of -CURRENT, on pkg build cluster and the arthur.nyi. It has been fixed. Thanks, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-head@freebsd.org Tue Jul 10 22:00:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBB7A10318A2; Tue, 10 Jul 2018 22:00:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C20C8E515; Tue, 10 Jul 2018 22:00: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A9241AC5; Tue, 10 Jul 2018 22:00: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 w6AM0Mh8035158; Tue, 10 Jul 2018 22:00:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AM0LgC035151; Tue, 10 Jul 2018 22:00:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201807102200.w6AM0LgC035151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Jul 2018 22:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336182 - in head: . lib/libc/sys share/man/man4 sys/sys usr.bin usr.bin/numactl X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: . lib/libc/sys share/man/man4 sys/sys usr.bin usr.bin/numactl X-SVN-Commit-Revision: 336182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 22:00:23 -0000 Author: kib Date: Tue Jul 10 22:00:20 2018 New Revision: 336182 URL: https://svnweb.freebsd.org/changeset/base/336182 Log: Remove bits of the old NUMA. Remove numactl(1), edit numa(4) to bring it some closer to reality, provide libc ABI shims for old NUMA syscalls. Noted and reviewed by: brooks (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D16142 Deleted: head/lib/libc/sys/numa_getaffinity.2 head/sys/sys/numa.h head/usr.bin/numactl/ Modified: head/ObsoleteFiles.inc head/lib/libc/sys/Makefile.inc head/lib/libc/sys/compat-stub.c head/share/man/man4/numa.4 head/usr.bin/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Jul 10 21:20:49 2018 (r336181) +++ head/ObsoleteFiles.inc Tue Jul 10 22:00:20 2018 (r336182) @@ -38,6 +38,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20180710: old numa cleanup +OLD_FILES+=usr/include/sys/numa.h +OLD_FILES+=usr/share/man/man2/numa_getaffinity.2.gz +OLD_FILES+=usr/share/man/man2/numa_setaffinity.2.gz +OLD_FILES+=usr/share/man/man1/numactl.1.gz +OLD_FILES+=usr/bin/numactl # 20180630: new clang import which bumps version from 6.0.0 to 6.0.1. OLD_FILES+=usr/lib/clang/6.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/6.0.0/include/sanitizer/asan_interface.h Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Jul 10 21:20:49 2018 (r336181) +++ head/lib/libc/sys/Makefile.inc Tue Jul 10 22:00:20 2018 (r336182) @@ -258,7 +258,6 @@ MAN+= abort2.2 \ nanosleep.2 \ nfssvc.2 \ ntp_adjtime.2 \ - numa_getaffinity.2 \ open.2 \ pathconf.2 \ pdfork.2 \ @@ -430,7 +429,6 @@ MLINKS+=mount.2 nmount.2 \ MLINKS+=mq_receive.2 mq_timedreceive.2 MLINKS+=mq_send.2 mq_timedsend.2 MLINKS+=ntp_adjtime.2 ntp_gettime.2 -MLINKS+=numa_getaffinity.2 numa_setaffinity.2 MLINKS+=open.2 openat.2 MLINKS+=pathconf.2 fpathconf.2 MLINKS+=pathconf.2 lpathconf.2 Modified: head/lib/libc/sys/compat-stub.c ============================================================================== --- head/lib/libc/sys/compat-stub.c Tue Jul 10 21:20:49 2018 (r336181) +++ head/lib/libc/sys/compat-stub.c Tue Jul 10 22:00:20 2018 (r336182) @@ -54,3 +54,5 @@ __sym_compat(symbol, __compat_enosys ## symbol, versio __compat_nosys(netbsd_lchown, FBSD_1.0); __compat_nosys(netbsd_msync, FBSD_1.0); +__compat_nosys(numa_getaffinity, FBSD_1.4); +__compat_nosys(numa_setaffinity, FBSD_1.4); Modified: head/share/man/man4/numa.4 ============================================================================== --- head/share/man/man4/numa.4 Tue Jul 10 21:20:49 2018 (r336181) +++ head/share/man/man4/numa.4 Tue Jul 10 22:00:20 2018 (r336182) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 10, 2015 +.Dd July 10, 2018 .Dt NUMA 4 .Os .Sh NAME @@ -34,7 +34,6 @@ .Cd options SMP .Cd options MAXMEMDOM=16 .Pp -.In sys/numa.h .In sys/cpuset.h .In sys/bus.h .Sh DESCRIPTION @@ -51,20 +50,21 @@ that is connected to one of the other processors. .Pp .Nm is enabled when the -.Cd MAXMEMDOM +.Cd NUMA option is used in a kernel configuration -file and is set to a value greater than 1. +file and the +.Cd MAXMEMDOM +option is set to a value greater than 1. .Pp Thread and process .Nm policies are controlled with the -.Xr numa_setaffinity 2 +.Xr cpuset_getdomain 2 and -.Xr numa_getaffinity 2 +.Xr cpuset_setdomain 2 syscalls. -.Pp The -.Xr numactl 1 +.Xr cpuset 1 tool is available for starting processes with a non-default policy, or to change the policy of an existing thread or process. .Pp @@ -83,15 +83,6 @@ MIB variables: .It Va vm.ndomains The number of VM domains which have been detected. .Pp -.It Va vm.default_policy -The default VM domain allocation policy. -Defaults to "first-touch-rr". -The valid values are "first-touch", "first-touch-rr", -"rr", where "rr" is a short-hand for "round-robin." -See -.Xr numa_setaffinity 2 -for more information about the available policies. -.Pp .It Va vm.phys_locality A table indicating the relative cost of each VM domain to each other. A value of 10 indicates equal cost. @@ -111,36 +102,11 @@ domains are mapped into a contiguous, non-sparse VM domain space, starting from 0. Thus, VM domain information (for example, the domain identifier) is not necessarily the same as is found in the hardware specific information. -.Pp -The -.Nm -allocation policies are implemented as a policy and iterator in -.Pa sys/vm/vm_domain.c -and -.Pa sys/vm/vm_domain.h . Policy information is available in both struct thread and struct proc. -Processes inherit -.Nm -policy from parent processes and threads inherit -.Nm -policy from parent threads. -Note that threads do not explicitly inherit their -.Nm -policy from processes. -Instead, if no thread policy is set, the system -will fall back to the process policy. -.Pp -For now, -.Nm -domain policies only influence physical page allocation in -.Pa sys/vm/vm_phys.c . -This is useful for userland memory allocation, but not for kernel -and driver memory allocation. -These features will be implemented in future work. .Sh SEE ALSO -.Xr numactl 1 , -.Xr numa_getaffinity 2 , -.Xr numa_setaffinity 2 , +.Xr cpuset 1 , +.Xr cpuset_getaffinity 2 , +.Xr cpuset_setaffinity 2 , .Xr bus_get_domain 9 .Sh HISTORY .Nm @@ -156,13 +122,15 @@ The .Xr numa_getaffinity 2 and .Xr numa_setaffinity 2 -syscalls first appeared in -.Fx 11.0 . -.Pp -The +syscalls and the .Xr numactl 1 tool first appeared in -.Fx 11.0 . +.Fx 11.0 +and were removed in +.Fx 12.0 . +Current implementation appeared in +.Fx 12.0 . +.Pp .Sh AUTHORS This manual page written by .An Adrian Chadd Aq Mt adrian@FreeBSD.org . Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Jul 10 21:20:49 2018 (r336181) +++ head/usr.bin/Makefile Tue Jul 10 22:00:20 2018 (r336182) @@ -104,7 +104,6 @@ SUBDIR= alias \ nfsstat \ nice \ nl \ - numactl \ nohup \ opieinfo \ opiekey \ From owner-svn-src-head@freebsd.org Tue Jul 10 22:53:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EE33103880B; Tue, 10 Jul 2018 22:53:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 437B1706B3; Tue, 10 Jul 2018 22:53:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24BE52451; Tue, 10 Jul 2018 22:53:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6AMr7mm065734; Tue, 10 Jul 2018 22:53:07 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6AMr73t065733; Tue, 10 Jul 2018 22:53:07 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807102253.w6AMr73t065733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 10 Jul 2018 22:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336183 - head/usr.sbin/nfsd X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/nfsd X-SVN-Commit-Revision: 336183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 22:53:08 -0000 Author: rmacklem Date: Tue Jul 10 22:53:07 2018 New Revision: 336183 URL: https://svnweb.freebsd.org/changeset/base/336183 Log: Update the pnfs(4) man page. This is a content change. Modified: head/usr.sbin/nfsd/pnfs.4 Modified: head/usr.sbin/nfsd/pnfs.4 ============================================================================== --- head/usr.sbin/nfsd/pnfs.4 Tue Jul 10 22:00:20 2018 (r336182) +++ head/usr.sbin/nfsd/pnfs.4 Tue Jul 10 22:53:07 2018 (r336183) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 26, 2018 +.Dd July 10, 2018 .Dt PNFS 4 .Os .Sh NAME @@ -67,7 +67,8 @@ It is for a byte range of a file and is either Read or For the FreeBSD server, a layout covers all bytes of a file. A layout may be recalled by the MDS using a LayoutRecall callback. When a client returns a layout via the LayoutReturn operation it can -indicate that error(s) were encountered while doing I/O on the DS. +indicate that error(s) were encountered while doing I/O on the DS, +at least for certain layout types such as the Flexible File Layout. .Pp The FreeBSD client and server supports two layout types. .Pp @@ -94,7 +95,9 @@ For a non-mirrored configuration, the FreeBSD server w layouts by default. However that default can be set to the Flexible File Layout by setting the .Xr sysctl 1 -sysctl ``vfs.nfsd.default_flexfile'' to one. +sysctl +.Dq vfs.nfsd.default_flexfile +to one. Mirrored server configurations will only issue Flexible File Layouts. .Tn pNFS clients mount the MDS as they would a single NFS server. @@ -115,14 +118,14 @@ Each of these files will also have two extended attrib attribute name space: .Bd -literal -offset indent pnfsd.dsfile - This extended attrbute stores the information that the - MDS needs to find the data file on a DS for this file. + MDS needs to find the data file on a DS(s) for this file. pnfsd.dsattr - This extended attribute stores the Size, AccessTime, ModifyTime and Change attributes for the file. .Ed .Pp For each regular (VREG) file, the MDS creates a data file on one (or on N of them for the mirrored case, where N is the mirror_level) -of the DSs where the file's data will be stored. +of the DS(s) where the file's data will be stored. The name of this file is the file handle of the file on the MDS in hexadecimal at time of file creation. The data file will have the same file ownership, mode and NFSv4 ACL @@ -143,6 +146,17 @@ For the non-pNFS aware client, the MDS will perform I/ a proxy for the non-pNFS aware client. This is also true for NFSv3 and NFSv4.0 mounts, since these are always non-pNFS aware. +.Pp +It is possible to assign a DS to an MDS exported file system so that it will +store data for files on the MDS exported file system. +If a DS is not assigned to an MDS exported file system, it will store data +for files on all exported file systems on the MDS. +.Pp +If mirroring is enabled, the pNFS service will continue to function when +DS(s) have failed, so long is there is at least one DS still operational +that stores data for files on all of the MDS exported file systems. +After a disabled mirrored DS is repaired, it is possible to recover the DS +as a mirror while the pNFS service continues to function. .Pp See .Bd -literal -offset indent From owner-svn-src-head@freebsd.org Tue Jul 10 23:30:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACA2D103C43C; Tue, 10 Jul 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5705E7185A; Tue, 10 Jul 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 305922955; Tue, 10 Jul 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ANUJpG081316; Tue, 10 Jul 2018 23:30:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ANUJN6081315; Tue, 10 Jul 2018 23:30:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807102330.w6ANUJN6081315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Jul 2018 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336184 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 336184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2018 23:30:20 -0000 Author: kevans Date: Tue Jul 10 23:30:19 2018 New Revision: 336184 URL: https://svnweb.freebsd.org/changeset/base/336184 Log: net80211: Fix ifdetach w/o ifattach, small whitespace cleanup As the comment says, ifdetach might be called during the course of driver detach if initialization failed. This shouldn't be a total failure, though, we just have nothing to do there. This has been modified slightly from Augustin's original commit to move the bail-out slightly earlier since the ic wouldn't have been added to the ic list in the first place, and a comment has been added describing when this might be an issue. Submitted by: Augustin Cavalier Obtained from: Haiku (e6f6c1b4633532a8ad37c803dc7c65601e5b24ba) Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Jul 10 22:53:07 2018 (r336183) +++ head/sys/net80211/ieee80211.c Tue Jul 10 23:30:19 2018 (r336184) @@ -276,14 +276,14 @@ null_update_chw(struct ieee80211com *ic) int ic_printf(struct ieee80211com *ic, const char * fmt, ...) -{ +{ va_list ap; int retval; retval = printf("%s: ", ic->ic_name); va_start(ap, fmt); retval += vprintf(fmt, ap); - va_end(ap); + va_end(ap); return (retval); } @@ -386,6 +386,15 @@ ieee80211_ifdetach(struct ieee80211com *ic) { struct ieee80211vap *vap; + /* + * We use this as an indicator that ifattach never had a chance to be + * called, e.g. early driver attach failed and ifdetach was called + * during subsequent detach. Never fear, for we have nothing to do + * here. + */ + if (ic->ic_tq == NULL) + return; + mtx_lock(&ic_list_mtx); LIST_REMOVE(ic, ic_next); mtx_unlock(&ic_list_mtx); @@ -702,7 +711,7 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_cha return 1; } -/* +/* * Tear down vap state and reclaim the ifnet. * The driver is assumed to have prepared for * this; e.g. by turning off interrupts for the @@ -1760,7 +1769,7 @@ addmedia(struct ifmedia *media, int caps, int addsta, #define ADD(_ic, _s, _o) \ ifmedia_add(media, \ IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL) - static const u_int mopts[IEEE80211_MODE_MAX] = { + static const u_int mopts[IEEE80211_MODE_MAX] = { [IEEE80211_MODE_AUTO] = IFM_AUTO, [IEEE80211_MODE_11A] = IFM_IEEE80211_11A, [IEEE80211_MODE_11B] = IFM_IEEE80211_11B, @@ -2386,13 +2395,13 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate case IEEE80211_MODE_11NA: case IEEE80211_MODE_TURBO_A: case IEEE80211_MODE_STURBO_A: - return findmedia(rates, nitems(rates), + return findmedia(rates, nitems(rates), rate | IFM_IEEE80211_11A); case IEEE80211_MODE_11B: - return findmedia(rates, nitems(rates), + return findmedia(rates, nitems(rates), rate | IFM_IEEE80211_11B); case IEEE80211_MODE_FH: - return findmedia(rates, nitems(rates), + return findmedia(rates, nitems(rates), rate | IFM_IEEE80211_FH); case IEEE80211_MODE_AUTO: /* NB: ic may be NULL for some drivers */ From owner-svn-src-head@freebsd.org Wed Jul 11 01:37:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B5A1046C5B; Wed, 11 Jul 2018 01:37:02 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10ADD759F9; Wed, 11 Jul 2018 01:37:02 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E242B4267; Wed, 11 Jul 2018 01:37:01 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B1b1cq046882; Wed, 11 Jul 2018 01:37:01 GMT (envelope-from bwidawsk@FreeBSD.org) Received: (from bwidawsk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B1b1ne046881; Wed, 11 Jul 2018 01:37:01 GMT (envelope-from bwidawsk@FreeBSD.org) Message-Id: <201807110137.w6B1b1ne046881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bwidawsk set sender to bwidawsk@FreeBSD.org using -f From: Ben Widawsky Date: Wed, 11 Jul 2018 01:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336185 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: bwidawsk X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 336185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 01:37:02 -0000 Author: bwidawsk Date: Wed Jul 11 01:37:01 2018 New Revision: 336185 URL: https://svnweb.freebsd.org/changeset/base/336185 Log: acpidump(8): Add ACPI LPIT (Low Power Idle Table) The LPIT is the part of the "standardized" way that one can enumerate various power state information on Intel platforms. The documentation for this change can be found here: http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf Reviewed By: jhb Approved By: jhb Differential Revision: https://reviews.freebsd.org/D15931 Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.8 Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Jul 10 23:30:19 2018 (r336184) +++ head/usr.sbin/acpi/acpidump/acpi.c Wed Jul 11 01:37:01 2018 (r336185) @@ -68,6 +68,7 @@ static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp); static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp); static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp); static void acpi_handle_wddt(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_lpit(ACPI_TABLE_HEADER *sdp); static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, uint32_t flags); static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); @@ -716,6 +717,79 @@ acpi_handle_wddt(ACPI_TABLE_HEADER *sdp) } static void +acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl) +{ + printf("\tEntryTrigger="); + acpi_print_gas(&nl->EntryTrigger); + printf("\tResidency=%u\n", nl->Residency); + printf("\tLatency=%u\n", nl->Latency); + if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER) + printf("\tResidencyCounter=Not Present"); + else { + printf("\tResidencyCounter="); + acpi_print_gas(&nl->ResidencyCounter); + } + if (nl->CounterFrequency) + printf("\tCounterFrequency=%ju\n", nl->CounterFrequency); + else + printf("\tCounterFrequency=TSC\n"); +} + +static void +acpi_print_lpit(ACPI_LPIT_HEADER *lpit) +{ + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE) + printf("\tType=ACPI_LPIT_TYPE_NATIVE_CSTATE\n"); + else + warnx("unknown LPIT type %u", lpit->Type); + + printf("\tLength=%u\n", lpit->Length); + printf("\tUniqueId=0x%04x\n", lpit->UniqueId); +#define PRINTFLAG(var, flag) printflag((var), ACPI_LPIT_## flag, #flag) + printf("\tFlags="); + PRINTFLAG(lpit->Flags, STATE_DISABLED); + PRINTFLAG_END(); +#undef PRINTFLAG + + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE) + return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit); +} + +static void +acpi_walk_lpit(ACPI_TABLE_HEADER *table, void *first, + void (*action)(ACPI_LPIT_HEADER *)) +{ + ACPI_LPIT_HEADER *subtable; + char *end; + + subtable = first; + end = (char *)table + table->Length; + while ((char *)subtable < end) { + printf("\n"); + if (subtable->Length < sizeof(ACPI_LPIT_HEADER)) { + warnx("invalid subtable length %u", subtable->Length); + return; + } + action(subtable); + subtable = (ACPI_LPIT_HEADER *)((char *)subtable + + subtable->Length); + } +} + +static void +acpi_handle_lpit(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_LPIT *lpit; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + lpit = (ACPI_TABLE_LPIT *)sdp; + acpi_walk_lpit(sdp, (lpit + 1), acpi_print_lpit); + + printf(END_COMMENT); +} + +static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, uint32_t flags) { @@ -1693,6 +1767,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_nfit(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_WDDT, 4)) acpi_handle_wddt(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4)) + acpi_handle_lpit(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); Modified: head/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.8 Tue Jul 10 23:30:19 2018 (r336184) +++ head/usr.sbin/acpi/acpidump/acpidump.8 Wed Jul 11 01:37:01 2018 (r336185) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2018 +.Dd July 10, 2018 .Dt ACPIDUMP 8 .Os .Sh NAME @@ -103,6 +103,7 @@ utility dumps contents of the following tables: .It FACS .It FADT .It HPET +.It LPIT .It MADT .It MCFG .It NFIT From owner-svn-src-head@freebsd.org Wed Jul 11 01:38:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 049601046DD9; Wed, 11 Jul 2018 01:38:11 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE34D75BA8; Wed, 11 Jul 2018 01:38:10 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Received: from smtp.freebsd.org (c-73-25-164-31.hsd1.or.comcast.net [73.25.164.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bwidawsk) by smtp.freebsd.org (Postfix) with ESMTPSA id 1B27D18BF9; Wed, 11 Jul 2018 01:38:10 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Date: Tue, 10 Jul 2018 18:38:08 -0700 From: Ben Widawsky To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336185 - head/usr.sbin/acpi/acpidump Message-ID: <20180711013808.mflhpmbqysf5ep44@smtp.freebsd.org> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807110137.w6B1b1ne046881@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807110137.w6B1b1ne046881@repo.freebsd.org> User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 01:38:11 -0000 Here is sample output from the tool: LPIT: Length=148, Revision=1, Checksum=32, OEMID=INTEL, OEM Table ID=SKL, OEM Revision=0x0, Creator ID=MSFT, Creator Revision=0x5f Type=ACPI_LPIT_TYPE_NATIVE_CSTATE Length=56 UniqueId=0x0000 Flags= EntryTrigger=0x0000000000000060 (?) Residency=30000 Latency=3000 ResidencyCounter=0x0000000000000632 (?) CounterFrequency=TSC Type=ACPI_LPIT_TYPE_NATIVE_CSTATE Length=56 UniqueId=0x0001 Flags= EntryTrigger=0x0000000000000060 (?) Residency=30000 Latency=3000 ResidencyCounter=0x0000000000000632 (?) CounterFrequency=TSC On 18-07-11 01:37:01, Ben Widawsky wrote: > Author: bwidawsk > Date: Wed Jul 11 01:37:01 2018 > New Revision: 336185 > URL: https://svnweb.freebsd.org/changeset/base/336185 > > Log: > acpidump(8): Add ACPI LPIT (Low Power Idle Table) > > The LPIT is the part of the "standardized" way that one can enumerate > various power state information on Intel platforms. > > The documentation for this change can be found here: > http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf > > Reviewed By: jhb > Approved By: jhb > Differential Revision: https://reviews.freebsd.org/D15931 > > Modified: > head/usr.sbin/acpi/acpidump/acpi.c > head/usr.sbin/acpi/acpidump/acpidump.8 > > Modified: head/usr.sbin/acpi/acpidump/acpi.c > ============================================================================== > --- head/usr.sbin/acpi/acpidump/acpi.c Tue Jul 10 23:30:19 2018 (r336184) > +++ head/usr.sbin/acpi/acpidump/acpi.c Wed Jul 11 01:37:01 2018 (r336185) > @@ -68,6 +68,7 @@ static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp); > static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp); > static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp); > static void acpi_handle_wddt(ACPI_TABLE_HEADER *sdp); > +static void acpi_handle_lpit(ACPI_TABLE_HEADER *sdp); > static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, > uint32_t flags); > static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); > @@ -716,6 +717,79 @@ acpi_handle_wddt(ACPI_TABLE_HEADER *sdp) > } > > static void > +acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl) > +{ > + printf("\tEntryTrigger="); > + acpi_print_gas(&nl->EntryTrigger); > + printf("\tResidency=%u\n", nl->Residency); > + printf("\tLatency=%u\n", nl->Latency); > + if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER) > + printf("\tResidencyCounter=Not Present"); > + else { > + printf("\tResidencyCounter="); > + acpi_print_gas(&nl->ResidencyCounter); > + } > + if (nl->CounterFrequency) > + printf("\tCounterFrequency=%ju\n", nl->CounterFrequency); > + else > + printf("\tCounterFrequency=TSC\n"); > +} > + > +static void > +acpi_print_lpit(ACPI_LPIT_HEADER *lpit) > +{ > + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE) > + printf("\tType=ACPI_LPIT_TYPE_NATIVE_CSTATE\n"); > + else > + warnx("unknown LPIT type %u", lpit->Type); > + > + printf("\tLength=%u\n", lpit->Length); > + printf("\tUniqueId=0x%04x\n", lpit->UniqueId); > +#define PRINTFLAG(var, flag) printflag((var), ACPI_LPIT_## flag, #flag) > + printf("\tFlags="); > + PRINTFLAG(lpit->Flags, STATE_DISABLED); > + PRINTFLAG_END(); > +#undef PRINTFLAG > + > + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE) > + return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit); > +} > + > +static void > +acpi_walk_lpit(ACPI_TABLE_HEADER *table, void *first, > + void (*action)(ACPI_LPIT_HEADER *)) > +{ > + ACPI_LPIT_HEADER *subtable; > + char *end; > + > + subtable = first; > + end = (char *)table + table->Length; > + while ((char *)subtable < end) { > + printf("\n"); > + if (subtable->Length < sizeof(ACPI_LPIT_HEADER)) { > + warnx("invalid subtable length %u", subtable->Length); > + return; > + } > + action(subtable); > + subtable = (ACPI_LPIT_HEADER *)((char *)subtable + > + subtable->Length); > + } > +} > + > +static void > +acpi_handle_lpit(ACPI_TABLE_HEADER *sdp) > +{ > + ACPI_TABLE_LPIT *lpit; > + > + printf(BEGIN_COMMENT); > + acpi_print_sdt(sdp); > + lpit = (ACPI_TABLE_LPIT *)sdp; > + acpi_walk_lpit(sdp, (lpit + 1), acpi_print_lpit); > + > + printf(END_COMMENT); > +} > + > +static void > acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, > uint32_t flags) > { > @@ -1693,6 +1767,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) > acpi_handle_nfit(sdp); > else if (!memcmp(sdp->Signature, ACPI_SIG_WDDT, 4)) > acpi_handle_wddt(sdp); > + else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4)) > + acpi_handle_lpit(sdp); > else { > printf(BEGIN_COMMENT); > acpi_print_sdt(sdp); > > Modified: head/usr.sbin/acpi/acpidump/acpidump.8 > ============================================================================== > --- head/usr.sbin/acpi/acpidump/acpidump.8 Tue Jul 10 23:30:19 2018 (r336184) > +++ head/usr.sbin/acpi/acpidump/acpidump.8 Wed Jul 11 01:37:01 2018 (r336185) > @@ -29,7 +29,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd June 20, 2018 > +.Dd July 10, 2018 > .Dt ACPIDUMP 8 > .Os > .Sh NAME > @@ -103,6 +103,7 @@ utility dumps contents of the following tables: > .It FACS > .It FADT > .It HPET > +.It LPIT > .It MADT > .It MCFG > .It NFIT > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Wed Jul 11 02:09:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBE211049538; Wed, 11 Jul 2018 02:09:12 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D9B976BC0; Wed, 11 Jul 2018 02:09:12 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E5334748; Wed, 11 Jul 2018 02:09:12 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B29Cnu062134; Wed, 11 Jul 2018 02:09:12 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B29CIT062133; Wed, 11 Jul 2018 02:09:12 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201807110209.w6B29CIT062133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Wed, 11 Jul 2018 02:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336186 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dab X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 336186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 02:09:12 -0000 Author: dab Date: Wed Jul 11 02:09:11 2018 New Revision: 336186 URL: https://svnweb.freebsd.org/changeset/base/336186 Log: Address some (although not all) style(9) issues in event.h after r335776. Reported by: bde@ MFC after: 1 day Sponsored by: Dell EMC Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h ============================================================================== --- head/sys/sys/event.h Wed Jul 11 01:37:01 2018 (r336185) +++ head/sys/sys/event.h Wed Jul 11 02:09:11 2018 (r336186) @@ -50,16 +50,16 @@ #define EVFILT_SYSCOUNT 13 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define EV_SET(kevp_, a, b, c, d, e, f) do { \ - *(kevp_) = (struct kevent){ \ - .ident = (a), \ - .filter = (b), \ - .flags = (c), \ - .fflags = (d), \ - .data = (e), \ - .udata = (f), \ - .ext = {0}, \ - }; \ +#define EV_SET(kevp_, a, b, c, d, e, f) do { \ + *(kevp_) = (struct kevent){ \ + .ident = (a), \ + .filter = (b), \ + .flags = (c), \ + .fflags = (d), \ + .data = (e), \ + .udata = (f), \ + .ext = {0}, \ + }; \ } while(0) #else /* Pre-C99 or not STDC (e.g., C++) */ /* The definition of the local variable kevp could possibly conflict From owner-svn-src-head@freebsd.org Wed Jul 11 02:32:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D688C1025130; Wed, 11 Jul 2018 02:32:07 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85A9777AAB; Wed, 11 Jul 2018 02:32:07 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CDAE4BDA; Wed, 11 Jul 2018 02:32:07 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B2W77I077096; Wed, 11 Jul 2018 02:32:07 GMT (envelope-from bwidawsk@FreeBSD.org) Received: (from bwidawsk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B2W6Kn077093; Wed, 11 Jul 2018 02:32:06 GMT (envelope-from bwidawsk@FreeBSD.org) Message-Id: <201807110232.w6B2W6Kn077093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bwidawsk set sender to bwidawsk@FreeBSD.org using -f From: Ben Widawsky Date: Wed, 11 Jul 2018 02:32:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336187 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Group: head X-SVN-Commit-Author: bwidawsk X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Commit-Revision: 336187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 02:32:08 -0000 Author: bwidawsk Date: Wed Jul 11 02:32:06 2018 New Revision: 336187 URL: https://svnweb.freebsd.org/changeset/base/336187 Log: run(4): Add a new USB device ID. Summary: Add the device id of the Panda Wireless PAU06 which seems to be the already-supported combination of RT5392 MAC and RF RT5372 radio. Reviewed By: allanjude, eadler, jhb Approved By: jhb Differential Revision: https://reviews.freebsd.org/D16211 Modified: head/share/man/man4/run.4 head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_run.c Modified: head/share/man/man4/run.4 ============================================================================== --- head/share/man/man4/run.4 Wed Jul 11 02:09:11 2018 (r336186) +++ head/share/man/man4/run.4 Wed Jul 11 02:32:06 2018 (r336187) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 19, 2015 +.Dd July 10, 2018 .Dt RUN 4 .Os .Sh NAME @@ -164,6 +164,7 @@ driver supports the following wireless adapters: .It Linksys WUSB600N .It Logitec LAN-W150N/U2 .It Mvix Nubbin MS-811N +.It Panda Wireless PAU06 .It Planex GW-USMicroN .It Planex GW-US300MiniS .It Sitecom WL-182 Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Jul 11 02:09:11 2018 (r336186) +++ head/sys/dev/usb/usbdevs Wed Jul 11 02:32:06 2018 (r336187) @@ -3900,6 +3900,7 @@ product RALINK RT3370 0x3370 RT3370 product RALINK RT3572 0x3572 RT3572 product RALINK RT3573 0x3573 RT3573 product RALINK RT5370 0x5370 RT5370 +product RALINK RT5372 0x5372 RT5372 product RALINK RT5572 0x5572 RT5572 product RALINK RT8070 0x8070 RT8070 product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Wed Jul 11 02:09:11 2018 (r336186) +++ head/sys/dev/usb/wlan/if_run.c Wed Jul 11 02:32:06 2018 (r336187) @@ -301,6 +301,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = { RUN_DEV(RALINK, RT3572), RUN_DEV(RALINK, RT3573), RUN_DEV(RALINK, RT5370), + RUN_DEV(RALINK, RT5372), RUN_DEV(RALINK, RT5572), RUN_DEV(RALINK, RT8070), RUN_DEV(SAMSUNG, WIS09ABGN), From owner-svn-src-head@freebsd.org Wed Jul 11 02:34:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32B2F10254CA; Wed, 11 Jul 2018 02:34:44 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEEA377D06; Wed, 11 Jul 2018 02:34:43 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Received: from smtp.freebsd.org (c-73-25-164-31.hsd1.or.comcast.net [73.25.164.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bwidawsk) by smtp.freebsd.org (Postfix) with ESMTPSA id 163351920F; Wed, 11 Jul 2018 02:34:42 +0000 (UTC) (envelope-from bwidawsk@freebsd.org) Date: Tue, 10 Jul 2018 19:34:41 -0700 From: Ben Widawsky To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: Scott Phillips Subject: Re: svn commit: r336187 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan Message-ID: <20180711023440.qrlsnf3bie3xbvn4@smtp.freebsd.org> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Scott Phillips References: <201807110232.w6B2W6Kn077093@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807110232.w6B2W6Kn077093@repo.freebsd.org> User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 02:34:44 -0000 I accidentally snipped the Submitted By: before committing. This was actually authored by Scott... Scott Phillips On 18-07-11 02:32:06, Ben Widawsky wrote: > Author: bwidawsk > Date: Wed Jul 11 02:32:06 2018 > New Revision: 336187 > URL: https://svnweb.freebsd.org/changeset/base/336187 > > Log: > run(4): Add a new USB device ID. > > Summary: > Add the device id of the Panda Wireless PAU06 which seems to be > the already-supported combination of RT5392 MAC and RF RT5372 > radio. > > Reviewed By: allanjude, eadler, jhb > Approved By: jhb > Differential Revision: https://reviews.freebsd.org/D16211 > > Modified: > head/share/man/man4/run.4 > head/sys/dev/usb/usbdevs > head/sys/dev/usb/wlan/if_run.c > > Modified: head/share/man/man4/run.4 > ============================================================================== > --- head/share/man/man4/run.4 Wed Jul 11 02:09:11 2018 (r336186) > +++ head/share/man/man4/run.4 Wed Jul 11 02:32:06 2018 (r336187) > @@ -16,7 +16,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd April 19, 2015 > +.Dd July 10, 2018 > .Dt RUN 4 > .Os > .Sh NAME > @@ -164,6 +164,7 @@ driver supports the following wireless adapters: > .It Linksys WUSB600N > .It Logitec LAN-W150N/U2 > .It Mvix Nubbin MS-811N > +.It Panda Wireless PAU06 > .It Planex GW-USMicroN > .It Planex GW-US300MiniS > .It Sitecom WL-182 > > Modified: head/sys/dev/usb/usbdevs > ============================================================================== > --- head/sys/dev/usb/usbdevs Wed Jul 11 02:09:11 2018 (r336186) > +++ head/sys/dev/usb/usbdevs Wed Jul 11 02:32:06 2018 (r336187) > @@ -3900,6 +3900,7 @@ product RALINK RT3370 0x3370 RT3370 > product RALINK RT3572 0x3572 RT3572 > product RALINK RT3573 0x3573 RT3573 > product RALINK RT5370 0x5370 RT5370 > +product RALINK RT5372 0x5372 RT5372 > product RALINK RT5572 0x5572 RT5572 > product RALINK RT8070 0x8070 RT8070 > product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter > > Modified: head/sys/dev/usb/wlan/if_run.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_run.c Wed Jul 11 02:09:11 2018 (r336186) > +++ head/sys/dev/usb/wlan/if_run.c Wed Jul 11 02:32:06 2018 (r336187) > @@ -301,6 +301,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = { > RUN_DEV(RALINK, RT3572), > RUN_DEV(RALINK, RT3573), > RUN_DEV(RALINK, RT5370), > + RUN_DEV(RALINK, RT5372), > RUN_DEV(RALINK, RT5572), > RUN_DEV(RALINK, RT8070), > RUN_DEV(SAMSUNG, WIS09ABGN), > From owner-svn-src-head@freebsd.org Wed Jul 11 03:23:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 989251029C23; Wed, 11 Jul 2018 03:23:11 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F847A00E; Wed, 11 Jul 2018 03:23:11 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11CAF54C6; Wed, 11 Jul 2018 03:23:11 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B3NAs0003644; Wed, 11 Jul 2018 03:23:10 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B3N9FO003639; Wed, 11 Jul 2018 03:23:09 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201807110323.w6B3N9FO003639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 11 Jul 2018 03:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336188 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 336188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 03:23:11 -0000 Author: araujo Date: Wed Jul 11 03:23:09 2018 New Revision: 336188 URL: https://svnweb.freebsd.org/changeset/base/336188 Log: Improve bhyve exit(3) error code. The bhyve(8) exit status indicates how the VM was terminated: 0 rebooted 1 powered off 2 halted 3 triple fault The problem is when we have wrappers around bhyve that parses the exit error code and gets an exit(1) for an error but interprets it as "powered off". So to mitigate this issue and makes it less error prone for third part applications, I have added a new exit code 4 that is "exited due to an error". For now the bhyve(8) exit status are: 0 rebooted 1 powered off 2 halted 3 triple fault 4 exited due to an error Reviewed by: @jhb MFC after: 2 weeks. Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D16161 Modified: head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/dbgport.c head/usr.sbin/bhyve/fwctl.c head/usr.sbin/bhyve/mevent_test.c head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 03:23:09 2018 (r336188) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 05, 2018 +.Dd Jul 11, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -520,6 +520,8 @@ powered off halted .It 3 triple fault +.It 4 +exited due to an error .El .Sh EXAMPLES If not using a boot ROM, the guest operating system must have been loaded with Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 03:23:09 2018 (r336188) @@ -397,7 +397,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) if (!CPU_ISSET(vcpu, &cpumask)) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); - exit(1); + exit(4); } CPU_CLR_ATOMIC(vcpu, &cpumask); @@ -742,7 +742,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", exitcode); - exit(1); + exit(4); } rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); @@ -753,7 +753,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip case VMEXIT_ABORT: abort(); default: - exit(1); + exit(4); } } fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); @@ -785,7 +785,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp); if (err < 0) { fprintf(stderr, "VM exit on HLT not supported\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1); if (cpu == BSP) @@ -800,7 +800,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) if (err < 0) { fprintf(stderr, "SMP mux requested, no pause support\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1); if (cpu == BSP) @@ -814,7 +814,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) if (err) { fprintf(stderr, "Unable to set x2apic state (%d)\n", err); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); @@ -850,7 +850,7 @@ do_open(const char *vmname) } } else { perror("vm_create"); - exit(1); + exit(4); } } else { if (!romboot) { @@ -859,14 +859,14 @@ do_open(const char *vmname) * bootrom must be configured to boot it. */ fprintf(stderr, "virtual machine cannot be booted\n"); - exit(1); + exit(4); } } ctx = vm_open(vmname); if (ctx == NULL) { perror("vm_open"); - exit(1); + exit(4); } #ifndef WITHOUT_CAPSICUM @@ -888,7 +888,7 @@ do_open(const char *vmname) error = vm_reinit(ctx); if (error) { perror("vm_reinit"); - exit(1); + exit(4); } } error = vm_set_topology(ctx, sockets, cores, threads, maxcpus); @@ -967,7 +967,7 @@ main(int argc, char *argv[]) break; case 's': if (pci_parse_slot(optarg) != 0) - exit(1); + exit(4); else break; case 'S': @@ -1033,7 +1033,7 @@ main(int argc, char *argv[]) if (guest_ncpus > max_vcpus) { fprintf(stderr, "%d vCPUs requested but only %d available\n", guest_ncpus, max_vcpus); - exit(1); + exit(4); } fbsdrun_set_capabilities(ctx, BSP); @@ -1042,13 +1042,13 @@ main(int argc, char *argv[]) err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL); if (err) { fprintf(stderr, "Unable to setup memory (%d)\n", errno); - exit(1); + exit(4); } error = init_msr(); if (error) { fprintf(stderr, "init_msr error %d", error); - exit(1); + exit(4); } init_mem(); @@ -1063,8 +1063,10 @@ main(int argc, char *argv[]) /* * Exit if a device emulation finds an error in its initilization */ - if (init_pci(ctx) != 0) - exit(1); + if (init_pci(ctx) != 0) { + perror("device emulation initialization error"); + exit(4); + } if (dbg_port != 0) init_dbgport(dbg_port); @@ -1079,7 +1081,7 @@ main(int argc, char *argv[]) if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) { fprintf(stderr, "ROM boot failed: unrestricted guest " "capability not available\n"); - exit(1); + exit(4); } error = vcpu_reset(ctx, BSP); assert(error == 0); @@ -1093,8 +1095,10 @@ main(int argc, char *argv[]) */ if (mptgen) { error = mptable_build(ctx, guest_ncpus); - if (error) - exit(1); + if (error) { + perror("error to build the guest tables"); + exit(4); + } } error = smbios_build(ctx); @@ -1133,5 +1137,5 @@ main(int argc, char *argv[]) */ mevent_dispatch(); - exit(1); + exit(4); } Modified: head/usr.sbin/bhyve/dbgport.c ============================================================================== --- head/usr.sbin/bhyve/dbgport.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/dbgport.c Wed Jul 11 03:23:09 2018 (r336188) @@ -139,8 +139,8 @@ init_dbgport(int sport) conn_fd = -1; if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - exit(1); + perror("cannot create socket"); + exit(4); } sin.sin_len = sizeof(sin); @@ -151,18 +151,18 @@ init_dbgport(int sport) reuse = 1; if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0) { - perror("setsockopt"); - exit(1); + perror("cannot set socket options"); + exit(4); } if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("bind"); - exit(1); + perror("cannot bind socket"); + exit(4); } if (listen(listen_fd, 1) < 0) { - perror("listen"); - exit(1); + perror("cannot listen socket"); + exit(4); } #ifndef WITHOUT_CAPSICUM Modified: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- head/usr.sbin/bhyve/fwctl.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/fwctl.c Wed Jul 11 03:23:09 2018 (r336188) @@ -375,7 +375,7 @@ fwctl_request(uint32_t value) /* Verify size */ if (value < 12) { printf("msg size error"); - exit(1); + exit(4); } rinfo.req_size = value; rinfo.req_count = 1; Modified: head/usr.sbin/bhyve/mevent_test.c ============================================================================== --- head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 03:23:09 2018 (r336188) @@ -143,7 +143,7 @@ echoer(void *param) mev = mevent_add(fd, EVF_READ, echoer_callback, &sync); if (mev == NULL) { printf("Could not allocate echoer event\n"); - exit(1); + exit(4); } while (!pthread_cond_wait(&sync.e_cond, &sync.e_mt)) { @@ -200,8 +200,8 @@ acceptor(void *param) static int first; if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - exit(1); + perror("cannot create socket"); + exit(4); } sin.sin_len = sizeof(sin); @@ -210,13 +210,13 @@ acceptor(void *param) sin.sin_port = htons(TEST_PORT); if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("bind"); - exit(1); + perror("cannot bind socket"); + exit(4); } if (listen(s, 1) < 0) { - perror("listen"); - exit(1); + perror("cannot listen socket"); + exit(4); } (void) mevent_add(s, EVF_READ, acceptor_callback, NULL); Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 03:23:09 2018 (r336188) @@ -2224,7 +2224,7 @@ e82545_open_tap(struct e82545_softc *sc, char *opts) sc->esc_tapfd = open(tbuf, O_RDWR); if (sc->esc_tapfd == -1) { DPRINTF("unable to open tap device %s\n", opts); - exit(1); + exit(4); } /* From owner-svn-src-head@freebsd.org Wed Jul 11 03:28:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13BB3102A223; Wed, 11 Jul 2018 03:28:30 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE9837A2B4; Wed, 11 Jul 2018 03:28:29 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.41] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 1B16419721; Wed, 11 Jul 2018 03:28:29 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.e.1.180613 Date: Tue, 10 Jul 2018 20:28:26 -0700 Subject: Re: svn commit: r336188 - head/usr.sbin/bhyve From: Ravi Pokala To: Marcelo Araujo , , , Message-ID: <3D1CA66E-9F52-435E-A5A4-E22C6A4931F5@panasas.com> Thread-Topic: svn commit: r336188 - head/usr.sbin/bhyve References: <201807110323.w6B3N9FO003639@repo.freebsd.org> In-Reply-To: <201807110323.w6B3N9FO003639@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 03:28:30 -0000 Hi Marcelo, If the intention is to have specific exit codes have specific meanings, wou= ldn't it be useful to set up defines or an enum or something, so a symbolic = value can be used rather than a bare integer? Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Marcelo Araujo Date: 2018-07-10, Tuesday at 20:23 To: , , Subject: svn commit: r336188 - head/usr.sbin/bhyve Author: araujo Date: Wed Jul 11 03:23:09 2018 New Revision: 336188 URL: https://svnweb.freebsd.org/changeset/base/336188 Log: Improve bhyve exit(3) error code. =20 The bhyve(8) exit status indicates how the VM was terminated: =20 0 rebooted 1 powered off 2 halted 3 triple fault =20 The problem is when we have wrappers around bhyve that parses the exit error code and gets an exit(1) for an error but interprets it as "powered= off". So to mitigate this issue and makes it less error prone for third part applications, I have added a new exit code 4 that is "exited due to an er= ror". =20 For now the bhyve(8) exit status are: 0 rebooted 1 powered off 2 halted 3 triple fault 4 exited due to an error =20 Reviewed by: @jhb MFC after: 2 weeks. Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D16161 Modified: head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/dbgport.c head/usr.sbin/bhyve/fwctl.c head/usr.sbin/bhyve/mevent_test.c head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/bhyve.8 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 03:23:09 2018 (r336188) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 05, 2018 +.Dd Jul 11, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -520,6 +520,8 @@ powered off halted .It 3 triple fault +.It 4 +exited due to an error .El .Sh EXAMPLES If not using a boot ROM, the guest operating system must have been loaded = with Modified: head/usr.sbin/bhyve/bhyverun.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 03:23:09 2018 (r336188) @@ -397,7 +397,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) =20 if (!CPU_ISSET(vcpu, &cpumask)) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); - exit(1); + exit(4); } =20 CPU_CLR_ATOMIC(vcpu, &cpumask); @@ -742,7 +742,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip if (exitcode >=3D VM_EXITCODE_MAX || handler[exitcode] =3D=3D NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", exitcode); - exit(1); + exit(4); } =20 rc =3D (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); @@ -753,7 +753,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip case VMEXIT_ABORT: abort(); default: - exit(1); + exit(4); } } fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); @@ -785,7 +785,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) err =3D vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp); if (err < 0) { fprintf(stderr, "VM exit on HLT not supported\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1); if (cpu =3D=3D BSP) @@ -800,7 +800,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) if (err < 0) { fprintf(stderr, "SMP mux requested, no pause support\n"); - exit(1); + exit(4); } vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1); if (cpu =3D=3D BSP) @@ -814,7 +814,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) =20 if (err) { fprintf(stderr, "Unable to set x2apic state (%d)\n", err); - exit(1); + exit(4); } =20 vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); @@ -850,7 +850,7 @@ do_open(const char *vmname) } } else { perror("vm_create"); - exit(1); + exit(4); } } else { if (!romboot) { @@ -859,14 +859,14 @@ do_open(const char *vmname) * bootrom must be configured to boot it. */ fprintf(stderr, "virtual machine cannot be booted\n"); - exit(1); + exit(4); } } =20 ctx =3D vm_open(vmname); if (ctx =3D=3D NULL) { perror("vm_open"); - exit(1); + exit(4); } =20 #ifndef WITHOUT_CAPSICUM @@ -888,7 +888,7 @@ do_open(const char *vmname) error =3D vm_reinit(ctx); if (error) { perror("vm_reinit"); - exit(1); + exit(4); } } error =3D vm_set_topology(ctx, sockets, cores, threads, maxcpus); @@ -967,7 +967,7 @@ main(int argc, char *argv[]) break; case 's': if (pci_parse_slot(optarg) !=3D 0) - exit(1); + exit(4); else break; case 'S': @@ -1033,7 +1033,7 @@ main(int argc, char *argv[]) if (guest_ncpus > max_vcpus) { fprintf(stderr, "%d vCPUs requested but only %d available\n", guest_ncpus, max_vcpus); - exit(1); + exit(4); } =20 fbsdrun_set_capabilities(ctx, BSP); @@ -1042,13 +1042,13 @@ main(int argc, char *argv[]) err =3D vm_setup_memory(ctx, memsize, VM_MMAP_ALL); if (err) { fprintf(stderr, "Unable to setup memory (%d)\n", errno); - exit(1); + exit(4); } =20 error =3D init_msr(); if (error) { fprintf(stderr, "init_msr error %d", error); - exit(1); + exit(4); } =20 init_mem(); @@ -1063,8 +1063,10 @@ main(int argc, char *argv[]) /* * Exit if a device emulation finds an error in its initilization */ - if (init_pci(ctx) !=3D 0) - exit(1); + if (init_pci(ctx) !=3D 0) { + perror("device emulation initialization error"); + exit(4); + } =20 if (dbg_port !=3D 0) init_dbgport(dbg_port); @@ -1079,7 +1081,7 @@ main(int argc, char *argv[]) if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) { fprintf(stderr, "ROM boot failed: unrestricted guest " "capability not available\n"); - exit(1); + exit(4); } error =3D vcpu_reset(ctx, BSP); assert(error =3D=3D 0); @@ -1093,8 +1095,10 @@ main(int argc, char *argv[]) */ if (mptgen) { error =3D mptable_build(ctx, guest_ncpus); - if (error) - exit(1); + if (error) { + perror("error to build the guest tables"); + exit(4); + } } =20 error =3D smbios_build(ctx); @@ -1133,5 +1137,5 @@ main(int argc, char *argv[]) */ mevent_dispatch(); =20 - exit(1); + exit(4); } Modified: head/usr.sbin/bhyve/dbgport.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/dbgport.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/dbgport.c Wed Jul 11 03:23:09 2018 (r336188) @@ -139,8 +139,8 @@ init_dbgport(int sport) conn_fd =3D -1; =20 if ((listen_fd =3D socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - exit(1); + perror("cannot create socket"); + exit(4); } =20 sin.sin_len =3D sizeof(sin); @@ -151,18 +151,18 @@ init_dbgport(int sport) reuse =3D 1; if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0) { - perror("setsockopt"); - exit(1); + perror("cannot set socket options"); + exit(4); } =20 if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("bind"); - exit(1); + perror("cannot bind socket"); + exit(4); } =20 if (listen(listen_fd, 1) < 0) { - perror("listen"); - exit(1); + perror("cannot listen socket"); + exit(4); } =20 #ifndef WITHOUT_CAPSICUM Modified: head/usr.sbin/bhyve/fwctl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/fwctl.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/fwctl.c Wed Jul 11 03:23:09 2018 (r336188) @@ -375,7 +375,7 @@ fwctl_request(uint32_t value) /* Verify size */ if (value < 12) { printf("msg size error"); - exit(1); + exit(4); } rinfo.req_size =3D value; rinfo.req_count =3D 1; Modified: head/usr.sbin/bhyve/mevent_test.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 03:23:09 2018 (r336188) @@ -143,7 +143,7 @@ echoer(void *param) mev =3D mevent_add(fd, EVF_READ, echoer_callback, &sync); if (mev =3D=3D NULL) { printf("Could not allocate echoer event\n"); - exit(1); + exit(4); } =20 while (!pthread_cond_wait(&sync.e_cond, &sync.e_mt)) { @@ -200,8 +200,8 @@ acceptor(void *param) static int first; =20 if ((s =3D socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror("socket"); - exit(1); + perror("cannot create socket"); + exit(4); } =20 sin.sin_len =3D sizeof(sin); @@ -210,13 +210,13 @@ acceptor(void *param) sin.sin_port =3D htons(TEST_PORT); =20 if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("bind"); - exit(1); + perror("cannot bind socket"); + exit(4); } =20 if (listen(s, 1) < 0) { - perror("listen"); - exit(1); + perror("cannot listen socket"); + exit(4); } =20 (void) mevent_add(s, EVF_READ, acceptor_callback, NULL); Modified: head/usr.sbin/bhyve/pci_e82545.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 02:32:06 2018 (r336187) +++ head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 03:23:09 2018 (r336188) @@ -2224,7 +2224,7 @@ e82545_open_tap(struct e82545_softc *sc, char *opts) sc->esc_tapfd =3D open(tbuf, O_RDWR); if (sc->esc_tapfd =3D=3D -1) { DPRINTF("unable to open tap device %s\n", opts); - exit(1); + exit(4); } =20 /* From owner-svn-src-head@freebsd.org Wed Jul 11 03:37:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 451AD102AE39; Wed, 11 Jul 2018 03:37:26 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::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 808F97A8C0; Wed, 11 Jul 2018 03:37:25 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-lf0-x242.google.com with SMTP id v22-v6so6574727lfe.8; Tue, 10 Jul 2018 20:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=YNoqBzuBQ3+kXqhOQPnvQvh45x9XsGsOHGfaqekJWjs=; b=f2NaxJ+5ChSqRRV/8gF0O7R1B9f7kpoTXmvwe+ax9lAqIZgaJv8aaSVubqxiPlSLEb 69Td52iSHQni4fHV4UQ1mcJx9YTBaoRQ3ou1Rdr7EQJF2RAFfh46Xj9TYuTx5cRRodGh Diu1UcOD1GGvVwTawDuU7H+/3V7mmpEAkukmFfXGNvJ+R6XADeUcduAwcSSZ4GOr+Hrc tJI5Dte/fALU+PEFMJF5rhkMVYwAA9YtTDKaTMsJSNQ6Mt50J5yYiacpIS5QurwBo0pX u4LbNWfQmmLZnCjLoaBDOeZujA+I6VMK7SHfByRdler7cJIO9nhZ3xEjjccR5Sh05RT1 2xSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=YNoqBzuBQ3+kXqhOQPnvQvh45x9XsGsOHGfaqekJWjs=; b=XiAlK1NYqMNABGrIk+74lH/RaU/Q/6F2Ae91rDDC8tNVMWYVqDhUvDEo7AKUoKLiBs C8toQHBS3fVSauBcNeo4zvfvi2Urh73b9WwWYWYPYrJD73PbNfbHSw1JRwAY/eh11OLO IuZmmEsBB6jcu++UQqVMFj7J3q7pPAoKwdgmK4ACY/K8k7j/Phfty9F7IN+SV3Geg39P yqwOwO7YhI9yxA8QMTGRRNGbNFkIEAoBQvAWOyhfwB0XvJ0EUDoIZAmzXvJF4Rp8xQ+8 TnHOiclVNxJzcjXdZIASRS4mJZGz611FQ0qBBqf1MqqKeKejMKVL8b7tPHIGR33Fvvoe li+Q== X-Gm-Message-State: APt69E1HMexYnYbtG6Oer7xQZkhMo2O3KFA2JfiYzEw4BF91rldlb9M/ rFfTyUZTR/yA8GqmctKdEqNuFzGl7YG49bw1Fcr2RA== X-Google-Smtp-Source: AAOMgpeEvUT9AudGFRjpROQkg5GqRp34yqdc0u8rvjC2x2q79hNU0PwU3/n1G3HP3Fciwi4AjG3uU1nIYkGDA8NlhMI= X-Received: by 2002:a19:2207:: with SMTP id i7-v6mr4312787lfi.69.1531280242976; Tue, 10 Jul 2018 20:37:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:1f0d:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 20:37:21 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <3D1CA66E-9F52-435E-A5A4-E22C6A4931F5@panasas.com> References: <201807110323.w6B3N9FO003639@repo.freebsd.org> <3D1CA66E-9F52-435E-A5A4-E22C6A4931F5@panasas.com> From: Marcelo Araujo Date: Wed, 11 Jul 2018 11:37:21 +0800 Message-ID: Subject: Re: svn commit: r336188 - head/usr.sbin/bhyve To: Ravi Pokala Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 03:37:26 -0000 Hi Ravi, Yes, you are correct! I have discussed about it in the review and the approach you mentioned is exactly I'm gonna do. Although with this patch the intention for now is make exit(1) more unique for "powered off". Snipped from the review: "OK, I will update the manpage and commit it as-is just to make the exit(1) more unique for now. I have intention to revisit it and improve all the exit returns. I will replace fprintf/perror + exit as soon as I finish the drivers analysis to make sure what can be improved as error, exit and return code." The full discussion is at that review. Best, 2018-07-11 11:28 GMT+08:00 Ravi Pokala : > Hi Marcelo, > > If the intention is to have specific exit codes have specific meanings, > wouldn't it be useful to set up defines or an enum or something, so a > symbolic value can be used rather than a bare integer? > > Thanks, > > Ravi (rpokala@) > > =EF=BB=BF-----Original Message----- > From: on behalf of Marcelo Araujo > > Date: 2018-07-10, Tuesday at 20:23 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r336188 - head/usr.sbin/bhyve > > Author: araujo > Date: Wed Jul 11 03:23:09 2018 > New Revision: 336188 > URL: https://svnweb.freebsd.org/changeset/base/336188 > > Log: > Improve bhyve exit(3) error code. > > The bhyve(8) exit status indicates how the VM was terminated: > > 0 rebooted > 1 powered off > 2 halted > 3 triple fault > > The problem is when we have wrappers around bhyve that parses the exit > error code and gets an exit(1) for an error but interprets it as > "powered off". > So to mitigate this issue and makes it less error prone for third part > applications, I have added a new exit code 4 that is "exited due to an > error". > > For now the bhyve(8) exit status are: > 0 rebooted > 1 powered off > 2 halted > 3 triple fault > 4 exited due to an error > > Reviewed by: @jhb > MFC after: 2 weeks. > Sponsored by: iXsystems Inc. > Differential Revision: https://reviews.freebsd.org/D16161 > > Modified: > head/usr.sbin/bhyve/bhyve.8 > head/usr.sbin/bhyve/bhyverun.c > head/usr.sbin/bhyve/dbgport.c > head/usr.sbin/bhyve/fwctl.c > head/usr.sbin/bhyve/mevent_test.c > head/usr.sbin/bhyve/pci_e82545.c > > Modified: head/usr.sbin/bhyve/bhyve.8 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 02:32:06 2018 (r336187) > +++ head/usr.sbin/bhyve/bhyve.8 Wed Jul 11 03:23:09 2018 (r336188) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd Jul 05, 2018 > +.Dd Jul 11, 2018 > .Dt BHYVE 8 > .Os > .Sh NAME > @@ -520,6 +520,8 @@ powered off > halted > .It 3 > triple fault > +.It 4 > +exited due to an error > .El > .Sh EXAMPLES > If not using a boot ROM, the guest operating system must have been loade= d > with > > Modified: head/usr.sbin/bhyve/bhyverun.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 02:32:06 2018 > (r336187) > +++ head/usr.sbin/bhyve/bhyverun.c Wed Jul 11 03:23:09 2018 > (r336188) > @@ -397,7 +397,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) > > if (!CPU_ISSET(vcpu, &cpumask)) { > fprintf(stderr, "Attempting to delete unknown cpu %d\n", > vcpu); > - exit(1); > + exit(4); > } > > CPU_CLR_ATOMIC(vcpu, &cpumask); > @@ -742,7 +742,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startri= p > if (exitcode >=3D VM_EXITCODE_MAX || handler[exitcode] = =3D=3D > NULL) { > fprintf(stderr, "vm_loop: unexpected exitcode > 0x%x\n", > exitcode); > - exit(1); > + exit(4); > } > > rc =3D (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); > @@ -753,7 +753,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t startri= p > case VMEXIT_ABORT: > abort(); > default: > - exit(1); > + exit(4); > } > } > fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); > @@ -785,7 +785,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) > err =3D vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tm= p); > if (err < 0) { > fprintf(stderr, "VM exit on HLT not supported\n")= ; > - exit(1); > + exit(4); > } > vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1); > if (cpu =3D=3D BSP) > @@ -800,7 +800,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) > if (err < 0) { > fprintf(stderr, > "SMP mux requested, no pause support\n"); > - exit(1); > + exit(4); > } > vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1); > if (cpu =3D=3D BSP) > @@ -814,7 +814,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) > > if (err) { > fprintf(stderr, "Unable to set x2apic state (%d)\n", err)= ; > - exit(1); > + exit(4); > } > > vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); > @@ -850,7 +850,7 @@ do_open(const char *vmname) > } > } else { > perror("vm_create"); > - exit(1); > + exit(4); > } > } else { > if (!romboot) { > @@ -859,14 +859,14 @@ do_open(const char *vmname) > * bootrom must be configured to boot it. > */ > fprintf(stderr, "virtual machine cannot be > booted\n"); > - exit(1); > + exit(4); > } > } > > ctx =3D vm_open(vmname); > if (ctx =3D=3D NULL) { > perror("vm_open"); > - exit(1); > + exit(4); > } > > #ifndef WITHOUT_CAPSICUM > @@ -888,7 +888,7 @@ do_open(const char *vmname) > error =3D vm_reinit(ctx); > if (error) { > perror("vm_reinit"); > - exit(1); > + exit(4); > } > } > error =3D vm_set_topology(ctx, sockets, cores, threads, maxcpus); > @@ -967,7 +967,7 @@ main(int argc, char *argv[]) > break; > case 's': > if (pci_parse_slot(optarg) !=3D 0) > - exit(1); > + exit(4); > else > break; > case 'S': > @@ -1033,7 +1033,7 @@ main(int argc, char *argv[]) > if (guest_ncpus > max_vcpus) { > fprintf(stderr, "%d vCPUs requested but only %d > available\n", > guest_ncpus, max_vcpus); > - exit(1); > + exit(4); > } > > fbsdrun_set_capabilities(ctx, BSP); > @@ -1042,13 +1042,13 @@ main(int argc, char *argv[]) > err =3D vm_setup_memory(ctx, memsize, VM_MMAP_ALL); > if (err) { > fprintf(stderr, "Unable to setup memory (%d)\n", errno); > - exit(1); > + exit(4); > } > > error =3D init_msr(); > if (error) { > fprintf(stderr, "init_msr error %d", error); > - exit(1); > + exit(4); > } > > init_mem(); > @@ -1063,8 +1063,10 @@ main(int argc, char *argv[]) > /* > * Exit if a device emulation finds an error in its initilization > */ > - if (init_pci(ctx) !=3D 0) > - exit(1); > + if (init_pci(ctx) !=3D 0) { > + perror("device emulation initialization error"); > + exit(4); > + } > > if (dbg_port !=3D 0) > init_dbgport(dbg_port); > @@ -1079,7 +1081,7 @@ main(int argc, char *argv[]) > if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST= , > 1)) { > fprintf(stderr, "ROM boot failed: unrestricted > guest " > "capability not available\n"); > - exit(1); > + exit(4); > } > error =3D vcpu_reset(ctx, BSP); > assert(error =3D=3D 0); > @@ -1093,8 +1095,10 @@ main(int argc, char *argv[]) > */ > if (mptgen) { > error =3D mptable_build(ctx, guest_ncpus); > - if (error) > - exit(1); > + if (error) { > + perror("error to build the guest tables"); > + exit(4); > + } > } > > error =3D smbios_build(ctx); > @@ -1133,5 +1137,5 @@ main(int argc, char *argv[]) > */ > mevent_dispatch(); > > - exit(1); > + exit(4); > } > > Modified: head/usr.sbin/bhyve/dbgport.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/dbgport.c Wed Jul 11 02:32:06 2018 > (r336187) > +++ head/usr.sbin/bhyve/dbgport.c Wed Jul 11 03:23:09 2018 > (r336188) > @@ -139,8 +139,8 @@ init_dbgport(int sport) > conn_fd =3D -1; > > if ((listen_fd =3D socket(AF_INET, SOCK_STREAM, 0)) < 0) { > - perror("socket"); > - exit(1); > + perror("cannot create socket"); > + exit(4); > } > > sin.sin_len =3D sizeof(sin); > @@ -151,18 +151,18 @@ init_dbgport(int sport) > reuse =3D 1; > if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, > sizeof(reuse)) < 0) { > - perror("setsockopt"); > - exit(1); > + perror("cannot set socket options"); > + exit(4); > } > > if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { > - perror("bind"); > - exit(1); > + perror("cannot bind socket"); > + exit(4); > } > > if (listen(listen_fd, 1) < 0) { > - perror("listen"); > - exit(1); > + perror("cannot listen socket"); > + exit(4); > } > > #ifndef WITHOUT_CAPSICUM > > Modified: head/usr.sbin/bhyve/fwctl.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/fwctl.c Wed Jul 11 02:32:06 2018 (r336187) > +++ head/usr.sbin/bhyve/fwctl.c Wed Jul 11 03:23:09 2018 (r336188) > @@ -375,7 +375,7 @@ fwctl_request(uint32_t value) > /* Verify size */ > if (value < 12) { > printf("msg size error"); > - exit(1); > + exit(4); > } > rinfo.req_size =3D value; > rinfo.req_count =3D 1; > > Modified: head/usr.sbin/bhyve/mevent_test.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 02:32:06 2018 > (r336187) > +++ head/usr.sbin/bhyve/mevent_test.c Wed Jul 11 03:23:09 2018 > (r336188) > @@ -143,7 +143,7 @@ echoer(void *param) > mev =3D mevent_add(fd, EVF_READ, echoer_callback, &sync); > if (mev =3D=3D NULL) { > printf("Could not allocate echoer event\n"); > - exit(1); > + exit(4); > } > > while (!pthread_cond_wait(&sync.e_cond, &sync.e_mt)) { > @@ -200,8 +200,8 @@ acceptor(void *param) > static int first; > > if ((s =3D socket(AF_INET, SOCK_STREAM, 0)) < 0) { > - perror("socket"); > - exit(1); > + perror("cannot create socket"); > + exit(4); > } > > sin.sin_len =3D sizeof(sin); > @@ -210,13 +210,13 @@ acceptor(void *param) > sin.sin_port =3D htons(TEST_PORT); > > if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { > - perror("bind"); > - exit(1); > + perror("cannot bind socket"); > + exit(4); > } > > if (listen(s, 1) < 0) { > - perror("listen"); > - exit(1); > + perror("cannot listen socket"); > + exit(4); > } > > (void) mevent_add(s, EVF_READ, acceptor_callback, NULL); > > Modified: head/usr.sbin/bhyve/pci_e82545.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 02:32:06 2018 > (r336187) > +++ head/usr.sbin/bhyve/pci_e82545.c Wed Jul 11 03:23:09 2018 > (r336188) > @@ -2224,7 +2224,7 @@ e82545_open_tap(struct e82545_softc *sc, char *opts= ) > sc->esc_tapfd =3D open(tbuf, O_RDWR); > if (sc->esc_tapfd =3D=3D -1) { > DPRINTF("unable to open tap device %s\n", opts); > - exit(1); > + exit(4); > } > > /* > > > > --=20 --=20 Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@freebsd.org Wed Jul 11 09:41:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5516F104AA0A; Wed, 11 Jul 2018 09:41:51 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A2DA88133; Wed, 11 Jul 2018 09:41:51 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFCF611169; Wed, 11 Jul 2018 09:41:50 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B9foKN097412; Wed, 11 Jul 2018 09:41:50 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B9fogg097391; Wed, 11 Jul 2018 09:41:50 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201807110941.w6B9fogg097391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Wed, 11 Jul 2018 09:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336195 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 336195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 09:41:51 -0000 Author: eugen Date: Wed Jul 11 09:41:50 2018 New Revision: 336195 URL: https://svnweb.freebsd.org/changeset/base/336195 Log: Make dhclient(8) verify if new MTU (option 26) differs from current one and skip unneeded MTU change. This check eliminates infinite loop of MTU change / link flap / lease verification / MTU change / link flap etc. in case of some NIC drivers like em(4) or igb(4). N.B.: obsolete u_int16_t is used in consistency with the rest of the file. PR: 229432 Approved by: mav (mentor) MFC after: 1 week Modified: head/sbin/dhclient/dispatch.c Modified: head/sbin/dhclient/dispatch.c ============================================================================== --- head/sbin/dhclient/dispatch.c Wed Jul 11 07:45:04 2018 (r336194) +++ head/sbin/dhclient/dispatch.c Wed Jul 11 09:41:50 2018 (r336195) @@ -547,17 +547,29 @@ interface_set_mtu_priv(char *ifname, u_int16_t mtu) { struct ifreq ifr; int sock; + u_int16_t old_mtu; if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) error("Can't create socket"); memset(&ifr, 0, sizeof(ifr)); + old_mtu = 0; strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - ifr.ifr_mtu = mtu; - if (ioctl(sock, SIOCSIFMTU, &ifr) == -1) - warning("SIOCSIFMTU failed (%d): %s", mtu, + if (ioctl(sock, SIOCGIFMTU, (caddr_t)&ifr) == -1) + warning("SIOCGIFMTU failed (%s): %s", ifname, strerror(errno)); + else + old_mtu = ifr.ifr_mtu; + + if (mtu != old_mtu) { + ifr.ifr_mtu = mtu; + + if (ioctl(sock, SIOCSIFMTU, &ifr) == -1) + warning("SIOCSIFMTU failed (%d): %s", mtu, + strerror(errno)); + } + close(sock); } From owner-svn-src-head@freebsd.org Wed Jul 11 13:53:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 355DF103FB58; Wed, 11 Jul 2018 13:53:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB5B3729C8; Wed, 11 Jul 2018 13:53:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC7AE13970; Wed, 11 Jul 2018 13:53:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BDrikw025680; Wed, 11 Jul 2018 13:53:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BDrieS025679; Wed, 11 Jul 2018 13:53:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201807111353.w6BDrieS025679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 11 Jul 2018 13:53:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336197 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 336197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 13:53:45 -0000 Author: trasz Date: Wed Jul 11 13:53:44 2018 New Revision: 336197 URL: https://svnweb.freebsd.org/changeset/base/336197 Log: Tweak ports(7) manual page to better explain the basics. Reviewed by: allanjude@ (earlier version) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16149 Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Wed Jul 11 12:12:49 2018 (r336196) +++ head/share/man/man7/ports.7 Wed Jul 11 13:53:44 2018 (r336197) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 5, 2018 +.Dd July 11, 2018 .Dt PORTS 7 .Os .Sh NAME @@ -35,28 +35,33 @@ The .Fx Ports Collection -offers a simple way for users and -administrators to install applications. -It is also used to build the packages, to be installed using +offers a simple way to compile and install third party applications. +It is also used to build packages, to be installed using .Xr pkg 8 . -Each -.Em port -contains any patches necessary to make the original -application source code compile and run on +It can be installed and updated using +.Xr portsnap 8 . +.Pp +The ports tree, typically located at +.Pa /usr/ports , +consists of subdirectories, one for each category; those in turn contain +individual ports. +Each port is a directory with metadata and patches necessary to make +the original application source code compile and run on .Fx . Compiling an application is as simple as typing .Nm make Cm build -in the port directory! +in the port directory. The .Pa Makefile automatically fetches the -application source code, either from a local disk or via FTP, unpacks it -on your system, applies the patches, and compiles it. -If all goes well, -simply type +application source code, either from a local disk or the network, unpacks it, +applies the patches, and compiles it. +It also recursively handles dependencies \(em other pieces of software +the port depends on in order to build and work. +Afterwards, .Nm make Cm install -to install the application. +installs the application. .Pp For more information about using ports, see the .Dq "Packages and Ports" section @@ -65,12 +70,14 @@ in .Pp .Lk https://www.FreeBSD.org/doc/en/books/handbook/ports.html .Pp -For information about creating new ports, see: +For information about creating new ports, see .%B "The Porter's Handbook": .Pp .Lk https://www.FreeBSD.org/doc/en/books/porters-handbook/ .Sh TARGETS -Some of the targets work recursively through subdirectories. +Some of the +.Xr make 1 +targets work recursively through subdirectories. This lets you, for example, install all of the .Dq Li biology ports. From owner-svn-src-head@freebsd.org Wed Jul 11 14:54:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 040241045268; Wed, 11 Jul 2018 14:54:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5DE075CB8; Wed, 11 Jul 2018 14:54:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86F0A14333; Wed, 11 Jul 2018 14:54:56 +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 w6BEsuRX057272; Wed, 11 Jul 2018 14:54:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BEsu9R057271; Wed, 11 Jul 2018 14:54:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807111454.w6BEsu9R057271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Jul 2018 14:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336199 - head/sys/netinet/libalias X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet/libalias X-SVN-Commit-Revision: 336199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 14:54:57 -0000 Author: markj Date: Wed Jul 11 14:54:56 2018 New Revision: 336199 URL: https://svnweb.freebsd.org/changeset/base/336199 Log: Remove a duplicate check. PR: 229663 Submitted by: David Binderman MFC after: 3 days Modified: head/sys/netinet/libalias/alias_irc.c Modified: head/sys/netinet/libalias/alias_irc.c ============================================================================== --- head/sys/netinet/libalias/alias_irc.c Wed Jul 11 14:50:06 2018 (r336198) +++ head/sys/netinet/libalias/alias_irc.c Wed Jul 11 14:54:56 2018 (r336199) @@ -98,8 +98,7 @@ static int fingerprint(struct libalias *la, struct alias_data *ah) { - if (ah->dport == NULL || ah->dport == NULL || ah->lnk == NULL || - ah->maxpktsize == 0) + if (ah->dport == NULL || ah->lnk == NULL || ah->maxpktsize == 0) return (-1); if (ntohs(*ah->dport) == IRC_CONTROL_PORT_NUMBER_1 || ntohs(*ah->dport) == IRC_CONTROL_PORT_NUMBER_2) From owner-svn-src-head@freebsd.org Wed Jul 11 16:44:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 641B31027B7D; Wed, 11 Jul 2018 16:44:17 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13E8A7B418; Wed, 11 Jul 2018 16:44:17 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4AFC15547; Wed, 11 Jul 2018 16:44:16 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BGiGA2014503; Wed, 11 Jul 2018 16:44:16 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BGiEDq014488; Wed, 11 Jul 2018 16:44:14 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201807111644.w6BGiEDq014488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 11 Jul 2018 16:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336201 - head/sys/dev/smartpqi X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/smartpqi X-SVN-Commit-Revision: 336201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 16:44:17 -0000 Author: sbruno Date: Wed Jul 11 16:44:14 2018 New Revision: 336201 URL: https://svnweb.freebsd.org/changeset/base/336201 Log: smartpqi(4): - Update to release "3" Submitted by: Deepak Ukey Reviewed by: mav MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16060 Modified: head/sys/dev/smartpqi/smartpqi_cam.c head/sys/dev/smartpqi/smartpqi_defines.h head/sys/dev/smartpqi/smartpqi_discovery.c head/sys/dev/smartpqi/smartpqi_event.c head/sys/dev/smartpqi/smartpqi_helper.c head/sys/dev/smartpqi/smartpqi_init.c head/sys/dev/smartpqi/smartpqi_intr.c head/sys/dev/smartpqi/smartpqi_ioctl.c head/sys/dev/smartpqi/smartpqi_main.c head/sys/dev/smartpqi/smartpqi_mem.c head/sys/dev/smartpqi/smartpqi_prototypes.h head/sys/dev/smartpqi/smartpqi_queue.c head/sys/dev/smartpqi/smartpqi_request.c head/sys/dev/smartpqi/smartpqi_sis.c head/sys/dev/smartpqi/smartpqi_structures.h Modified: head/sys/dev/smartpqi/smartpqi_cam.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_cam.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_cam.c Wed Jul 11 16:44:14 2018 (r336201) @@ -137,7 +137,6 @@ void os_remove_device(pqisrc_softstate_t *softs, xpt_async(AC_LOST_DEVICE, tmppath, NULL); xpt_free_path(tmppath); pqisrc_free_device(softs, device); - OS_SLEEP(10000); } DBG_FUNC("OUT\n"); @@ -1199,3 +1198,7 @@ void deregister_sim(struct pqisrc_softstate *softs) DBG_FUNC("OUT\n"); } + +static void smartpqi_cam_action(struct cam_sim *, union ccb *); +static void smartpqi_poll(struct cam_sim *); + Modified: head/sys/dev/smartpqi/smartpqi_defines.h ============================================================================== --- head/sys/dev/smartpqi/smartpqi_defines.h Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_defines.h Wed Jul 11 16:44:14 2018 (r336201) @@ -35,9 +35,8 @@ #define PQI_STATUS_SUCCESS 0 #define PQISRC_CMD_TIMEOUT_CNT 1200000 /* 500usec * 1200000 = 5 min */ +#define PQI_CMND_COMPLETE_TMO 1000 /* in millisecond */ -/* #define SHARE_EVENT_QUEUE_FOR_IO 1 */ - #define INVALID_ELEM 0xffff #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -94,10 +93,13 @@ enum INTR_TYPE { #define LOCKNAME_SIZE 32 +#define INTR_TYPE_NONE 0x0 #define INTR_TYPE_FIXED 0x1 #define INTR_TYPE_MSI 0x2 #define INTR_TYPE_MSIX 0x4 #define SIS_ENABLE_MSIX 0x40 +#define SIS_ENABLE_INTX 0x80 +#define PQISRC_LEGACY_INTX_MASK 0x1 #define DMA_TO_VIRT(mem) ((mem)->virt_addr) #define DMA_PHYS_LOW(mem) (((mem)->dma_addr) & 0x00000000ffffffff) @@ -120,7 +122,9 @@ typedef enum device_type DISK_DEVICE, TAPE_DEVICE, ROM_DEVICE = 5, - MEDIUM_CHANGER_DEVICE = 8, + SES_DEVICE, + CONTROLLER_DEVICE, + MEDIUM_CHANGER_DEVICE, RAID_DEVICE = 0x0c, ENCLOSURE_DEVICE, ZBC_DEVICE = 0x14 @@ -549,8 +553,8 @@ enum pqisrc_ctrl_mode{ #define PQI_MAX_LOGICALS 64 #define PQI_MAX_PHYSICALS 1024 #define PQI_MAX_DEVICES (PQI_MAX_LOGICALS + PQI_MAX_PHYSICALS + 1) /* 1 for controller device entry */ +#define PQI_MAX_EXT_TARGETS 32 - #define PQI_CTLR_INDEX (PQI_MAX_DEVICES - 1) #define PQI_PD_INDEX(t) (t + PQI_MAX_LOGICALS) @@ -700,8 +704,8 @@ typedef uint8_t *passthru_buf_type_t; #define PQISRC_DRIVER_MAJOR 1 #define PQISRC_DRIVER_MINOR 0 -#define PQISRC_DRIVER_RELEASE 1 -# define PQISRC_DRIVER_REVISION 239 +#define PQISRC_DRIVER_RELEASE 3 +#define PQISRC_DRIVER_REVISION 239 #define STR(s) # s #define PQISRC_VERSION(a, b, c, d) STR(a.b.c-d) @@ -892,15 +896,17 @@ typedef volatile uint64_t OS_ATOMIC64_T; typedef struct mtx OS_LOCK_T; typedef struct sema OS_SEMA_LOCK_T; +#define OS_PQILOCK_T OS_LOCK_T + #define OS_ACQUIRE_SPINLOCK(_lock) mtx_lock_spin(_lock) #define OS_RELEASE_SPINLOCK(_lock) mtx_unlock_spin(_lock) -#define PQI_LOCK(_lock) OS_ACQUIRE_SPINLOCK(_lock) -#define PQI_UNLOCK(_lock) OS_RELEASE_SPINLOCK(_lock) - #define OS_INIT_PQILOCK(_softs,_lock,_lockname) os_init_spinlock(_softs,_lock,_lockname) #define OS_UNINIT_PQILOCK(_lock) os_uninit_spinlock(_lock) +#define PQI_LOCK(_lock) OS_ACQUIRE_SPINLOCK(_lock) +#define PQI_UNLOCK(_lock) OS_RELEASE_SPINLOCK(_lock) + #define OS_GET_CDBP(rcb) ((rcb->cm_ccb->ccb_h.flags & CAM_CDB_POINTER) ? rcb->cm_ccb->csio.cdb_io.cdb_ptr : rcb->cm_ccb->csio.cdb_io.cdb_bytes) #define GET_SCSI_BUFFLEN(rcb) (rcb->cm_ccb->csio.dxfer_len) @@ -909,6 +915,10 @@ typedef struct sema OS_SEMA_LOCK_T; #define OS_GET_IO_REQ_QINDEX(softs,rcb) OS_GET_IO_QINDEX(softs,rcb) #define OS_GET_TMF_RESP_QID OS_GET_IO_RESP_QID #define OS_GET_TMF_REQ_QINDEX OS_GET_IO_REQ_QINDEX + +/* check request type */ +#define is_internal_req(rcb) (!(rcb)->cm_ccb) + /* sg elements addr, len, flags */ #define OS_GET_IO_SG_COUNT(rcb) rcb->nseg #define OS_GET_IO_SG_ADDR(rcb,i) rcb->sgt[i].addr @@ -926,7 +936,7 @@ typedef struct sema OS_SEMA_LOCK_T; /* Debug facility */ -#define PQISRC_LOG_LEVEL 0x30 +#define PQISRC_LOG_LEVEL 0x60 static int logging_level = PQISRC_LOG_LEVEL; @@ -935,8 +945,9 @@ static int logging_level = PQISRC_LOG_LEVEL; #define PQISRC_FLAGS_INFO 0x00000002 #define PQISRC_FLAGS_FUNC 0x00000004 #define PQISRC_FLAGS_TRACEIO 0x00000008 -#define PQISRC_FLAGS_WARN 0x00000010 -#define PQISRC_FLAGS_ERROR 0x00000020 +#define PQISRC_FLAGS_DISC 0x00000010 +#define PQISRC_FLAGS_WARN 0x00000020 +#define PQISRC_FLAGS_ERROR 0x00000040 #define DBG_INIT(fmt,args...) \ @@ -964,6 +975,13 @@ static int logging_level = PQISRC_LOG_LEVEL; do { \ if (logging_level & PQISRC_FLAGS_TRACEIO) { \ printf("[TRACEIO]:[ %s ] [ %d ]"fmt,__func__,__LINE__,##args); \ + } \ + }while(0); + +#define DBG_DISC(fmt,args...) \ + do { \ + if (logging_level & PQISRC_FLAGS_DISC) { \ + printf("[DISC]:[ %s ] [ %d ]"fmt,__func__,__LINE__,##args); \ } \ }while(0); Modified: head/sys/dev/smartpqi/smartpqi_discovery.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_discovery.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_discovery.c Wed Jul 11 16:44:14 2018 (r336201) @@ -41,6 +41,38 @@ static inline boolean_t pqisrc_scsi_sense_valid(const return (sshdr->response_code & 0x70) == 0x70; } +/* Initialize target ID pool for HBA/PDs */ +void pqisrc_init_targetid_pool(pqisrc_softstate_t *softs) +{ + int i, tid = PQI_MAX_PHYSICALS + PQI_MAX_LOGICALS - 1; + + for(i = 0; i < PQI_MAX_PHYSICALS; i++) { + softs->tid_pool.tid[i] = tid--; + } + softs->tid_pool.index = i - 1; +} + +int pqisrc_alloc_tid(pqisrc_softstate_t *softs) +{ + if(softs->tid_pool.index <= -1) { + DBG_ERR("Target ID exhausted\n"); + return INVALID_ELEM; + } + + return softs->tid_pool.tid[softs->tid_pool.index--]; +} + +void pqisrc_free_tid(pqisrc_softstate_t *softs, int tid) +{ + if(softs->tid_pool.index >= PQI_MAX_PHYSICALS) { + DBG_ERR("Target ID queue is full\n"); + return; + } + + softs->tid_pool.index++; + softs->tid_pool.tid[softs->tid_pool.index] = tid; +} + /* Update scsi sense info to a local buffer*/ boolean_t pqisrc_update_scsi_sense(const uint8_t *buff, int len, struct sense_header_scsi *header) @@ -176,6 +208,7 @@ int pqisrc_build_send_raid_request(pqisrc_softstate_t break; case SA_CACHE_FLUSH: request->data_direction = SOP_DATA_DIR_FROM_DEVICE; + memcpy(device_mem.virt_addr, buff, datasize); cdb[0] = BMIC_WRITE; cdb[6] = BMIC_CACHE_FLUSH; cdb[7] = (uint8_t)((datasize) << 8); @@ -258,7 +291,7 @@ int pqisrc_build_send_raid_request(pqisrc_softstate_t ret = PQI_STATUS_SUCCESS; } else{ - DBG_INFO("Error!! Bus=%u Target=%u, Cmd=0x%x," + DBG_DISC("Error!! Bus=%u Target=%u, Cmd=0x%x," "Ret=%d\n", BMIC_GET_LEVEL_2_BUS(scsi3addr), BMIC_GET_LEVEL_TWO_TARGET(scsi3addr), cmd, ret); @@ -342,7 +375,7 @@ retry: } if (list_len == 0) { - DBG_INFO("list_len is 0\n"); + DBG_DISC("list_len is 0\n"); memcpy(lun_data, &report_lun_header, sizeof(report_lun_header)); goto out; } @@ -491,7 +524,7 @@ static void pqisrc_assign_btl(pqi_scsi_dev_t *device) if (pqisrc_is_logical_device(device)) { if (pqisrc_is_external_raid_device(device)) { - DBG_INFO("External Raid Device!!!"); + DBG_DISC("External Raid Device!!!"); bus = PQI_EXTERNAL_RAID_VOLUME_BUS; target = (lunid >> 16) & 0x3fff; lun = lunid & 0xff; @@ -505,9 +538,6 @@ static void pqisrc_assign_btl(pqi_scsi_dev_t *device) return; } - /* physical device */ - pqisrc_set_btl(device, PQI_PHYSICAL_DEVICE_BUS, PQI_PD_INDEX(scsi3addr[6]), 0); - DBG_FUNC("OUT\n"); } @@ -547,7 +577,7 @@ static void pqisrc_fetch_sense_info(const uint8_t *sen *ascq = header.ascq; } - DBG_INFO("sense_key: %x asc: %x ascq: %x\n", *sense_key, *asc, *ascq); + DBG_DISC("sense_key: %x asc: %x ascq: %x\n", *sense_key, *asc, *ascq); DBG_FUNC("OUT\n"); } @@ -636,7 +666,7 @@ static uint8_t pqisrc_get_dev_vol_status(pqisrc_softst /* Determine the reason for not ready state. */ off_status = pqisrc_get_volume_offline_status(softs, scsi3addr); - DBG_INFO("offline_status 0x%x\n", off_status); + DBG_DISC("offline_status 0x%x\n", off_status); /* Keep volume offline in certain cases. */ switch (off_status) { @@ -806,7 +836,7 @@ static void pqisrc_get_dev_ioaccel_status(pqisrc_softs device->offload_enabled_pending = false; } - DBG_INFO("offload_config: 0x%x offload_enabled_pending: 0x%x \n", + DBG_DISC("offload_config: 0x%x offload_enabled_pending: 0x%x \n", device->offload_config, device->offload_enabled_pending); err_out: @@ -839,7 +869,7 @@ static void pqisrc_get_dev_raid_level(pqisrc_softstate } device->raid_level = raid_level; - DBG_INFO("RAID LEVEL: %x \n", raid_level); + DBG_DISC("RAID LEVEL: %x \n", raid_level); DBG_FUNC("OUT\n"); } @@ -869,7 +899,7 @@ static int pqisrc_get_dev_data(pqisrc_softstate_t *sof sizeof(device->vendor)); memcpy(device->model, &inq_buff[16], sizeof(device->model)); - DBG_INFO("DEV_TYPE: %x VENDOR: %s MODEL: %s\n", device->devtype, device->vendor, device->model); + DBG_DISC("DEV_TYPE: %x VENDOR: %s MODEL: %s\n", device->devtype, device->vendor, device->model); if (pqisrc_is_logical_device(device) && device->devtype == DISK_DEVICE) { if (pqisrc_is_external_raid_device(device)) { @@ -950,7 +980,7 @@ int pqisrc_get_ctrl_fw_version(pqisrc_softstate_t *sof "-%u", identify_ctrl->fw_build_number); out: os_mem_free(softs, (char *)identify_ctrl, sizeof(*identify_ctrl)); - DBG_INFO("Firmware version: %s Firmware build number: %d\n", softs->fw_version, softs->fw_build_number); + DBG_INIT("Firmware version: %s Firmware build number: %d\n", softs->fw_version, softs->fw_build_number); DBG_FUNC("OUT\n"); return ret; } @@ -1012,7 +1042,7 @@ static void pqisrc_get_physical_device_info(pqisrc_sof sizeof(device->phys_connector)); device->bay = id_phys->phys_bay_in_box; - DBG_INFO("BMIC DEV_TYPE: %x QUEUE DEPTH: 0x%x \n", device->device_type, device->queue_depth); + DBG_DISC("BMIC DEV_TYPE: %x QUEUE DEPTH: 0x%x \n", device->device_type, device->queue_depth); DBG_FUNC("OUT\n"); } @@ -1126,7 +1156,8 @@ static void pqisrc_update_log_dev_qdepth(pqisrc_softst raidmap_data_t *dev_data; pqi_scsi_dev_t *phys_disk; unsigned j; - + unsigned k; + DBG_FUNC("IN\n"); for(i = 0; i < PQI_MAX_DEVICES; i++) { @@ -1152,9 +1183,9 @@ static void pqisrc_update_log_dev_qdepth(pqisrc_softst LE_16(raid_map->row_cnt); queue_depth = 0; - for (i = 0; i < num_raidmap_entries; i++) { + for (k = 0; k < num_raidmap_entries; k++) { phys_disk = pqisrc_identify_device_via_ioaccel(softs, - dev_data[i].ioaccel_handle); + dev_data[k].ioaccel_handle); if (!phys_disk) { DBG_WARN( @@ -1182,7 +1213,7 @@ static int pqisrc_add_device(pqisrc_softstate_t *softs pqi_scsi_dev_t *device) { DBG_FUNC("IN\n"); - DBG_INFO("vendor: %s model: %s bus:%d target:%d lun:%d is_physical_device:0x%x expose_device:0x%x volume_offline 0x%x volume_status 0x%x \n", + DBG_WARN("vendor: %s model: %s bus:%d target:%d lun:%d is_physical_device:0x%x expose_device:0x%x volume_offline 0x%x volume_status 0x%x \n", device->vendor, device->model, device->bus, device->target, device->lun, device->is_physical_device, device->expose_device, device->volume_offline, device->volume_status); device->invalid = false; @@ -1201,7 +1232,7 @@ void pqisrc_remove_device(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { DBG_FUNC("IN\n"); - DBG_INFO("vendor: %s model: %s bus:%d target:%d lun:%d is_physical_device:0x%x expose_device:0x%x volume_offline 0x%x volume_status 0x%x \n", + DBG_DISC("vendor: %s model: %s bus:%d target:%d lun:%d is_physical_device:0x%x expose_device:0x%x volume_offline 0x%x volume_status 0x%x \n", device->vendor, device->model, device->bus, device->target, device->lun, device->is_physical_device, device->expose_device, device->volume_offline, device->volume_status); /* TBD: Call OS upper layer function to remove the device entry */ @@ -1285,21 +1316,21 @@ static void pqisrc_display_volume_status(pqisrc_softst break; } - DBG_INFO("scsi BTL %d:%d:%d %s\n", + DBG_DISC("scsi BTL %d:%d:%d %s\n", device->bus, device->target, device->lun, status); DBG_FUNC("OUT\n"); } void pqisrc_device_mem_free(pqisrc_softstate_t *softs, pqi_scsi_dev_t *device) { - DBG_INFO("IN\n"); + DBG_FUNC("IN\n"); if (!device) return; if (device->raid_map) { os_mem_free(softs, (char *)device->raid_map, sizeof(pqisrc_raid_map_t)); } os_mem_free(softs, (char *)device,sizeof(*device)); - DBG_INFO("OUT\n"); + DBG_FUNC("OUT\n"); } @@ -1308,6 +1339,9 @@ void pqisrc_free_device(pqisrc_softstate_t * softs,pqi { OS_ACQUIRE_SPINLOCK(&softs->devlist_lock); + if (!pqisrc_is_logical_device(device)) { + pqisrc_free_tid(softs,device->target); + } pqisrc_device_mem_free(softs, device); OS_RELEASE_SPINLOCK(&softs->devlist_lock); @@ -1327,8 +1361,10 @@ static void pqisrc_update_device_list(pqisrc_softstate pqi_scsi_dev_t **removed = NULL; int nadded = 0, nremoved = 0; int j; - DBG_INFO("IN\n"); + int tid = 0; + DBG_FUNC("IN\n"); + added = os_mem_alloc(softs, sizeof(*added) * PQI_MAX_DEVICES); removed = os_mem_alloc(softs, sizeof(*removed) * PQI_MAX_DEVICES); @@ -1395,8 +1431,15 @@ static void pqisrc_update_device_list(pqisrc_softstate if (device->volume_offline) continue; + /* physical device */ + if (!pqisrc_is_logical_device(device)) { + tid = pqisrc_alloc_tid(softs); + if(INVALID_ELEM != tid) + pqisrc_set_btl(device, PQI_PHYSICAL_DEVICE_BUS, tid, 0); + } + softs->device_list[device->target][device->lun] = device; - DBG_INFO("Added device %p at B : %d T : %d L : %d\n",device, + DBG_DISC("Added device %p at B : %d T : %d L : %d\n",device, device->bus,device->target,device->lun); /* To prevent this entry from being freed later. */ new_device_list[i] = NULL; @@ -1479,7 +1522,7 @@ free_and_out: os_mem_free(softs, (char *)removed, sizeof(*removed) * PQI_MAX_DEVICES); - DBG_INFO("OUT\n"); + DBG_FUNC("OUT\n"); } /* @@ -1517,7 +1560,7 @@ int pqisrc_write_driver_version_to_host_wellness(pqisr strncpy(host_wellness_driver_ver->driver_version + strlen(softs->os_name), PQISRC_DRIVER_VERSION, sizeof(host_wellness_driver_ver->driver_version) - strlen(softs->os_name)); } else { - DBG_INFO("OS name length(%lu) is longer than buffer of driver_version\n", + DBG_DISC("OS name length(%lu) is longer than buffer of driver_version\n", strlen(softs->os_name)); } host_wellness_driver_ver->driver_version[sizeof(host_wellness_driver_ver->driver_version) - 1] = '\0'; @@ -1618,7 +1661,7 @@ int pqisrc_scan_devices(pqisrc_softstate_t *softs) logical_cnt = BE_32(logical_dev_list->header.list_length) / sizeof(logical_dev_list->lun_entries[0]); - DBG_INFO("physical_cnt %d logical_cnt %d\n", physical_cnt, logical_cnt); + DBG_DISC("physical_cnt %d logical_cnt %d\n", physical_cnt, logical_cnt); if (physical_cnt) { bmic_phy_info = os_mem_alloc(softs, sizeof(*bmic_phy_info)); @@ -1663,9 +1706,15 @@ int pqisrc_scan_devices(pqisrc_softstate_t *softs) } scsi3addr = lun_ext_entry->lunid; + /* Save the target sas adderess for external raid device */ + if(lun_ext_entry->device_type == CONTROLLER_DEVICE) { + int target = lun_ext_entry->lunid[3] & 0x3f; + softs->target_sas_addr[target] = BE_64(lun_ext_entry->wwid); + } /* Skip masked physical non-disk devices. */ - if (MASKED_DEVICE(scsi3addr) && is_physical_device) + if (MASKED_DEVICE(scsi3addr) && is_physical_device + && (lun_ext_entry->ioaccel_handle == 0)) continue; device = new_device_list[new_dev_cnt]; @@ -1683,7 +1732,7 @@ int pqisrc_scan_devices(pqisrc_softstate_t *softs) if (ret) { DBG_WARN("Inquiry failed, skipping device %016llx\n", (unsigned long long)BE_64(device->scsi3addr[0])); - DBG_INFO("INQUIRY FAILED \n"); + DBG_DISC("INQUIRY FAILED \n"); continue; } pqisrc_assign_btl(device); @@ -1724,11 +1773,6 @@ int pqisrc_scan_devices(pqisrc_softstate_t *softs) pqisrc_get_physical_device_info(softs, device, bmic_phy_info); } - /* Logical device doesn't have SAS address - * so requires target SAS address for MSA. - */ - if(device->is_external_raid_device) - device->sas_address = BE_64((uint64_t)lun_ext_entry->lunid); new_dev_cnt++; break; case ENCLOSURE_DEVICE: @@ -1751,9 +1795,12 @@ int pqisrc_scan_devices(pqisrc_softstate_t *softs) if (pqisrc_is_hba_lunid(scsi3addr)) new_dev_cnt++; break; + case SES_DEVICE: + case CONTROLLER_DEVICE: + break; } } - DBG_INFO("new_dev_cnt %d\n", new_dev_cnt); + DBG_DISC("new_dev_cnt %d\n", new_dev_cnt); pqisrc_update_device_list(softs, new_device_list, new_dev_cnt); Modified: head/sys/dev/smartpqi/smartpqi_event.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_event.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_event.c Wed Jul 11 16:44:14 2018 (r336201) @@ -49,6 +49,12 @@ pqisrc_rescan_devices(pqisrc_softstate_t *softs) return ret; } +void pqisrc_wait_for_rescan_complete(pqisrc_softstate_t *softs) +{ + os_sema_lock(&softs->scan_lock); + os_sema_unlock(&softs->scan_lock); +} + /* * Subroutine to acknowledge the events processed by the driver to the adapter. */ Modified: head/sys/dev/smartpqi/smartpqi_helper.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_helper.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_helper.c Wed Jul 11 16:44:14 2018 (r336201) @@ -40,6 +40,28 @@ boolean_t pqisrc_ctrl_offline(pqisrc_softstate_t *soft return !softs->ctrl_online; } +/* Function used set/clear legacy INTx bit in Legacy Interrupt INTx + * mask clear pqi register + */ +void pqisrc_configure_legacy_intx(pqisrc_softstate_t *softs, boolean_t enable_intx) +{ + uint32_t intx_mask; + uint32_t *reg_addr = NULL; + + DBG_FUNC("IN\n"); + + if (enable_intx) + reg_addr = &softs->pqi_reg->legacy_intr_mask_clr; + else + reg_addr = &softs->pqi_reg->legacy_intr_mask_set; + + intx_mask = PCI_MEM_GET32(softs, reg_addr, PQI_LEGACY_INTR_MASK_CLR); + intx_mask |= PQISRC_LEGACY_INTX_MASK; + PCI_MEM_PUT32(softs, reg_addr, PQI_LEGACY_INTR_MASK_CLR ,intx_mask); + + DBG_FUNC("OUT\n"); +} + /* * Function used to take exposed devices to OS as offline. */ @@ -213,7 +235,6 @@ static char *raid_levels[] = { "RAID 5+1", "RAID ADG", "RAID 1(ADM)", - "RAID 6", }; /* Get the RAID level from the index */ Modified: head/sys/dev/smartpqi/smartpqi_init.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_init.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_init.c Wed Jul 11 16:44:14 2018 (r336201) @@ -96,17 +96,17 @@ static int pqisrc_report_pqi_capability(pqisrc_softsta softs->ib_spanning_supported = iu_layer_desc->ib_spanning_supported; softs->ob_spanning_supported = iu_layer_desc->ob_spanning_supported; - DBG_INFO("softs->pqi_dev_cap.max_iqs: %d\n", softs->pqi_dev_cap.max_iqs); - DBG_INFO("softs->pqi_dev_cap.max_iq_elements: %d\n", softs->pqi_dev_cap.max_iq_elements); - DBG_INFO("softs->pqi_dev_cap.max_iq_elem_len: %d\n", softs->pqi_dev_cap.max_iq_elem_len); - DBG_INFO("softs->pqi_dev_cap.min_iq_elem_len: %d\n", softs->pqi_dev_cap.min_iq_elem_len); - DBG_INFO("softs->pqi_dev_cap.max_oqs: %d\n", softs->pqi_dev_cap.max_oqs); - DBG_INFO("softs->pqi_dev_cap.max_oq_elements: %d\n", softs->pqi_dev_cap.max_oq_elements); - DBG_INFO("softs->pqi_dev_cap.max_oq_elem_len: %d\n", softs->pqi_dev_cap.max_oq_elem_len); - DBG_INFO("softs->pqi_dev_cap.intr_coales_time_granularity: %d\n", softs->pqi_dev_cap.intr_coales_time_granularity); - DBG_INFO("softs->max_ib_iu_length_per_fw: %d\n", softs->max_ib_iu_length_per_fw); - DBG_INFO("softs->ib_spanning_supported: %d\n", softs->ib_spanning_supported); - DBG_INFO("softs->ob_spanning_supported: %d\n", softs->ob_spanning_supported); + DBG_INIT("softs->pqi_dev_cap.max_iqs: %d\n", softs->pqi_dev_cap.max_iqs); + DBG_INIT("softs->pqi_dev_cap.max_iq_elements: %d\n", softs->pqi_dev_cap.max_iq_elements); + DBG_INIT("softs->pqi_dev_cap.max_iq_elem_len: %d\n", softs->pqi_dev_cap.max_iq_elem_len); + DBG_INIT("softs->pqi_dev_cap.min_iq_elem_len: %d\n", softs->pqi_dev_cap.min_iq_elem_len); + DBG_INIT("softs->pqi_dev_cap.max_oqs: %d\n", softs->pqi_dev_cap.max_oqs); + DBG_INIT("softs->pqi_dev_cap.max_oq_elements: %d\n", softs->pqi_dev_cap.max_oq_elements); + DBG_INIT("softs->pqi_dev_cap.max_oq_elem_len: %d\n", softs->pqi_dev_cap.max_oq_elem_len); + DBG_INIT("softs->pqi_dev_cap.intr_coales_time_granularity: %d\n", softs->pqi_dev_cap.intr_coales_time_granularity); + DBG_INIT("softs->max_ib_iu_length_per_fw: %d\n", softs->max_ib_iu_length_per_fw); + DBG_INIT("softs->ib_spanning_supported: %d\n", softs->ib_spanning_supported); + DBG_INIT("softs->ob_spanning_supported: %d\n", softs->ob_spanning_supported); os_mem_free(softs, (void *)capability, @@ -165,11 +165,11 @@ static int pqisrc_allocate_rcb(pqisrc_softstate_t *sof /* Set maximum outstanding requests */ /* The valid tag values are from 1, 2, ..., softs->max_outstanding_io * The rcb will be accessed by using the tag as index - * As 0 tag index is not used, we need to allocate one extra. + * * As 0 tag index is not used, we need to allocate one extra. */ softs->max_outstanding_io = softs->pqi_cap.max_outstanding_io; num_req = softs->max_outstanding_io + 1; - DBG_INFO("Max Outstanding IO reset to %d\n", num_req); + DBG_INIT("Max Outstanding IO reset to %d\n", num_req); alloc_size = num_req * sizeof(rcb_t); @@ -225,7 +225,7 @@ void pqisrc_decide_opq_config(pqisrc_softstate_t *soft DBG_FUNC("IN\n"); - DBG_INFO("softs->intr_count : %d softs->num_cpus_online : %d", + DBG_INIT("softs->intr_count : %d softs->num_cpus_online : %d", softs->intr_count, softs->num_cpus_online); if (softs->intr_count == 1 || softs->num_cpus_online == 1) { @@ -241,16 +241,14 @@ void pqisrc_decide_opq_config(pqisrc_softstate_t *soft softs->share_opq_and_eventq = false; } -#ifdef MULTIPLE_MSIX /* * softs->num_cpus_online is set as number of physical CPUs, * So we can have more queues/interrupts . */ if (softs->intr_count > 1) softs->share_opq_and_eventq = false; -#endif - DBG_INFO("softs->num_op_obq : %d\n",softs->num_op_obq); + DBG_INIT("softs->num_op_obq : %d\n",softs->num_op_obq); softs->num_op_raid_ibq = softs->num_op_obq; softs->num_op_aio_ibq = softs->num_op_raid_ibq; @@ -286,10 +284,10 @@ void pqisrc_decide_opq_config(pqisrc_softstate_t *soft sizeof(sgt_t)) + MAX_EMBEDDED_SG_IN_FIRST_IU; - DBG_INFO("softs->max_ib_iu_length: %d\n", softs->max_ib_iu_length); - DBG_INFO("softs->num_elem_per_op_ibq: %d\n", softs->num_elem_per_op_ibq); - DBG_INFO("softs->num_elem_per_op_obq: %d\n", softs->num_elem_per_op_obq); - DBG_INFO("softs->max_sg_per_iu: %d\n", softs->max_sg_per_iu); + DBG_INIT("softs->max_ib_iu_length: %d\n", softs->max_ib_iu_length); + DBG_INIT("softs->num_elem_per_op_ibq: %d\n", softs->num_elem_per_op_ibq); + DBG_INIT("softs->num_elem_per_op_obq: %d\n", softs->num_elem_per_op_obq); + DBG_INIT("softs->max_sg_per_iu: %d\n", softs->max_sg_per_iu); DBG_FUNC("OUT\n"); } @@ -479,7 +477,7 @@ int pqisrc_wait_for_pqi_reset_completion(pqisrc_softst max_timeout = (val & 0xFFFF00000000) >> 32; - DBG_INFO("max_timeout for PQI reset completion in 100 msec units = %u\n", max_timeout); + DBG_INIT("max_timeout for PQI reset completion in 100 msec units = %u\n", max_timeout); while(1) { if (pqi_reset_timeout++ == max_timeout) { @@ -566,6 +564,8 @@ int pqisrc_pqi_init(pqisrc_softstate_t *softs) goto err_out; } + softs->intr_type = INTR_TYPE_NONE; + /* Get the interrupt count, type, priority available from OS */ ret = os_get_intr_config(softs); if (ret) { @@ -573,7 +573,15 @@ int pqisrc_pqi_init(pqisrc_softstate_t *softs) ret); goto err_out; } - + + /*Enable/Set Legacy INTx Interrupt mask clear pqi register, + *if allocated interrupt is legacy type. + */ + if (INTR_TYPE_FIXED == softs->intr_type) { + pqisrc_configure_legacy_intx(softs, true); + sis_enable_intx(softs); + } + /* Create Admin Queue pair*/ ret = pqisrc_create_admin_queue(softs); if(ret) { @@ -639,7 +647,7 @@ int pqisrc_force_sis(pqisrc_softstate_t *softs) int ret = PQI_STATUS_SUCCESS; if (SIS_IS_KERNEL_PANIC(softs)) { - DBG_INFO("Controller FW is not runnning"); + DBG_INIT("Controller FW is not runnning"); return PQI_STATUS_FAILURE; } @@ -652,7 +660,7 @@ int pqisrc_force_sis(pqisrc_softstate_t *softs) return ret; } /* Disable interrupts ? */ - sis_disable_msix(softs); + sis_disable_interrupt(softs); /* reset pqi, this will delete queues */ ret = pqi_reset(softs); @@ -670,14 +678,54 @@ int pqisrc_force_sis(pqisrc_softstate_t *softs) return ret; } +int pqisrc_wait_for_cmnd_complete(pqisrc_softstate_t *softs) +{ + int ret = PQI_STATUS_SUCCESS; + int tmo = PQI_CMND_COMPLETE_TMO; + + COND_WAIT((softs->taglist.num_elem == softs->max_outstanding_io), tmo); + if (!tmo) { + DBG_ERR("Pending commands %x!!!",softs->taglist.num_elem); + ret = PQI_STATUS_TIMEOUT; + } + return ret; +} + +void pqisrc_complete_internal_cmds(pqisrc_softstate_t *softs) +{ + int tag = 0; + rcb_t *rcb; + + for (tag = 1; tag <= softs->max_outstanding_io; tag++) { + rcb = &softs->rcb[tag]; + if(rcb->req_pending && is_internal_req(rcb)) { + rcb->status = REQUEST_FAILED; + rcb->req_pending = false; + } + } +} + /* * Uninitialize the resources used during PQI initialization. */ void pqisrc_pqi_uninit(pqisrc_softstate_t *softs) { - int i; + int i, ret; + DBG_FUNC("IN\n"); - + + /* Wait for any rescan to finish */ + pqisrc_wait_for_rescan_complete(softs); + + /* Wait for commands to complete */ + ret = pqisrc_wait_for_cmnd_complete(softs); + + /* Complete all pending commands. */ + if(ret != PQI_STATUS_SUCCESS) { + pqisrc_complete_internal_cmds(softs); + os_complete_outstanding_cmds_nodevice(softs); + } + if(softs->devlist_lockcreated==true){ os_uninit_spinlock(&softs->devlist_lock); softs->devlist_lockcreated = false; @@ -701,9 +749,6 @@ void pqisrc_pqi_uninit(pqisrc_softstate_t *softs) os_dma_mem_free(softs, &softs->op_ibq_dma_mem); os_dma_mem_free(softs, &softs->op_obq_dma_mem); os_dma_mem_free(softs, &softs->event_q_dma_mem); - - /* Complete all pending commands. */ - os_complete_outstanding_cmds_nodevice(softs); /* Free rcb */ pqisrc_free_rcb(softs, softs->max_outstanding_io + 1); @@ -711,10 +756,10 @@ void pqisrc_pqi_uninit(pqisrc_softstate_t *softs) /* Free request id lists */ pqisrc_destroy_taglist(softs,&softs->taglist); - if(softs->admin_ib_queue.lockcreated==true){ - OS_UNINIT_PQILOCK(&softs->admin_ib_queue.lock); - softs->admin_ib_queue.lockcreated = false; - } + if(softs->admin_ib_queue.lockcreated==true){ + OS_UNINIT_PQILOCK(&softs->admin_ib_queue.lock); + softs->admin_ib_queue.lockcreated = false; + } /* Free Admin Queue */ os_dma_mem_free(softs, &softs->admin_queue_dma_mem); @@ -746,6 +791,12 @@ int pqisrc_init(pqisrc_softstate_t *softs) goto err_out; } + ret = os_create_semaphore("scan_lock", 1, &softs->scan_lock); + if(ret != PQI_STATUS_SUCCESS){ + DBG_ERR(" Failed to initialize scan lock\n"); + goto err_scan_lock; + } + /* Init the PQI interface */ ret = pqisrc_pqi_init(softs); if (ret) { @@ -798,12 +849,6 @@ int pqisrc_init(pqisrc_softstate_t *softs) } softs->devlist_lockcreated = true; - ret = os_create_semaphore("scan_lock", 1, &softs->scan_lock); - if(ret != PQI_STATUS_SUCCESS){ - DBG_ERR(" Failed to initialize scan lock\n"); - goto err_scan_lock; - } - OS_ATOMIC64_SET(softs, num_intrs, 0); softs->prev_num_intrs = softs->num_intrs; @@ -825,12 +870,12 @@ int pqisrc_init(pqisrc_softstate_t *softs) for(j = 0; j < PQI_MAX_MULTILUN; j++) softs->device_list[i][j] = NULL; + pqisrc_init_targetid_pool(softs); + DBG_FUNC("OUT\n"); return ret; err_config_tab: - os_destroy_semaphore(&softs->scan_lock); -err_scan_lock: if(softs->devlist_lockcreated==true){ os_uninit_spinlock(&softs->devlist_lock); softs->devlist_lockcreated = false; @@ -843,6 +888,8 @@ err_host_wellness: err_intr: pqisrc_pqi_uninit(softs); err_pqi: + os_destroy_semaphore(&softs->scan_lock); +err_scan_lock: pqisrc_sis_uninit(softs); err_out: DBG_FUNC("OUT failed\n"); @@ -899,13 +946,13 @@ void pqisrc_uninit(pqisrc_softstate_t *softs) { DBG_FUNC("IN\n"); - os_destroy_intr(softs); - - os_destroy_semaphore(&softs->scan_lock); - pqisrc_pqi_uninit(softs); pqisrc_sis_uninit(softs); + + os_destroy_semaphore(&softs->scan_lock); + + os_destroy_intr(softs); pqisrc_cleanup_devices(softs); Modified: head/sys/dev/smartpqi/smartpqi_intr.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_intr.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_intr.c Wed Jul 11 16:44:14 2018 (r336201) @@ -181,7 +181,7 @@ int register_legacy_intr(pqisrc_softstate_t *softs) return PQI_STATUS_FAILURE; } softs->os_specific.msi_ctx[0].pqi_dev = dev; - softs->os_specific.msi_ctx[0].oq_id = 0; + softs->os_specific.msi_ctx[0].oq_id = 1; error = bus_setup_intr(dev, softs->os_specific.pqi_irq[0], INTR_TYPE_CAM | INTR_MPSAFE, \ @@ -227,7 +227,7 @@ int register_msix_intr(pqisrc_softstate_t *softs) } softs->os_specific.msi_ctx[i].pqi_dev = dev; - softs->os_specific.msi_ctx[i].oq_id = i; + softs->os_specific.msi_ctx[i].oq_id = i+1; error = bus_setup_intr(dev,softs->os_specific.pqi_irq[i], INTR_TYPE_CAM | INTR_MPSAFE,\ Modified: head/sys/dev/smartpqi/smartpqi_ioctl.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_ioctl.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_ioctl.c Wed Jul 11 16:44:14 2018 (r336201) @@ -166,6 +166,10 @@ static int smartpqi_ioctl(struct cdev *cdev, u_long cm return error; } +static d_open_t smartpqi_open; +static d_ioctl_t smartpqi_ioctl; +static d_close_t smartpqi_close; + static struct cdevsw smartpqi_cdevsw = { .d_version = D_VERSION, @@ -312,6 +316,11 @@ pqisrc_passthru_ioctl(struct pqisrc_softstate *softs, request.sg_descriptors[0].flags = SG_FLAG_LAST; } tag = pqisrc_get_tag(&softs->taglist); + if (INVALID_ELEM == tag) { + DBG_ERR("Tag not available\n"); + ret = PQI_STATUS_FAILURE; + goto free_mem; + } request.request_id = tag; request.response_queue_id = ob_q->q_id; request.error_index = request.request_id; Modified: head/sys/dev/smartpqi/smartpqi_main.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_main.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_main.c Wed Jul 11 16:44:14 2018 (r336201) @@ -75,6 +75,10 @@ struct pqi_ident {0x9005, 0x028f, 0x9005, 0x806, PQI_HWIF_SRCV, "SmartRAID 3100"}, {0x9005, 0x028f, 0x9005, 0x807, PQI_HWIF_SRCV, "SmartRAID 3162-8i"}, {0x9005, 0x028f, 0x152d, 0x8a22, PQI_HWIF_SRCV, "QS-8204-8i"}, + {0x9005, 0x028f, 0x193d, 0xf460, PQI_HWIF_SRCV, "UN RAID P460-M4"}, + {0x9005, 0x028f, 0x193d, 0xf461, PQI_HWIF_SRCV, "UN RAID P460-B4"}, + {0x9005, 0x028f, 0x1bd4, 0x004b, PQI_HWIF_SRCV, "INSPUR RAID PM8204-2GB"}, + {0x9005, 0x028f, 0x1bd4, 0x004c, PQI_HWIF_SRCV, "INSPUR RAID PM8204-4GB"}, /* (MSCC PM8222 8x12G based) */ {0x9005, 0x028f, 0x9005, 0x900, PQI_HWIF_SRCV, "SmartHBA 2100-8i"}, @@ -87,6 +91,10 @@ struct pqi_ident {0x9005, 0x028f, 0x9005, 0x907, PQI_HWIF_SRCV, "HBA 1100"}, {0x9005, 0x028f, 0x9005, 0x908, PQI_HWIF_SRCV, "SmartHBA 2100"}, {0x9005, 0x028f, 0x9005, 0x90a, PQI_HWIF_SRCV, "SmartHBA 2100A-8i"}, + {0x9005, 0x028f, 0x193d, 0x8460, PQI_HWIF_SRCV, "UN HBA H460-M1"}, + {0x9005, 0x028f, 0x193d, 0x8461, PQI_HWIF_SRCV, "UN HBA H460-B1"}, + {0x9005, 0x028f, 0x1bd4, 0x004a, PQI_HWIF_SRCV, "INSPUR SMART-HBA PM8222-SHBA"}, + {0x9005, 0x028f, 0x13fe, 0x8312, PQI_HWIF_SRCV, "MIC-8312BridgeB"}, /* (SRCx MSCC FVB 24x12G based) */ {0x9005, 0x028f, 0x103c, 0x1001, PQI_HWIF_SRCV, "MSCC FVB"}, @@ -99,10 +107,13 @@ struct pqi_ident {0x9005, 0x028f, 0x9005, 0x1301, PQI_HWIF_SRCV, "HBA 1100-24i"}, {0x9005, 0x028f, 0x9005, 0x1302, PQI_HWIF_SRCV, "SmartHBA 2100-8i8e"}, {0x9005, 0x028f, 0x9005, 0x1303, PQI_HWIF_SRCV, "SmartHBA 2100-24i"}, + {0x9005, 0x028f, 0x105b, 0x1321, PQI_HWIF_SRCV, "8242-24i"}, + {0x9005, 0x028f, 0x1bd4, 0x0045, PQI_HWIF_SRCV, "INSPUR SMART-HBA 8242-24i"}, /* (MSCC PM8236 16x12G based) */ {0x9005, 0x028f, 0x152d, 0x8a24, PQI_HWIF_SRCV, "QS-8236-16i"}, {0x9005, 0x028f, 0x9005, 0x1380, PQI_HWIF_SRCV, "SmartRAID 3154-16i"}, + {0x9005, 0x028f, 0x1bd4, 0x0046, PQI_HWIF_SRCV, "INSPUR RAID 8236-16i"}, /* (MSCC PM8237 24x12G based) */ {0x9005, 0x028f, 0x103c, 0x1100, PQI_HWIF_SRCV, "P816i-a SR Gen10"}, @@ -112,12 +123,16 @@ struct pqi_ident {0x9005, 0x028f, 0x152d, 0x8a23, PQI_HWIF_SRCV, "QS-8238-16i"}, {0x9005, 0x028f, 0x9005, 0x1280, PQI_HWIF_SRCV, "HBA 1100-16i"}, {0x9005, 0x028f, 0x9005, 0x1281, PQI_HWIF_SRCV, "HBA 1100-16e"}, + {0x9005, 0x028f, 0x105b, 0x1211, PQI_HWIF_SRCV, "8238-16i"}, + {0x9005, 0x028f, 0x1bd4, 0x0048, PQI_HWIF_SRCV, "INSPUR SMART-HBA 8238-16i"}, + {0x9005, 0x028f, 0x9005, 0x1282, PQI_HWIF_SRCV, "SmartHBA 2100-16i"}, /* (MSCC PM8240 24x12G based) */ {0x9005, 0x028f, 0x152d, 0x8a36, PQI_HWIF_SRCV, "QS-8240-24i"}, {0x9005, 0x028f, 0x9005, 0x1200, PQI_HWIF_SRCV, "SmartRAID 3154-24i"}, {0x9005, 0x028f, 0x9005, 0x1201, PQI_HWIF_SRCV, "SmartRAID 3154-8i16e"}, {0x9005, 0x028f, 0x9005, 0x1202, PQI_HWIF_SRCV, "SmartRAID 3154-8i8e"}, + {0x9005, 0x028f, 0x1bd4, 0x0047, PQI_HWIF_SRCV, "INSPUR RAID 8240-24i"}, {0, 0, 0, 0, 0, 0} }; @@ -466,6 +481,12 @@ smartpqi_shutdown(void *arg) return rval; } + +static int smartpqi_probe(device_t dev); +static int smartpqi_attach(device_t dev); +static int smartpqi_detach(device_t dev); +static int smartpqi_suspend(device_t dev); +static int smartpqi_resume(device_t dev); /* * PCI bus interface. Modified: head/sys/dev/smartpqi/smartpqi_mem.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_mem.c Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_mem.c Wed Jul 11 16:44:14 2018 (r336201) @@ -40,20 +40,6 @@ os_dma_map(void *arg, bus_dma_segment_t *segs, int nse *paddr = segs[0].ds_addr; } -int os_dma_setup(pqisrc_softstate_t *softs) -{ - DBG_FUNC("IN\n"); - DBG_FUNC("OUT\n"); - return PQI_STATUS_SUCCESS; -} - -int os_dma_destroy(pqisrc_softstate_t *softs) -{ - DBG_FUNC("IN\n"); - DBG_FUNC("OUT\n"); - return PQI_STATUS_SUCCESS; -} - /* * DMA mem resource allocation wrapper function */ Modified: head/sys/dev/smartpqi/smartpqi_prototypes.h ============================================================================== --- head/sys/dev/smartpqi/smartpqi_prototypes.h Wed Jul 11 14:56:38 2018 (r336200) +++ head/sys/dev/smartpqi/smartpqi_prototypes.h Wed Jul 11 16:44:14 2018 (r336201) @@ -38,6 +38,8 @@ void pqisrc_pqi_uninit(pqisrc_softstate_t *); int pqisrc_process_config_table(pqisrc_softstate_t *); int pqisrc_flush_cache(pqisrc_softstate_t *, enum pqisrc_flush_cache_event_type); int pqisrc_wait_for_pqi_reset_completion(pqisrc_softstate_t *); +int pqisrc_wait_for_cmnd_complete(pqisrc_softstate_t *); +void pqisrc_complete_internal_cmds(pqisrc_softstate_t *); /* pqi_sis.c*/ int pqisrc_sis_init(pqisrc_softstate_t *); @@ -45,8 +47,11 @@ void pqisrc_sis_uninit(pqisrc_softstate_t *); int pqisrc_reenable_sis(pqisrc_softstate_t *); void pqisrc_trigger_nmi_sis(pqisrc_softstate_t *); void sis_disable_msix(pqisrc_softstate_t *); +void sis_enable_intx(pqisrc_softstate_t *); +void sis_disable_intx(pqisrc_softstate_t *softs); int pqisrc_force_sis(pqisrc_softstate_t *); int pqisrc_sis_wait_for_db_bit_to_clear(pqisrc_softstate_t *, uint32_t); +void sis_disable_interrupt(pqisrc_softstate_t*); /* pqi_queue.c */ int pqisrc_submit_admin_req(pqisrc_softstate_t *, @@ -82,6 +87,9 @@ void pqisrc_cleanup_devices(pqisrc_softstate_t *); void pqisrc_device_mem_free(pqisrc_softstate_t *, pqi_scsi_dev_t *); boolean_t pqisrc_is_external_raid_device(pqi_scsi_dev_t *device); void pqisrc_free_device(pqisrc_softstate_t * softs,pqi_scsi_dev_t *device); +void pqisrc_init_targetid_pool(pqisrc_softstate_t *softs); +int pqisrc_alloc_tid(pqisrc_softstate_t *softs); +void pqisrc_free_tid(pqisrc_softstate_t *softs, int); /* pqi_helper.c */ boolean_t pqisrc_ctrl_offline(pqisrc_softstate_t *); @@ -95,6 +103,7 @@ void pqisrc_display_device_info(pqisrc_softstate_t *, boolean_t pqisrc_scsi3addr_equal(uint8_t *, uint8_t *); void check_struct_sizes(void); char *pqisrc_raidlevel_to_string(uint8_t); +void pqisrc_configure_legacy_intx(pqisrc_softstate_t*, boolean_t); /* pqi_response.c */ void pqisrc_signal_event(pqisrc_softstate_t *softs, rcb_t *rcb); @@ -131,6 +140,9 @@ int pqisrc_process_event_intr_src(pqisrc_softstate_t * void pqisrc_ack_all_events(void *arg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jul 11 17:54:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD645102F0AB; Wed, 11 Jul 2018 17:54:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5BB7E1A6; Wed, 11 Jul 2018 17:54:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 575241606B; Wed, 11 Jul 2018 17:54:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BHsgeO050471; Wed, 11 Jul 2018 17:54:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BHsg8n050470; Wed, 11 Jul 2018 17:54:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807111754.w6BHsg8n050470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 11 Jul 2018 17:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336202 - head/sys/dev/spibus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/spibus X-SVN-Commit-Revision: 336202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 17:54:43 -0000 Author: ian Date: Wed Jul 11 17:54:41 2018 New Revision: 336202 URL: https://svnweb.freebsd.org/changeset/base/336202 Log: Enhancements and fixes for the spigen(4) driver... - Resources used by spigen_mmap_single() are now tracked using devfs_set_cdevpriv() rather than in the softc. - Since resources are now tracked per-open-fd, there is no need to try to impose any exclusive-open logic, so flags related to that are removed. - Flags used to track open status to prevent detach() when the device is open are replaced with calls to device_busy()/device_unbusy(). That extends the protection up the hierarchy so that the spibus and hardware controller drivers also can't be detached while the device is open/in use. - Arbitrary limits on the maximum size of a transfer are removed, along with the sysctl variables that allowed the limits to be changed. There is just no reason to limit the size of a spi transfer to the machine's page size. Or to any other arbitrary value, really. - Most of the locking is removed. It was mostly protecting access to flags and fields in the softc that no longer exist. The locking that remains is just to prevent concurrent calls to device_[un]busy(). - The code was calling malloc() with M_WAITOK while holding a mutex in several places. Since most of the locking is gone, that's fixed. Modified: head/sys/dev/spibus/spigen.c Modified: head/sys/dev/spibus/spigen.c ============================================================================== --- head/sys/dev/spibus/spigen.c Wed Jul 11 16:44:14 2018 (r336201) +++ head/sys/dev/spibus/spigen.c Wed Jul 11 17:54:41 2018 (r336202) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -55,13 +54,16 @@ __FBSDID("$FreeBSD$"); #ifdef FDT #include + +static struct ofw_compat_data compat_data[] = { + {"freebsd,spigen", true}, + {NULL, false} +}; + #endif #include "spibus_if.h" -#define SPIGEN_OPEN (1 << 0) -#define SPIGEN_MMAP_BUSY (1 << 1) - struct spigen_softc { device_t sc_dev; struct cdev *sc_cdev; @@ -69,15 +71,14 @@ struct spigen_softc { struct cdev *sc_adev; /* alias device */ #endif struct mtx sc_mtx; - uint32_t sc_command_length_max; /* cannot change while mmapped */ - uint32_t sc_data_length_max; /* cannot change while mmapped */ - vm_object_t sc_mmap_buffer; /* command, then data */ - vm_offset_t sc_mmap_kvaddr; - size_t sc_mmap_buffer_size; - int sc_debug; - int sc_flags; }; +struct spigen_mmap { + vm_object_t bufobj; + vm_offset_t kvaddr; + size_t bufsize; +}; + static int spigen_probe(device_t dev) { @@ -92,7 +93,7 @@ spigen_probe(device_t dev) #ifdef FDT if (ofw_bus_status_okay(dev) && - ofw_bus_is_compatible(dev, "freebsd,spigen")) + ofw_bus_search_compatible(dev, compat_data)->ocd_data) rv = BUS_PROBE_DEFAULT; #endif @@ -116,76 +117,6 @@ static struct cdevsw spigen_cdevsw = { }; static int -spigen_command_length_max_proc(SYSCTL_HANDLER_ARGS) -{ - struct spigen_softc *sc = (struct spigen_softc *)arg1; - uint32_t command_length_max; - int error; - - mtx_lock(&sc->sc_mtx); - command_length_max = sc->sc_command_length_max; - mtx_unlock(&sc->sc_mtx); - error = sysctl_handle_int(oidp, &command_length_max, - sizeof(command_length_max), req); - if (error == 0 && req->newptr != NULL) { - mtx_lock(&sc->sc_mtx); - if (sc->sc_mmap_buffer != NULL) - error = EBUSY; - else - sc->sc_command_length_max = command_length_max; - mtx_unlock(&sc->sc_mtx); - } - return (error); -} - -static int -spigen_data_length_max_proc(SYSCTL_HANDLER_ARGS) -{ - struct spigen_softc *sc = (struct spigen_softc *)arg1; - uint32_t data_length_max; - int error; - - mtx_lock(&sc->sc_mtx); - data_length_max = sc->sc_data_length_max; - mtx_unlock(&sc->sc_mtx); - error = sysctl_handle_int(oidp, &data_length_max, - sizeof(data_length_max), req); - if (error == 0 && req->newptr != NULL) { - mtx_lock(&sc->sc_mtx); - if (sc->sc_mmap_buffer != NULL) - error = EBUSY; - else - sc->sc_data_length_max = data_length_max; - mtx_unlock(&sc->sc_mtx); - } - return (error); -} - -static void -spigen_sysctl_init(struct spigen_softc *sc) -{ - struct sysctl_ctx_list *ctx; - struct sysctl_oid *tree_node; - struct sysctl_oid_list *tree; - - /* - * Add system sysctl tree/handlers. - */ - ctx = device_get_sysctl_ctx(sc->sc_dev); - tree_node = device_get_sysctl_tree(sc->sc_dev); - tree = SYSCTL_CHILDREN(tree_node); - SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "command_length_max", - CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), - spigen_command_length_max_proc, "IU", "SPI command header portion (octets)"); - SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "data_length_max", - CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), - spigen_data_length_max_proc, "IU", "SPI data trailer portion (octets)"); - SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "data", CTLFLAG_RW, - &sc->sc_debug, 0, "debug flags"); - -} - -static int spigen_attach(device_t dev) { struct spigen_softc *sc; @@ -198,8 +129,6 @@ spigen_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_command_length_max = PAGE_SIZE; - sc->sc_data_length_max = PAGE_SIZE; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); @@ -230,30 +159,23 @@ spigen_attach(device_t dev) } #endif - spigen_sysctl_init(sc); - return (0); } static int spigen_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) { - int error; device_t dev; struct spigen_softc *sc; - error = 0; dev = cdev->si_drv1; sc = device_get_softc(dev); mtx_lock(&sc->sc_mtx); - if (sc->sc_flags & SPIGEN_OPEN) - error = EBUSY; - else - sc->sc_flags |= SPIGEN_OPEN; + device_busy(sc->sc_dev); mtx_unlock(&sc->sc_mtx); - return (error); + return (0); } static int @@ -261,23 +183,16 @@ spigen_transfer(struct cdev *cdev, struct spigen_trans { struct spi_command transfer = SPI_COMMAND_INITIALIZER; device_t dev = cdev->si_drv1; - struct spigen_softc *sc = device_get_softc(dev); int error = 0; - mtx_lock(&sc->sc_mtx); - if (st->st_command.iov_len == 0) - error = EINVAL; - else if (st->st_command.iov_len > sc->sc_command_length_max || - st->st_data.iov_len > sc->sc_data_length_max) - error = ENOMEM; - mtx_unlock(&sc->sc_mtx); - if (error) - return (error); - #if 0 device_printf(dev, "cmd %p %u data %p %u\n", st->st_command.iov_base, st->st_command.iov_len, st->st_data.iov_base, st->st_data.iov_len); #endif + + if (st->st_command.iov_len == 0) + return (EINVAL); + transfer.tx_cmd = transfer.rx_cmd = malloc(st->st_command.iov_len, M_DEVBUF, M_WAITOK); if (st->st_data.iov_len > 0) { @@ -313,37 +228,22 @@ spigen_transfer_mmapped(struct cdev *cdev, struct spig { struct spi_command transfer = SPI_COMMAND_INITIALIZER; device_t dev = cdev->si_drv1; - struct spigen_softc *sc = device_get_softc(dev); - int error = 0; + struct spigen_mmap *mmap; + int error; - mtx_lock(&sc->sc_mtx); - if (sc->sc_flags & SPIGEN_MMAP_BUSY) - error = EBUSY; - else if (stm->stm_command_length > sc->sc_command_length_max || - stm->stm_data_length > sc->sc_data_length_max) - error = E2BIG; - else if (sc->sc_mmap_buffer == NULL) - error = EINVAL; - else if (sc->sc_mmap_buffer_size < - stm->stm_command_length + stm->stm_data_length) - error = ENOMEM; - if (error == 0) - sc->sc_flags |= SPIGEN_MMAP_BUSY; - mtx_unlock(&sc->sc_mtx); - if (error) + if ((error = devfs_get_cdevpriv((void **)&mmap)) != 0) return (error); - - transfer.tx_cmd = transfer.rx_cmd = (void *)sc->sc_mmap_kvaddr; + + if (mmap->bufsize < stm->stm_command_length + stm->stm_data_length) + return (E2BIG); + + transfer.tx_cmd = transfer.rx_cmd = (void *)((uintptr_t)mmap->kvaddr); transfer.tx_cmd_sz = transfer.rx_cmd_sz = stm->stm_command_length; transfer.tx_data = transfer.rx_data = - (void *)(sc->sc_mmap_kvaddr + stm->stm_command_length); + (void *)((uintptr_t)mmap->kvaddr + stm->stm_command_length); transfer.tx_data_sz = transfer.rx_data_sz = stm->stm_data_length; error = SPIBUS_TRANSFER(device_get_parent(dev), dev, &transfer); - mtx_lock(&sc->sc_mtx); - KASSERT((sc->sc_flags & SPIGEN_MMAP_BUSY), ("mmap no longer marked busy")); - sc->sc_flags &= ~(SPIGEN_MMAP_BUSY); - mtx_unlock(&sc->sc_mtx); return (error); } @@ -380,14 +280,26 @@ spigen_ioctl(struct cdev *cdev, u_long cmd, caddr_t da return (error); } +static void +spigen_mmap_cleanup(void *arg) +{ + struct spigen_mmap *mmap = arg; + + if (mmap->kvaddr != 0) + pmap_qremove(mmap->kvaddr, mmap->bufsize / PAGE_SIZE); + if (mmap->bufobj != NULL) + vm_object_deallocate(mmap->bufobj); + free(mmap, M_DEVBUF); +} + static int spigen_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, struct vm_object **object, int nprot) { - device_t dev = cdev->si_drv1; - struct spigen_softc *sc = device_get_softc(dev); + struct spigen_mmap *mmap; vm_page_t *m; size_t n, pages; + int error; if (size == 0 || (nprot & (PROT_EXEC | PROT_READ | PROT_WRITE)) @@ -396,34 +308,38 @@ spigen_mmap_single(struct cdev *cdev, vm_ooffset_t *of size = roundup2(size, PAGE_SIZE); pages = size / PAGE_SIZE; - mtx_lock(&sc->sc_mtx); - if (sc->sc_mmap_buffer != NULL) { - mtx_unlock(&sc->sc_mtx); + if (devfs_get_cdevpriv((void **)&mmap) == 0) return (EBUSY); - } else if (size > sc->sc_command_length_max + sc->sc_data_length_max) { - mtx_unlock(&sc->sc_mtx); - return (E2BIG); + + mmap = malloc(sizeof(*mmap), M_DEVBUF, M_ZERO | M_WAITOK); + if ((mmap->kvaddr = kva_alloc(size)) == 0) { + spigen_mmap_cleanup(mmap); + return (ENOMEM); } - sc->sc_mmap_buffer_size = size; - *offset = 0; - sc->sc_mmap_buffer = *object = vm_pager_allocate(OBJT_PHYS, 0, size, - nprot, *offset, curthread->td_ucred); + mmap->bufsize = size; + mmap->bufobj = vm_pager_allocate(OBJT_PHYS, 0, size, nprot, 0, + curthread->td_ucred); + m = malloc(sizeof(*m) * pages, M_TEMP, M_WAITOK); - VM_OBJECT_WLOCK(*object); - vm_object_reference_locked(*object); // kernel and userland both + VM_OBJECT_WLOCK(mmap->bufobj); + vm_object_reference_locked(mmap->bufobj); // kernel and userland both for (n = 0; n < pages; n++) { - m[n] = vm_page_grab(*object, n, + m[n] = vm_page_grab(mmap->bufobj, n, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_WIRED); m[n]->valid = VM_PAGE_BITS_ALL; } - VM_OBJECT_WUNLOCK(*object); - sc->sc_mmap_kvaddr = kva_alloc(size); - pmap_qenter(sc->sc_mmap_kvaddr, m, pages); + VM_OBJECT_WUNLOCK(mmap->bufobj); + pmap_qenter(mmap->kvaddr, m, pages); free(m, M_TEMP); - mtx_unlock(&sc->sc_mtx); - if (*object == NULL) - return (EINVAL); + if ((error = devfs_set_cdevpriv(mmap, spigen_mmap_cleanup)) != 0) { + /* Two threads were racing through this code; we lost. */ + spigen_mmap_cleanup(mmap); + return (error); + } + *offset = 0; + *object = mmap->bufobj; + return (0); } @@ -434,16 +350,7 @@ spigen_close(struct cdev *cdev, int fflag, int devtype struct spigen_softc *sc = device_get_softc(dev); mtx_lock(&sc->sc_mtx); - if (sc->sc_mmap_buffer != NULL) { - pmap_qremove(sc->sc_mmap_kvaddr, - sc->sc_mmap_buffer_size / PAGE_SIZE); - kva_free(sc->sc_mmap_kvaddr, sc->sc_mmap_buffer_size); - sc->sc_mmap_kvaddr = 0; - vm_object_deallocate(sc->sc_mmap_buffer); - sc->sc_mmap_buffer = NULL; - sc->sc_mmap_buffer_size = 0; - } - sc->sc_flags &= ~(SPIGEN_OPEN); + device_unbusy(sc->sc_dev); mtx_unlock(&sc->sc_mtx); return (0); } @@ -455,15 +362,6 @@ spigen_detach(device_t dev) sc = device_get_softc(dev); - mtx_lock(&sc->sc_mtx); - if (sc->sc_flags & SPIGEN_OPEN) { - mtx_unlock(&sc->sc_mtx); - return (EBUSY); - } - mtx_unlock(&sc->sc_mtx); - - mtx_destroy(&sc->sc_mtx); - #ifdef SPIGEN_LEGACY_CDEVNAME if (sc->sc_adev) destroy_dev(sc->sc_adev); @@ -472,6 +370,8 @@ spigen_detach(device_t dev) if (sc->sc_cdev) destroy_dev(sc->sc_cdev); + mtx_destroy(&sc->sc_mtx); + return (0); } @@ -494,3 +394,6 @@ static driver_t spigen_driver = { DRIVER_MODULE(spigen, spibus, spigen_driver, spigen_devclass, 0, 0); MODULE_DEPEND(spigen, spibus, 1, 1, 1); +#ifdef FDT +SIMPLEBUS_PNP_INFO(compat_data); +#endif From owner-svn-src-head@freebsd.org Wed Jul 11 18:53:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B26C1034DE0; Wed, 11 Jul 2018 18:53:20 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D8CC80D62; Wed, 11 Jul 2018 18:53:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04A4B169ED; Wed, 11 Jul 2018 18:53:20 +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 w6BIrJ6i080722; Wed, 11 Jul 2018 18:53:19 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BIrI9B080714; Wed, 11 Jul 2018 18:53:18 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201807111853.w6BIrI9B080714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 11 Jul 2018 18:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336203 - in head: contrib/wpa contrib/wpa/hostapd contrib/wpa/hs20/client contrib/wpa/patches contrib/wpa/src/ap contrib/wpa/src/common contrib/wpa/src/crypto contrib/wpa/src/drivers c... X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head: contrib/wpa contrib/wpa/hostapd contrib/wpa/hs20/client contrib/wpa/patches contrib/wpa/src/ap contrib/wpa/src/common contrib/wpa/src/crypto contrib/wpa/src/drivers contrib/wpa/src/eap_common... X-SVN-Commit-Revision: 336203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 18:53:21 -0000 Author: cy Date: Wed Jul 11 18:53:18 2018 New Revision: 336203 URL: https://svnweb.freebsd.org/changeset/base/336203 Log: MFV r324714: Update wpa 2.5 --> 2.6. MFC after: 1 month Added: head/contrib/wpa/src/ap/mbo_ap.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/mbo_ap.c head/contrib/wpa/src/ap/mbo_ap.h - copied unchanged from r336186, vendor/wpa/dist/src/ap/mbo_ap.h head/contrib/wpa/src/ap/neighbor_db.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/neighbor_db.c head/contrib/wpa/src/ap/neighbor_db.h - copied unchanged from r336186, vendor/wpa/dist/src/ap/neighbor_db.h head/contrib/wpa/src/ap/rrm.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/rrm.c head/contrib/wpa/src/ap/rrm.h - copied unchanged from r336186, vendor/wpa/dist/src/ap/rrm.h head/contrib/wpa/src/ap/taxonomy.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/taxonomy.c head/contrib/wpa/src/ap/taxonomy.h - copied unchanged from r336186, vendor/wpa/dist/src/ap/taxonomy.h head/contrib/wpa/src/ap/vlan.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/vlan.c head/contrib/wpa/src/ap/vlan.h - copied unchanged from r336186, vendor/wpa/dist/src/ap/vlan.h head/contrib/wpa/src/ap/vlan_full.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/vlan_full.c head/contrib/wpa/src/ap/vlan_ifconfig.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/vlan_ifconfig.c head/contrib/wpa/src/ap/vlan_ioctl.c - copied unchanged from r336186, vendor/wpa/dist/src/ap/vlan_ioctl.c head/contrib/wpa/src/common/cli.c - copied unchanged from r336186, vendor/wpa/dist/src/common/cli.c head/contrib/wpa/src/common/cli.h - copied unchanged from r336186, vendor/wpa/dist/src/common/cli.h head/contrib/wpa/src/common/ctrl_iface_common.c - copied unchanged from r336186, vendor/wpa/dist/src/common/ctrl_iface_common.c head/contrib/wpa/src/common/ctrl_iface_common.h - copied unchanged from r336186, vendor/wpa/dist/src/common/ctrl_iface_common.h head/contrib/wpa/src/crypto/sha384-internal.c - copied unchanged from r336186, vendor/wpa/dist/src/crypto/sha384-internal.c head/contrib/wpa/src/crypto/sha384_i.h - copied unchanged from r336186, vendor/wpa/dist/src/crypto/sha384_i.h head/contrib/wpa/src/crypto/sha512-internal.c - copied unchanged from r336186, vendor/wpa/dist/src/crypto/sha512-internal.c head/contrib/wpa/src/crypto/sha512_i.h - copied unchanged from r336186, vendor/wpa/dist/src/crypto/sha512_i.h head/contrib/wpa/src/crypto/tls_openssl.h - copied unchanged from r336186, vendor/wpa/dist/src/crypto/tls_openssl.h head/contrib/wpa/src/crypto/tls_openssl_ocsp.c - copied unchanged from r336186, vendor/wpa/dist/src/crypto/tls_openssl_ocsp.c head/contrib/wpa/src/tls/tlsv1_client_ocsp.c - copied unchanged from r336186, vendor/wpa/dist/src/tls/tlsv1_client_ocsp.c head/contrib/wpa/src/utils/module_tests.h - copied unchanged from r336186, vendor/wpa/dist/src/utils/module_tests.h head/contrib/wpa/wpa_supplicant/Android.mk - copied unchanged from r336186, vendor/wpa/dist/wpa_supplicant/Android.mk head/contrib/wpa/wpa_supplicant/README-Windows.txt - copied unchanged from r336186, vendor/wpa/dist/wpa_supplicant/README-Windows.txt head/contrib/wpa/wpa_supplicant/android.config - copied unchanged from r336186, vendor/wpa/dist/wpa_supplicant/android.config head/contrib/wpa/wpa_supplicant/binder/ - copied from r336186, vendor/wpa/dist/wpa_supplicant/binder/ head/contrib/wpa/wpa_supplicant/libwpa_test.c - copied unchanged from r336186, vendor/wpa/dist/wpa_supplicant/libwpa_test.c head/contrib/wpa/wpa_supplicant/mbo.c - copied unchanged from r336186, vendor/wpa/dist/wpa_supplicant/mbo.c head/contrib/wpa/wpa_supplicant/systemd/ - copied from r336186, vendor/wpa/dist/wpa_supplicant/systemd/ head/contrib/wpa/wpa_supplicant/vs2005/ - copied from r336186, vendor/wpa/dist/wpa_supplicant/vs2005/ Deleted: head/contrib/wpa/patches/openssl-0.9.8za-tls-extensions.patch head/contrib/wpa/patches/openssl-0.9.8zf-tls-extensions.patch head/contrib/wpa/wpa_supplicant/tests/link_test.c head/contrib/wpa/wpa_supplicant/tests/test_eap_sim_common.c head/contrib/wpa/wpa_supplicant/tests/test_wpa.c Modified: head/contrib/wpa/CONTRIBUTIONS head/contrib/wpa/COPYING head/contrib/wpa/README head/contrib/wpa/hostapd/ChangeLog head/contrib/wpa/hostapd/README head/contrib/wpa/hostapd/config_file.c head/contrib/wpa/hostapd/ctrl_iface.c head/contrib/wpa/hostapd/defconfig head/contrib/wpa/hostapd/hapd_module_tests.c head/contrib/wpa/hostapd/hlr_auc_gw.c head/contrib/wpa/hostapd/hostapd.conf head/contrib/wpa/hostapd/hostapd_cli.c head/contrib/wpa/hostapd/main.c head/contrib/wpa/hs20/client/Android.mk head/contrib/wpa/hs20/client/Makefile head/contrib/wpa/hs20/client/est.c head/contrib/wpa/hs20/client/osu_client.c head/contrib/wpa/src/ap/accounting.c head/contrib/wpa/src/ap/accounting.h head/contrib/wpa/src/ap/acs.c head/contrib/wpa/src/ap/ap_config.c head/contrib/wpa/src/ap/ap_config.h head/contrib/wpa/src/ap/ap_drv_ops.c head/contrib/wpa/src/ap/ap_drv_ops.h head/contrib/wpa/src/ap/ap_mlme.c head/contrib/wpa/src/ap/authsrv.c head/contrib/wpa/src/ap/beacon.c head/contrib/wpa/src/ap/beacon.h head/contrib/wpa/src/ap/ctrl_iface_ap.c head/contrib/wpa/src/ap/ctrl_iface_ap.h head/contrib/wpa/src/ap/dfs.c head/contrib/wpa/src/ap/dhcp_snoop.c head/contrib/wpa/src/ap/drv_callbacks.c head/contrib/wpa/src/ap/gas_serv.c head/contrib/wpa/src/ap/gas_serv.h head/contrib/wpa/src/ap/hostapd.c head/contrib/wpa/src/ap/hostapd.h head/contrib/wpa/src/ap/hw_features.c head/contrib/wpa/src/ap/iapp.c head/contrib/wpa/src/ap/ieee802_11.c head/contrib/wpa/src/ap/ieee802_11.h head/contrib/wpa/src/ap/ieee802_11_auth.c head/contrib/wpa/src/ap/ieee802_11_auth.h head/contrib/wpa/src/ap/ieee802_11_ht.c head/contrib/wpa/src/ap/ieee802_11_shared.c head/contrib/wpa/src/ap/ieee802_11_vht.c head/contrib/wpa/src/ap/ieee802_1x.c head/contrib/wpa/src/ap/ieee802_1x.h head/contrib/wpa/src/ap/ndisc_snoop.c head/contrib/wpa/src/ap/pmksa_cache_auth.c head/contrib/wpa/src/ap/pmksa_cache_auth.h head/contrib/wpa/src/ap/sta_info.c head/contrib/wpa/src/ap/sta_info.h head/contrib/wpa/src/ap/vlan_init.c head/contrib/wpa/src/ap/vlan_init.h head/contrib/wpa/src/ap/vlan_util.c head/contrib/wpa/src/ap/vlan_util.h head/contrib/wpa/src/ap/wnm_ap.c head/contrib/wpa/src/ap/wnm_ap.h head/contrib/wpa/src/ap/wpa_auth.c head/contrib/wpa/src/ap/wpa_auth.h head/contrib/wpa/src/ap/wpa_auth_ft.c head/contrib/wpa/src/ap/wpa_auth_glue.c head/contrib/wpa/src/ap/wpa_auth_i.h head/contrib/wpa/src/ap/wpa_auth_ie.c head/contrib/wpa/src/ap/wps_hostapd.c head/contrib/wpa/src/common/common_module_tests.c head/contrib/wpa/src/common/defs.h head/contrib/wpa/src/common/eapol_common.h head/contrib/wpa/src/common/ieee802_11_common.c head/contrib/wpa/src/common/ieee802_11_common.h head/contrib/wpa/src/common/ieee802_11_defs.h head/contrib/wpa/src/common/ieee802_1x_defs.h head/contrib/wpa/src/common/qca-vendor.h head/contrib/wpa/src/common/sae.c head/contrib/wpa/src/common/sae.h head/contrib/wpa/src/common/version.h head/contrib/wpa/src/common/wpa_common.c head/contrib/wpa/src/common/wpa_common.h head/contrib/wpa/src/common/wpa_ctrl.c head/contrib/wpa/src/common/wpa_ctrl.h head/contrib/wpa/src/common/wpa_helpers.c head/contrib/wpa/src/crypto/aes-cbc.c head/contrib/wpa/src/crypto/aes-omac1.c head/contrib/wpa/src/crypto/crypto.h head/contrib/wpa/src/crypto/crypto_internal.c head/contrib/wpa/src/crypto/crypto_module_tests.c head/contrib/wpa/src/crypto/crypto_openssl.c head/contrib/wpa/src/crypto/dh_group5.c head/contrib/wpa/src/crypto/dh_groups.c head/contrib/wpa/src/crypto/fips_prf_openssl.c head/contrib/wpa/src/crypto/md4-internal.c head/contrib/wpa/src/crypto/md5-internal.c head/contrib/wpa/src/crypto/ms_funcs.c head/contrib/wpa/src/crypto/sha1-internal.c head/contrib/wpa/src/crypto/sha256-internal.c head/contrib/wpa/src/crypto/sha256-prf.c head/contrib/wpa/src/crypto/sha256.h head/contrib/wpa/src/crypto/tls.h head/contrib/wpa/src/crypto/tls_gnutls.c head/contrib/wpa/src/crypto/tls_internal.c head/contrib/wpa/src/crypto/tls_none.c head/contrib/wpa/src/crypto/tls_openssl.c head/contrib/wpa/src/drivers/driver.h head/contrib/wpa/src/drivers/driver_bsd.c head/contrib/wpa/src/drivers/driver_common.c head/contrib/wpa/src/drivers/driver_macsec_qca.c head/contrib/wpa/src/drivers/driver_ndis.c head/contrib/wpa/src/drivers/driver_nl80211.h head/contrib/wpa/src/drivers/driver_nl80211_capa.c head/contrib/wpa/src/drivers/driver_nl80211_event.c head/contrib/wpa/src/drivers/driver_nl80211_monitor.c head/contrib/wpa/src/drivers/driver_nl80211_scan.c head/contrib/wpa/src/drivers/driver_privsep.c head/contrib/wpa/src/drivers/driver_wired.c head/contrib/wpa/src/drivers/drivers.c head/contrib/wpa/src/eap_common/eap_eke_common.c head/contrib/wpa/src/eap_common/eap_fast_common.c head/contrib/wpa/src/eap_common/eap_fast_common.h head/contrib/wpa/src/eap_common/eap_gpsk_common.c head/contrib/wpa/src/eap_common/eap_pax_common.c head/contrib/wpa/src/eap_common/eap_pwd_common.c head/contrib/wpa/src/eap_common/eap_sake_common.c head/contrib/wpa/src/eap_common/ikev2_common.c head/contrib/wpa/src/eap_peer/eap.c head/contrib/wpa/src/eap_peer/eap_aka.c head/contrib/wpa/src/eap_peer/eap_config.h head/contrib/wpa/src/eap_peer/eap_eke.c head/contrib/wpa/src/eap_peer/eap_fast.c head/contrib/wpa/src/eap_peer/eap_fast_pac.c head/contrib/wpa/src/eap_peer/eap_gpsk.c head/contrib/wpa/src/eap_peer/eap_gtc.c head/contrib/wpa/src/eap_peer/eap_i.h head/contrib/wpa/src/eap_peer/eap_ikev2.c head/contrib/wpa/src/eap_peer/eap_leap.c head/contrib/wpa/src/eap_peer/eap_md5.c head/contrib/wpa/src/eap_peer/eap_methods.c head/contrib/wpa/src/eap_peer/eap_methods.h head/contrib/wpa/src/eap_peer/eap_mschapv2.c head/contrib/wpa/src/eap_peer/eap_otp.c head/contrib/wpa/src/eap_peer/eap_pax.c head/contrib/wpa/src/eap_peer/eap_peap.c head/contrib/wpa/src/eap_peer/eap_psk.c head/contrib/wpa/src/eap_peer/eap_pwd.c head/contrib/wpa/src/eap_peer/eap_sake.c head/contrib/wpa/src/eap_peer/eap_sim.c head/contrib/wpa/src/eap_peer/eap_tls.c head/contrib/wpa/src/eap_peer/eap_tls_common.c head/contrib/wpa/src/eap_peer/eap_tnc.c head/contrib/wpa/src/eap_peer/eap_ttls.c head/contrib/wpa/src/eap_peer/eap_vendor_test.c head/contrib/wpa/src/eap_peer/eap_wsc.c head/contrib/wpa/src/eap_peer/ikev2.c head/contrib/wpa/src/eap_peer/tncc.c head/contrib/wpa/src/eap_server/eap_methods.h head/contrib/wpa/src/eap_server/eap_server_aka.c head/contrib/wpa/src/eap_server/eap_server_eke.c head/contrib/wpa/src/eap_server/eap_server_fast.c head/contrib/wpa/src/eap_server/eap_server_gpsk.c head/contrib/wpa/src/eap_server/eap_server_gtc.c head/contrib/wpa/src/eap_server/eap_server_identity.c head/contrib/wpa/src/eap_server/eap_server_ikev2.c head/contrib/wpa/src/eap_server/eap_server_md5.c head/contrib/wpa/src/eap_server/eap_server_methods.c head/contrib/wpa/src/eap_server/eap_server_mschapv2.c head/contrib/wpa/src/eap_server/eap_server_pax.c head/contrib/wpa/src/eap_server/eap_server_peap.c head/contrib/wpa/src/eap_server/eap_server_psk.c head/contrib/wpa/src/eap_server/eap_server_pwd.c head/contrib/wpa/src/eap_server/eap_server_sake.c head/contrib/wpa/src/eap_server/eap_server_sim.c head/contrib/wpa/src/eap_server/eap_server_tls.c head/contrib/wpa/src/eap_server/eap_server_tls_common.c head/contrib/wpa/src/eap_server/eap_server_tnc.c head/contrib/wpa/src/eap_server/eap_server_ttls.c head/contrib/wpa/src/eap_server/eap_server_vendor_test.c head/contrib/wpa/src/eap_server/eap_server_wsc.c head/contrib/wpa/src/eap_server/eap_sim_db.c head/contrib/wpa/src/eap_server/eap_sim_db.h head/contrib/wpa/src/eap_server/ikev2.c head/contrib/wpa/src/eap_server/tncs.c head/contrib/wpa/src/eapol_auth/eapol_auth_sm.c head/contrib/wpa/src/eapol_auth/eapol_auth_sm_i.h head/contrib/wpa/src/eapol_supp/eapol_supp_sm.c head/contrib/wpa/src/fst/fst.c head/contrib/wpa/src/fst/fst_ctrl_aux.c head/contrib/wpa/src/fst/fst_ctrl_iface.c head/contrib/wpa/src/fst/fst_defs.h head/contrib/wpa/src/fst/fst_group.c head/contrib/wpa/src/fst/fst_group.h head/contrib/wpa/src/fst/fst_iface.c head/contrib/wpa/src/fst/fst_iface.h head/contrib/wpa/src/fst/fst_session.c head/contrib/wpa/src/p2p/p2p.c head/contrib/wpa/src/p2p/p2p.h head/contrib/wpa/src/p2p/p2p_build.c head/contrib/wpa/src/p2p/p2p_go_neg.c head/contrib/wpa/src/p2p/p2p_group.c head/contrib/wpa/src/p2p/p2p_i.h head/contrib/wpa/src/p2p/p2p_invitation.c head/contrib/wpa/src/p2p/p2p_parse.c head/contrib/wpa/src/p2p/p2p_pd.c head/contrib/wpa/src/p2p/p2p_sd.c head/contrib/wpa/src/pae/ieee802_1x_cp.c head/contrib/wpa/src/pae/ieee802_1x_cp.h head/contrib/wpa/src/pae/ieee802_1x_kay.c head/contrib/wpa/src/pae/ieee802_1x_kay.h head/contrib/wpa/src/pae/ieee802_1x_kay_i.h head/contrib/wpa/src/pae/ieee802_1x_secy_ops.c head/contrib/wpa/src/pae/ieee802_1x_secy_ops.h head/contrib/wpa/src/radius/radius.c head/contrib/wpa/src/radius/radius.h head/contrib/wpa/src/radius/radius_client.c head/contrib/wpa/src/radius/radius_client.h head/contrib/wpa/src/radius/radius_das.c head/contrib/wpa/src/radius/radius_das.h head/contrib/wpa/src/rsn_supp/pmksa_cache.c head/contrib/wpa/src/rsn_supp/pmksa_cache.h head/contrib/wpa/src/rsn_supp/preauth.c head/contrib/wpa/src/rsn_supp/preauth.h head/contrib/wpa/src/rsn_supp/tdls.c head/contrib/wpa/src/rsn_supp/wpa.c head/contrib/wpa/src/rsn_supp/wpa.h head/contrib/wpa/src/rsn_supp/wpa_i.h head/contrib/wpa/src/rsn_supp/wpa_ie.c head/contrib/wpa/src/tls/asn1.h head/contrib/wpa/src/tls/pkcs5.c head/contrib/wpa/src/tls/tlsv1_client.c head/contrib/wpa/src/tls/tlsv1_client.h head/contrib/wpa/src/tls/tlsv1_client_i.h head/contrib/wpa/src/tls/tlsv1_client_read.c head/contrib/wpa/src/tls/tlsv1_client_write.c head/contrib/wpa/src/tls/tlsv1_common.c head/contrib/wpa/src/tls/tlsv1_common.h head/contrib/wpa/src/tls/tlsv1_cred.c head/contrib/wpa/src/tls/tlsv1_cred.h head/contrib/wpa/src/tls/tlsv1_server_i.h head/contrib/wpa/src/tls/tlsv1_server_read.c head/contrib/wpa/src/tls/tlsv1_server_write.c head/contrib/wpa/src/tls/x509v3.c head/contrib/wpa/src/tls/x509v3.h head/contrib/wpa/src/utils/browser-android.c head/contrib/wpa/src/utils/common.c head/contrib/wpa/src/utils/common.h head/contrib/wpa/src/utils/edit_simple.c head/contrib/wpa/src/utils/eloop.c head/contrib/wpa/src/utils/eloop.h head/contrib/wpa/src/utils/eloop_win.c head/contrib/wpa/src/utils/ext_password.c head/contrib/wpa/src/utils/ext_password_i.h head/contrib/wpa/src/utils/http_curl.c head/contrib/wpa/src/utils/os.h head/contrib/wpa/src/utils/os_unix.c head/contrib/wpa/src/utils/pcsc_funcs.c head/contrib/wpa/src/utils/platform.h head/contrib/wpa/src/utils/radiotap.c head/contrib/wpa/src/utils/radiotap.h head/contrib/wpa/src/utils/radiotap_iter.h head/contrib/wpa/src/utils/trace.c head/contrib/wpa/src/utils/trace.h head/contrib/wpa/src/utils/utils_module_tests.c head/contrib/wpa/src/utils/wpa_debug.c head/contrib/wpa/src/utils/wpabuf.c head/contrib/wpa/src/utils/wpabuf.h head/contrib/wpa/src/utils/xml_libxml2.c head/contrib/wpa/src/wps/wps.c head/contrib/wpa/src/wps/wps.h head/contrib/wpa/src/wps/wps_attr_build.c head/contrib/wpa/src/wps/wps_attr_parse.c head/contrib/wpa/src/wps/wps_attr_process.c head/contrib/wpa/src/wps/wps_common.c head/contrib/wpa/src/wps/wps_defs.h head/contrib/wpa/src/wps/wps_enrollee.c head/contrib/wpa/src/wps/wps_i.h head/contrib/wpa/src/wps/wps_module_tests.c head/contrib/wpa/src/wps/wps_registrar.c head/contrib/wpa/src/wps/wps_upnp.c head/contrib/wpa/src/wps/wps_upnp.h head/contrib/wpa/src/wps/wps_upnp_i.h head/contrib/wpa/src/wps/wps_upnp_ssdp.c head/contrib/wpa/src/wps/wps_upnp_web.c head/contrib/wpa/wpa_supplicant/ChangeLog head/contrib/wpa/wpa_supplicant/README head/contrib/wpa/wpa_supplicant/README-HS20 head/contrib/wpa/wpa_supplicant/README-P2P head/contrib/wpa/wpa_supplicant/ap.c head/contrib/wpa/wpa_supplicant/ap.h head/contrib/wpa/wpa_supplicant/autoscan.c head/contrib/wpa/wpa_supplicant/autoscan.h head/contrib/wpa/wpa_supplicant/bgscan.c head/contrib/wpa/wpa_supplicant/bgscan.h head/contrib/wpa/wpa_supplicant/bss.c head/contrib/wpa/wpa_supplicant/bss.h head/contrib/wpa/wpa_supplicant/config.c head/contrib/wpa/wpa_supplicant/config.h head/contrib/wpa/wpa_supplicant/config_file.c head/contrib/wpa/wpa_supplicant/config_ssid.h head/contrib/wpa/wpa_supplicant/ctrl_iface.c head/contrib/wpa/wpa_supplicant/ctrl_iface_udp.c head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c head/contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf head/contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h head/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c head/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h head/contrib/wpa/wpa_supplicant/dbus/dbus_new.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new.h head/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h head/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h head/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c head/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h head/contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c head/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c head/contrib/wpa/wpa_supplicant/defconfig head/contrib/wpa/wpa_supplicant/driver_i.h head/contrib/wpa/wpa_supplicant/eapol_test.c head/contrib/wpa/wpa_supplicant/events.c head/contrib/wpa/wpa_supplicant/gas_query.c head/contrib/wpa/wpa_supplicant/gas_query.h head/contrib/wpa/wpa_supplicant/hs20_supplicant.c head/contrib/wpa/wpa_supplicant/hs20_supplicant.h head/contrib/wpa/wpa_supplicant/ibss_rsn.c head/contrib/wpa/wpa_supplicant/ibss_rsn.h head/contrib/wpa/wpa_supplicant/interworking.c head/contrib/wpa/wpa_supplicant/interworking.h head/contrib/wpa/wpa_supplicant/main.c head/contrib/wpa/wpa_supplicant/mesh.c head/contrib/wpa/wpa_supplicant/mesh.h head/contrib/wpa/wpa_supplicant/mesh_mpm.c head/contrib/wpa/wpa_supplicant/mesh_mpm.h head/contrib/wpa/wpa_supplicant/mesh_rsn.c head/contrib/wpa/wpa_supplicant/mesh_rsn.h head/contrib/wpa/wpa_supplicant/notify.c head/contrib/wpa/wpa_supplicant/notify.h head/contrib/wpa/wpa_supplicant/offchannel.c head/contrib/wpa/wpa_supplicant/p2p_supplicant.c head/contrib/wpa/wpa_supplicant/p2p_supplicant.h head/contrib/wpa/wpa_supplicant/p2p_supplicant_sd.c head/contrib/wpa/wpa_supplicant/scan.c head/contrib/wpa/wpa_supplicant/scan.h head/contrib/wpa/wpa_supplicant/sme.c head/contrib/wpa/wpa_supplicant/wmm_ac.h head/contrib/wpa/wpa_supplicant/wnm_sta.c head/contrib/wpa/wpa_supplicant/wnm_sta.h head/contrib/wpa/wpa_supplicant/wpa_cli.c head/contrib/wpa/wpa_supplicant/wpa_priv.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.conf head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h head/contrib/wpa/wpa_supplicant/wpas_glue.c head/contrib/wpa/wpa_supplicant/wpas_kay.c head/contrib/wpa/wpa_supplicant/wpas_module_tests.c head/contrib/wpa/wpa_supplicant/wps_supplicant.c head/contrib/wpa/wpa_supplicant/wps_supplicant.h head/usr.sbin/wpa/Makefile.inc head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/hostapd_cli/Makefile head/usr.sbin/wpa/wpa_cli/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile Directory Properties: head/contrib/wpa/ (props changed) Modified: head/contrib/wpa/CONTRIBUTIONS ============================================================================== --- head/contrib/wpa/CONTRIBUTIONS Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/CONTRIBUTIONS Wed Jul 11 18:53:18 2018 (r336203) @@ -29,6 +29,34 @@ using your real name. Pseudonyms or anonymous contribu unfortunately be accepted. +The preferred method of submitting the contribution to the project is by +email to the hostap mailing list: +hostap@lists.infradead.org +Note that the list may require subscription before accepting message +without moderation. You can subscribe to the list at this address: +http://lists.infradead.org/mailman/listinfo/hostap + +The message should contain an inlined patch against the current +development branch (i.e., the master branch of +git://w1.fi/hostap.git). Please make sure the software you use for +sending the patch does not corrupt whitespace. If that cannot be fixed +for some reason, it is better to include an attached version of the +patch file than just send a whitespace damaged version in the message +body. + +The patches should be separate logical changes rather than doing +everything in a single patch. In other words, please keep cleanup, new +features, and bug fixes all in their own patches. Each patch needs a +commit log that describes the changes (what the changes fix, what +functionality is added, why the changes are useful, etc.). + +Please try to follow the coding style used in the project. + +In general, the best way of generating a suitable formatted patch file +is by committing the changes to a cloned git repository and using git +format-patch. The patch can then be sent, e.g., with git send-email. + + History of license and contributions terms ------------------------------------------ @@ -112,7 +140,7 @@ The license terms used for hostap.git files Modified BSD license (no advertisement clause): -Copyright (c) 2002-2015, Jouni Malinen and contributors +Copyright (c) 2002-2016, Jouni Malinen and contributors All Rights Reserved. Redistribution and use in source and binary forms, with or without Modified: head/contrib/wpa/COPYING ============================================================================== --- head/contrib/wpa/COPYING Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/COPYING Wed Jul 11 18:53:18 2018 (r336203) @@ -1,7 +1,7 @@ wpa_supplicant and hostapd -------------------------- -Copyright (c) 2002-2015, Jouni Malinen and contributors +Copyright (c) 2002-2016, Jouni Malinen and contributors All Rights Reserved. Modified: head/contrib/wpa/README ============================================================================== --- head/contrib/wpa/README Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/README Wed Jul 11 18:53:18 2018 (r336203) @@ -1,7 +1,7 @@ wpa_supplicant and hostapd -------------------------- -Copyright (c) 2002-2015, Jouni Malinen and contributors +Copyright (c) 2002-2016, Jouni Malinen and contributors All Rights Reserved. These programs are licensed under the BSD license (the one with Modified: head/contrib/wpa/hostapd/ChangeLog ============================================================================== --- head/contrib/wpa/hostapd/ChangeLog Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/hostapd/ChangeLog Wed Jul 11 18:53:18 2018 (r336203) @@ -1,5 +1,78 @@ ChangeLog for hostapd +2016-10-02 - v2.6 + * fixed EAP-pwd last fragment validation + [http://w1.fi/security/2015-7/] (CVE-2015-5314) + * fixed WPS configuration update vulnerability with malformed passphrase + [http://w1.fi/security/2016-1/] (CVE-2016-4476) + * extended channel switch support for VHT bandwidth changes + * added support for configuring new ANQP-elements with + anqp_elem=: + * fixed Suite B 192-bit AKM to use proper PMK length + (note: this makes old releases incompatible with the fixed behavior) + * added no_probe_resp_if_max_sta=1 parameter to disable Probe Response + frame sending for not-associated STAs if max_num_sta limit has been + reached + * added option (-S as command line argument) to request all interfaces + to be started at the same time + * modified rts_threshold and fragm_threshold configuration parameters + to allow -1 to be used to disable RTS/fragmentation + * EAP-pwd: added support for Brainpool Elliptic Curves + (with OpenSSL 1.0.2 and newer) + * fixed EAPOL reauthentication after FT protocol run + * fixed FTIE generation for 4-way handshake after FT protocol run + * fixed and improved various FST operations + * TLS server + - support SHA384 and SHA512 hashes + - support TLS v1.2 signature algorithm with SHA384 and SHA512 + - support PKCS #5 v2.0 PBES2 + - support PKCS #5 with PKCS #12 style key decryption + - minimal support for PKCS #12 + - support OCSP stapling (including ocsp_multi) + * added support for OpenSSL 1.1 API changes + - drop support for OpenSSL 0.9.8 + - drop support for OpenSSL 1.0.0 + * EAP-PEAP: support fast-connect crypto binding + * RADIUS + - fix Called-Station-Id to not escape SSID + - add Event-Timestamp to all Accounting-Request packets + - add Acct-Session-Id to Accounting-On/Off + - add Acct-Multi-Session-Id ton Access-Request packets + - add Service-Type (= Frames) + - allow server to provide PSK instead of passphrase for WPA-PSK + Tunnel_password case + - update full message for interim accounting updates + - add Acct-Delay-Time into Accounting messages + - add require_message_authenticator configuration option to require + CoA/Disconnect-Request packets to be authenticated + * started to postpone WNM-Notification frame sending by 100 ms so that + the STA has some more time to configure the key before this frame is + received after the 4-way handshake + * VHT: added interoperability workaround for 80+80 and 160 MHz channels + * extended VLAN support (per-STA vif, etc.) + * fixed PMKID derivation with SAE + * nl80211 + - added support for full station state operations + - fix IEEE 802.1X/WEP EAP reauthentication and rekeying to use + unencrypted EAPOL frames + * added initial MBO support; number of extensions to WNM BSS Transition + Management + * added initial functionality for location related operations + * added assocresp_elements parameter to allow vendor specific elements + to be added into (Re)Association Response frames + * improved Public Action frame addressing + - use Address 3 = wildcard BSSID in GAS response if a query from an + unassociated STA used that address + - fix TX status processing for Address 3 = wildcard BSSID + - add gas_address3 configuration parameter to control Address 3 + behavior + * added command line parameter -i to override interface parameter in + hostapd.conf + * added command completion support to hostapd_cli + * added passive client taxonomy determination (CONFIG_TAXONOMY=y + compile option and "SIGNATURE " control interface command) + * number of small fixes + 2015-09-27 - v2.5 * fixed WPS UPnP vulnerability with HTTP chunked transfer encoding [http://w1.fi/security/2015-2/] (CVE-2015-4141) Modified: head/contrib/wpa/hostapd/README ============================================================================== --- head/contrib/wpa/hostapd/README Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/hostapd/README Wed Jul 11 18:53:18 2018 (r336203) @@ -2,7 +2,7 @@ hostapd - user space IEEE 802.11 AP and IEEE 802.1X/WP Authenticator and RADIUS authentication server ================================================================ -Copyright (c) 2002-2015, Jouni Malinen and contributors +Copyright (c) 2002-2016, Jouni Malinen and contributors All Rights Reserved. This program is licensed under the BSD license (the one with Modified: head/contrib/wpa/hostapd/config_file.c ============================================================================== --- head/contrib/wpa/hostapd/config_file.c Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/hostapd/config_file.c Wed Jul 11 18:53:18 2018 (r336203) @@ -97,6 +97,8 @@ static int hostapd_config_read_vlan_file(struct hostap } vlan->vlan_id = vlan_id; + vlan->vlan_desc.untagged = vlan_id; + vlan->vlan_desc.notempty = !!vlan_id; os_strlcpy(vlan->ifname, pos, sizeof(vlan->ifname)); vlan->next = bss->vlan; bss->vlan = vlan; @@ -197,7 +199,10 @@ static int hostapd_config_read_maclist(const char *fna *acl = newacl; os_memcpy((*acl)[*num].addr, addr, ETH_ALEN); - (*acl)[*num].vlan_id = vlan_id; + os_memset(&(*acl)[*num].vlan_id, 0, + sizeof((*acl)[*num].vlan_id)); + (*acl)[*num].vlan_id.untagged = vlan_id; + (*acl)[*num].vlan_id.notempty = !!vlan_id; (*num)++; } @@ -631,8 +636,7 @@ hostapd_parse_radius_attr(const char *value) } -static int hostapd_parse_das_client(struct hostapd_bss_config *bss, - const char *val) +static int hostapd_parse_das_client(struct hostapd_bss_config *bss, char *val) { char *secret; @@ -640,7 +644,7 @@ static int hostapd_parse_das_client(struct hostapd_bss if (secret == NULL) return -1; - secret++; + *secret++ = '\0'; if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr)) return -1; @@ -1519,6 +1523,54 @@ fail: } +static int parse_anqp_elem(struct hostapd_bss_config *bss, char *buf, int line) +{ + char *delim; + u16 infoid; + size_t len; + struct wpabuf *payload; + struct anqp_element *elem; + + delim = os_strchr(buf, ':'); + if (!delim) + return -1; + delim++; + infoid = atoi(buf); + len = os_strlen(delim); + if (len & 1) + return -1; + len /= 2; + payload = wpabuf_alloc(len); + if (!payload) + return -1; + if (hexstr2bin(delim, wpabuf_put(payload, len), len) < 0) { + wpabuf_free(payload); + return -1; + } + + dl_list_for_each(elem, &bss->anqp_elem, struct anqp_element, list) { + if (elem->infoid == infoid) { + /* Update existing entry */ + wpabuf_free(elem->payload); + elem->payload = payload; + return 0; + } + } + + /* Add a new entry */ + elem = os_zalloc(sizeof(*elem)); + if (!elem) { + wpabuf_free(payload); + return -1; + } + elem->infoid = infoid; + elem->payload = payload; + dl_list_add(&bss->anqp_elem, &elem->list); + + return 0; +} + + static int parse_qos_map_set(struct hostapd_bss_config *bss, char *buf, int line) { @@ -1867,31 +1919,6 @@ static int hs20_parse_osu_service_desc(struct hostapd_ #endif /* CONFIG_HS20 */ -#ifdef CONFIG_WPS_NFC -static struct wpabuf * hostapd_parse_bin(const char *buf) -{ - size_t len; - struct wpabuf *ret; - - len = os_strlen(buf); - if (len & 0x01) - return NULL; - len /= 2; - - ret = wpabuf_alloc(len); - if (ret == NULL) - return NULL; - - if (hexstr2bin(buf, wpabuf_put(ret, len), len)) { - wpabuf_free(ret); - return NULL; - } - - return ret; -} -#endif /* CONFIG_WPS_NFC */ - - #ifdef CONFIG_ACS static int hostapd_config_parse_acs_chan_bias(struct hostapd_config *conf, char *pos) @@ -1934,6 +1961,31 @@ fail: #endif /* CONFIG_ACS */ +static int parse_wpabuf_hex(int line, const char *name, struct wpabuf **buf, + const char *val) +{ + struct wpabuf *elems; + + if (val[0] == '\0') { + wpabuf_free(*buf); + *buf = NULL; + return 0; + } + + elems = wpabuf_parse_bin(val); + if (!elems) { + wpa_printf(MSG_ERROR, "Line %d: Invalid %s '%s'", + line, name, val); + return -1; + } + + wpabuf_free(*buf); + *buf = elems; + + return 0; +} + + static int hostapd_config_fill(struct hostapd_config *conf, struct hostapd_bss_config *bss, const char *buf, char *pos, int line) @@ -2084,6 +2136,9 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "ocsp_stapling_response") == 0) { os_free(bss->ocsp_stapling_response); bss->ocsp_stapling_response = os_strdup(pos); + } else if (os_strcmp(buf, "ocsp_stapling_response_multi") == 0) { + os_free(bss->ocsp_stapling_response_multi); + bss->ocsp_stapling_response_multi = os_strdup(pos); } else if (os_strcmp(buf, "dh_file") == 0) { os_free(bss->dh_file); bss->dh_file = os_strdup(pos); @@ -2139,6 +2194,8 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "eap_sim_db") == 0) { os_free(bss->eap_sim_db); bss->eap_sim_db = os_strdup(pos); + } else if (os_strcmp(buf, "eap_sim_db_timeout") == 0) { + bss->eap_sim_db_timeout = atoi(pos); } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) { bss->eap_sim_aka_result_ind = atoi(pos); #endif /* EAP_SERVER_SIM */ @@ -2353,6 +2410,9 @@ static int hostapd_config_fill(struct hostapd_config * bss->radius_das_time_window = atoi(pos); } else if (os_strcmp(buf, "radius_das_require_event_timestamp") == 0) { bss->radius_das_require_event_timestamp = atoi(pos); + } else if (os_strcmp(buf, "radius_das_require_message_authenticator") == + 0) { + bss->radius_das_require_message_authenticator = atoi(pos); #endif /* CONFIG_NO_RADIUS */ } else if (os_strcmp(buf, "auth_algs") == 0) { bss->auth_algs = atoi(pos); @@ -2644,7 +2704,7 @@ static int hostapd_config_fill(struct hostapd_config * } } else if (os_strcmp(buf, "rts_threshold") == 0) { conf->rts_threshold = atoi(pos); - if (conf->rts_threshold < 0 || conf->rts_threshold > 2347) { + if (conf->rts_threshold < -1 || conf->rts_threshold > 65535) { wpa_printf(MSG_ERROR, "Line %d: invalid rts_threshold %d", line, conf->rts_threshold); @@ -2652,8 +2712,10 @@ static int hostapd_config_fill(struct hostapd_config * } } else if (os_strcmp(buf, "fragm_threshold") == 0) { conf->fragm_threshold = atoi(pos); - if (conf->fragm_threshold < 256 || - conf->fragm_threshold > 2346) { + if (conf->fragm_threshold == -1) { + /* allow a value of -1 */ + } else if (conf->fragm_threshold < 256 || + conf->fragm_threshold > 2346) { wpa_printf(MSG_ERROR, "Line %d: invalid fragm_threshold %d", line, conf->fragm_threshold); @@ -2686,6 +2748,8 @@ static int hostapd_config_fill(struct hostapd_config * conf->preamble = LONG_PREAMBLE; } else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) { bss->ignore_broadcast_ssid = atoi(pos); + } else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { + bss->no_probe_resp_if_max_sta = atoi(pos); } else if (os_strcmp(buf, "wep_default_key") == 0) { bss->ssid.wep.idx = atoi(pos); if (bss->ssid.wep.idx > 3) { @@ -2707,6 +2771,8 @@ static int hostapd_config_fill(struct hostapd_config * #ifndef CONFIG_NO_VLAN } else if (os_strcmp(buf, "dynamic_vlan") == 0) { bss->ssid.dynamic_vlan = atoi(pos); + } else if (os_strcmp(buf, "per_sta_vif") == 0) { + bss->ssid.per_sta_vif = atoi(pos); } else if (os_strcmp(buf, "vlan_file") == 0) { if (hostapd_config_read_vlan_file(bss, pos)) { wpa_printf(MSG_ERROR, "Line %d: failed to read VLAN file '%s'", @@ -2762,6 +2828,8 @@ static int hostapd_config_fill(struct hostapd_config * line); return 1; } + } else if (os_strcmp(buf, "use_driver_iface_addr") == 0) { + conf->use_driver_iface_addr = atoi(pos); #ifdef CONFIG_IEEE80211W } else if (os_strcmp(buf, "ieee80211w") == 0) { bss->ieee80211w = atoi(pos); @@ -2827,6 +2895,8 @@ static int hostapd_config_fill(struct hostapd_config * conf->vht_oper_centr_freq_seg1_idx = atoi(pos); } else if (os_strcmp(buf, "vendor_vht") == 0) { bss->vendor_vht = atoi(pos); + } else if (os_strcmp(buf, "use_sta_nsts") == 0) { + bss->use_sta_nsts = atoi(pos); #endif /* CONFIG_IEEE80211AC */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); @@ -2965,15 +3035,15 @@ static int hostapd_config_fill(struct hostapd_config * bss->wps_nfc_pw_from_config = 1; } else if (os_strcmp(buf, "wps_nfc_dh_pubkey") == 0) { wpabuf_free(bss->wps_nfc_dh_pubkey); - bss->wps_nfc_dh_pubkey = hostapd_parse_bin(pos); + bss->wps_nfc_dh_pubkey = wpabuf_parse_bin(pos); bss->wps_nfc_pw_from_config = 1; } else if (os_strcmp(buf, "wps_nfc_dh_privkey") == 0) { wpabuf_free(bss->wps_nfc_dh_privkey); - bss->wps_nfc_dh_privkey = hostapd_parse_bin(pos); + bss->wps_nfc_dh_privkey = wpabuf_parse_bin(pos); bss->wps_nfc_pw_from_config = 1; } else if (os_strcmp(buf, "wps_nfc_dev_pw") == 0) { wpabuf_free(bss->wps_nfc_dev_pw); - bss->wps_nfc_dev_pw = hostapd_parse_bin(pos); + bss->wps_nfc_dev_pw = wpabuf_parse_bin(pos); bss->wps_nfc_pw_from_config = 1; #endif /* CONFIG_WPS_NFC */ #endif /* CONFIG_WPS */ @@ -3136,6 +3206,9 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "nai_realm") == 0) { if (parse_nai_realm(bss, pos, line) < 0) return 1; + } else if (os_strcmp(buf, "anqp_elem") == 0) { + if (parse_anqp_elem(bss, pos, line) < 0) + return 1; } else if (os_strcmp(buf, "gas_frag_limit") == 0) { bss->gas_frag_limit = atoi(pos); } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { @@ -3149,13 +3222,15 @@ static int hostapd_config_fill(struct hostapd_config * os_free(bss->dump_msk_file); bss->dump_msk_file = os_strdup(pos); #endif /* CONFIG_RADIUS_TEST */ +#ifdef CONFIG_PROXYARP + } else if (os_strcmp(buf, "proxy_arp") == 0) { + bss->proxy_arp = atoi(pos); +#endif /* CONFIG_PROXYARP */ #ifdef CONFIG_HS20 } else if (os_strcmp(buf, "hs20") == 0) { bss->hs20 = atoi(pos); } else if (os_strcmp(buf, "disable_dgaf") == 0) { bss->disable_dgaf = atoi(pos); - } else if (os_strcmp(buf, "proxy_arp") == 0) { - bss->proxy_arp = atoi(pos); } else if (os_strcmp(buf, "na_mcast_to_ucast") == 0) { bss->na_mcast_to_ucast = atoi(pos); } else if (os_strcmp(buf, "osen") == 0) { @@ -3231,6 +3306,10 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "subscr_remediation_method") == 0) { bss->subscr_remediation_method = atoi(pos); #endif /* CONFIG_HS20 */ +#ifdef CONFIG_MBO + } else if (os_strcmp(buf, "mbo") == 0) { + bss->mbo_enabled = atoi(pos); +#endif /* CONFIG_MBO */ #ifdef CONFIG_TESTING_OPTIONS #define PARSE_TEST_PROBABILITY(_val) \ } else if (os_strcmp(buf, #_val) == 0) { \ @@ -3249,6 +3328,8 @@ static int hostapd_config_fill(struct hostapd_config * PARSE_TEST_PROBABILITY(ignore_assoc_probability) PARSE_TEST_PROBABILITY(ignore_reassoc_probability) PARSE_TEST_PROBABILITY(corrupt_gtk_rekey_mic_probability) + } else if (os_strcmp(buf, "ecsa_ie_only") == 0) { + conf->ecsa_ie_only = atoi(pos); } else if (os_strcmp(buf, "bss_load_test") == 0) { WPA_PUT_LE16(bss->bss_load_test, atoi(pos)); pos = os_strchr(pos, ':'); @@ -3269,7 +3350,15 @@ static int hostapd_config_fill(struct hostapd_config * WPA_PUT_LE16(&bss->bss_load_test[3], atoi(pos)); bss->bss_load_test_set = 1; } else if (os_strcmp(buf, "radio_measurements") == 0) { - bss->radio_measurements = atoi(pos); + /* + * DEPRECATED: This parameter will be removed in the future. + * Use rrm_neighbor_report instead. + */ + int val = atoi(pos); + + if (val & BIT(0)) + bss->radio_measurements[0] |= + WLAN_RRM_CAPS_NEIGHBOR_REPORT; } else if (os_strcmp(buf, "own_ie_override") == 0) { struct wpabuf *tmp; size_t len = os_strlen(pos) / 2; @@ -3290,35 +3379,11 @@ static int hostapd_config_fill(struct hostapd_config * bss->own_ie_override = tmp; #endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strcmp(buf, "vendor_elements") == 0) { - struct wpabuf *elems; - size_t len = os_strlen(pos); - if (len & 0x01) { - wpa_printf(MSG_ERROR, - "Line %d: Invalid vendor_elements '%s'", - line, pos); + if (parse_wpabuf_hex(line, buf, &bss->vendor_elements, pos)) return 1; - } - len /= 2; - if (len == 0) { - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = NULL; - return 0; - } - - elems = wpabuf_alloc(len); - if (elems == NULL) + } else if (os_strcmp(buf, "assocresp_elements") == 0) { + if (parse_wpabuf_hex(line, buf, &bss->assocresp_elements, pos)) return 1; - - if (hexstr2bin(pos, wpabuf_put(elems, len), len)) { - wpabuf_free(elems); - wpa_printf(MSG_ERROR, - "Line %d: Invalid vendor_elements '%s'", - line, pos); - return 1; - } - - wpabuf_free(bss->vendor_elements); - bss->vendor_elements = elems; } else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) { bss->sae_anti_clogging_threshold = atoi(pos); } else if (os_strcmp(buf, "sae_groups") == 0) { @@ -3391,7 +3456,8 @@ static int hostapd_config_fill(struct hostapd_config * return -1; } val = strtol(pos, &endp, 0); - if (*endp || val < 1 || val > FST_MAX_LLT_MS) { + if (*endp || val < 1 || + (unsigned long int) val > FST_MAX_LLT_MS) { wpa_printf(MSG_ERROR, "Line %d: Invalid fst_llt %ld (%s) (expected 1..%u)", line, val, pos, FST_MAX_LLT_MS); @@ -3409,6 +3475,22 @@ static int hostapd_config_fill(struct hostapd_config * } else if (os_strcmp(buf, "no_auth_if_seen_on") == 0) { os_free(bss->no_auth_if_seen_on); bss->no_auth_if_seen_on = os_strdup(pos); + } else if (os_strcmp(buf, "lci") == 0) { + wpabuf_free(conf->lci); + conf->lci = wpabuf_parse_bin(pos); + } else if (os_strcmp(buf, "civic") == 0) { + wpabuf_free(conf->civic); + conf->civic = wpabuf_parse_bin(pos); + } else if (os_strcmp(buf, "rrm_neighbor_report") == 0) { + if (atoi(pos)) + bss->radio_measurements[0] |= + WLAN_RRM_CAPS_NEIGHBOR_REPORT; + } else if (os_strcmp(buf, "gas_address3") == 0) { + bss->gas_address3 = atoi(pos); + } else if (os_strcmp(buf, "ftm_responder") == 0) { + bss->ftm_responder = atoi(pos); + } else if (os_strcmp(buf, "ftm_initiator") == 0) { + bss->ftm_initiator = atoi(pos); } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", @@ -3429,7 +3511,7 @@ struct hostapd_config * hostapd_config_read(const char { struct hostapd_config *conf; FILE *f; - char buf[512], *pos; + char buf[4096], *pos; int line = 0; int errors = 0; size_t i; Modified: head/contrib/wpa/hostapd/ctrl_iface.c ============================================================================== --- head/contrib/wpa/hostapd/ctrl_iface.c Wed Jul 11 17:54:41 2018 (r336202) +++ head/contrib/wpa/hostapd/ctrl_iface.c Wed Jul 11 18:53:18 2018 (r336203) @@ -19,10 +19,16 @@ #include #include +#ifdef CONFIG_CTRL_IFACE_UDP +#include +#endif /* CONFIG_CTRL_IFACE_UDP */ + #include "utils/common.h" #include "utils/eloop.h" +#include "utils/module_tests.h" #include "common/version.h" #include "common/ieee802_11_defs.h" +#include "common/ctrl_iface_common.h" #include "crypto/tls.h" #include "drivers/driver.h" #include "eapol_auth/eapol_auth_sm.h" @@ -42,6 +48,8 @@ #include "ap/wnm_ap.h" #include "ap/wpa_auth.h" #include "ap/beacon.h" +#include "ap/neighbor_db.h" +#include "ap/rrm.h" #include "wps/wps_defs.h" #include "wps/wps.h" #include "fst/fst_ctrl_iface.h" @@ -51,96 +59,43 @@ #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -struct wpa_ctrl_dst { - struct wpa_ctrl_dst *next; - struct sockaddr_un addr; - socklen_t addrlen; - int debug_level; - int errors; -}; +#ifdef CONFIG_CTRL_IFACE_UDP +#define COOKIE_LEN 8 +static unsigned char cookie[COOKIE_LEN]; +static unsigned char gcookie[COOKIE_LEN]; +#define HOSTAPD_CTRL_IFACE_PORT 8877 +#define HOSTAPD_CTRL_IFACE_PORT_LIMIT 50 +#define HOSTAPD_GLOBAL_CTRL_IFACE_PORT 8878 +#define HOSTAPD_GLOBAL_CTRL_IFACE_PORT_LIMIT 50 +#endif /* CONFIG_CTRL_IFACE_UDP */ - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, enum wpa_msg_type type, const char *buf, size_t len); static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, - struct sockaddr_un *from, + struct sockaddr_storage *from, socklen_t fromlen) { - struct wpa_ctrl_dst *dst; - - dst = os_zalloc(sizeof(*dst)); - if (dst == NULL) - return -1; - os_memcpy(&dst->addr, from, sizeof(struct sockaddr_un)); - dst->addrlen = fromlen; - dst->debug_level = MSG_INFO; - dst->next = hapd->ctrl_dst; - hapd->ctrl_dst = dst; - wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached", - (u8 *) from->sun_path, - fromlen - offsetof(struct sockaddr_un, sun_path)); - return 0; + return ctrl_iface_attach(&hapd->ctrl_dst, from, fromlen); } static int hostapd_ctrl_iface_detach(struct hostapd_data *hapd, - struct sockaddr_un *from, + struct sockaddr_storage *from, socklen_t fromlen) { - struct wpa_ctrl_dst *dst, *prev = NULL; - - dst = hapd->ctrl_dst; - while (dst) { - if (fromlen == dst->addrlen && - os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - offsetof(struct sockaddr_un, sun_path)) - == 0) { - wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached", - (u8 *) from->sun_path, - fromlen - - offsetof(struct sockaddr_un, sun_path)); - if (prev == NULL) - hapd->ctrl_dst = dst->next; - else - prev->next = dst->next; - os_free(dst); - return 0; - } - prev = dst; - dst = dst->next; - } - return -1; + return ctrl_iface_detach(&hapd->ctrl_dst, from, fromlen); } static int hostapd_ctrl_iface_level(struct hostapd_data *hapd, - struct sockaddr_un *from, + struct sockaddr_storage *from, socklen_t fromlen, char *level) { - struct wpa_ctrl_dst *dst; - - wpa_printf(MSG_DEBUG, "CTRL_IFACE LEVEL %s", level); - - dst = hapd->ctrl_dst; - while (dst) { - if (fromlen == dst->addrlen && - os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - offsetof(struct sockaddr_un, sun_path)) - == 0) { - wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor " - "level", (u8 *) from->sun_path, fromlen - - offsetof(struct sockaddr_un, sun_path)); - dst->debug_level = atoi(level); - return 0; - } - dst = dst->next; - } - - return -1; + return ctrl_iface_level(&hapd->ctrl_dst, from, fromlen, level); } @@ -884,6 +839,8 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostap int ret; u8 nei_rep[1000]; u8 *nei_pos = nei_rep; + u8 mbo[10]; + size_t mbo_len = 0; if (hwaddr_aton(cmd, addr)) { wpa_printf(MSG_DEBUG, "Invalid STA MAC address"); @@ -1049,10 +1006,66 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostap if (os_strstr(cmd, " disassoc_imminent=1")) req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; +#ifdef CONFIG_MBO + pos = os_strstr(cmd, "mbo="); + if (pos) { + unsigned int mbo_reason, cell_pref, reassoc_delay; + u8 *mbo_pos = mbo; + + ret = sscanf(pos, "mbo=%u:%u:%u", &mbo_reason, + &reassoc_delay, &cell_pref); + if (ret != 3) { + wpa_printf(MSG_DEBUG, + "MBO requires three arguments: mbo=::"); + return -1; + } + + if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) { + wpa_printf(MSG_DEBUG, + "Invalid MBO transition reason code %u", + mbo_reason); + return -1; + } + + /* Valid values for Cellular preference are: 0, 1, 255 */ + if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) { + wpa_printf(MSG_DEBUG, + "Invalid MBO cellular capability %u", + cell_pref); + return -1; + } + + if (reassoc_delay > 65535 || + (reassoc_delay && + !(req_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT))) { + wpa_printf(MSG_DEBUG, + "MBO: Assoc retry delay is only valid in disassoc imminent mode"); + return -1; + } + + *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; + *mbo_pos++ = 1; + *mbo_pos++ = mbo_reason; + *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; + *mbo_pos++ = 1; + *mbo_pos++ = cell_pref; + + if (reassoc_delay) { + *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; + *mbo_pos++ = 2; + WPA_PUT_LE16(mbo_pos, reassoc_delay); + mbo_pos += 2; + } + + mbo_len = mbo_pos - mbo; + } +#endif /* CONFIG_MBO */ + ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, valid_int, bss_term_dur, url, nei_pos > nei_rep ? nei_rep : NULL, - nei_pos - nei_rep); + nei_pos - nei_rep, mbo_len ? mbo : NULL, + mbo_len); os_free(url); return ret; } @@ -1320,9 +1333,28 @@ static int hostapd_ctrl_iface_set(struct hostapd_data } else if (os_strcasecmp(cmd, "ext_eapol_frame_io") == 0) { hapd->ext_eapol_frame_io = atoi(value); #endif /* CONFIG_TESTING_OPTIONS */ +#ifdef CONFIG_MBO + } else if (os_strcasecmp(cmd, "mbo_assoc_disallow") == 0) { + int val; + + if (!hapd->conf->mbo_enabled) + return -1; + + val = atoi(value); + if (val < 0 || val > 1) + return -1; + + hapd->mbo_assoc_disallow = val; + ieee802_11_update_beacons(hapd->iface); + + /* + * TODO: Need to configure drivers that do AP MLME offload with + * disallowing station logic. + */ +#endif /* CONFIG_MBO */ } else { struct sta_info *sta; - int vlan_id; + struct vlan_description vlan_id; ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); if (ret) @@ -1334,7 +1366,8 @@ static int hostapd_ctrl_iface_set(struct hostapd_data hapd->conf->deny_mac, hapd->conf->num_deny_mac, sta->addr, &vlan_id) && - (!vlan_id || vlan_id == sta->vlan_id)) + (!vlan_id.notempty || + !vlan_compare(&vlan_id, sta->vlan_desc))) ap_sta_disconnect( hapd, sta, sta->addr, WLAN_REASON_UNSPECIFIED); @@ -1346,7 +1379,8 @@ static int hostapd_ctrl_iface_set(struct hostapd_data hapd->conf->accept_mac, hapd->conf->num_accept_mac, sta->addr, &vlan_id) || - (vlan_id && vlan_id != sta->vlan_id)) + (vlan_id.notempty && + vlan_compare(&vlan_id, sta->vlan_desc))) ap_sta_disconnect( hapd, sta, sta->addr, WLAN_REASON_UNSPECIFIED); @@ -1557,8 +1591,8 @@ static u16 ipv4_hdr_checksum(const void *buf, size_t l #define HWSIM_PACKETLEN 1500 #define HWSIM_IP_LEN (HWSIM_PACKETLEN - sizeof(struct ether_header)) -void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, - size_t len) +static void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, + size_t len) { struct hostapd_data *hapd = ctx; const struct ether_header *eth; @@ -1745,8 +1779,6 @@ done: static int hostapd_ctrl_test_alloc_fail(struct hostapd_data *hapd, char *cmd) { #ifdef WPA_TRACE_BFD - extern char wpa_trace_fail_func[256]; - extern unsigned int wpa_trace_fail_after; char *pos; wpa_trace_fail_after = atoi(cmd); @@ -1770,9 +1802,6 @@ static int hostapd_ctrl_get_alloc_fail(struct hostapd_ char *buf, size_t buflen) { #ifdef WPA_TRACE_BFD - extern char wpa_trace_fail_func[256]; - extern unsigned int wpa_trace_fail_after; - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_fail_after, wpa_trace_fail_func); #else /* WPA_TRACE_BFD */ @@ -1784,8 +1813,6 @@ static int hostapd_ctrl_get_alloc_fail(struct hostapd_ static int hostapd_ctrl_test_fail(struct hostapd_data *hapd, char *cmd) { #ifdef WPA_TRACE_BFD - extern char wpa_trace_test_fail_func[256]; - extern unsigned int wpa_trace_test_fail_after; char *pos; wpa_trace_test_fail_after = atoi(cmd); @@ -1809,9 +1836,6 @@ static int hostapd_ctrl_get_fail(struct hostapd_data * char *buf, size_t buflen) { #ifdef WPA_TRACE_BFD - extern char wpa_trace_test_fail_func[256]; - extern unsigned int wpa_trace_test_fail_after; - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_test_fail_after, wpa_trace_test_fail_func); #else /* WPA_TRACE_BFD */ @@ -1875,13 +1899,13 @@ static int hostapd_ctrl_iface_vendor(struct hostapd_da /* cmd: [] */ vendor_id = strtoul(cmd, &pos, 16); - if (!isblank(*pos)) + if (!isblank((unsigned char) *pos)) return -EINVAL; subcmd = strtoul(pos, &pos, 10); if (*pos != '\0') { - if (!isblank(*pos++)) + if (!isblank((unsigned char) *pos++)) return -EINVAL; data_len = os_strlen(pos); } @@ -2016,6 +2040,9 @@ static int hostapd_ctrl_iface_track_sta_list(struct ho struct hostapd_sta_info *info; struct os_reltime now; + if (!iface->num_sta_seen) + return 0; + sta_track_expire(iface, 0); pos = buf; @@ -2040,10 +2067,228 @@ static int hostapd_ctrl_iface_track_sta_list(struct ho #endif /* NEED_AP_MLME */ +static int hostapd_ctrl_iface_req_lci(struct hostapd_data *hapd, + const char *cmd) +{ + u8 addr[ETH_ALEN]; + + if (hwaddr_aton(cmd, addr)) { + wpa_printf(MSG_INFO, "CTRL: REQ_LCI: Invalid MAC address"); + return -1; + } + + return hostapd_send_lci_req(hapd, addr); +} + + +static int hostapd_ctrl_iface_req_range(struct hostapd_data *hapd, char *cmd) +{ + u8 addr[ETH_ALEN]; + char *token, *context = NULL; + int random_interval, min_ap; + u8 responders[ETH_ALEN * RRM_RANGE_REQ_MAX_RESPONDERS]; + unsigned int n_responders; + + token = str_token(cmd, " ", &context); + if (!token || hwaddr_aton(token, addr)) { + wpa_printf(MSG_INFO, + "CTRL: REQ_RANGE - Bad destination address"); + return -1; + } + + token = str_token(cmd, " ", &context); + if (!token) + return -1; + + random_interval = atoi(token); + if (random_interval < 0 || random_interval > 0xffff) + return -1; + + token = str_token(cmd, " ", &context); + if (!token) + return -1; + + min_ap = atoi(token); + if (min_ap <= 0 || min_ap > WLAN_RRM_RANGE_REQ_MAX_MIN_AP) + return -1; + + n_responders = 0; + while ((token = str_token(cmd, " ", &context))) { + if (n_responders == RRM_RANGE_REQ_MAX_RESPONDERS) { + wpa_printf(MSG_INFO, + "CTRL: REQ_RANGE: Too many responders"); + return -1; + } + + if (hwaddr_aton(token, responders + n_responders * ETH_ALEN)) { + wpa_printf(MSG_INFO, + "CTRL: REQ_RANGE: Bad responder address"); + return -1; + } + + n_responders++; + } + + if (!n_responders) { + wpa_printf(MSG_INFO, + "CTRL: REQ_RANGE - No FTM responder address"); + return -1; + } + + return hostapd_send_range_req(hapd, addr, random_interval, min_ap, + responders, n_responders); +} + + +static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf) +{ + struct wpa_ssid_value ssid; + u8 bssid[ETH_ALEN]; + struct wpabuf *nr, *lci = NULL, *civic = NULL; + char *tmp; + int ret; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jul 11 19:02:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D48C1035B51; Wed, 11 Jul 2018 19:02:50 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ABF9D813CB; Wed, 11 Jul 2018 19:02:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id dKNqft9LLwyxUdKNsfu7lC; Wed, 11 Jul 2018 13:02:41 -0600 X-Authority-Analysis: v=2.3 cv=NPJhBHyg c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=R9QF1RCXAYgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=TZECKli3YUp6tOQkyVQA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 0247D2C2; Wed, 11 Jul 2018 12:02:37 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w6BJ2LBt023956; Wed, 11 Jul 2018 12:02:21 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w6BJ2LhJ023953; Wed, 11 Jul 2018 12:02:21 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201807111902.w6BJ2LhJ023953@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336203 - in head: contrib/wpa contrib/wpa/hostapd contrib/wpa/hs20/client contrib/wpa/patches contrib/wpa/src/ap contrib/wpa/src/common contrib/wpa/src/crypto contrib/wpa/src/drivers c... In-Reply-To: Message from Cy Schubert of "Wed, 11 Jul 2018 18:53:18 -0000." <201807111853.w6BIrI9B080714@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 11 Jul 2018 12:02:21 -0700 X-CMAE-Envelope: MS4wfCTYCPiGlH6aW/J4wvWKeR9QHfGcW819iD1VSxO7EFqoyiTecn6qS8NJ0sZ5pFMlkyNcm5zeWAywHMN3WPd3L2L+p69h8m0wtttoMwIoTCXEMKUxzCCx HR3ck3ewIH9N1VHHgMjccNfxFkOBaffXYEFUF/RBtmALLTfIYWNbic5yEmWeUUrTxkxZexy8HSE+eDb8eI27OGN3SVcnGWAPiET9RyLYs9Z/ZBUXC0wTwrsQ KppV003Rcti3SNkt4qbUSIbr9I/MkQedn9g+ibGpsEA3r/TKwbWxL83tYPgEaMRU X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 19:02:50 -0000 In message <201807111853.w6BIrI9B080714@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Wed Jul 11 18:53:18 2018 > New Revision: 336203 > URL: https://svnweb.freebsd.org/changeset/base/336203 > > Log: > MFV r324714: > > Update wpa 2.5 --> 2.6. > > MFC after: 1 month This has been sitting in a to be committed tree and in my "prod" tree and in use for a while. Thanks to kevens@ for reminding me. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Wed Jul 11 19:38:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 903DC103C1E2; Wed, 11 Jul 2018 19:38:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4130E833CD; Wed, 11 Jul 2018 19:38:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DD161703D; Wed, 11 Jul 2018 19:38:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BJcgAg002098; Wed, 11 Jul 2018 19:38:42 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BJcgFn002096; Wed, 11 Jul 2018 19:38:42 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201807111938.w6BJcgFn002096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 11 Jul 2018 19:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336205 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 19:38:43 -0000 Author: asomers Date: Wed Jul 11 19:38:42 2018 New Revision: 336205 URL: https://svnweb.freebsd.org/changeset/base/336205 Log: Don't acquire evclass_lock with a spinlock held When the "pc" audit class is enabled and auditd is running, witness will panic during thread exit because au_event_class tries to lock an rwlock while holding a spinlock acquired upstack by thread_exit. To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is acquired. Of thread_exit's 16 callers, it's only necessary to call AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit (for exiting threads). The other callers are all kernel threads, which needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls there will be nothing to audit. And exit1 already does call AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that case. PR: 228444 Reported by: aniketp Reviewed by: aniketp, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16210 Modified: head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Wed Jul 11 19:23:11 2018 (r336204) +++ head/sys/kern/kern_thr.c Wed Jul 11 19:38:42 2018 (r336205) @@ -374,6 +374,11 @@ kern_thr_exit(struct thread *td) KASSERT(p->p_numthreads > 1, ("too few threads")); racct_sub(p, RACCT_NTHR, 1); tdsigcleanup(td); + +#ifdef AUDIT + AUDIT_SYSCALL_EXIT(0, td); +#endif + PROC_SLOCK(p); thread_stopped(p); thread_exit(); Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Jul 11 19:23:11 2018 (r336204) +++ head/sys/kern/kern_thread.c Wed Jul 11 19:38:42 2018 (r336205) @@ -532,9 +532,6 @@ thread_exit(void) SDT_PROBE0(proc, , , lwp__exit); KASSERT(TAILQ_EMPTY(&td->td_sigqueue.sq_list), ("signal pending")); -#ifdef AUDIT - AUDIT_SYSCALL_EXIT(0, td); -#endif /* * drop FPU & debug register state storage, or any other * architecture specific resources that From owner-svn-src-head@freebsd.org Wed Jul 11 21:53:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25FEA1049E05; Wed, 11 Jul 2018 21:53:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5D3F8A03A; Wed, 11 Jul 2018 21:53:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8710B18657; Wed, 11 Jul 2018 21:53:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BLr4xa073444; Wed, 11 Jul 2018 21:53:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BLr4FB073443; Wed, 11 Jul 2018 21:53:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807112153.w6BLr4FB073443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 11 Jul 2018 21:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336213 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 21:53:05 -0000 Author: imp Date: Wed Jul 11 21:53:04 2018 New Revision: 336213 URL: https://svnweb.freebsd.org/changeset/base/336213 Log: Small refactor of install-boot Use newfs_msdos to create the filesystem for the partition requested and use loader.efi instead of boot1.efi. Modified: head/tools/boot/install-boot.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Wed Jul 11 20:11:06 2018 (r336212) +++ head/tools/boot/install-boot.sh Wed Jul 11 21:53:04 2018 (r336213) @@ -27,18 +27,33 @@ find-part() { gpart show $dev | tail +2 | awk '$4 == "'$part'" { print $3; }' } -boot_nogeli_gpt_ufs_legacy() { +make_esp() { + local dev dst mntpt + dev=$1 dst=$2 - idx=$(find-part $dev "freebsd-boot") - if [ -z "$idx" ] ; then - die "No freebsd-boot partition found" + newfs_msdos -a 32 /dev/${dev} + mntpt=$(mktemp -d /tmp/stand-test.XXXXXX) + mount -t msdos /dev/${md} ${mntpt} + mkdir -p ${mntpt}/efi/boot + cp ${dst}/boot/loader.efi ${mntpt}/efi/boot/bootx64.efi + umount ${mntpt} + rmdir ${mntpt} +} + +make_esp_mbr() { + dev=$1 + dst=$2 + + s=$(find-part $dev "!239") + if [ -z "$s" ] ; then + die "No ESP slice found" fi - doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev + make_esp /dev/${dev}s${s} ${dst} } -boot_nogeli_gpt_ufs_uefi() { +make_esp_gpt() { dev=$1 dst=$2 @@ -46,9 +61,24 @@ boot_nogeli_gpt_ufs_uefi() { if [ -z "$idx" ] ; then die "No ESP partition found" fi - doit gpart bootcode -p ${efi2} -i $idx $dev + make_esp /dev/${dev}p${idx} ${dst} } +boot_nogeli_gpt_ufs_legacy() { + dev=$1 + dst=$2 + + idx=$(find-part $dev "freebsd-boot") + if [ -z "$idx" ] ; then + die "No freebsd-boot partition found" + fi + doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev +} + +boot_nogeli_gpt_ufs_uefi() { + make_esp_gpt $1 $2 +} + boot_nogeli_gpt_ufs_both() { boot_nogeli_gpt_ufs_legacy $1 $2 $3 boot_nogeli_gpt_ufs_uefi $1 $2 $3 @@ -66,14 +96,7 @@ boot_nogeli_gpt_zfs_legacy() { } boot_nogeli_gpt_zfs_uefi() { - dev=$1 - dst=$2 - - idx=$(find-part $dev "efi") - if [ -z "$idx" ] ; then - die "No ESP partition found" - fi - doit gpart bootcode -p ${efi2} -i $idx $dev + make_esp_gpt $1 $2 } boot_nogeli_gpt_zfs_both() { @@ -94,14 +117,7 @@ boot_nogeli_mbr_ufs_legacy() { } boot_nogeli_mbr_ufs_uefi() { - dev=$1 - dst=$2 - - s=$(find-part ${dev} "!239") - if [ -z "$s" ] ; then - die "No ESP slice found" - fi - doit gpart bootcode -p ${efi2} -i ${s} ${dev} + make_esp_mbr $1 $2 } boot_nogeli_mbr_ufs_both() { @@ -133,14 +149,7 @@ boot_nogeli_mbr_zfs_legacy() { } boot_nogeli_mbr_zfs_uefi() { - dev=$1 - dst=$2 - - s=$(find-part $dev "!239") - if [ -z "$s" ] ; then - die "No ESP slice found" - fi - doit gpart bootcode -p ${efi2} -i ${s} ${dev} + make_eps_mbr $1 $2 } boot_nogeli_mbr_zfs_both() { @@ -245,11 +254,6 @@ dev=$1 gpt0=${DESTDIR}/boot/pmbr gpt2=${DESTDIR}/boot/gptboot gptzfs2=${DESTDIR}/boot/gptzfsboot - -# For gpt + EFI we install the ESP -# XXX This should use newfs or makefs, but it doesn't yet -efi1=${DESTDIR}/boot/boot1.efi -efi2=${DESTDIR}/boot/boot1.efifat # For MBR, we have lots of choices, but select mbr, boot0 has issues with UEFI mbr0=${DESTDIR}/boot/mbr From owner-svn-src-head@freebsd.org Wed Jul 11 22:23:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 209F810274C2; Wed, 11 Jul 2018 22:23:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C34B48B3A2; Wed, 11 Jul 2018 22:23:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4E3C18B26; Wed, 11 Jul 2018 22:23:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BMNoxO088843; Wed, 11 Jul 2018 22:23:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BMNofk088841; Wed, 11 Jul 2018 22:23:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807112223.w6BMNofk088841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 11 Jul 2018 22:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336214 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 336214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 22:23:51 -0000 Author: ian Date: Wed Jul 11 22:23:50 2018 New Revision: 336214 URL: https://svnweb.freebsd.org/changeset/base/336214 Log: Add various spi devices to NOTES. Add some required options for building the cqspi and n25q drivers. Modified: head/sys/conf/NOTES head/sys/conf/files Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Jul 11 21:53:04 2018 (r336213) +++ head/sys/conf/NOTES Wed Jul 11 22:23:50 2018 (r336214) @@ -3045,5 +3045,12 @@ options UINPUT_DEBUG # enable uinput debug msgs # Encrypted kernel crash dumps. options EKCD +# Serial Peripheral Interface (SPI) support. +device spibus # Bus support. +device at45d # DataFlash driver +device cqspi # +device mx25l # SPIFlash driver +device n25q # +device spigen # Generic access to SPI devices from userland. # Enable legacy /dev/spigenN name aliases for /dev/spigenX.Y devices. options SPIGEN_LEGACY_CDEVNAME # legacy device names for spigen Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jul 11 21:53:04 2018 (r336213) +++ head/sys/conf/files Wed Jul 11 22:23:50 2018 (r336214) @@ -1785,10 +1785,10 @@ dev/firewire/if_fwip.c optional fwip dev/firewire/sbp.c optional sbp dev/firewire/sbp_targ.c optional sbp_targ dev/flash/at45d.c optional at45d -dev/flash/cqspi.c optional cqspi +dev/flash/cqspi.c optional cqspi fdt xdma dev/flash/mx25l.c optional mx25l -dev/flash/n25q.c optional n25q -dev/flash/qspi_if.m optional cqspi | n25q +dev/flash/n25q.c optional n25q fdt +dev/flash/qspi_if.m optional cqspi fdt | n25q fdt dev/fxp/if_fxp.c optional fxp dev/fxp/inphy.c optional fxp dev/gem/if_gem.c optional gem From owner-svn-src-head@freebsd.org Wed Jul 11 23:23:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD806102DCFB; Wed, 11 Jul 2018 23:23:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 933388D491; Wed, 11 Jul 2018 23:23:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 744E3194AC; Wed, 11 Jul 2018 23:23:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BNNTGZ019357; Wed, 11 Jul 2018 23:23:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BNNTZ2019356; Wed, 11 Jul 2018 23:23:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807112323.w6BNNTZ2019356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 11 Jul 2018 23:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336215 - head/sys/fs/nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsserver X-SVN-Commit-Revision: 336215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 23:23:30 -0000 Author: rmacklem Date: Wed Jul 11 23:23:29 2018 New Revision: 336215 URL: https://svnweb.freebsd.org/changeset/base/336215 Log: Ignore the cookie verifier for NFSv4.1 when the cookie is 0. RFC5661 states that the cookie verifier should be 0 when the cookie is 0. However, the wording is somewhat unclear and a recent discussion on the nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore the cookie verifier's value when the dirctory offset cookie is 0. This patch deletes the check for this that would return NFSERR_BAD_COOKIE when the verifier was not 0. This was found during testing of the ESXi client against the NFSv4.1 server. Reported by: daniel@ftml.net (via packet trace) MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Wed Jul 11 22:23:50 2018 (r336214) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Wed Jul 11 23:23:29 2018 (r336215) @@ -2101,6 +2101,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg } fullsiz = siz; nd->nd_repstat = getret = nfsvno_getattr(vp, &at, nd, p, 1, NULL); +#if 0 if (!nd->nd_repstat) { if (off && verf != at.na_filerev) { /* @@ -2109,17 +2110,14 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg * removed/added unless that offset cookies returned to * the client are no longer valid. */ -#if 0 if (nd->nd_flag & ND_NFSV4) { nd->nd_repstat = NFSERR_NOTSAME; } else { nd->nd_repstat = NFSERR_BAD_COOKIE; } -#endif - } else if ((nd->nd_flag & ND_NFSV4) && off == 0 && verf != 0) { - nd->nd_repstat = NFSERR_BAD_COOKIE; } } +#endif if (!nd->nd_repstat && vp->v_type != VDIR) nd->nd_repstat = NFSERR_NOTDIR; if (!nd->nd_repstat && cnt == 0) From owner-svn-src-head@freebsd.org Wed Jul 11 23:59:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AAF51031DE2; Wed, 11 Jul 2018 23:59:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 394008EACF; Wed, 11 Jul 2018 23:59:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1466319972; Wed, 11 Jul 2018 23:59:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6BNx4Wi034863; Wed, 11 Jul 2018 23:59:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6BNx465034862; Wed, 11 Jul 2018 23:59:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807112359.w6BNx465034862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 11 Jul 2018 23:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336216 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 336216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 23:59:05 -0000 Author: ian Date: Wed Jul 11 23:59:04 2018 New Revision: 336216 URL: https://svnweb.freebsd.org/changeset/base/336216 Log: Actually build and install the spigen.4 manpage. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Jul 11 23:23:29 2018 (r336215) +++ head/share/man/man4/Makefile Wed Jul 11 23:59:04 2018 (r336216) @@ -505,6 +505,7 @@ MAN= aac.4 \ snd_via82c686.4 \ snd_vibes.4 \ snp.4 \ + spigen.4 \ ${_spkr.4} \ splash.4 \ sppp.4 \ From owner-svn-src-head@freebsd.org Thu Jul 12 02:51:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A90CC1047C03; Thu, 12 Jul 2018 02:51:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5919C763E2; Thu, 12 Jul 2018 02:51:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B7351B7E5; Thu, 12 Jul 2018 02:51:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6C2ppHC024545; Thu, 12 Jul 2018 02:51:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6C2poUa024462; Thu, 12 Jul 2018 02:51:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201807120251.w6C2poUa024462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Jul 2018 02:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336217 - in head: . sys/kern usr.sbin/config X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . sys/kern usr.sbin/config X-SVN-Commit-Revision: 336217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 02:51:51 -0000 Author: kevans Date: Thu Jul 12 02:51:50 2018 New Revision: 336217 URL: https://svnweb.freebsd.org/changeset/base/336217 Log: kern_environment: Give the static environment a chance to disable MD env This variable has been given the name "loader_env.disabled" as it's the primary way most people will have an MD environment. This restores the previously-default behavior of ignoring the loader(8) environment, which may be useful for vendor distributions or other scenarios where inheriting the loader environment may be considered a security issue or potentially breaking of a more locked-down environment. As the change to config(5) indicates, disabling the loader environment should not be a choice made lightly since it may provide ACPI hints and other useful things that the system can rely on to boot. An UPDATING entry has been added to mention an upgrade path for those that may have relied on the previous behavior. Discussed with: bde Relnotes: yes (maybe) Modified: head/UPDATING head/sys/kern/kern_environment.c head/usr.sbin/config/config.5 Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jul 11 23:59:04 2018 (r336216) +++ head/UPDATING Thu Jul 12 02:51:50 2018 (r336217) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20180711: + The static environment setup in kernel configs is no longer mutually + exclusive with the loader(8) environment by default. In order to + restore the previous default behavior of disabling the loader(8) + environment if a static environment is present, you must specify + loader_env.disabled=1 in the static environment. + 20180705: The ABI of syscalls used by management tools like sockstat and netstat has been broken to allow 32-bit binaries to work on Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Wed Jul 11 23:59:04 2018 (r336216) +++ head/sys/kern/kern_environment.c Thu Jul 12 02:51:50 2018 (r336217) @@ -249,11 +249,10 @@ init_static_kenv(char *buf, size_t len) { char *eval; - md_envp = buf; - md_env_len = len; - md_env_pos = 0; - /* + * Give the static environment a chance to disable the loader(8) + * environment first. This is done with loader_env.disabled=1. + * * static_env and static_hints may both be disabled, but in slightly * different ways. For static_env, we just don't setup kern_envp and * it's as if a static env wasn't even provided. For static_hints, @@ -263,10 +262,21 @@ init_static_kenv(char *buf, size_t len) * We're intentionally setting this up so that static_hints.disabled may * be specified in either the MD env or the static env. This keeps us * consistent in our new world view. + * + * As a warning, the static environment may not be disabled in any way + * if the static environment has disabled the loader environment. */ - eval = kern_getenv("static_env.disabled"); - if (eval == NULL || strcmp(eval, "1") != 0) - kern_envp = static_env; + kern_envp = static_env; + eval = kern_getenv("loader_env.disabled"); + if (eval == NULL || strcmp(eval, "1") != 0) { + md_envp = buf; + md_env_len = len; + md_env_pos = 0; + + eval = kern_getenv("static_env.disabled"); + if (eval != NULL && strcmp(eval, "1") == 0) + *kern_envp = '\0'; + } eval = kern_getenv("static_hints.disabled"); if (eval != NULL && strcmp(eval, "1") == 0) *static_hints = '\0'; Modified: head/usr.sbin/config/config.5 ============================================================================== --- head/usr.sbin/config/config.5 Wed Jul 11 23:59:04 2018 (r336216) +++ head/usr.sbin/config/config.5 Thu Jul 12 02:51:50 2018 (r336217) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 26, 2018 +.Dd July 11, 2018 .Dt CONFIG 5 .Os .Sh NAME @@ -125,13 +125,24 @@ environment will take precedence over environment vari and environment variables specified in the dynamic environment take precedence over both of these. .Pp +.Va loader_env.disabled=1 +may be specified in the static environment to disable the +.Xr loader 8 +environment. +Disabling the +.Xr loader 8 +should be done with caution and due consideration for whether or not it supplies +environment variables needed for properly booting the system. +.Pp .Va static_env.disabled=1 may be specified in the .Xr loader 8 -environment to disable use of this compiled-in environment. +environment to disable use of the static environment. This option has no effect if specified in any environment after the .Xr loader 8 environment is processed. +This option is not usable in conjunction with +.Va loader_env.disabled . .Pp This directive is useful for setting kernel tunables in embedded environments that do not start from From owner-svn-src-head@freebsd.org Thu Jul 12 03:49:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12F3C10260DD; Thu, 12 Jul 2018 03:49:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 658EA78FD1; Thu, 12 Jul 2018 03:49:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id dSbqfgpf7WppDdSbsfV6Ot; Wed, 11 Jul 2018 21:49:41 -0600 X-Authority-Analysis: v=2.3 cv=YIcrNiOx c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=R9QF1RCXAYgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=AD9GVtJHjYr9fbXkUkMA:9 a=CjuIK1q_8ugA:10 a=RhCIQvNMhSUA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id BF3A9E1E; Wed, 11 Jul 2018 20:49:38 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w6C3ncM8094426; Wed, 11 Jul 2018 20:49:38 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w6C3ncJG094423; Wed, 11 Jul 2018 20:49:38 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201807120349.w6C3ncJG094423@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336203 - in head: contrib/wpa contrib/wpa/hostapd contrib/wpa/hs20/client contrib/wpa/patches contrib/wpa/src/ap contrib/wpa/src/common contrib/wpa/src/crypto contrib/wpa/src/drivers c... In-Reply-To: Message from Cy Schubert of "Wed, 11 Jul 2018 18:53:18 -0000." <201807111853.w6BIrI9B080714@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 11 Jul 2018 20:49:38 -0700 X-CMAE-Envelope: MS4wfGhIaSE2srTP8vpGLHiKsBPzJuf1RHNWr9tnlDaQQwMeXOODYkNjg3gLFgiMF/FcSQOd5RkDCEUrym1g/Obfiz8qwWMyo4QRz5IS002pDtZyIAqlQozw 6Vvmim5SRjRJ4jnRA2WQpPAyAcJBsTmy9qFdh8uD4R/+jPJA0iAR2z2nGqcq1l6t7J8f2+DK0xH7VS/559ngLToz8XkPe5mt/4qFtqe8VQ+8jko82S5W/Nkp Zj0L8ydseFUTP8MjbEeUQr9iw4len0VClHFbUVHqj0SHWTT9ErNxaPaYVhLtpuEX X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 03:49:49 -0000 In message <201807111853.w6BIrI9B080714@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Wed Jul 11 18:53:18 2018 > New Revision: 336203 > URL: https://svnweb.freebsd.org/changeset/base/336203 > > Log: > MFV r324714: > > Update wpa 2.5 --> 2.6. > > MFC after: 1 month Relnotes: yes -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Jul 12 11:38:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05C22102AEC4; Thu, 12 Jul 2018 11:38:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A79F18BFC3; Thu, 12 Jul 2018 11:38:18 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88E0220D6E; Thu, 12 Jul 2018 11:38:18 +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 w6CBcI70092511; Thu, 12 Jul 2018 11:38:18 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CBcIDA092510; Thu, 12 Jul 2018 11:38:18 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201807121138.w6CBcIDA092510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Jul 2018 11:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336219 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 336219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 11:38:19 -0000 Author: ae Date: Thu Jul 12 11:38:18 2018 New Revision: 336219 URL: https://svnweb.freebsd.org/changeset/base/336219 Log: Use correct size when we are allocating array for skipto index. Also, there is no need to use M_ZERO for idxmap_back. It will be re-filled just after allocation in update_skipto_cache(). PR: 229665 MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Thu Jul 12 05:37:52 2018 (r336218) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Thu Jul 12 11:38:18 2018 (r336219) @@ -301,10 +301,8 @@ ipfw_init_skipto_cache(struct ip_fw_chain *chain) { int *idxmap, *idxmap_back; - idxmap = malloc(65536 * sizeof(uint32_t *), M_IPFW, - M_WAITOK | M_ZERO); - idxmap_back = malloc(65536 * sizeof(uint32_t *), M_IPFW, - M_WAITOK | M_ZERO); + idxmap = malloc(65536 * sizeof(int), M_IPFW, M_WAITOK | M_ZERO); + idxmap_back = malloc(65536 * sizeof(int), M_IPFW, M_WAITOK); /* * Note we may be called at any time after initialization, From owner-svn-src-head@freebsd.org Thu Jul 12 16:19:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C68E1049580; Thu, 12 Jul 2018 16:19:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED900712AA; Thu, 12 Jul 2018 16:19:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEAF323B92; Thu, 12 Jul 2018 16:19:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CGJHZl036682; Thu, 12 Jul 2018 16:19:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CGJHoj036681; Thu, 12 Jul 2018 16:19:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807121619.w6CGJHoj036681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 12 Jul 2018 16:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336220 - head/lib/libefivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libefivar X-SVN-Commit-Revision: 336220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 16:19:18 -0000 Author: imp Date: Thu Jul 12 16:19:17 2018 New Revision: 336220 URL: https://svnweb.freebsd.org/changeset/base/336220 Log: Fix an obvious 'is odd' check. len % 1 is always true. Fix StrHexToBytes to do a proper odd length check. This was only called by DevPathFromTextGenericPath, ConvertFromTextVendor and DevPathFromTextMAC, which we've not had a need to actually use just yet. Submitted by: David Binderman PR: 229718 Modified: head/lib/libefivar/uefi-dplib.h Modified: head/lib/libefivar/uefi-dplib.h ============================================================================== --- head/lib/libefivar/uefi-dplib.h Thu Jul 12 11:38:18 2018 (r336219) +++ head/lib/libefivar/uefi-dplib.h Thu Jul 12 16:19:17 2018 (r336220) @@ -576,7 +576,7 @@ StrHexToBytes(const char *str, size_t len, uint8_t *bu /* * Sanity check preconditions. */ - if (buflen != len / 2 || (len % 1) == 1) + if (buflen != len / 2 || (len % 2) == 1) return 1; for (i = 0; i < len; i += 2) { if (!isxdigit(str[i]) || !isxdigit(str[i + 1])) From owner-svn-src-head@freebsd.org Thu Jul 12 16:35:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0531104AF8A; Thu, 12 Jul 2018 16:35:35 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93EB4720B6; Thu, 12 Jul 2018 16:35:35 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 752E223EF2; Thu, 12 Jul 2018 16:35:35 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CGZZAv046920; Thu, 12 Jul 2018 16:35:35 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CGZZAN046919; Thu, 12 Jul 2018 16:35:35 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807121635.w6CGZZAN046919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 12 Jul 2018 16:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336221 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 336221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 16:35:36 -0000 Author: kp Date: Thu Jul 12 16:35:35 2018 New Revision: 336221 URL: https://svnweb.freebsd.org/changeset/base/336221 Log: pf: Increate default state table size The typical system now has a lot more memory than when pf was new, and is also expected to handle more connections. Increase the default size of the state table. Note that users can overrule this using 'set limit states' in pf.conf. From OpenBSD: The year is 2018. Mercury, Bowie, Cash, Motorola and DEC all left us. Just pf still has a default state table limit of 10000. Had! Now it's a tiny little bit more, 100k. lead guitar: me ok chorus: phessler theo claudio benno background school girl laughing: bob Obtained from: OpenBSD Modified: head/sys/net/pfvar.h Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Thu Jul 12 16:19:17 2018 (r336220) +++ head/sys/net/pfvar.h Thu Jul 12 16:35:35 2018 (r336221) @@ -621,9 +621,9 @@ struct pf_rule { #define PFRULE_IFBOUND 0x00010000 /* if-bound */ #define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ -#define PFSTATE_HIWAT 10000 /* default state table size */ -#define PFSTATE_ADAPT_START 6000 /* default adaptive timeout start */ -#define PFSTATE_ADAPT_END 12000 /* default adaptive timeout end */ +#define PFSTATE_HIWAT 100000 /* default state table size */ +#define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ +#define PFSTATE_ADAPT_END 102000 /* default adaptive timeout end */ struct pf_threshold { From owner-svn-src-head@freebsd.org Thu Jul 12 17:22:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1605E10298C0; Thu, 12 Jul 2018 17:22:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD5F574273; Thu, 12 Jul 2018 17:22:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E9C824702; Thu, 12 Jul 2018 17:22:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CHMPIu071885; Thu, 12 Jul 2018 17:22:25 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CHMPus071884; Thu, 12 Jul 2018 17:22:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807121722.w6CHMPus071884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 12 Jul 2018 17:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336222 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 17:22:26 -0000 Author: ian Date: Thu Jul 12 17:22:25 2018 New Revision: 336222 URL: https://svnweb.freebsd.org/changeset/base/336222 Log: Wee fix: $dev is passed in to the function with the /dev prefix already in place, don't add it. Modified: head/tools/boot/install-boot.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Thu Jul 12 16:35:35 2018 (r336221) +++ head/tools/boot/install-boot.sh Thu Jul 12 17:22:25 2018 (r336222) @@ -33,9 +33,9 @@ make_esp() { dev=$1 dst=$2 - newfs_msdos -a 32 /dev/${dev} + newfs_msdos -a 32 ${dev} mntpt=$(mktemp -d /tmp/stand-test.XXXXXX) - mount -t msdos /dev/${md} ${mntpt} + mount -t msdos ${dev} ${mntpt} mkdir -p ${mntpt}/efi/boot cp ${dst}/boot/loader.efi ${mntpt}/efi/boot/bootx64.efi umount ${mntpt} From owner-svn-src-head@freebsd.org Thu Jul 12 17:42:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ACC7102BB15; Thu, 12 Jul 2018 17:42:38 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC7AD75423; Thu, 12 Jul 2018 17:42:37 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D9CC24A49; Thu, 12 Jul 2018 17:42:37 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CHgb4v082038; Thu, 12 Jul 2018 17:42:37 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CHgbfV082036; Thu, 12 Jul 2018 17:42:37 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201807121742.w6CHgbfV082036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 12 Jul 2018 17:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336223 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 336223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 17:42:38 -0000 Author: erj Date: Thu Jul 12 17:42:36 2018 New Revision: 336223 URL: https://svnweb.freebsd.org/changeset/base/336223 Log: ixl(4): Set baudrate on link up using proper link_speed variable And remove old, now-completely unused link_speed variable. Reported by: Jacob Keller MFC after: 1 month Modified: head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/ixl_pf.h Modified: head/sys/dev/ixl/if_ixl.c ============================================================================== --- head/sys/dev/ixl/if_ixl.c Thu Jul 12 17:22:25 2018 (r336222) +++ head/sys/dev/ixl/if_ixl.c Thu Jul 12 17:42:36 2018 (r336223) @@ -1181,12 +1181,13 @@ void ixl_update_link_status(struct ixl_pf *pf) { struct ixl_vsi *vsi = &pf->vsi; + struct i40e_hw *hw = &pf->hw; u64 baudrate; if (pf->link_up) { if (vsi->link_active == FALSE) { vsi->link_active = TRUE; - baudrate = ixl_max_aq_speed_to_value(pf->link_speed); + baudrate = ixl_max_aq_speed_to_value(hw->phy.link_info.link_speed); iflib_link_state_change(vsi->ctx, LINK_STATE_UP, baudrate); ixl_link_up_msg(pf); #ifdef PCI_IOV Modified: head/sys/dev/ixl/ixl_pf.h ============================================================================== --- head/sys/dev/ixl/ixl_pf.h Thu Jul 12 17:22:25 2018 (r336222) +++ head/sys/dev/ixl/ixl_pf.h Thu Jul 12 17:42:36 2018 (r336223) @@ -120,7 +120,6 @@ struct ixl_pf { int rx_itr; bool link_up; - u32 link_speed; int advertised_speed; int fc; /* link flow ctrl setting */ enum ixl_dbg_mask dbg_mask; From owner-svn-src-head@freebsd.org Thu Jul 12 18:07:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F361102E5C1; Thu, 12 Jul 2018 18:07:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3248D76546; Thu, 12 Jul 2018 18:07:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08A3B24D8B; Thu, 12 Jul 2018 18:07:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CI7Sal092624; Thu, 12 Jul 2018 18:07:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CI7SXZ092623; Thu, 12 Jul 2018 18:07:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807121807.w6CI7SXZ092623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 12 Jul 2018 18:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336224 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 336224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 18:07:29 -0000 Author: kp Date: Thu Jul 12 18:07:28 2018 New Revision: 336224 URL: https://svnweb.freebsd.org/changeset/base/336224 Log: pf: Fix typo in r336221 Reported by: olivier@ Modified: head/sys/net/pfvar.h Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Thu Jul 12 17:42:36 2018 (r336223) +++ head/sys/net/pfvar.h Thu Jul 12 18:07:28 2018 (r336224) @@ -623,7 +623,7 @@ struct pf_rule { #define PFSTATE_HIWAT 100000 /* default state table size */ #define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ -#define PFSTATE_ADAPT_END 102000 /* default adaptive timeout end */ +#define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ struct pf_threshold { From owner-svn-src-head@freebsd.org Thu Jul 12 18:44:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DE80103296C; Thu, 12 Jul 2018 18:44:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4F8778529; Thu, 12 Jul 2018 18:44:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 961D4253FF; Thu, 12 Jul 2018 18:44:01 +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 w6CIi1HV012847; Thu, 12 Jul 2018 18:44:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CIi1fW012845; Thu, 12 Jul 2018 18:44:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807121844.w6CIi1fW012845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 12 Jul 2018 18:44:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336225 - in head/sys/dev: ahci usb/controller X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 336225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 18:44:02 -0000 Author: markj Date: Thu Jul 12 18:44:00 2018 New Revision: 336225 URL: https://svnweb.freebsd.org/changeset/base/336225 Log: Add PCI IDs for AMD X370 AHCI and XHCI. Submitted by: Greg V MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D15398 Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Thu Jul 12 18:07:28 2018 (r336224) +++ head/sys/dev/ahci/ahci_pci.c Thu Jul 12 18:44:00 2018 (r336225) @@ -69,7 +69,8 @@ static const struct { /* Not sure SB8x0/SB9x0 needs this quirk. Be conservative though */ {0x43951002, 0x00, "AMD SB8x0/SB9x0", AHCI_Q_ATI_PMP_BUG}, {0x43b61022, 0x00, "AMD X399", 0}, - {0x43b71022, 0x00, "AMD 300 Series", 0}, + {0x43b51022, 0x00, "AMD 300 Series", 0}, /* X370 */ + {0x43b71022, 0x00, "AMD 300 Series", 0}, /* B350 */ {0x78001022, 0x00, "AMD Hudson-2", 0}, {0x78011022, 0x00, "AMD Hudson-2", 0}, {0x78021022, 0x00, "AMD Hudson-2", 0}, Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Thu Jul 12 18:07:28 2018 (r336224) +++ head/sys/dev/usb/controller/xhci_pci.c Thu Jul 12 18:44:00 2018 (r336225) @@ -101,7 +101,8 @@ xhci_pci_match(device_t self) return ("AMD KERNCZ USB 3.0 controller"); case 0x43ba1022: return ("AMD X399 USB 3.0 controller"); - case 0x43bb1022: + case 0x43b91022: /* X370 */ + case 0x43bb1022: /* B350 */ return ("AMD 300 Series USB 3.0 controller"); case 0x78141022: return ("AMD FCH USB 3.0 controller"); From owner-svn-src-head@freebsd.org Thu Jul 12 18:48:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B21351033294; Thu, 12 Jul 2018 18:48:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6215178EC2; Thu, 12 Jul 2018 18:48:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 442A52540B; Thu, 12 Jul 2018 18:48:54 +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 w6CImsON013191; Thu, 12 Jul 2018 18:48:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CImsL5013190; Thu, 12 Jul 2018 18:48:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807121848.w6CImsL5013190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 12 Jul 2018 18:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336226 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 336226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 18:48:54 -0000 Author: markj Date: Thu Jul 12 18:48:53 2018 New Revision: 336226 URL: https://svnweb.freebsd.org/changeset/base/336226 Log: Pass the right sizes to malloc() and realloc(). Reported by: scan-build, via Mark Millard MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D16180 Modified: head/contrib/elftoolchain/elfcopy/sections.c Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Thu Jul 12 18:44:00 2018 (r336225) +++ head/contrib/elftoolchain/elfcopy/sections.c Thu Jul 12 18:48:53 2018 (r336226) @@ -716,13 +716,13 @@ filter_reloc(struct elfcopy *ecp, struct section *s) #define COPYREL(REL, SZ) do { \ if (nrels == 0) { \ if ((REL##SZ = malloc(cap * \ - sizeof(Elf##SZ##_Rel))) == NULL) \ + sizeof(*REL##SZ))) == NULL) \ err(EXIT_FAILURE, "malloc failed"); \ } \ if (nrels >= cap) { \ cap *= 2; \ if ((REL##SZ = realloc(REL##SZ, cap * \ - sizeof(Elf##SZ##_Rel))) == NULL) \ + sizeof(*REL##SZ))) == NULL) \ err(EXIT_FAILURE, "realloc failed"); \ } \ REL##SZ[nrels].r_offset = REL.r_offset; \ From owner-svn-src-head@freebsd.org Thu Jul 12 19:03:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6F511034F6D; Thu, 12 Jul 2018 19:03:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88F9C79E87; Thu, 12 Jul 2018 19:03:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A22C25739; Thu, 12 Jul 2018 19:03:00 +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 w6CJ30bj023200; Thu, 12 Jul 2018 19:03:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CJ30Fv023199; Thu, 12 Jul 2018 19:03:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201807121903.w6CJ30Fv023199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 12 Jul 2018 19:03:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336227 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Driver/ToolChains X-SVN-Commit-Revision: 336227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 19:03:01 -0000 Author: dim Date: Thu Jul 12 19:02:59 2018 New Revision: 336227 URL: https://svnweb.freebsd.org/changeset/base/336227 Log: Pull in r336008 from upstream clang trunk: Request init/fini array on FreeBSD 12 and later Summary: It seems a bad idea to change the default in the middle of a release branch due to possible changes in global ctor / dtor ordering between .ctors and .init_array. With FreeBSD 11.0's release imminent lets change the default now for FreeBSD 12 (the current development stream) and later. FreeBSD rtld has supported .init_array / .fini_array for many years. As of Jan 1 2017 all supported FreeBSD releases and branches will have support. Reviewers: dim, brooks, arichardson Reviewed By: dim, brooks, arichardson Subscribers: bsdjhb, krytarowski, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D24867 Requested by: jhb MFC after: 3 days Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Thu Jul 12 18:48:53 2018 (r336226) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Thu Jul 12 19:02:59 2018 (r336227) @@ -2375,6 +2375,8 @@ void Generic_ELF::addClangTargetOptions(const ArgList bool UseInitArrayDefault = getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || + (getTriple().getOS() == llvm::Triple::FreeBSD && + getTriple().getOSMajorVersion() >= 12) || (getTriple().getOS() == llvm::Triple::Linux && ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || getTriple().isAndroid())) || From owner-svn-src-head@freebsd.org Thu Jul 12 19:15:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0BFD103890C; Thu, 12 Jul 2018 19:15:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87CB67A98D; Thu, 12 Jul 2018 19:15:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 5980110A87D; Thu, 12 Jul 2018 15:15:51 -0400 (EDT) Subject: Re: svn commit: r336227 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807121903.w6CJ30Fv023199@repo.freebsd.org> From: John Baldwin Message-ID: Date: Thu, 12 Jul 2018 12:15:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201807121903.w6CJ30Fv023199@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 12 Jul 2018 15:15:51 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 19:15:59 -0000 On 7/12/18 12:03 PM, Dimitry Andric wrote: > Author: dim > Date: Thu Jul 12 19:02:59 2018 > New Revision: 336227 > URL: https://svnweb.freebsd.org/changeset/base/336227 > > Log: > Pull in r336008 from upstream clang trunk: > > Request init/fini array on FreeBSD 12 and later > > Summary: > > It seems a bad idea to change the default in the middle of a release > branch due to possible changes in global ctor / dtor ordering between > .ctors and .init_array. With FreeBSD 11.0's release imminent lets > change the default now for FreeBSD 12 (the current development > stream) and later. > > FreeBSD rtld has supported .init_array / .fini_array for many years. > As of Jan 1 2017 all supported FreeBSD releases and branches will > have support. > > Reviewers: dim, brooks, arichardson > > Reviewed By: dim, brooks, arichardson > > Subscribers: bsdjhb, krytarowski, emaste, cfe-commits > > Differential Revision: https://reviews.llvm.org/D24867 > > Requested by: jhb > MFC after: 3 days I think that this is a flag day for 12 (and I wanted to get this in sooner rather than later so we can test it). I changed the external GCC ports to use init_array and fini_array earlier this week. I think lang/gcc* still need to be updated to enable it for 12.x and later. As long as a single executable or shared library is only using one of .ctors/.dtors vs init_array/fini_array I believe mixing them in a single process will be ok as the order of constructors and destructors doesn't change. I think you can only get into a bind if you mix old and new .o files into a single executable or shared library (and even then I don't think constructor order across different object files is really defined anyway, but I'm not sure if LTO might be affected in some way if you try to mix them). -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 12 20:46:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A3981044136; Thu, 12 Jul 2018 20:46:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 492DE7F71D; Thu, 12 Jul 2018 20:46:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A4AA26765; Thu, 12 Jul 2018 20:46:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CKkNHu074167; Thu, 12 Jul 2018 20:46:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CKkMSB074165; Thu, 12 Jul 2018 20:46:22 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807122046.w6CKkMSB074165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 12 Jul 2018 20:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336229 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 336229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 20:46:23 -0000 Author: rmacklem Date: Thu Jul 12 20:46:22 2018 New Revision: 336229 URL: https://svnweb.freebsd.org/changeset/base/336229 Log: Modify the NFSv4.1 pNFS client to use separate TCP connections for DSs. Without this patch, the NFSv4.1 pNFS client shared a single TCP connection for all DSs that resided on the same machine. This made disabling one of the DSs impossible. Although unlikely, it is possible that the storage subsystem has failed in such a way that the storage for one DS on a machine is no longer functioning correctly, but the storage used by another DS on the same machine is still ok. For this case, it would be nice if a system can fail one of the DSs without failing them all. This patch changes the default behaviour to use separate TCP connections for each DS even if they reside on the same machine. I do not believe that this will be a problem for extant pNFS servers, but a sysctl can be set to restore the old behaviour if this change causes a problem for an extant pNFS server. This patch only affects the NFSv4.1 pNFS client. MFC after: 2 weeks Modified: head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Thu Jul 12 20:28:52 2018 (r336228) +++ head/sys/fs/nfs/nfsclstate.h Thu Jul 12 20:46:22 2018 (r336229) @@ -94,6 +94,7 @@ struct nfsclds { #define NFSCLDS_MDS 0x0002 #define NFSCLDS_DS 0x0004 #define NFSCLDS_CLOSED 0x0008 +#define NFSCLDS_SAMECONN 0x0010 struct nfsclclient { LIST_ENTRY(nfsclclient) nfsc_list; Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 12 20:28:52 2018 (r336228) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 12 20:46:22 2018 (r336229) @@ -57,6 +57,10 @@ static int nfsignore_eexist = 0; SYSCTL_INT(_vfs_nfs, OID_AUTO, ignore_eexist, CTLFLAG_RW, &nfsignore_eexist, 0, "NFS ignore EEXIST replies for mkdir/symlink"); +static int nfscl_dssameconn = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, + &nfscl_dssameconn, 0, "Use same TCP connection to multiple DSs"); + /* * Global variables */ @@ -162,7 +166,7 @@ static int nfsrpc_writedsmir(vnode_t, int *, int *, nf struct nfsclds *, uint64_t, int, struct nfsfh *, struct mbuf *, int, int, struct ucred *, NFSPROC_T *); static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, - struct nfsclds *, struct nfsclds **); + struct nfsclds *, struct nfsclds **, uint32_t *); static int nfsio_commitds(vnode_t, uint64_t, int, struct nfsclds *, struct nfsfh *, int, int, struct nfsclwritedsdorpc *, struct ucred *, NFSPROC_T *); @@ -5498,9 +5502,14 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in dsp->nfsclds_sockp = nrp; if (vers == NFS_VER4) { NFSLOCKMNT(nmp); - retv = nfscl_getsameserver(nmp, dsp, &tdsp); + retv = nfscl_getsameserver(nmp, dsp, &tdsp, + &sequenceid); NFSCL_DEBUG(3, "getsame ret=%d\n", retv); - if (retv == NFSDSP_USETHISSESSION) { + if (retv == NFSDSP_USETHISSESSION && + nfscl_dssameconn != 0) { + NFSLOCKDS(tdsp); + tdsp->nfsclds_flags |= NFSCLDS_SAMECONN; + NFSUNLOCKDS(tdsp); NFSUNLOCKMNT(nmp); /* * If there is already a session for this @@ -5511,11 +5520,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *dspp = tdsp; return (0); } - if (retv == NFSDSP_SEQTHISSESSION) + if (retv == NFSDSP_NOTFOUND) sequenceid = - tdsp->nfsclds_sess.nfsess_sequenceid; - else - sequenceid = dsp->nfsclds_sess.nfsess_sequenceid; NFSUNLOCKMNT(nmp); error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, @@ -6516,15 +6522,16 @@ nfscl_freenfsclds(struct nfsclds *dsp) static enum nfsclds_state nfscl_getsameserver(struct nfsmount *nmp, struct nfsclds *newdsp, - struct nfsclds **retdspp) + struct nfsclds **retdspp, uint32_t *sequencep) { - struct nfsclds *dsp, *cur_dsp; + struct nfsclds *dsp; + int fndseq; /* * Search the list of nfsclds structures for one with the same * server. */ - cur_dsp = NULL; + fndseq = 0; TAILQ_FOREACH(dsp, &nmp->nm_sess, nfsclds_list) { if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && dsp->nfsclds_servownlen != 0 && @@ -6534,24 +6541,22 @@ nfscl_getsameserver(struct nfsmount *nmp, struct nfscl NFSCL_DEBUG(4, "fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); + if (fndseq == 0) { + /* Get sequenceid# from first entry. */ + *sequencep = + dsp->nfsclds_sess.nfsess_sequenceid; + fndseq = 1; + } /* Server major id matches. */ if ((dsp->nfsclds_flags & NFSCLDS_DS) != 0) { *retdspp = dsp; return (NFSDSP_USETHISSESSION); } - /* - * Note the first match, so it can be used for - * sequence'ing new sessions. - */ - if (cur_dsp == NULL) - cur_dsp = dsp; } } - if (cur_dsp != NULL) { - *retdspp = cur_dsp; + if (fndseq != 0) return (NFSDSP_SEQTHISSESSION); - } return (NFSDSP_NOTFOUND); } From owner-svn-src-head@freebsd.org Thu Jul 12 22:34:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EE1F102980F; Thu, 12 Jul 2018 22:34:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B894F844DD; Thu, 12 Jul 2018 22:34:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99E0C27915; Thu, 12 Jul 2018 22:34:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CMYexO030185; Thu, 12 Jul 2018 22:34:40 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CMYe5B030184; Thu, 12 Jul 2018 22:34:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201807122234.w6CMYe5B030184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Jul 2018 22:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336230 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 336230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 22:34:41 -0000 Author: mjg Date: Thu Jul 12 22:34:40 2018 New Revision: 336230 URL: https://svnweb.freebsd.org/changeset/base/336230 Log: sx: remove the spurious macro value difference vs rwlocks No functional changes. Modified: head/sys/sys/sx.h Modified: head/sys/sys/sx.h ============================================================================== --- head/sys/sys/sx.h Thu Jul 12 20:46:22 2018 (r336229) +++ head/sys/sys/sx.h Thu Jul 12 22:34:40 2018 (r336230) @@ -70,8 +70,8 @@ #define SX_LOCK_SHARED 0x01 #define SX_LOCK_SHARED_WAITERS 0x02 #define SX_LOCK_EXCLUSIVE_WAITERS 0x04 -#define SX_LOCK_RECURSED 0x08 -#define SX_LOCK_WRITE_SPINNER 0x10 +#define SX_LOCK_WRITE_SPINNER 0x08 +#define SX_LOCK_RECURSED 0x10 #define SX_LOCK_FLAGMASK \ (SX_LOCK_SHARED | SX_LOCK_SHARED_WAITERS | \ SX_LOCK_EXCLUSIVE_WAITERS | SX_LOCK_RECURSED | SX_LOCK_WRITE_SPINNER) From owner-svn-src-head@freebsd.org Thu Jul 12 22:35:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BBE51029B25; Thu, 12 Jul 2018 22:35:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFE1C84730; Thu, 12 Jul 2018 22:35:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91FAC27919; Thu, 12 Jul 2018 22:35:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CMZqK3030292; Thu, 12 Jul 2018 22:35:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CMZqO8030291; Thu, 12 Jul 2018 22:35:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201807122235.w6CMZqO8030291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Jul 2018 22:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336231 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 336231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 22:35:53 -0000 Author: mjg Date: Thu Jul 12 22:35:52 2018 New Revision: 336231 URL: https://svnweb.freebsd.org/changeset/base/336231 Log: uma: whack main zone counter update in the slow path, freeing side See r333052. Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Thu Jul 12 22:34:40 2018 (r336230) +++ head/sys/vm/uma_core.c Thu Jul 12 22:35:52 2018 (r336231) @@ -3135,14 +3135,6 @@ zfree_start: cpu = curcpu; cache = &zone->uz_cpu[cpu]; - /* - * Since we have locked the zone we may as well send back our stats. - */ - atomic_add_long(&zone->uz_allocs, cache->uc_allocs); - atomic_add_long(&zone->uz_frees, cache->uc_frees); - cache->uc_allocs = 0; - cache->uc_frees = 0; - bucket = cache->uc_freebucket; if (bucket != NULL && bucket->ub_cnt < bucket->ub_entries) { ZONE_UNLOCK(zone); From owner-svn-src-head@freebsd.org Thu Jul 12 22:48:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 233C9102B4A9; Thu, 12 Jul 2018 22:48:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5BE9852E1; Thu, 12 Jul 2018 22:48:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7D8227AC6; Thu, 12 Jul 2018 22:48:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6CMmIu4035684; Thu, 12 Jul 2018 22:48:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6CMmI0O035683; Thu, 12 Jul 2018 22:48:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201807122248.w6CMmI0O035683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Jul 2018 22:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336232 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 22:48:19 -0000 Author: mjg Date: Thu Jul 12 22:48:18 2018 New Revision: 336232 URL: https://svnweb.freebsd.org/changeset/base/336232 Log: fd: stop passing M_ZERO to uma_zalloc The optimisation seen with malloc cannot be used here as zone sizes are now known at compilation. Thus bzero by hand to get the optimisation instead. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jul 12 22:35:52 2018 (r336231) +++ head/sys/kern/kern_descrip.c Thu Jul 12 22:48:18 2018 (r336232) @@ -1865,7 +1865,8 @@ falloc_noinstall(struct thread *td, struct file **resu } return (ENFILE); } - fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); + fp = uma_zalloc(file_zone, M_WAITOK); + bzero(fp, sizeof(*fp)); refcount_init(&fp->f_count, 1); fp->f_cred = crhold(td->td_ucred); fp->f_ops = &badfileops; From owner-svn-src-head@freebsd.org Thu Jul 12 22:59:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A888102CEA3; Thu, 12 Jul 2018 22:59:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf0-x229.google.com (mail-pf0-x229.google.com [IPv6:2607:f8b0:400e:c00::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 192C6860E3; Thu, 12 Jul 2018 22:59:04 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf0-x229.google.com with SMTP id u16-v6so21437067pfh.3; Thu, 12 Jul 2018 15:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sPIShR6YMRt8822wZN7qhX5/vHRJF7xCgt3D8pzVO10=; b=nnwvcegUaHkczKPXZgQygU8GwPNsOHcVJcilEYEgR8qM/9xLEFphboBqvfj8PbnN7u v936lAQE8ZfrzV6f0U5FtQwKV0HELM1339a8176Mg4WXtwzU6Mzx0WocTB1wVH/pvlU9 2sA+RCRoGA/traPXMnpAOwrf5mGStcmtOlmlMdRUt0vm7hXo5YtbFIuyQaVfCZnhPBah bkxbvC49lB7l01EjVTR04pPrYC+t+BLjg/P/Rg8BpL9yNK56U5lKDrqbSkIZK7Te2wel 6+sOXRLgMxwMaiEA2Qhf0TeEnuYQH524OuGmhb3K6/pbmXeahRNGbMydfMk8vxlV3DL4 IufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=sPIShR6YMRt8822wZN7qhX5/vHRJF7xCgt3D8pzVO10=; b=JmMsGCTvz14WPgyz961SjXR5lgHjGzLzJLmF2KasD/D6jFyYt3v3ngh9088mA4M71+ 1b2NqAew4yPg+7haHxpR4IUVcyeMmjLmFLmLEGcQklHk1tmNyfnobMVA0PWmhKbrpSLS VNu/6v8Kwwk50AXnGZKS9BkcH4NkAAk7L2Pzj1AQKXfD45FMu7vxCZAz5vPOy225ReGB OpMNOgY4su8cvd3i7ro6geaQMIkEKkYfNNtMbvy1YWmR+kP4GGy8tMUIywEKmmMdOOJ/ CswEN1cqH/KRnLw8//YyHFylrEMvq8D3D8kh8aRL5MoLcrbVj7IJlSM7yS4bRWb9en3J J3ZA== X-Gm-Message-State: AOUpUlF6OMuGm/m60utg9L9LiQapgr7WZKQHklR21OsG3O9zHNrSnvqb 2PUIIODWSydnDD8Qmy0jFujLcxHM X-Google-Smtp-Source: AAOMgpdpP7H9bxAcqUsugSGkTD0uqv3NdGOg4gtQTkE3c+wxNnv8dzr4GYiIklYMVrl8mSHL+bXhOg== X-Received: by 2002:a62:4dc5:: with SMTP id a188-v6mr4362378pfb.217.1531436342648; Thu, 12 Jul 2018 15:59:02 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-107.dsl.bell.ca. [70.52.224.107]) by smtp.gmail.com with ESMTPSA id e16-v6sm2261958pga.2.2018.07.12.15.59.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 15:59:01 -0700 (PDT) Sender: Mark Johnston Date: Thu, 12 Jul 2018 18:58:56 -0400 From: Mark Johnston To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336231 - head/sys/vm Message-ID: <20180712225856.GA26064@raichu> References: <201807122235.w6CMZqO8030291@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807122235.w6CMZqO8030291@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 22:59:04 -0000 On Thu, Jul 12, 2018 at 10:35:52PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Thu Jul 12 22:35:52 2018 > New Revision: 336231 > URL: https://svnweb.freebsd.org/changeset/base/336231 > > Log: > uma: whack main zone counter update in the slow path, freeing side > > See r333052. > > Modified: > head/sys/vm/uma_core.c > > Modified: head/sys/vm/uma_core.c > ============================================================================== > --- head/sys/vm/uma_core.c Thu Jul 12 22:34:40 2018 (r336230) > +++ head/sys/vm/uma_core.c Thu Jul 12 22:35:52 2018 (r336231) > @@ -3135,14 +3135,6 @@ zfree_start: > cpu = curcpu; > cache = &zone->uz_cpu[cpu]; > > - /* > - * Since we have locked the zone we may as well send back our stats. > - */ > - atomic_add_long(&zone->uz_allocs, cache->uc_allocs); > - atomic_add_long(&zone->uz_frees, cache->uc_frees); > - cache->uc_allocs = 0; > - cache->uc_frees = 0; > - Doesn't this break the accounting of these stats? uma_reclaim() doesn't update them when it frees cached items, and uma_zone_get_cur() doesn't look at the stats for cached buckets. From owner-svn-src-head@freebsd.org Thu Jul 12 23:41:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8F951032058; Thu, 12 Jul 2018 23:41:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40C9688A97; Thu, 12 Jul 2018 23:41:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qk0-x244.google.com with SMTP id v17-v6so13910433qkb.11; Thu, 12 Jul 2018 16:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Vog8DTkiqx6AlL/5dDVe+gbcFFcZCGvT74lC/gJK3Dc=; b=eM/94gjojGew9ECKmPQlc/o+iDpWD9gUPo1AG9FAWJnqCU17sS2iJwhr0vjOIINUcg D9g4RdTnYUllA+nClP88ozfv/IhevHQ0YO3o79FFahwhH2FahjSa6gbpOF6KwjSxekSi gCGB64dVpSyJ7o/akiXis+oTVFvqHTeFDNW14+VYYF9s8XFTTQn0tQL6xMMjcEGv6aKO OGEupNuftfeK4/JzduXPGLdQTD2l4D/saGKJmCbkgO3uH1Ye1kbXc9b85IcwLor/aIXc YNSJApCmBNmyH6hIIwWiMyCcDQmRRr97GvZelX3jIDVcJftE7babEFthyUSfMwbJxFZ0 ooLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Vog8DTkiqx6AlL/5dDVe+gbcFFcZCGvT74lC/gJK3Dc=; b=KoqTbnnEM7/Jewd5F7MO67sS6s0Hmuj/+ozvQxL0p0+uy6sg5DSyhywf5/TfJD4961 PB+/G4YJQfh4RPZEkPi4W2REfnjquc0sgtJZUB2ZpYB8VQH47YMB034dNDRBeuKgrruR Eq1AmbzvEU+DpIoryhJbGZmZPEFq1+sA5N5pXTnRl6q/7MihFOkG2zJSacgxCBojK1WL ORtho/a9UJ43WbO7Wxo5k/dBgdzvJ2kGcrkuFl+lISapTWHxcuecLyY+fsDaslnTMR2f GQCW83PkQS7XRS+JurasTRO6H6FmGJlOsL14nDQqZKWEpsmiwGvcLdUr2lxzEw74CbZc h0sQ== X-Gm-Message-State: AOUpUlE+o/VIde3lKi/kynqnR0Tb82Mmi0xzWPykQwrA2XprQiKfg3ln 7VzyDeXFT7LFLIDayF/5CLpt0lK2Z+yA9XqEPBw= X-Google-Smtp-Source: AAOMgpefQaqT77L95ZWueaAu2TeBbBj9O3KQ3AhZQ1c8KcYkIenpBhb9B5I1uzRUL+UAapWtYJDlqlJBMElkvGFZMDk= X-Received: by 2002:a37:77c7:: with SMTP id s190-v6mr3673066qkc.73.1531438906517; Thu, 12 Jul 2018 16:41:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aed:2807:0:0:0:0:0 with HTTP; Thu, 12 Jul 2018 16:41:46 -0700 (PDT) In-Reply-To: <20180712225856.GA26064@raichu> References: <201807122235.w6CMZqO8030291@repo.freebsd.org> <20180712225856.GA26064@raichu> From: Mateusz Guzik Date: Fri, 13 Jul 2018 01:41:46 +0200 Message-ID: Subject: Re: svn commit: r336231 - head/sys/vm To: Mark Johnston Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 23:41:47 -0000 uma_zone_get_cur iterates the per-cpu stats and looks at the zone-global stats. The patch only gets rid of rolling them up, thus there is no difference from the pov of this func. I don't follow the remark about uma_reclaim. On Fri, Jul 13, 2018 at 12:58 AM, Mark Johnston wrote: > On Thu, Jul 12, 2018 at 10:35:52PM +0000, Mateusz Guzik wrote: > > Author: mjg > > Date: Thu Jul 12 22:35:52 2018 > > New Revision: 336231 > > URL: https://svnweb.freebsd.org/changeset/base/336231 > > > > Log: > > uma: whack main zone counter update in the slow path, freeing side > > > > See r333052. > > > > Modified: > > head/sys/vm/uma_core.c > > > > Modified: head/sys/vm/uma_core.c > > ============================================================ > ================== > > --- head/sys/vm/uma_core.c Thu Jul 12 22:34:40 2018 (r336230) > > +++ head/sys/vm/uma_core.c Thu Jul 12 22:35:52 2018 (r336231) > > @@ -3135,14 +3135,6 @@ zfree_start: > > cpu = curcpu; > > cache = &zone->uz_cpu[cpu]; > > > > - /* > > - * Since we have locked the zone we may as well send back our > stats. > > - */ > > - atomic_add_long(&zone->uz_allocs, cache->uc_allocs); > > - atomic_add_long(&zone->uz_frees, cache->uc_frees); > > - cache->uc_allocs = 0; > > - cache->uc_frees = 0; > > - > > Doesn't this break the accounting of these stats? uma_reclaim() doesn't > update them when it frees cached items, and uma_zone_get_cur() doesn't > look at the stats for cached buckets. > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Fri Jul 13 02:02:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19340104391A; Fri, 13 Jul 2018 02:02:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C216B8E2BD; Fri, 13 Jul 2018 02:02:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A49E11B18; Fri, 13 Jul 2018 02:02:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6D22GOM035339; Fri, 13 Jul 2018 02:02:16 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6D22GJ4035338; Fri, 13 Jul 2018 02:02:16 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201807130202.w6D22GJ4035338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 13 Jul 2018 02:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336236 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 336236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 02:02:17 -0000 Author: delphij Date: Fri Jul 13 02:02:16 2018 New Revision: 336236 URL: https://svnweb.freebsd.org/changeset/base/336236 Log: Detect and handle invalid number of FATs If the number of FATs field in the boot sector is zero, give an appropriate error code. Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/6c29bbe8d58e6fe8755935a04166ecf82ff31f47%5E%21/ MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/boot.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Fri Jul 13 00:37:47 2018 (r336235) +++ head/sbin/fsck_msdosfs/boot.c Fri Jul 13 02:02:16 2018 (r336236) @@ -87,6 +87,10 @@ readboot(int dosfs, struct bootblock *boot) pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); return FSFATAL; } + if (boot->bpbFATs == 0) { + pfatal("Invalid number of FATs: %u", boot->bpbFATs); + return FSFATAL; + } if (!boot->bpbRootDirEnts) boot->flags |= FAT32; if (boot->flags & FAT32) { From owner-svn-src-head@freebsd.org Fri Jul 13 03:39:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B51A0104B30B; Fri, 13 Jul 2018 03:39:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 31F0F721D9; Fri, 13 Jul 2018 03:39:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pg1-x543.google.com with SMTP id x5-v6so4530986pgp.7; Thu, 12 Jul 2018 20:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5i+nH/xOvKbWkGCtpw9CHY+vTy6g6in1/ckjBtxApEc=; b=BUnnHsBiuqZ98utuAa4tRZnBTk6JlHaj57gunpcr2kUDJCbjuDzaVSKWghXkwBxg/W oa/5KVcAA1noGtRogSMKaZND6njsBKRYV/e++DXw9WtADQ/VAf6hjhUEJAULVkXQnqEX mJZUvNTfMwLhAbZBDtpWyfaNB9jfqYyYNe0f1fCSyE190R7wn//qEMHBw9sDZaBd4+bc x+b0l1lFZB+hv0xTW4opL40vn+i3dUnYoXzgOM0v3+3MVlHTBGuvrfLLjhOWO6nPLnnw zcOkiiCmnP0MA0DfGvdeqjTXZ7PZ8D5D1bjL/lrPIFZob9lYD2SEekimE0nyNm/a4oO0 4nIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=5i+nH/xOvKbWkGCtpw9CHY+vTy6g6in1/ckjBtxApEc=; b=VQ0uhHFwLRqBpxXMk4L8l5xFrtAWBGQQ1I8ywd/E4+v7GG851ROGHBxARAtRI2O3LQ eNjYWELb/lgal1J3LQ9tMQ6C3A8URmnAIM+8/YgHxq1mVXsw3+aS0vjhSifFkU1haFDy JzoMdhGVk1KI5jw2b+Hi0sx+IJaeU7Q8GHIVPOqS7mTZMGlYDGfn98di7EKTKir4y6DC lHDr+hMCNInLkju/kp5z/02Yq05xQyGs0YVEbOCBhthRpVX//CiGTmxtBqJGjIDq6Ner HWCOWoLmJ38arqFnz9cXgWTYnxV4CI0XoNHQs1n7dbA8A3ZSXLAz2M5M72w/kBQb3foQ RpDg== X-Gm-Message-State: AOUpUlEJT84YVq9liaX7b0lOrtHojoVvUZtukNp5q5jw5Nd9ECCGdcc9 IRO/KtjR8jIH+ndEqvERyDU= X-Google-Smtp-Source: AAOMgpdH8GSRiGeiMJisVGk+DVvtUoDfRTLfKbj155SnsdaCqQq0yRNpzk8imD6Jdob27c+z/+Ovfg== X-Received: by 2002:a62:4898:: with SMTP id q24-v6mr5130634pfi.58.1531453196151; Thu, 12 Jul 2018 20:39:56 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-107.dsl.bell.ca. [70.52.224.107]) by smtp.gmail.com with ESMTPSA id l79-v6sm48136908pfj.179.2018.07.12.20.39.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 20:39:54 -0700 (PDT) Sender: Mark Johnston Date: Thu, 12 Jul 2018 23:39:51 -0400 From: Mark Johnston To: Mateusz Guzik Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336231 - head/sys/vm Message-ID: <20180713033951.GB26064@raichu> References: <201807122235.w6CMZqO8030291@repo.freebsd.org> <20180712225856.GA26064@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 03:39:58 -0000 On Fri, Jul 13, 2018 at 01:41:46AM +0200, Mateusz Guzik wrote: > uma_zone_get_cur iterates the per-cpu stats and looks at the zone-global > stats. The patch only gets rid of rolling them up, thus there is no > difference from the pov of this func. > I don't follow the remark about uma_reclaim. I'm pointing out that with this change we no longer maintain any zone-global stats. > On Fri, Jul 13, 2018 at 12:58 AM, Mark Johnston wrote: > > > On Thu, Jul 12, 2018 at 10:35:52PM +0000, Mateusz Guzik wrote: > > > Author: mjg > > > Date: Thu Jul 12 22:35:52 2018 > > > New Revision: 336231 > > > URL: https://svnweb.freebsd.org/changeset/base/336231 > > > > > > Log: > > > uma: whack main zone counter update in the slow path, freeing side > > > > > > See r333052. > > > > > > Modified: > > > head/sys/vm/uma_core.c > > > > > > Modified: head/sys/vm/uma_core.c > > > ============================================================ > > ================== > > > --- head/sys/vm/uma_core.c Thu Jul 12 22:34:40 2018 (r336230) > > > +++ head/sys/vm/uma_core.c Thu Jul 12 22:35:52 2018 (r336231) > > > @@ -3135,14 +3135,6 @@ zfree_start: > > > cpu = curcpu; > > > cache = &zone->uz_cpu[cpu]; > > > > > > - /* > > > - * Since we have locked the zone we may as well send back our > > stats. > > > - */ > > > - atomic_add_long(&zone->uz_allocs, cache->uc_allocs); > > > - atomic_add_long(&zone->uz_frees, cache->uc_frees); > > > - cache->uc_allocs = 0; > > > - cache->uc_frees = 0; > > > - > > > > Doesn't this break the accounting of these stats? uma_reclaim() doesn't > > update them when it frees cached items, and uma_zone_get_cur() doesn't > > look at the stats for cached buckets. From owner-svn-src-head@freebsd.org Fri Jul 13 04:29:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF081025E54; Fri, 13 Jul 2018 04:29:34 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8E6573BA6; Fri, 13 Jul 2018 04:29:33 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x243.google.com with SMTP id z8-v6so17587815qto.9; Thu, 12 Jul 2018 21:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ozBuKjhD1akUbd+hSjdqVfcvwyHhExoo+yZGXmXvS7Q=; b=CCxQrEaOW94Gwbd7lu6wizUROZ81HwIIjVD1QUhq4wCQuNsXs7ZGjUTni/MTRj6VAo lW+NXS3r2EIEzAHNTqivSY90Ul2ADWZvJ1ykNquPWpsWXdUz8jd/gIGLA8cNwegmPws/ bTMAIS019eTbOBeuUKKGQ5bdu8pHnc0V4KTJyPoHNxNh1FQoXpe3HGYunPpLyMVNG4CN +KGx3wGeuqYGgWb+uYkIQ2HoMIH0wYHFff+AwTYCdzyB+750MVgsD/ABnUYuEIsEvXei FnurjTJvLDMauhPMIRWnA+dP1ESLjHDwnLMR1Ak47zlDsi3Ig2JTZIFveJue227cWg6c RuhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ozBuKjhD1akUbd+hSjdqVfcvwyHhExoo+yZGXmXvS7Q=; b=Th1RwEV7i6VCEUF0+7OVUfWGpqcKPUGUtVE+NbBnEIV53+kfIXh94VMDWpviSykgnP Bkoma60FbcGyMP7DGaFHYd5ozsEz3x5nZ4hH/hZEGHNWmQA2UOsFqUOCkBZExAmwGi4T okdbMmJ/axv1CVLGoXZUJJ0zwBDHbKF8BgeQ/TyA97prQA4LD6I9txpWtpHYIiP1mxuc SgJMXmyKylSH7hzJvdHhLuL8oOZa8uMM6UE/MztuQZAOFrTcKZt5v6JQ+aBANLBTnHGG GuyV97ak+IH0+dEN3pv+IPcAko2VAY/U6z6G2ms8AnzWY3HabvKrdLVosxF3K0FmKqJN MlUQ== X-Gm-Message-State: AOUpUlEfseu6kEzHbAMYN/BGyUMalOg73wupyJfDg93QfQaIOz2XIECX 1KdQWgxtG9pjK4/XkO0MBLxHTtmeWpDhDjsGrJQ= X-Google-Smtp-Source: AAOMgpcQa8kZqFMz1uoQBXuBmEBJnUxFxaZnYtaj0R6BhEFLjpxw8F4qkFeMSItf4J82Zdj8hDQA4Eo6uQlrwgylbj4= X-Received: by 2002:ac8:3417:: with SMTP id u23-v6mr4200872qtb.237.1531456173244; Thu, 12 Jul 2018 21:29:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aed:2807:0:0:0:0:0 with HTTP; Thu, 12 Jul 2018 21:29:32 -0700 (PDT) In-Reply-To: <20180713033951.GB26064@raichu> References: <201807122235.w6CMZqO8030291@repo.freebsd.org> <20180712225856.GA26064@raichu> <20180713033951.GB26064@raichu> From: Mateusz Guzik Date: Fri, 13 Jul 2018 06:29:32 +0200 Message-ID: Subject: Re: svn commit: r336231 - head/sys/vm To: Mark Johnston Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 04:29:34 -0000 they are modified in 2 places: zone_alloc_item and zone_free_item. this should probably get fixed up at some point, but I have no interest in working on it. On Fri, Jul 13, 2018 at 5:39 AM, Mark Johnston wrote: > On Fri, Jul 13, 2018 at 01:41:46AM +0200, Mateusz Guzik wrote: > > uma_zone_get_cur iterates the per-cpu stats and looks at the zone-global > > stats. The patch only gets rid of rolling them up, thus there is no > > difference from the pov of this func. > > I don't follow the remark about uma_reclaim. > > I'm pointing out that with this change we no longer maintain any > zone-global stats. > > > On Fri, Jul 13, 2018 at 12:58 AM, Mark Johnston > wrote: > > > > > On Thu, Jul 12, 2018 at 10:35:52PM +0000, Mateusz Guzik wrote: > > > > Author: mjg > > > > Date: Thu Jul 12 22:35:52 2018 > > > > New Revision: 336231 > > > > URL: https://svnweb.freebsd.org/changeset/base/336231 > > > > > > > > Log: > > > > uma: whack main zone counter update in the slow path, freeing side > > > > > > > > See r333052. > > > > > > > > Modified: > > > > head/sys/vm/uma_core.c > > > > > > > > Modified: head/sys/vm/uma_core.c > > > > ============================================================ > > > ================== > > > > --- head/sys/vm/uma_core.c Thu Jul 12 22:34:40 2018 > (r336230) > > > > +++ head/sys/vm/uma_core.c Thu Jul 12 22:35:52 2018 > (r336231) > > > > @@ -3135,14 +3135,6 @@ zfree_start: > > > > cpu = curcpu; > > > > cache = &zone->uz_cpu[cpu]; > > > > > > > > - /* > > > > - * Since we have locked the zone we may as well send back our > > > stats. > > > > - */ > > > > - atomic_add_long(&zone->uz_allocs, cache->uc_allocs); > > > > - atomic_add_long(&zone->uz_frees, cache->uc_frees); > > > > - cache->uc_allocs = 0; > > > > - cache->uc_frees = 0; > > > > - > > > > > > Doesn't this break the accounting of these stats? uma_reclaim() > doesn't > > > update them when it frees cached items, and uma_zone_get_cur() doesn't > > > look at the stats for cached buckets. > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Fri Jul 13 07:08:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6362102C1E2; Fri, 13 Jul 2018 07:08:07 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 57E4578377; Fri, 13 Jul 2018 07:08:07 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34D825070; Fri, 13 Jul 2018 07:08:07 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6D787re091213; Fri, 13 Jul 2018 07:08:07 GMT (envelope-from trociny@FreeBSD.org) Received: (from trociny@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6D787JY091212; Fri, 13 Jul 2018 07:08:07 GMT (envelope-from trociny@FreeBSD.org) Message-Id: <201807130708.w6D787JY091212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trociny set sender to trociny@FreeBSD.org using -f From: Mikolaj Golub Date: Fri, 13 Jul 2018 07:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336237 - head/sys/geom/gate X-SVN-Group: head X-SVN-Commit-Author: trociny X-SVN-Commit-Paths: head/sys/geom/gate X-SVN-Commit-Revision: 336237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 07:08:07 -0000 Author: trociny (ports committer) Date: Fri Jul 13 07:08:06 2018 New Revision: 336237 URL: https://svnweb.freebsd.org/changeset/base/336237 Log: geom_gate: enable resize Reviewed By: pjd Approved By: pjd Differential Revision: https://reviews.freebsd.org/D11531 Modified: head/sys/geom/gate/g_gate.c Modified: head/sys/geom/gate/g_gate.c ============================================================================== --- head/sys/geom/gate/g_gate.c Fri Jul 13 02:02:16 2018 (r336236) +++ head/sys/geom/gate/g_gate.c Fri Jul 13 07:08:06 2018 (r336237) @@ -616,8 +616,8 @@ g_gate_modify(struct g_gate_softc *sc, struct g_gate_c G_GATE_DEBUG(1, "Invalid media size."); return (EINVAL); } - /* TODO */ - return (EOPNOTSUPP); + g_resize_provider(pp, ggio->gctl_mediasize); + return (0); } if ((ggio->gctl_modify & GG_MODIFY_INFO) != 0) From owner-svn-src-head@freebsd.org Fri Jul 13 11:32:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 782CA10354FE; Fri, 13 Jul 2018 11:32:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BBB18174D; Fri, 13 Jul 2018 11:32:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CBE17B25; Fri, 13 Jul 2018 11:32:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DBWR7K029639; Fri, 13 Jul 2018 11:32:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DBWRZI029638; Fri, 13 Jul 2018 11:32:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201807131132.w6DBWRZI029638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 13 Jul 2018 11:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336238 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 11:32:28 -0000 Author: brooks Date: Fri Jul 13 11:32:27 2018 New Revision: 336238 URL: https://svnweb.freebsd.org/changeset/base/336238 Log: Round down the location of execpathp to slightly improve copyout speed. In practice, this moves the padding from below the canary to above execpathp has no impact on stack consumption. Submitted by: Wuyang-Chung (via github pull request #159) MFC after: 1 week Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jul 13 07:08:06 2018 (r336237) +++ head/sys/kern/kern_exec.c Fri Jul 13 11:32:27 2018 (r336238) @@ -1512,6 +1512,7 @@ exec_copyout_strings(struct image_params *imgp) */ if (execpath_len != 0) { destp -= execpath_len; + destp = rounddown2(destp, sizeof(void *)); imgp->execpathp = destp; copyout(imgp->execpath, (void *)destp, execpath_len); } From owner-svn-src-head@freebsd.org Fri Jul 13 12:39:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ED76103ADAD; Fri, 13 Jul 2018 12:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2ECAB840AE; Fri, 13 Jul 2018 12:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BD73104C6; Fri, 13 Jul 2018 12:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DCdRa8060603; Fri, 13 Jul 2018 12:39:27 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DCdRBm060602; Fri, 13 Jul 2018 12:39:27 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807131239.w6DCdRBm060602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 13 Jul 2018 12:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336239 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 336239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 12:39:28 -0000 Author: rmacklem Date: Fri Jul 13 12:39:27 2018 New Revision: 336239 URL: https://svnweb.freebsd.org/changeset/base/336239 Log: Change the pNFS client so that it does not report an NFSERR_STALE from an I/O attempt on a DS to the server via LayoutReturn. The current FreeBSD client can generate these errors for an operational DS while doing a recovery of a mirror after a mirrored DS has been repaired. I am not sure why these errors occur, but my best current guess is a race between the Layout Recall issued by the kernel code run from pnfsdscopymr(8) and a Read operation on the DS for the file bing copied. The errrors are not fatal, since the client falls back on doing I/O through the MDS, which can do the I/O successfully as a proxy. (The fact that the MDS can do this indicates that the file does still exist on the functioning DS.) This patch only affects behaviour of the pNFS client and only when using Flexible File layouts. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Fri Jul 13 11:32:27 2018 (r336238) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Fri Jul 13 12:39:27 2018 (r336239) @@ -6046,7 +6046,8 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * *dspp, fhp, dp->nfsdi_vers, dp->nfsdi_minorvers, tcred, p); NFSCL_DEBUG(4, "commitds=%d\n", error); - if (error != 0 && error != EACCES) { + if (error != 0 && error != EACCES && error != + ESTALE) { NFSCL_DEBUG(4, "DS layreterr for commit\n"); nfscl_dserr(NFSV4OP_COMMIT, error, dp, @@ -6071,7 +6072,7 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * off, xfer, fhp, 1, dp->nfsdi_vers, dp->nfsdi_minorvers, tcred, p); NFSCL_DEBUG(4, "readds=%d\n", error); - if (error != 0 && error != EACCES) { + if (error != 0 && error != EACCES && error != ESTALE) { NFSCL_DEBUG(4, "DS layreterr for read\n"); nfscl_dserr(NFSV4OP_READ, error, dp, lyp, *dspp); @@ -6107,7 +6108,8 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * xfer, fhp, m, dp->nfsdi_vers, dp->nfsdi_minorvers, tcred, p); NFSCL_DEBUG(4, "nfsio_writedsmir=%d\n", error); - if (error != 0 && error != EACCES) { + if (error != 0 && error != EACCES && error != + ESTALE) { NFSCL_DEBUG(4, "DS layreterr for write\n"); nfscl_dserr(NFSV4OP_WRITE, error, dp, From owner-svn-src-head@freebsd.org Fri Jul 13 16:30:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B98461042FE1; Fri, 13 Jul 2018 16:30:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B1CA8D651; Fri, 13 Jul 2018 16:30:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C4B4129E7; Fri, 13 Jul 2018 16:30:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGUtT9078771; Fri, 13 Jul 2018 16:30:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGUskw078769; Fri, 13 Jul 2018 16:30:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131630.w6DGUskw078769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 16:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336240 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:30:56 -0000 Author: ian Date: Fri Jul 13 16:30:54 2018 New Revision: 336240 URL: https://svnweb.freebsd.org/changeset/base/336240 Log: More little fixes... fix a function name typo (eps vs esp), and cope with newer versions of gpart that show mbr efi partition types with the name 'efi' rather than as '!239'. Modified: head/tools/boot/install-boot.sh head/tools/boot/rootgen.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Fri Jul 13 12:39:27 2018 (r336239) +++ head/tools/boot/install-boot.sh Fri Jul 13 16:30:54 2018 (r336240) @@ -48,7 +48,10 @@ make_esp_mbr() { s=$(find-part $dev "!239") if [ -z "$s" ] ; then - die "No ESP slice found" + s=$(find-part $dev "efi") + if [ -z "$s" ] ; then + die "No ESP slice found" + fi fi make_esp /dev/${dev}s${s} ${dst} } @@ -149,7 +152,7 @@ boot_nogeli_mbr_zfs_legacy() { } boot_nogeli_mbr_zfs_uefi() { - make_eps_mbr $1 $2 + make_esp_mbr $1 $2 } boot_nogeli_mbr_zfs_both() { Modified: head/tools/boot/rootgen.sh ============================================================================== --- head/tools/boot/rootgen.sh Fri Jul 13 12:39:27 2018 (r336239) +++ head/tools/boot/rootgen.sh Fri Jul 13 16:30:54 2018 (r336240) @@ -2,8 +2,8 @@ # $FreeBSD$ -passphrase=passphrase -iterations=50000 +passphrase=x +iterations=5 do_boot1_efi=0 @@ -668,7 +668,7 @@ EOF rm -f ${src}/etc/fstab } -qser="-serial telnet::4444,server -nographic" +qser="-serial telnet::4444,server -net none" # https://wiki.freebsd.org/QemuRecipes # aarch64 @@ -681,6 +681,7 @@ qemu_aarch64_uefi() -bios QEMU_EFI.fd ${qser} \ -drive if=none,file=${img},id=hd0 \ -device virtio-blk-device,drive=hd0" > $sh + chmod 755 $sh # https://wiki.freebsd.org/arm64/QEMU also has # -device virtio-net-device,netdev=net0 # -netdev user,id=net0 @@ -693,6 +694,7 @@ qemu_amd64_legacy() sh=$2 echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } qemu_amd64_uefi() @@ -701,6 +703,7 @@ qemu_amd64_uefi() sh=$2 echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } qemu_amd64_both() @@ -710,6 +713,7 @@ qemu_amd64_both() echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh + chmod 755 $sh } # arm @@ -722,6 +726,7 @@ qemu_i386_legacy() sh=$2 echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } # Not yet supported @@ -731,6 +736,7 @@ qemu_i386_uefi() sh=$2 echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } # Needs UEFI to be supported @@ -741,6 +747,7 @@ qemu_i386_both() echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh + chmod 755 $sh } make_one_image() From owner-svn-src-head@freebsd.org Fri Jul 13 16:32:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E06C210431D2; Fri, 13 Jul 2018 16:32:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 959978D8DD; Fri, 13 Jul 2018 16:32:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 768B912B5F; Fri, 13 Jul 2018 16:32:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGWW5h083360; Fri, 13 Jul 2018 16:32:32 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGWW4w083358; Fri, 13 Jul 2018 16:32:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131632.w6DGWW4w083358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 16:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336241 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:32:33 -0000 Author: ian Date: Fri Jul 13 16:32:31 2018 New Revision: 336241 URL: https://svnweb.freebsd.org/changeset/base/336241 Log: Revert r336240, which contained unrelated changes accidentally committed. Modified: head/tools/boot/install-boot.sh head/tools/boot/rootgen.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Fri Jul 13 16:30:54 2018 (r336240) +++ head/tools/boot/install-boot.sh Fri Jul 13 16:32:31 2018 (r336241) @@ -48,10 +48,7 @@ make_esp_mbr() { s=$(find-part $dev "!239") if [ -z "$s" ] ; then - s=$(find-part $dev "efi") - if [ -z "$s" ] ; then - die "No ESP slice found" - fi + die "No ESP slice found" fi make_esp /dev/${dev}s${s} ${dst} } @@ -152,7 +149,7 @@ boot_nogeli_mbr_zfs_legacy() { } boot_nogeli_mbr_zfs_uefi() { - make_esp_mbr $1 $2 + make_eps_mbr $1 $2 } boot_nogeli_mbr_zfs_both() { Modified: head/tools/boot/rootgen.sh ============================================================================== --- head/tools/boot/rootgen.sh Fri Jul 13 16:30:54 2018 (r336240) +++ head/tools/boot/rootgen.sh Fri Jul 13 16:32:31 2018 (r336241) @@ -2,8 +2,8 @@ # $FreeBSD$ -passphrase=x -iterations=5 +passphrase=passphrase +iterations=50000 do_boot1_efi=0 @@ -668,7 +668,7 @@ EOF rm -f ${src}/etc/fstab } -qser="-serial telnet::4444,server -net none" +qser="-serial telnet::4444,server -nographic" # https://wiki.freebsd.org/QemuRecipes # aarch64 @@ -681,7 +681,6 @@ qemu_aarch64_uefi() -bios QEMU_EFI.fd ${qser} \ -drive if=none,file=${img},id=hd0 \ -device virtio-blk-device,drive=hd0" > $sh - chmod 755 $sh # https://wiki.freebsd.org/arm64/QEMU also has # -device virtio-net-device,netdev=net0 # -netdev user,id=net0 @@ -694,7 +693,6 @@ qemu_amd64_legacy() sh=$2 echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh - chmod 755 $sh } qemu_amd64_uefi() @@ -703,7 +701,6 @@ qemu_amd64_uefi() sh=$2 echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh - chmod 755 $sh } qemu_amd64_both() @@ -713,7 +710,6 @@ qemu_amd64_both() echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh - chmod 755 $sh } # arm @@ -726,7 +722,6 @@ qemu_i386_legacy() sh=$2 echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh - chmod 755 $sh } # Not yet supported @@ -736,7 +731,6 @@ qemu_i386_uefi() sh=$2 echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" > $sh - chmod 755 $sh } # Needs UEFI to be supported @@ -747,7 +741,6 @@ qemu_i386_both() echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh - chmod 755 $sh } make_one_image() From owner-svn-src-head@freebsd.org Fri Jul 13 16:33:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D646104326A; Fri, 13 Jul 2018 16:33:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3883D8DA4D; Fri, 13 Jul 2018 16:33:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B1BF12B61; Fri, 13 Jul 2018 16:33:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGXL3F083453; Fri, 13 Jul 2018 16:33:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGXL1I083452; Fri, 13 Jul 2018 16:33:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131633.w6DGXL1I083452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 16:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336242 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:33:22 -0000 Author: ian Date: Fri Jul 13 16:33:21 2018 New Revision: 336242 URL: https://svnweb.freebsd.org/changeset/base/336242 Log: More little fixes... fix a function name typo (eps vs esp), and cope with newer versions of gpart that show mbr efi partition types with the name 'efi' rather than as '!239'. Modified: head/tools/boot/install-boot.sh Modified: head/tools/boot/install-boot.sh ============================================================================== --- head/tools/boot/install-boot.sh Fri Jul 13 16:32:31 2018 (r336241) +++ head/tools/boot/install-boot.sh Fri Jul 13 16:33:21 2018 (r336242) @@ -48,7 +48,10 @@ make_esp_mbr() { s=$(find-part $dev "!239") if [ -z "$s" ] ; then - die "No ESP slice found" + s=$(find-part $dev "efi") + if [ -z "$s" ] ; then + die "No ESP slice found" + fi fi make_esp /dev/${dev}s${s} ${dst} } @@ -149,7 +152,7 @@ boot_nogeli_mbr_zfs_legacy() { } boot_nogeli_mbr_zfs_uefi() { - make_eps_mbr $1 $2 + make_esp_mbr $1 $2 } boot_nogeli_mbr_zfs_both() { From owner-svn-src-head@freebsd.org Fri Jul 13 16:37:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7070610433F2; Fri, 13 Jul 2018 16:37:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FA158DC49; Fri, 13 Jul 2018 16:37:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF7AE12B62; Fri, 13 Jul 2018 16:37:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGbgep083699; Fri, 13 Jul 2018 16:37:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGbg9v083698; Fri, 13 Jul 2018 16:37:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131637.w6DGbg9v083698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 16:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336243 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 336243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:37:43 -0000 Author: ian Date: Fri Jul 13 16:37:42 2018 New Revision: 336243 URL: https://svnweb.freebsd.org/changeset/base/336243 Log: Make generated scripts executable. Modified: head/tools/boot/rootgen.sh Modified: head/tools/boot/rootgen.sh ============================================================================== --- head/tools/boot/rootgen.sh Fri Jul 13 16:33:21 2018 (r336242) +++ head/tools/boot/rootgen.sh Fri Jul 13 16:37:42 2018 (r336243) @@ -681,6 +681,7 @@ qemu_aarch64_uefi() -bios QEMU_EFI.fd ${qser} \ -drive if=none,file=${img},id=hd0 \ -device virtio-blk-device,drive=hd0" > $sh + chmod 755 $sh # https://wiki.freebsd.org/arm64/QEMU also has # -device virtio-net-device,netdev=net0 # -netdev user,id=net0 @@ -693,6 +694,7 @@ qemu_amd64_legacy() sh=$2 echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } qemu_amd64_uefi() @@ -701,6 +703,7 @@ qemu_amd64_uefi() sh=$2 echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } qemu_amd64_both() @@ -710,6 +713,7 @@ qemu_amd64_both() echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh + chmod 755 $sh } # arm @@ -722,6 +726,7 @@ qemu_i386_legacy() sh=$2 echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } # Not yet supported @@ -731,6 +736,7 @@ qemu_i386_uefi() sh=$2 echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" > $sh + chmod 755 $sh } # Needs UEFI to be supported @@ -741,6 +747,7 @@ qemu_i386_both() echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh + chmod 755 $sh } make_one_image() From owner-svn-src-head@freebsd.org Fri Jul 13 16:43:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D4C110437D3; Fri, 13 Jul 2018 16:43:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B38A48E19C; Fri, 13 Jul 2018 16:43:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A18912D04; Fri, 13 Jul 2018 16:43:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGh7ig088841; Fri, 13 Jul 2018 16:43:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGh6f4088834; Fri, 13 Jul 2018 16:43:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131643.w6DGh6f4088834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 16:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336244 - in head: stand/libsa sys/arm/arm sys/conf sys/kern sys/sys sys/x86/xen X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: stand/libsa sys/arm/arm sys/conf sys/kern sys/sys sys/x86/xen X-SVN-Commit-Revision: 336244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:43:08 -0000 Author: imp Date: Fri Jul 13 16:43:05 2018 New Revision: 336244 URL: https://svnweb.freebsd.org/changeset/base/336244 Log: Create helper functions for parsing boot args. boot_parse_arg to parse a single arg boot_parse_cmdline to parse a command line string boot_parse_args to parse all the args in a vector boot_howto_to_env Convert howto bits to env vars boot_env_to_howto Return howto mask mased on what's set in the environment. All these routines return an int that's the bitmask of the args translated to RB_* flags. As a special case, the 'S' flag sets the comconsole_speed env var. Any arg that looks like a=b will set the env key 'a' to value 'b'. If =b is omitted, 'a' is set to '1'. This should help us reduce the number of redundant copies of these routines in the tree. It should also give a more uniform experience between platforms. Also, invent a new flag RB_PROBE that's set when 'P' is parsed. On x86 + BIOS, this means 'probe for the keyboard, and if it's not there set both RB_MULTIPLE and RB_SERIAL (which means show the output on both video and serial consoles, but make serial primary). Others it may be some similar concept of probing, but it's loader dependent what, exactly, it means. These routines are suitable for /boot/loader and/or the kernel, though they may not be suitable for the tightly hand-rolled-for-space environments like boot2. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16205 Added: head/sys/kern/subr_boot.c (contents, props changed) Modified: head/stand/libsa/Makefile head/sys/arm/arm/machdep_boot.c head/sys/conf/files head/sys/sys/boot.h head/sys/sys/reboot.h head/sys/x86/xen/pv.c Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Jul 13 16:37:42 2018 (r336243) +++ head/stand/libsa/Makefile Fri Jul 13 16:43:05 2018 (r336244) @@ -37,6 +37,10 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ .PATH: ${LIBC_SRC}/stdlib SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c +# common boot code +.PATH: ${SYSDIR}/kern +SRCS+= subr_boot.c + .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC_SRC}/arm/gen Modified: head/sys/arm/arm/machdep_boot.c ============================================================================== --- head/sys/arm/arm/machdep_boot.c Fri Jul 13 16:37:42 2018 (r336243) +++ head/sys/arm/arm/machdep_boot.c Fri Jul 13 16:43:05 2018 (r336244) @@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static char static_kenv[4096]; + extern int *end; static uint32_t board_revision; @@ -146,9 +148,8 @@ arm_print_kenv(void) static void cmdline_set_env(char *cmdline, const char *guard) { - char *cmdline_next, *env; + char *cmdline_next; size_t size, guard_len; - int i; size = strlen(cmdline); /* Skip leading spaces. */ @@ -164,37 +165,27 @@ cmdline_set_env(char *cmdline, const char *guard) size -= guard_len; } - /* Skip leading spaces. */ - for (; isspace(*cmdline) && (size > 0); cmdline++) - size--; - - /* Replace ',' with '\0'. */ - /* TODO: implement escaping for ',' character. */ - cmdline_next = cmdline; - while(strsep(&cmdline_next, ",") != NULL) - ; - init_static_kenv(cmdline, 0); - /* Parse boothowto. */ - for (i = 0; howto_names[i].ev != NULL; i++) { - env = kern_getenv(howto_names[i].ev); - if (env != NULL) { - if (strtoul(env, NULL, 10) != 0) - boothowto |= howto_names[i].mask; - freeenv(env); - } - } + boothowto |= boot_parse_cmdline(); } +/* + * Called for armv6 and newer. + */ void arm_parse_fdt_bootargs(void) { #ifdef FDT if (loader_envp == NULL && fdt_get_chosen_bootargs(linux_command_line, - LBABI_MAX_COMMAND_LINE) == 0) + LBABI_MAX_COMMAND_LINE) == 0) { + init_static_kenv(static_kenv, sizeof(static_kenv)); cmdline_set_env(linux_command_line, CMDLINE_GUARD); + } #endif } +/* + * Called for armv[45]. + */ static vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp) { @@ -271,6 +262,7 @@ linux_parse_boot_param(struct arm_boot_params *abp) (char *)walker - (char *)atag_list + ATAG_SIZE(walker)); lastaddr = fake_preload_metadata(abp, NULL, 0); + init_static_kenv(static_kenv, sizeof(static_kenv)); cmdline_set_env(linux_command_line, CMDLINE_GUARD); return lastaddr; } Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jul 13 16:37:42 2018 (r336243) +++ head/sys/conf/files Fri Jul 13 16:43:05 2018 (r336244) @@ -3868,6 +3868,7 @@ kern/subr_acl_nfs4.c optional ufs_acl | zfs kern/subr_acl_posix1e.c optional ufs_acl kern/subr_autoconf.c standard kern/subr_blist.c standard +kern/subr_boot.c standard kern/subr_bus.c standard kern/subr_bus_dma.c standard kern/subr_bufring.c standard Added: head/sys/kern/subr_boot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_boot.c Fri Jul 13 16:43:05 2018 (r336244) @@ -0,0 +1,223 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 1998 Michael Smith + * All Rights Reserved. + * Copyright (c) 1998 Robert Nordier + * All Rights Reserved. + * Copyright (c) 2009, Oleksandr Tymoshenko + * All rights reserved. + * Copyright (c) 2014 Roger Pau Monné + * All Rights Reserved. + * Copyright (c) 2018 Kyle Evans + * Copyright (c) 2018 Netflix + * + * 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 + * in this position and unchanged. + * 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$"); + +/* Note: This is compiled in both the kernel and boot loader contexts */ + +#include +#ifdef _KERNEL +#include +#else +#include +#endif +#include +#include + +#ifdef _KERNEL +#define SETENV(k, v) kern_setenv(k, v) +#define GETENV(k) kern_getenv(k) +#define FREE(v) freeenv(v) +#else /* Boot loader */ +#define SETENV(k, v) setenv(k, v, 1) +#define GETENV(k) getenv(k) +#define FREE(v) +#endif + +static struct +{ + const char *ev; + int mask; +} howto_names[] = { + { "boot_askname", RB_ASKNAME}, + { "boot_cdrom", RB_CDROM}, + { "boot_ddb", RB_KDB}, + { "boot_dfltroot", RB_DFLTROOT}, + { "boot_gdb", RB_GDB}, + { "boot_multicons", RB_MULTIPLE}, + { "boot_mute", RB_MUTE}, + { "boot_pause", RB_PAUSE}, + { "boot_serial", RB_SERIAL}, + { "boot_single", RB_SINGLE}, + { "boot_verbose", RB_VERBOSE}, + { NULL, 0} +}; + +/* + * In the boot environment, we often parse a command line and have to throw away + * its contents. As we do so, we set environment variables that correspond to + * the flags we encounter. Later, to get a howto mask, we grovel through these + * to reconstruct it. This also allows users in their loader.conf to set them + * and have the kernel see them. + */ + +/** + * @brief convert the env vars in howto_names into a howto mask + */ +int +boot_env_to_howto(void) +{ + int i, howto; + char *val; + + for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) { + val = GETENV(howto_names[i].ev); + if (val != NULL && strcasecmp(val, "no") != 0) + howto |= howto_names[i].mask; + FREE(val); + } + return (howto); +} + +/** + * @brief Set env vars from howto_names based on howto passed in + */ +void +boot_howto_to_env(int howto) +{ + int i; + + for (i = 0; howto_names[i].ev != NULL; i++) + if (howto & howto_names[i].mask) + SETENV(howto_names[i].ev, "YES"); +} + +/** + * @brief Helper routine to parse a single arg and return its mask + * + * Parse all the - options to create a mask (or a serial speed in the + * case of -S). If the arg doesn't start with '-' assume it's an env + * variable and set that instead. + */ +int +boot_parse_arg(char *v) +{ + char *n; + int howto; + +#if 0 +/* Need to see if this is better or worse than the meat of the #else */ +static const char howto_switches[] = "aCdrgDmphsv"; +static int howto_masks[] = { + RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, + RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE +}; + + opts = strchr(kargs, '-'); + while (opts != NULL) { + while (*(++opts) != '\0') { + sw = strchr(howto_switches, *opts); + if (sw == NULL) + break; + howto |= howto_masks[sw - howto_switches]; + } + opts = strchr(opts, '-'); + } +#else + howto = 0; + if (*v == '-') { + while (*v != '\0') { + v++; + switch (*v) { + case 'a': howto |= RB_ASKNAME; break; + case 'C': howto |= RB_CDROM; break; + case 'd': howto |= RB_KDB; break; + case 'D': howto |= RB_MULTIPLE; break; + case 'm': howto |= RB_MUTE; break; + case 'g': howto |= RB_GDB; break; + case 'h': howto |= RB_SERIAL; break; + case 'p': howto |= RB_PAUSE; break; + case 'P': howto |= RB_PROBE; break; + case 'r': howto |= RB_DFLTROOT; break; + case 's': howto |= RB_SINGLE; break; + case 'S': SETENV("comconsole_speed", v + 1); v += strlen(v); break; + case 'v': howto |= RB_VERBOSE; break; + } + } + } else { + n = strsep(&v, "="); + if (v == NULL) + SETENV(n, "1"); + else + SETENV(n, v); + } +#endif + return (howto); +} + +/** + * @brief breakup the command line into args, and pass to boot_parse_arg + */ +int +boot_parse_cmdline_delim(char *cmdline, const char *delim) +{ + char *v; + int howto; + + howto = 0; + while ((v = strsep(&cmdline, delim)) != NULL) { + if (*v == '\0') + continue; + howto |= boot_parse_arg(v); + } + return (howto); +} + +/** + * @brief Simplified interface for common 'space separated' args + */ +int +boot_parse_cmdline(char *cmdline) +{ + + return (boot_parse_cmdline_delim(cmdline, " \n")); +} + +/** + * @brief Pass a vector of strings to boot_parse_arg + */ +int +boot_parse_args(int argc, char *argv[]) +{ + int i, howto; + + howto = 0; + for (i = 1; i < argc; i++) + howto |= boot_parse_arg(argv[i]); + return (howto); +} Modified: head/sys/sys/boot.h ============================================================================== --- head/sys/sys/boot.h Fri Jul 13 16:37:42 2018 (r336243) +++ head/sys/sys/boot.h Fri Jul 13 16:43:05 2018 (r336244) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 2018 Netflix * Copyright (c) 2014 Roger Pau Monné * All rights reserved. * @@ -31,27 +32,11 @@ #ifndef _SYS_BOOT_H_ #define _SYS_BOOT_H_ -/* - * Return a 'boothowto' value corresponding to the kernel arguments in - * (kargs) and any relevant environment variables. - */ -static struct -{ - const char *ev; - int mask; -} howto_names[] = { - { "boot_askname", RB_ASKNAME}, - { "boot_cdrom", RB_CDROM}, - { "boot_ddb", RB_KDB}, - { "boot_dfltroot", RB_DFLTROOT}, - { "boot_gdb", RB_GDB}, - { "boot_multicons", RB_MULTIPLE}, - { "boot_mute", RB_MUTE}, - { "boot_pause", RB_PAUSE}, - { "boot_serial", RB_SERIAL}, - { "boot_single", RB_SINGLE}, - { "boot_verbose", RB_VERBOSE}, - { NULL, 0} -}; +int boot_env_to_howto(void); +void boot_howto_to_env(int howto); +int boot_parse_arg(char *v); +int boot_parse_cmdline_delim(char *cmdline, const char *delim); +int boot_parse_cmdline(char *cmdline); +int boot_parse_args(int argc, char *argv[]); #endif /* !_SYS_BOOT_H_ */ Modified: head/sys/sys/reboot.h ============================================================================== --- head/sys/sys/reboot.h Fri Jul 13 16:37:42 2018 (r336243) +++ head/sys/sys/reboot.h Fri Jul 13 16:43:05 2018 (r336244) @@ -63,6 +63,7 @@ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ #define RB_POWERCYCLE 0x400000 /* Power cycle if possible */ +#define RB_PROBE 0x10000000 /* Probe multiple consoles */ #define RB_MULTIPLE 0x20000000 /* use multiple consoles */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ Modified: head/sys/x86/xen/pv.c ============================================================================== --- head/sys/x86/xen/pv.c Fri Jul 13 16:37:42 2018 (r336243) +++ head/sys/x86/xen/pv.c Fri Jul 13 16:43:05 2018 (r336244) @@ -305,21 +305,6 @@ xen_pv_set_env(void) init_static_kenv(cmd_line, 0); } -static void -xen_pv_set_boothowto(void) -{ - int i; - char *env; - - /* get equivalents from the environment */ - for (i = 0; howto_names[i].ev != NULL; i++) { - if ((env = kern_getenv(howto_names[i].ev)) != NULL) { - boothowto |= howto_names[i].mask; - freeenv(env); - } - } -} - #ifdef DDB /* * The way Xen loads the symtab is different from the native boot loader, @@ -418,7 +403,7 @@ xen_pv_parse_preload_data(u_int64_t modulep) } else { /* Parse the extra boot information given by Xen */ xen_pv_set_env(); - xen_pv_set_boothowto(); + boothowto |= boot_env_to_howto(); kmdp = NULL; } From owner-svn-src-head@freebsd.org Fri Jul 13 16:43:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6360610437FA; Fri, 13 Jul 2018 16:43:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 129188E296; Fri, 13 Jul 2018 16:43:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E926012D05; Fri, 13 Jul 2018 16:43:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGhIpx088904; Fri, 13 Jul 2018 16:43:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGhHVl088897; Fri, 13 Jul 2018 16:43:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131643.w6DGhHVl088897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 16:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336245 - in head/sys: dev/ofw mips/atheros mips/atheros/ar531x mips/cavium mips/ingenic mips/mediatek mips/nlm X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/ofw mips/atheros mips/atheros/ar531x mips/cavium mips/ingenic mips/mediatek mips/nlm X-SVN-Commit-Revision: 336245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:43:19 -0000 Author: imp Date: Fri Jul 13 16:43:17 2018 New Revision: 336245 URL: https://svnweb.freebsd.org/changeset/base/336245 Log: Use boot_parse_* to parse command line args and retire cut-n-paste code that was substantially identical. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16205 Modified: head/sys/dev/ofw/ofw_subr.c head/sys/mips/atheros/ar531x/ar5315_machdep.c head/sys/mips/atheros/ar71xx_machdep.c head/sys/mips/cavium/octeon_machdep.c head/sys/mips/ingenic/jz4780_machdep.c head/sys/mips/mediatek/mtk_machdep.c head/sys/mips/nlm/xlp_machdep.c Modified: head/sys/dev/ofw/ofw_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_subr.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/dev/ofw/ofw_subr.c Fri Jul 13 16:43:17 2018 (r336245) @@ -184,44 +184,6 @@ ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t return (0); } -/* Parse cmd line args as env - copied from xlp_machdep. */ -/* XXX-BZ this should really be centrally provided for all (boot) code. */ -static void -_parse_bootargs(char *cmdline) -{ - char *n, *v; - - while ((v = strsep(&cmdline, " \n")) != NULL) { - if (*v == '\0') - continue; - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - /* Someone should simulate that ;-) */ - case 'C': boothowto |= RB_CDROM; break; - case 'd': boothowto |= RB_KDB; break; - case 'D': boothowto |= RB_MULTIPLE; break; - case 'm': boothowto |= RB_MUTE; break; - case 'g': boothowto |= RB_GDB; break; - case 'h': boothowto |= RB_SERIAL; break; - case 'p': boothowto |= RB_PAUSE; break; - case 'r': boothowto |= RB_DFLTROOT; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } - } -} - /* * This is intended to be called early on, right after the OF system is * initialized, so pmap may not be up yet. @@ -238,7 +200,7 @@ ofw_parse_bootargs(void) return (chosen); if ((err = OF_getprop(chosen, "bootargs", buf, sizeof(buf))) != -1) { - _parse_bootargs(buf); + boothowto |= boot_parse_cmdline(buf); return (0); } Modified: head/sys/mips/atheros/ar531x/ar5315_machdep.c ============================================================================== --- head/sys/mips/atheros/ar531x/ar5315_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/atheros/ar531x/ar5315_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -65,39 +66,6 @@ uint32_t ar711_base_mac[ETHER_ADDR_LEN]; the dynamic kenv is setup */ char boot1_env[4096]; -/* - * We get a string in from Redboot with the all the arguments together, - * "foo=bar bar=baz". Split them up and save in kenv. - */ -static void -parse_argv(char *str) -{ - char *n, *v; - - while ((v = strsep(&str, " ")) != NULL) { - if (*v == '\0') - continue; - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - case 'd': boothowto |= RB_KDB; break; - case 'g': boothowto |= RB_GDB; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } - } -} - void platform_cpu_init() { @@ -299,7 +267,7 @@ platform_start(__register_t a0 __unused, __register_t if (MIPS_IS_VALID_PTR(argv)) { for (i = 0; i < argc; i++) { printf(" %s", argv[i]); - parse_argv(argv[i]); + boothowto |= boot_parse_arg(argv[i]); } } else Modified: head/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- head/sys/mips/atheros/ar71xx_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/atheros/ar71xx_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -66,39 +67,6 @@ extern char edata[], end[]; the dynamic kenv is setup */ char boot1_env[4096]; -/* - * We get a string in from Redboot with the all the arguments together, - * "foo=bar bar=baz". Split them up and save in kenv. - */ -static void -parse_argv(char *str) -{ - char *n, *v; - - while ((v = strsep(&str, " ")) != NULL) { - if (*v == '\0') - continue; - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - case 'd': boothowto |= RB_KDB; break; - case 'g': boothowto |= RB_GDB; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } - } -} - void platform_cpu_init() { @@ -428,7 +396,7 @@ platform_start(__register_t a0 __unused, __register_t if (MIPS_IS_VALID_PTR(argv)) { for (i = 0; i < argc; i++) { printf(" %s", argv[i]); - parse_argv(argv[i]); + boothowto |= boot_parse_arg(argv[i]); } } else Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/cavium/octeon_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -664,30 +664,6 @@ octeon_boot_params_init(register_t ptr) } /* impEND: This stuff should move back into the Cavium SDK */ -static void -boothowto_parse(const char *v) -{ - if ((v == NULL) || (*v != '-')) - return; - - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - case 'C': boothowto |= RB_CDROM; break; - case 'd': boothowto |= RB_KDB; break; - case 'D': boothowto |= RB_MULTIPLE; break; - case 'm': boothowto |= RB_MUTE; break; - case 'g': boothowto |= RB_GDB; break; - case 'h': boothowto |= RB_SERIAL; break; - case 'p': boothowto |= RB_PAUSE; break; - case 'r': boothowto |= RB_DFLTROOT; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } -} - /* * The boot loader command line may specify kernel environment variables or * applicable boot flags of boot(8). @@ -709,7 +685,7 @@ octeon_init_kenv(register_t ptr) if (v == NULL) continue; if (*v == '-') { - boothowto_parse(v); + boothowto |= boot_parse_arg(v); continue; } n = strsep(&v, "="); Modified: head/sys/mips/ingenic/jz4780_machdep.c ============================================================================== --- head/sys/mips/ingenic/jz4780_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/ingenic/jz4780_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -173,50 +173,7 @@ mips_init(void) #endif } -static void -_parse_bootarg(char *v) -{ - char *n; - - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - /* Someone should simulate that ;-) */ - case 'C': boothowto |= RB_CDROM; break; - case 'd': boothowto |= RB_KDB; break; - case 'D': boothowto |= RB_MULTIPLE; break; - case 'm': boothowto |= RB_MUTE; break; - case 'g': boothowto |= RB_GDB; break; - case 'h': boothowto |= RB_SERIAL; break; - case 'p': boothowto |= RB_PAUSE; break; - case 'r': boothowto |= RB_DFLTROOT; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } -} - -static void -_parse_cmdline(int argc, char *argv[]) -{ - int i; - - for (i = 1; i < argc; i++) - _parse_bootarg(argv[i]); -} - #ifdef FDT -/* Parse cmd line args as env - copied from xlp_machdep. */ -/* XXX-BZ this should really be centrally provided for all (boot) code. */ static void _parse_bootargs(char *cmdline) { @@ -225,7 +182,7 @@ _parse_bootargs(char *cmdline) while ((v = strsep(&cmdline, " \n")) != NULL) { if (*v == '\0') continue; - _parse_bootarg(v); + boothowto |= boot_parse_arg(v); } } #endif @@ -285,12 +242,12 @@ platform_start(__register_t a0, __register_t a1, */ chosen = OF_finddevice("/chosen"); if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1) - _parse_bootargs(buf); + boothowto |= boot_parse_cmdline(buf); #endif /* Parse cmdline from U-Boot */ argc = a0; argv = (char **)a1; - _parse_cmdline(argc, argv); + boothowto |= boot_parse_cmdline(argc, argv); mips_init(); } Modified: head/sys/mips/mediatek/mtk_machdep.c ============================================================================== --- head/sys/mips/mediatek/mtk_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/mediatek/mtk_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -196,52 +197,6 @@ mips_init(void) #endif } -static void -_parse_bootarg(char *v) -{ - char *n; - - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - /* Someone should simulate that ;-) */ - case 'C': boothowto |= RB_CDROM; break; - case 'd': boothowto |= RB_KDB; break; - case 'D': boothowto |= RB_MULTIPLE; break; - case 'm': boothowto |= RB_MUTE; break; - case 'g': boothowto |= RB_GDB; break; - case 'h': boothowto |= RB_SERIAL; break; - case 'p': boothowto |= RB_PAUSE; break; - case 'r': boothowto |= RB_DFLTROOT; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } -} - -/* Parse cmd line args as env - copied from xlp_machdep. */ -/* XXX-BZ this should really be centrally provided for all (boot) code. */ -static void -_parse_bootargs(char *cmdline) -{ - char *v; - - while ((v = strsep(&cmdline, " \n")) != NULL) { - if (*v == '\0') - continue; - _parse_bootarg(v); - } -} - void platform_reset(void) { @@ -295,7 +250,7 @@ platform_start(__register_t a0 __unused, __register_t */ chosen = OF_finddevice("/chosen"); if (OF_getprop(chosen, "bsdbootargs", buf, sizeof(buf)) != -1) - _parse_bootargs(buf); + boothowto |= boot_parse_cmdline(buf); printf("FDT DTB at: 0x%08x\n", (uint32_t)dtbp); Modified: head/sys/mips/nlm/xlp_machdep.c ============================================================================== --- head/sys/mips/nlm/xlp_machdep.c Fri Jul 13 16:43:05 2018 (r336244) +++ head/sys/mips/nlm/xlp_machdep.c Fri Jul 13 16:43:17 2018 (r336245) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include /* cinit() */ #include +#include #include #include #include @@ -261,36 +262,6 @@ unsupp: return; } -/* Parse cmd line args as env - copied from ar71xx */ -static void -xlp_parse_bootargs(char *cmdline) -{ - char *n, *v; - - while ((v = strsep(&cmdline, " \n")) != NULL) { - if (*v == '\0') - continue; - if (*v == '-') { - while (*v != '\0') { - v++; - switch (*v) { - case 'a': boothowto |= RB_ASKNAME; break; - case 'd': boothowto |= RB_KDB; break; - case 'g': boothowto |= RB_GDB; break; - case 's': boothowto |= RB_SINGLE; break; - case 'v': boothowto |= RB_VERBOSE; break; - } - } - } else { - n = strsep(&v, "="); - if (v == NULL) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } - } -} - #ifdef FDT static void xlp_bootargs_init(__register_t arg) @@ -321,7 +292,7 @@ xlp_bootargs_init(__register_t arg) } if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1) - xlp_parse_bootargs(buf); + boothowto |= boot_parse_cmdline(buf); } #else /* @@ -363,7 +334,7 @@ xlp_bootargs_init(__register_t arg) v = kern_getenv("bootargs"); if (v != NULL) { strlcpy(buf, v, sizeof(buf)); - xlp_parse_bootargs(buf); + boothowto |= boot_parse_cmdline(buf); freeenv(v); } } From owner-svn-src-head@freebsd.org Fri Jul 13 16:43:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3F74104381B; Fri, 13 Jul 2018 16:43:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D26B78E339; Fri, 13 Jul 2018 16:43:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE4E112D06; Fri, 13 Jul 2018 16:43:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGhOPL088961; Fri, 13 Jul 2018 16:43:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGhNeq088956; Fri, 13 Jul 2018 16:43:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131643.w6DGhNeq088956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 16:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336246 - in head/stand: common efi/loader i386/libi386 userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common efi/loader i386/libi386 userboot/userboot X-SVN-Commit-Revision: 336246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:43:28 -0000 Author: imp Date: Fri Jul 13 16:43:23 2018 New Revision: 336246 URL: https://svnweb.freebsd.org/changeset/base/336246 Log: Eliminate boot loader copies of boot arg parsing. Eliminate 4 of the copies of the arg parsing in /boot/laoder by using boot_parse_cmdline. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16205 Modified: head/stand/common/metadata.c head/stand/efi/loader/main.c head/stand/i386/libi386/bootinfo.c head/stand/userboot/userboot/bootinfo.c Modified: head/stand/common/metadata.c ============================================================================== --- head/stand/common/metadata.c Fri Jul 13 16:43:17 2018 (r336245) +++ head/stand/common/metadata.c Fri Jul 13 16:43:23 2018 (r336246) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #if defined(LOADER_FDT_SUPPORT) #include @@ -96,61 +97,10 @@ md_bootserial(void) static int md_getboothowto(char *kargs) { - char *cp; int howto; - int active; /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } - + howto = boot_parse_cmdline(kargs); howto |= bootenv_flags(); #if defined(__sparc64__) if (md_bootserial() != -1) Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Fri Jul 13 16:43:17 2018 (r336245) +++ head/stand/efi/loader/main.c Fri Jul 13 16:43:23 2018 (r336246) @@ -420,79 +420,10 @@ parse_args(int argc, CHAR16 *argv[], bool has_kbd) */ howto = 0; for (i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - for (j = 1; argv[i][j] != 0; j++) { - int ch; - - ch = argv[i][j]; - switch (ch) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'P': - if (!has_kbd) - howto |= RB_SERIAL | RB_MULTIPLE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'S': - if (argv[i][j + 1] == 0) { - if (i + 1 == argc) { - setenv("comconsole_speed", "115200", 1); - } else { - cpy16to8(&argv[i + 1][0], var, - sizeof(var)); - setenv("comconsole_speed", var, 1); - } - i++; - break; - } else { - cpy16to8(&argv[i][j + 1], var, - sizeof(var)); - setenv("comconsole_speed", var, 1); - break; - } - case 'v': - howto |= RB_VERBOSE; - break; - } - } - } else { - vargood = false; - for (j = 0; argv[i][j] != 0; j++) { - if (j == sizeof(var)) { - vargood = false; - break; - } - if (j > 0 && argv[i][j] == '=') - vargood = true; - var[j] = (char)argv[i][j]; - } - if (vargood) { - var[j] = 0; - putenv(var); - } - } + cpy16to8(argv[i], var, sizeof(var)); + howto |= boot_parse_arg(var); } + return (howto); } Modified: head/stand/i386/libi386/bootinfo.c ============================================================================== --- head/stand/i386/libi386/bootinfo.c Fri Jul 13 16:43:17 2018 (r336245) +++ head/stand/i386/libi386/bootinfo.c Fri Jul 13 16:43:23 2018 (r336246) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "bootstrap.h" #include "libi386.h" @@ -38,62 +39,11 @@ __FBSDID("$FreeBSD$"); int bi_getboothowto(char *kargs) { - char *cp; char *curpos, *next, *string; int howto; - int active; int vidconsole; - /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } + howto = boot_parse_cmdline(kargs); howto |= bootenv_flags(); /* Enable selected consoles */ Modified: head/stand/userboot/userboot/bootinfo.c ============================================================================== --- head/stand/userboot/userboot/bootinfo.c Fri Jul 13 16:43:17 2018 (r336245) +++ head/stand/userboot/userboot/bootinfo.c Fri Jul 13 16:43:23 2018 (r336246) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "bootstrap.h" @@ -38,63 +39,11 @@ __FBSDID("$FreeBSD$"); int bi_getboothowto(char *kargs) { - char *cp; char *curpos, *next, *string; int howto; - int active; int vidconsole; - /* Parse kargs */ - howto = 0; - if (kargs != NULL) { - cp = kargs; - active = 0; - while (*cp != 0) { - if (!active && (*cp == '-')) { - active = 1; - } else if (active) - switch (*cp) { - case 'a': - howto |= RB_ASKNAME; - break; - case 'C': - howto |= RB_CDROM; - break; - case 'd': - howto |= RB_KDB; - break; - case 'D': - howto |= RB_MULTIPLE; - break; - case 'm': - howto |= RB_MUTE; - break; - case 'g': - howto |= RB_GDB; - break; - case 'h': - howto |= RB_SERIAL; - break; - case 'p': - howto |= RB_PAUSE; - break; - case 'r': - howto |= RB_DFLTROOT; - break; - case 's': - howto |= RB_SINGLE; - break; - case 'v': - howto |= RB_VERBOSE; - break; - default: - active = 0; - break; - } - cp++; - } - } - + howto = boot_parse_cmdline(kargs); howto |= bootenv_flags(); /* Enable selected consoles */ @@ -117,7 +66,8 @@ bi_getboothowto(char *kargs) /* * XXX: Note that until the kernel is ready to respect multiple consoles - * for the boot messages, the first named console is the primary console + * for the messages from /etc/rc, the first named console is the primary + * console */ if (!strcmp(string, "vidconsole")) howto &= ~RB_SERIAL; From owner-svn-src-head@freebsd.org Fri Jul 13 16:43:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D66C31043846; Fri, 13 Jul 2018 16:43:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE0B38E3ED; Fri, 13 Jul 2018 16:43:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E17512D07; Fri, 13 Jul 2018 16:43:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DGhVVI089021; Fri, 13 Jul 2018 16:43:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DGhTqV089013; Fri, 13 Jul 2018 16:43:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131643.w6DGhTqV089013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 16:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336247 - in head/stand: common efi/loader i386/libi386 userboot/userboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: common efi/loader i386/libi386 userboot/userboot X-SVN-Commit-Revision: 336247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:43:33 -0000 Author: imp Date: Fri Jul 13 16:43:29 2018 New Revision: 336247 URL: https://svnweb.freebsd.org/changeset/base/336247 Log: Transition to boot_env_to_howto and boot_howto_to_env in the boot loader. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16205 Modified: head/stand/common/boot.c head/stand/common/bootstrap.h head/stand/common/metadata.c head/stand/efi/loader/bootinfo.c head/stand/efi/loader/main.c head/stand/i386/libi386/bootinfo.c head/stand/userboot/userboot/bootinfo.c Modified: head/stand/common/boot.c ============================================================================== --- head/stand/common/boot.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/common/boot.c Fri Jul 13 16:43:29 2018 (r336247) @@ -160,30 +160,6 @@ autoboot_maybe() autoboot(-1, NULL); /* try to boot automatically */ } -int -bootenv_flags() -{ - int i, howto; - char *val; - - for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) { - val = getenv(howto_names[i].ev); - if (val != NULL && strcasecmp(val, "no") != 0) - howto |= howto_names[i].mask; - } - return (howto); -} - -void -bootenv_set(int howto) -{ - int i; - - for (i = 0; howto_names[i].ev != NULL; i++) - if (howto & howto_names[i].mask) - setenv(howto_names[i].ev, "YES", 1); -} - static int autoboot(int timeout, char *prompt) { Modified: head/stand/common/bootstrap.h ============================================================================== --- head/stand/common/bootstrap.h Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/common/bootstrap.h Fri Jul 13 16:43:29 2018 (r336247) @@ -63,8 +63,6 @@ int parse(int *argc, char ***argv, const char *str); /* boot.c */ void autoboot_maybe(void); int getrootmount(char *rootdev); -int bootenv_flags(void); -void bootenv_set(int); /* misc.c */ char *unargv(int argc, char *argv[]); Modified: head/stand/common/metadata.c ============================================================================== --- head/stand/common/metadata.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/common/metadata.c Fri Jul 13 16:43:29 2018 (r336247) @@ -101,7 +101,7 @@ md_getboothowto(char *kargs) /* Parse kargs */ howto = boot_parse_cmdline(kargs); - howto |= bootenv_flags(); + howto |= boot_env_to_howto(); #if defined(__sparc64__) if (md_bootserial() != -1) howto |= RB_SERIAL; Modified: head/stand/efi/loader/bootinfo.c ============================================================================== --- head/stand/efi/loader/bootinfo.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/efi/loader/bootinfo.c Fri Jul 13 16:43:29 2018 (r336247) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -59,12 +60,6 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offse extern EFI_SYSTEM_TABLE *ST; -static const char howto_switches[] = "aCdrgDmphsv"; -static int howto_masks[] = { - RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, - RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE -}; - static int bi_getboothowto(char *kargs) { @@ -73,7 +68,8 @@ bi_getboothowto(char *kargs) char *console; int howto; - howto = bootenv_flags(); + howto = boot_parse_cmdline(kargs); + howto |= boot_env_to_howto(); console = getenv("console"); if (console != NULL) { @@ -81,21 +77,6 @@ bi_getboothowto(char *kargs) howto |= RB_SERIAL; if (strcmp(console, "nullconsole") == 0) howto |= RB_MUTE; - } - - /* Parse kargs */ - if (kargs == NULL) - return (howto); - - opts = strchr(kargs, '-'); - while (opts != NULL) { - while (*(++opts) != '\0') { - sw = strchr(howto_switches, *opts); - if (sw == NULL) - break; - howto |= howto_masks[sw - howto_switches]; - } - opts = strchr(opts, '-'); } return (howto); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/efi/loader/main.c Fri Jul 13 16:43:29 2018 (r336247) @@ -28,11 +28,13 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include +#include #include -#include #include #include #include @@ -481,7 +483,7 @@ main(int argc, CHAR16 *argv[]) howto = parse_args(argc, argv, has_kbd); - bootenv_set(howto); + boot_howto_to_env(howto); /* * XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables Modified: head/stand/i386/libi386/bootinfo.c ============================================================================== --- head/stand/i386/libi386/bootinfo.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/i386/libi386/bootinfo.c Fri Jul 13 16:43:29 2018 (r336247) @@ -44,7 +44,7 @@ bi_getboothowto(char *kargs) int vidconsole; howto = boot_parse_cmdline(kargs); - howto |= bootenv_flags(); + howto |= boot_env_to_howto(); /* Enable selected consoles */ string = next = strdup(getenv("console")); @@ -80,7 +80,7 @@ void bi_setboothowto(int howto) { - bootenv_set(howto); + boot_howto_to_env(howto); } /* Modified: head/stand/userboot/userboot/bootinfo.c ============================================================================== --- head/stand/userboot/userboot/bootinfo.c Fri Jul 13 16:43:23 2018 (r336246) +++ head/stand/userboot/userboot/bootinfo.c Fri Jul 13 16:43:29 2018 (r336247) @@ -44,7 +44,7 @@ bi_getboothowto(char *kargs) int vidconsole; howto = boot_parse_cmdline(kargs); - howto |= bootenv_flags(); + howto |= boot_env_to_howto(); /* Enable selected consoles */ string = next = strdup(getenv("console")); @@ -81,7 +81,7 @@ void bi_setboothowto(int howto) { - bootenv_set(howto); + boot_howto_to_env(howto); } /* From owner-svn-src-head@freebsd.org Fri Jul 13 16:50:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6DF41043C67; Fri, 13 Jul 2018 16:50:05 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C3C98E988; Fri, 13 Jul 2018 16:50:05 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lj1-x22f.google.com with SMTP id r13-v6so24977450ljg.10; Fri, 13 Jul 2018 09:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0omUOE0TbjgKPrAX32r4VwvVFfMttPv10Asu2qg0OTU=; b=qK0TSHMUN4rsbFWi4UoZryT9M2zKKfnNwm6fZIpWJzwD99XtKt5l36hPApUdRBuaPp 5p7kM4SLc01wY8vlSL+k23B8ClY21GZ99a8DoHBM0htXctzis9AHLnsm7poBerLCF3DX E9dOiDfFOIy0yc8bd2/7SQEr89ZqMjEHuJiPxYR1xGqW0pJiFpqkaQTjj7SsUoMm2sGY COR5yDCV3sMH5txGaowaGYkZaFVSxrtpi/4F43nqhubZW7NLsRAk7uqZy2G6dU4LU8E1 sRBtWBl9zJpyITRjthp4I2c+a/b0GISkqVJ0GOR8O0Lkn+As/WIjgvO9ZfhPZ2ZfKfIO xt/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0omUOE0TbjgKPrAX32r4VwvVFfMttPv10Asu2qg0OTU=; b=frMGoe1cUODEVqXgWwrBQw0IbhDmGFz4MRqscZGJNPovDF3d48irJ9YjYf0OD0nGPC aKJ1j/976EbYMOfC1DKrw/Q4kmJG48+unCrVoJ3AouwI75fiZ7lxM5vZ0CtTZIJD1voH M3g8Pd3D2RPkFyQVME0BUwk64XqYWTzVTdDJX2W8YP9Vzdh7k6HQUHID1kZnOVC/l32g VZ/z0xbyGdD6d1qNQfhIVKu8DW4KcwJ/pzJoBCTzHUyBt+CmrLZfomivWXWddRZ8xkM6 vXkGDBk/P4VNire6G2bQWdZqbizP6DXaec5Pnpd1PGMNhHGOOvq6f36Gcr8dLrBS18WX MIpA== X-Gm-Message-State: AOUpUlHLsMNjvI+4ngJWlxkPL3zltmg4pJjZGYNmIUBc7N59T1SWOsDf aEUbafoaet2L4PSXjA9Ump8cYhn2ENBvqNFSYJc= X-Google-Smtp-Source: AAOMgpcDhn662TOe1hSOG7xgoTG6yUkjPKsG1vb33LIE00Bwnlnoub5JGsiCIapdEUrZsNs3KGmSz8sSYAW20iQLGHs= X-Received: by 2002:a2e:1d50:: with SMTP id d77-v6mr3699431ljd.104.1531500603380; Fri, 13 Jul 2018 09:50:03 -0700 (PDT) MIME-Version: 1.0 References: <201807131643.w6DGhHVl088897@repo.freebsd.org> In-Reply-To: <201807131643.w6DGhHVl088897@repo.freebsd.org> From: Justin Hibbits Date: Fri, 13 Jul 2018 09:49:51 -0700 Message-ID: Subject: Re: svn commit: r336245 - in head/sys: dev/ofw mips/atheros mips/atheros/ar531x mips/cavium mips/ingenic mips/mediatek mips/nlm To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:50:06 -0000 I On Fri, Jul 13, 2018, 09:43 Warner Losh wrote: > Author: imp > Date: Fri Jul 13 16:43:17 2018 > New Revision: 336245 > URL: https://svnweb.freebsd.org/changeset/base/336245 > > Log: > Use boot_parse_* to parse command line args and retire cut-n-paste > code that was substantially identical. > > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D16205 Woohoo! Thanks for doing this. It's been on my list since the last c&p of it that I did. - Justin From owner-svn-src-head@freebsd.org Fri Jul 13 17:12:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AB8B10448ED; Fri, 13 Jul 2018 17:12:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0F498F6EB; Fri, 13 Jul 2018 17:12:50 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1E60131EE; Fri, 13 Jul 2018 17:12:50 +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 w6DHCoK8004266; Fri, 13 Jul 2018 17:12:50 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DHCocI004265; Fri, 13 Jul 2018 17:12:50 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807131712.w6DHCocI004265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 13 Jul 2018 17:12:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336248 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 336248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 17:12:51 -0000 Author: alc Date: Fri Jul 13 17:12:50 2018 New Revision: 336248 URL: https://svnweb.freebsd.org/changeset/base/336248 Log: Invalidate the mapping before updating its physical address. Doing so ensures that all threads sharing the pmap have a consistent view of the mapping. This fixes the problem described in the commit log message for r329254 without the overhead of an extra fault in the common case. (Once the riscv pmap_enter() implementation is similarly modified, the workaround added in r329254 can be removed, reducing the overhead of CoW faults.) See also r335784 for amd64. The mips implementation of pmap_enter() already reused the PV entry from the old mapping. Reviewed by: kib, markj MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D16199 Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Fri Jul 13 16:43:29 2018 (r336247) +++ head/sys/mips/mips/pmap.c Fri Jul 13 17:12:50 2018 (r336248) @@ -2037,6 +2037,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if (is_kernel_pmap(pmap)) newpte |= PTE_G; PMAP_PTE_SET_CACHE_BITS(newpte, pa, m); + if ((m->oflags & VPO_UNMANAGED) == 0) + newpte |= PTE_MANAGED; mpte = NULL; @@ -2066,8 +2068,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v panic("pmap_enter: invalid page directory, pdir=%p, va=%p", (void *)pmap->pm_segtab, (void *)va); } - om = NULL; + origpte = *pte; + KASSERT(!pte_test(&origpte, PTE_D | PTE_RO | PTE_V), + ("pmap_enter: modified page not writable: va: %p, pte: %#jx", + (void *)va, (uintmax_t)origpte)); opa = TLBLO_PTE_TO_PA(origpte); /* @@ -2086,10 +2091,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v PTE_W)) pmap->pm_stats.wired_count--; - KASSERT(!pte_test(&origpte, PTE_D | PTE_RO), - ("%s: modified page not writable: va: %p, pte: %#jx", - __func__, (void *)va, (uintmax_t)origpte)); - /* * Remove extra pte reference */ @@ -2098,8 +2099,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v if (pte_test(&origpte, PTE_MANAGED)) { m->md.pv_flags |= PV_TABLE_REF; - om = m; - newpte |= PTE_MANAGED; if (!pte_test(&newpte, PTE_RO)) vm_page_aflag_set(m, PGA_WRITEABLE); } @@ -2113,13 +2112,29 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v * handle validating new mapping. */ if (opa) { + if (is_kernel_pmap(pmap)) + *pte = PTE_G; + else + *pte = 0; if (pte_test(&origpte, PTE_W)) pmap->pm_stats.wired_count--; - if (pte_test(&origpte, PTE_MANAGED)) { om = PHYS_TO_VM_PAGE(opa); + if (pte_test(&origpte, PTE_D)) + vm_page_dirty(om); + if ((om->md.pv_flags & PV_TABLE_REF) != 0) { + om->md.pv_flags &= ~PV_TABLE_REF; + vm_page_aflag_set(om, PGA_REFERENCED); + } pv = pmap_pvh_remove(&om->md, pmap, va); + if (!pte_test(&newpte, PTE_MANAGED)) + free_pv_entry(pmap, pv); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_aflag_clear(om, PGA_WRITEABLE); } + pmap_invalidate_page(pmap, va); + origpte = 0; if (mpte != NULL) { mpte->wire_count--; KASSERT(mpte->wire_count > 0, @@ -2132,17 +2147,16 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v /* * Enter on the PV list if part of our managed memory. */ - if ((m->oflags & VPO_UNMANAGED) == 0) { + if (pte_test(&newpte, PTE_MANAGED)) { m->md.pv_flags |= PV_TABLE_REF; - if (pv == NULL) + if (pv == NULL) { pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; + pv->pv_va = va; + } TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); - newpte |= PTE_MANAGED; if (!pte_test(&newpte, PTE_RO)) vm_page_aflag_set(m, PGA_WRITEABLE); - } else if (pv != NULL) - free_pv_entry(pmap, pv); + } /* * Increment counters @@ -2163,21 +2177,11 @@ validate: if (origpte != newpte) { *pte = newpte; if (pte_test(&origpte, PTE_V)) { - if (pte_test(&origpte, PTE_MANAGED) && opa != pa) { - if (om->md.pv_flags & PV_TABLE_REF) - vm_page_aflag_set(om, PGA_REFERENCED); - om->md.pv_flags &= ~PV_TABLE_REF; - } + KASSERT(opa == pa, ("pmap_enter: invalid update")); if (pte_test(&origpte, PTE_D)) { - KASSERT(!pte_test(&origpte, PTE_RO), - ("pmap_enter: modified page not writable:" - " va: %p, pte: %#jx", (void *)va, (uintmax_t)origpte)); if (pte_test(&origpte, PTE_MANAGED)) - vm_page_dirty(om); + vm_page_dirty(m); } - if (pte_test(&origpte, PTE_MANAGED) && - TAILQ_EMPTY(&om->md.pv_list)) - vm_page_aflag_clear(om, PGA_WRITEABLE); pmap_update_page(pmap, va, newpte); } } From owner-svn-src-head@freebsd.org Fri Jul 13 17:15:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B763C1044AD1; Fri, 13 Jul 2018 17:15:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6530B8F8D0; Fri, 13 Jul 2018 17:15:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42253131F4; Fri, 13 Jul 2018 17:15:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DHFFnq004405; Fri, 13 Jul 2018 17:15:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DHFFeK004404; Fri, 13 Jul 2018 17:15:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131715.w6DHFFeK004404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 17:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336249 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 336249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 17:15:15 -0000 Author: imp Date: Fri Jul 13 17:15:14 2018 New Revision: 336249 URL: https://svnweb.freebsd.org/changeset/base/336249 Log: Fix sparc64 builds gcc is complaining about struct infate being defined in a parameter list. It's inclear how long this has been broken, but the fix is simple enough. Modified: head/stand/libsa/Makefile Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Jul 13 17:12:50 2018 (r336248) +++ head/stand/libsa/Makefile Fri Jul 13 17:15:14 2018 (r336249) @@ -96,6 +96,7 @@ SRCS+=bzlib.c crctable.c decompress.c huffman.c randta # decompression functionality from zlib .PATH: ${SRCTOP}/contrib/zlib CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib +CFLAGS.inflate.c+=-DKZIP SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c From owner-svn-src-head@freebsd.org Fri Jul 13 17:41:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEEFD1045BF6; Fri, 13 Jul 2018 17:41:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FFD970766; Fri, 13 Jul 2018 17:41:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 381B21357F; Fri, 13 Jul 2018 17:41:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DHfTEp017134; Fri, 13 Jul 2018 17:41:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DHfSAa016950; Fri, 13 Jul 2018 17:41:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131741.w6DHfSAa016950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 17:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336250 - in head: stand/libsa sys/conf sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: stand/libsa sys/conf sys/kern X-SVN-Commit-Revision: 336250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 17:41:30 -0000 Author: imp Date: Fri Jul 13 17:41:28 2018 New Revision: 336250 URL: https://svnweb.freebsd.org/changeset/base/336250 Log: There's two files in the sys tree named inflate.c, in addition to it being a common name elsewhere. Rename the old kzip one to subr_inflate.c. This actually fixes the build issues on sparc64 that my inclusion of .PATH ${SYSDIR}/kern created in r336244, so also revert the broken workaround I committed in r336249. This slipped passed me because apparently, I never did a clean build. Added: head/sys/kern/subr_inflate.c (contents, props changed) - copied, changed from r336249, head/sys/kern/inflate.c Deleted: head/sys/kern/inflate.c Modified: head/stand/libsa/Makefile head/sys/conf/Makefile.arm head/sys/conf/files Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Jul 13 17:15:14 2018 (r336249) +++ head/stand/libsa/Makefile Fri Jul 13 17:41:28 2018 (r336250) @@ -96,7 +96,6 @@ SRCS+=bzlib.c crctable.c decompress.c huffman.c randta # decompression functionality from zlib .PATH: ${SRCTOP}/contrib/zlib CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib -CFLAGS.inflate.c+=-DKZIP SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Fri Jul 13 17:15:14 2018 (r336249) +++ head/sys/conf/Makefile.arm Fri Jul 13 17:41:28 2018 (r336250) @@ -123,7 +123,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h ${CC} -O2 -ffreestanding -I. -I$S -c \ -DKZIP -DELF_TRAMPOLINE \ - $S/kern/inflate.c \ + $S/kern/subr_inflate.c \ -o inflate-tramp.o ${CC} -O -nostdlib -I. -I$S \ -Xlinker -T -Xlinker ldscript.$M.tramp \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jul 13 17:15:14 2018 (r336249) +++ head/sys/conf/files Fri Jul 13 17:41:28 2018 (r336250) @@ -3775,7 +3775,6 @@ kern/imgact_binmisc.c optional imagact_binmisc kern/imgact_elf.c standard kern/imgact_elf32.c optional compat_freebsd32 kern/imgact_shell.c standard -kern/inflate.c optional gzip kern/init_main.c standard kern/init_sysent.c standard kern/ksched.c optional _kposix_priority_scheduling @@ -3886,6 +3885,7 @@ kern/subr_firmware.c optional firmware kern/subr_gtaskqueue.c standard kern/subr_hash.c standard kern/subr_hints.c standard +kern/subr_inflate.c optional gzip kern/subr_kdb.c standard kern/subr_kobj.c standard kern/subr_lock.c standard Copied and modified: head/sys/kern/subr_inflate.c (from r336249, head/sys/kern/inflate.c) ============================================================================== From owner-svn-src-head@freebsd.org Fri Jul 13 17:42:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DA3E1045CE3; Fri, 13 Jul 2018 17:42:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C9AF70B95; Fri, 13 Jul 2018 17:42:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E2C9136C4; Fri, 13 Jul 2018 17:42:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DHgmmn023821; Fri, 13 Jul 2018 17:42:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DHgm2E023817; Fri, 13 Jul 2018 17:42:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807131742.w6DHgm2E023817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 13 Jul 2018 17:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336251 - in head/sys/x86: acpica x86 xen X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/x86: acpica x86 xen X-SVN-Commit-Revision: 336251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 17:42:49 -0000 Author: markj Date: Fri Jul 13 17:42:48 2018 New Revision: 336251 URL: https://svnweb.freebsd.org/changeset/base/336251 Log: Use C99 initializers for instances of struct apic_enumerator. MFC after: 3 days Modified: head/sys/x86/acpica/madt.c head/sys/x86/x86/mptable.c head/sys/x86/xen/pvcpu_enum.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Fri Jul 13 17:41:28 2018 (r336250) +++ head/sys/x86/acpica/madt.c Fri Jul 13 17:42:48 2018 (r336251) @@ -93,11 +93,11 @@ static int madt_setup_io(void); static void madt_walk_table(acpi_subtable_handler *handler, void *arg); static struct apic_enumerator madt_enumerator = { - "MADT", - madt_probe, - madt_probe_cpus, - madt_setup_local, - madt_setup_io + .apic_name = "MADT", + .apic_probe = madt_probe, + .apic_probe_cpus = madt_probe_cpus, + .apic_setup_local = madt_setup_local, + .apic_setup_io = madt_setup_io }; /* Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Fri Jul 13 17:41:28 2018 (r336250) +++ head/sys/x86/x86/mptable.c Fri Jul 13 17:42:48 2018 (r336251) @@ -206,11 +206,11 @@ static void mptable_walk_table(mptable_entry_handler * static int search_for_sig(u_int32_t target, int count); static struct apic_enumerator mptable_enumerator = { - "MPTable", - mptable_probe, - mptable_probe_cpus, - mptable_setup_local, - mptable_setup_io + .apic_name = "MPTable", + .apic_probe = mptable_probe, + .apic_probe_cpus = mptable_probe_cpus, + .apic_setup_local = mptable_setup_local, + .apic_setup_io = mptable_setup_io }; /* Modified: head/sys/x86/xen/pvcpu_enum.c ============================================================================== --- head/sys/x86/xen/pvcpu_enum.c Fri Jul 13 17:41:28 2018 (r336250) +++ head/sys/x86/xen/pvcpu_enum.c Fri Jul 13 17:42:48 2018 (r336251) @@ -68,11 +68,11 @@ static vm_paddr_t madt_physaddr; static vm_offset_t madt_length; static struct apic_enumerator xenpv_enumerator = { - "Xen PV", - xenpv_probe, - xenpv_probe_cpus, - xenpv_setup_local, - xenpv_setup_io + .apic_name = "Xen PV", + .apic_probe = xenpv_probe, + .apic_probe_cpus = xenpv_probe_cpus, + .apic_setup_local = xenpv_setup_local, + .apic_setup_io = xenpv_setup_io }; /*--------------------- Helper functions to parse MADT -----------------------*/ From owner-svn-src-head@freebsd.org Fri Jul 13 17:50:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 866001046024; Fri, 13 Jul 2018 17:50:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3552170E44; Fri, 13 Jul 2018 17:50:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16310136D8; Fri, 13 Jul 2018 17:50:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DHoTpN024248; Fri, 13 Jul 2018 17:50:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DHoPD9024230; Fri, 13 Jul 2018 17:50:25 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131750.w6DHoPD9024230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 17:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336252 - in head: share/mk stand stand/common stand/efi/loader stand/i386/gptboot stand/i386/gptzfsboot stand/i386/isoboot stand/i386/libi386 stand/i386/loader stand/i386/zfsboot stand... X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/mk stand stand/common stand/efi/loader stand/i386/gptboot stand/i386/gptzfsboot stand/i386/isoboot stand/i386/libi386 stand/i386/loader stand/i386/zfsboot stand/libsa/geli stand/userboo... X-SVN-Commit-Revision: 336252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 17:50:29 -0000 Author: ian Date: Fri Jul 13 17:50:25 2018 New Revision: 336252 URL: https://svnweb.freebsd.org/changeset/base/336252 Log: Extend loader(8) geli support to all architectures and all disk-like devices. This moves the bulk of the geli support from lib386/biosdisk.c into a new geli/gelidev.c which implements a devsw-type device whose dv_strategy() function handles geli decryption. Support for all arches comes from moving the taste-and-attach code to the devopen() function in libsa. After opening any DEVT_DISK device, devopen() calls the new function geli_probe_and_attach(), which will "attach" the geli code to the open_file struct by creating a geli_devdesc instance to replace the disk_devdesc instance in the open_file. That routes all IO for the device through the geli code. A new public geli_add_key() function is added, to allow arch/vendor-specific code to add keys obtained from custom hardware or other sources. With these changes, geli support will be compiled into all variations of loader(8) on all arches because the default is WITH_LOADER_GELI. Relnotes: yes Sponsored by: Microchip Technology Inc Differential Revision: https://reviews.freebsd.org/D15743 Added: head/stand/libsa/geli/geli_metadata.c (contents, props changed) head/stand/libsa/geli/gelidev.c (contents, props changed) Modified: head/share/mk/src.opts.mk head/stand/common/devopen.c head/stand/common/metadata.c head/stand/defs.mk head/stand/efi/loader/bootinfo.c head/stand/i386/gptboot/Makefile head/stand/i386/gptboot/gptboot.c head/stand/i386/gptzfsboot/Makefile head/stand/i386/isoboot/Makefile head/stand/i386/libi386/Makefile head/stand/i386/libi386/biosdisk.c head/stand/i386/libi386/bootinfo32.c head/stand/i386/libi386/bootinfo64.c head/stand/i386/loader/Makefile head/stand/i386/loader/main.c head/stand/i386/zfsboot/Makefile head/stand/i386/zfsboot/zfsboot.c head/stand/libsa/geli/Makefile.inc head/stand/libsa/geli/geliboot.c head/stand/libsa/geli/geliboot.h head/stand/libsa/geli/geliboot_internal.h head/stand/userboot/userboot/bootinfo32.c Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jul 13 17:42:48 2018 (r336251) +++ head/share/mk/src.opts.mk Fri Jul 13 17:50:25 2018 (r336252) @@ -343,10 +343,6 @@ BROKEN_OPTIONS+=SSP .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif -# GELI isn't supported on !x86 -.if ${__T} != "i386" && ${__T} != "amd64" -BROKEN_OPTIONS+=LOADER_GELI -.endif # OFW is only for powerpc and sparc64, exclude others .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" BROKEN_OPTIONS+=LOADER_OFW Modified: head/stand/common/devopen.c ============================================================================== --- head/stand/common/devopen.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/common/devopen.c Fri Jul 13 17:50:25 2018 (r336252) @@ -32,6 +32,10 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + int devopen(struct open_file *f, const char *fname, const char **file) { @@ -43,6 +47,7 @@ devopen(struct open_file *f, const char *fname, const return (result); /* point to device-specific data so that device open can use it */ + f->f_dev = dev->d_dev; f->f_devdata = dev; result = dev->d_dev->dv_open(f, dev); if (result != 0) { @@ -51,8 +56,17 @@ devopen(struct open_file *f, const char *fname, const return (result); } - /* reference the devsw entry from the open_file structure */ - f->f_dev = dev->d_dev; +#ifdef LOADER_GELI_SUPPORT + /* + * If f->f_dev is geli-encrypted and we can decrypt it (will prompt for + * pw if needed), this will attach the geli code to the open_file by + * replacing f->f_dev and f_devdata with pointers to a geli_devdesc. + */ + if (f->f_dev->dv_type == DEVT_DISK) { + geli_probe_and_attach(f); + } +#endif + return (0); } Modified: head/stand/common/metadata.c ============================================================================== --- head/stand/common/metadata.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/common/metadata.c Fri Jul 13 17:50:25 2018 (r336252) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + #if defined(__sparc64__) #include @@ -355,7 +359,9 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); } - +#ifdef LOADER_GELI_SUPPORT + geli_export_key_metadata(kfp); +#endif #if defined(__sparc64__) file_addmetadata(kfp, MODINFOMD_DTLB_SLOTS, sizeof dtlb_slot, &dtlb_slot); Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/defs.mk Fri Jul 13 17:50:25 2018 (r336252) @@ -56,7 +56,6 @@ CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mc # GELI Support, with backward compat hooks (mostly) -.if defined(HAVE_GELI) .if defined(LOADER_NO_GELI_SUPPORT) MK_LOADER_GELI=no .warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" @@ -69,7 +68,6 @@ MK_LOADER_GELI=yes CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${SASRC}/geli .endif # MK_LOADER_GELI -.endif # HAVE_GELI # These should be confined to loader.mk, but can't because uboot/lib # also uses it. It's part of loader, but isn't a loader so we can't Modified: head/stand/efi/loader/bootinfo.c ============================================================================== --- head/stand/efi/loader/bootinfo.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/efi/loader/bootinfo.c Fri Jul 13 17:50:25 2018 (r336252) @@ -56,6 +56,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef LOADER_GELI_SUPPORT +#include "geliboot.h" +#endif + int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); extern EFI_SYSTEM_TABLE *ST; @@ -452,7 +456,9 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof ST, &ST); - +#ifdef LOADER_GELI_SUPPORT + geli_export_key_metadata(kfp); +#endif bi_load_efi_data(kfp); /* Figure out the size and location of the metadata. */ Modified: head/stand/i386/gptboot/Makefile ============================================================================== --- head/stand/i386/gptboot/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/gptboot/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC} Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/gptboot/gptboot.c Fri Jul 13 17:50:25 2018 (r336252) @@ -113,11 +113,20 @@ static int vdev_read(void *vdev __unused, void *priv, #include "ufsread.c" #include "gpt.c" #ifdef LOADER_GELI_SUPPORT -#include "geliboot.c" +#include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; static struct keybuf *gelibuf; #endif +struct gptdsk { + struct dsk dsk; +#ifdef LOADER_GELI_SUPPORT + struct geli_dev *gdev; +#endif +}; + +static struct gptdsk gdsk; + static inline int xfsread(ufs_ino_t inode, void *buf, size_t nbyte) { @@ -225,19 +234,21 @@ static int gptinit(void) { - if (gptread(&freebsd_ufs_uuid, &dsk, dmadat->secbuf) == -1) { + if (gptread(&freebsd_ufs_uuid, &gdsk.dsk, dmadat->secbuf) == -1) { printf("%s: unable to load GPT\n", BOOTPROG); return (-1); } - if (gptfind(&freebsd_ufs_uuid, &dsk, dsk.part) == -1) { + if (gptfind(&freebsd_ufs_uuid, &gdsk.dsk, gdsk.dsk.part) == -1) { printf("%s: no UFS partition was found\n", BOOTPROG); return (-1); } #ifdef LOADER_GELI_SUPPORT - if (geli_taste(vdev_read, &dsk, (gpttable[curent].ent_lba_end - - gpttable[curent].ent_lba_start)) == 0) { - if (geli_havekey(&dsk) != 0 && geli_passphrase(gelipw, - dsk.unit, 'p', curent + 1, &dsk) != 0) { + gdsk.gdev = geli_taste(vdev_read, &gdsk.dsk, + (gpttable[curent].ent_lba_end - gpttable[curent].ent_lba_start), + "disk%up%u:", gdsk.dsk.unit, curent + 1); + if (gdsk.gdev != NULL) { + if (geli_havekey(gdsk.gdev) != 0 && + geli_passphrase(gdsk.gdev, gelipw) != 0) { printf("%s: unable to decrypt GELI key\n", BOOTPROG); return (-1); } @@ -273,21 +284,18 @@ main(void) v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - dsk.drive = *(uint8_t *)PTOV(ARGS); - dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; - dsk.unit = dsk.drive & DRV_MASK; - dsk.part = -1; - dsk.start = 0; + gdsk.dsk.drive = *(uint8_t *)PTOV(ARGS); + gdsk.dsk.type = gdsk.dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; + gdsk.dsk.unit = gdsk.dsk.drive & DRV_MASK; + gdsk.dsk.part = -1; + gdsk.dsk.start = 0; bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_size = sizeof(bootinfo); bootinfo.bi_basemem = bios_basemem / 1024; bootinfo.bi_extmem = bios_extmem / 1024; bootinfo.bi_memsizes_valid++; - bootinfo.bi_bios_dev = dsk.drive; + bootinfo.bi_bios_dev = gdsk.dsk.drive; -#ifdef LOADER_GELI_SUPPORT - geli_init(); -#endif /* Process configuration file */ if (gptinit() != 0) @@ -332,8 +340,8 @@ main(void) load(); memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL)); load(); - gptbootfailed(&dsk); - if (gptfind(&freebsd_ufs_uuid, &dsk, -1) == -1) + gptbootfailed(&gdsk.dsk); + if (gptfind(&freebsd_ufs_uuid, &gdsk.dsk, -1) == -1) break; dsk_meta = 0; } @@ -345,8 +353,8 @@ main(void) printf("\nFreeBSD/x86 boot\n" "Default: %u:%s(%up%u)%s\n" "boot: ", - dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, - dsk.part, kname); + gdsk.dsk.drive & DRV_MASK, dev_nm[gdsk.dsk.type], + gdsk.dsk.unit, gdsk.dsk.part, kname); } if (ioctrl & IO_SERIAL) sio_flush(); @@ -392,10 +400,9 @@ load(void) if (!(ino = lookup(kname))) { if (!ls) { printf("%s: No %s on %u:%s(%up%u)\n", BOOTPROG, - kname, dsk.drive & DRV_MASK, dev_nm[dsk.type], - dsk.unit, - dsk.part); - } + kname, gdsk.dsk.drive & DRV_MASK, dev_nm[gdsk.dsk.type], + gdsk.dsk.unit, gdsk.dsk.part); + } return; } if (xfsread(ino, &hdr, sizeof(hdr))) @@ -469,19 +476,19 @@ load(void) } bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(kname); - bootinfo.bi_bios_dev = dsk.drive; + bootinfo.bi_bios_dev = gdsk.dsk.drive; #ifdef LOADER_GELI_SUPPORT geliargs.size = sizeof(geliargs); explicit_bzero(gelipw, sizeof(gelipw)); gelibuf = malloc(sizeof(struct keybuf) + (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); - geli_fill_keybuf(gelibuf); + geli_export_key_buffer(gelibuf); geliargs.notapw = '\0'; geliargs.keybuf_sentinel = KEYBUF_SENTINEL; geliargs.keybuf = gelibuf; #endif __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), - MAKEBOOTDEV(dev_maj[dsk.type], dsk.part + 1, dsk.unit, 0xff), + MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, gdsk.dsk.unit, 0xff), KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo) #ifdef LOADER_GELI_SUPPORT , geliargs @@ -595,12 +602,13 @@ dskread(void *buf, daddr_t lba, unsigned nblk) { int err; - err = drvread(&dsk, buf, lba + dsk.start, nblk); + err = drvread(&gdsk.dsk, buf, lba + gdsk.dsk.start, nblk); #ifdef LOADER_GELI_SUPPORT - if (err == 0 && is_geli(&dsk) == 0) { + if (err == 0 && gdsk.gdev != NULL) { /* Decrypt */ - if (geli_read(&dsk, lba * DEV_BSIZE, buf, nblk * DEV_BSIZE)) + if (geli_read(gdsk.gdev, lba * DEV_BSIZE, buf, + nblk * DEV_BSIZE)) return (err); } #endif @@ -610,8 +618,8 @@ dskread(void *buf, daddr_t lba, unsigned nblk) #ifdef LOADER_GELI_SUPPORT /* - * Read function compartible with the ZFS callback, required to keep the GELI - * Implementation the same for both UFS and ZFS + * Read function compatible with the ZFS callback, required to keep the GELI + * implementation the same for both UFS and ZFS. */ static int vdev_read(void *vdev __unused, void *priv, off_t off, void *buf, size_t bytes) @@ -619,22 +627,22 @@ vdev_read(void *vdev __unused, void *priv, off_t off, char *p; daddr_t lba; unsigned int nb; - struct dsk *dskp; + struct gptdsk *dskp; - dskp = (struct dsk *)priv; + dskp = (struct gptdsk *)priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) return (-1); p = buf; lba = off / DEV_BSIZE; - lba += dskp->start; + lba += dskp->dsk.start; while (bytes > 0) { nb = bytes / DEV_BSIZE; if (nb > VBLKSIZE / DEV_BSIZE) nb = VBLKSIZE / DEV_BSIZE; - if (drvread(dskp, dmadat->blkbuf, lba, nb)) + if (drvread(&dskp->dsk, dmadat->blkbuf, lba, nb)) return (-1); memcpy(p, dmadat->blkbuf, nb * DEV_BSIZE); p += nb * DEV_BSIZE; Modified: head/stand/i386/gptzfsboot/Makefile ============================================================================== --- head/stand/i386/gptzfsboot/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/gptzfsboot/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ Modified: head/stand/i386/isoboot/Makefile ============================================================================== --- head/stand/i386/isoboot/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/isoboot/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/gptboot \ Modified: head/stand/i386/libi386/Makefile ============================================================================== --- head/stand/i386/libi386/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/libi386/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - .include LIB= i386 Modified: head/stand/i386/libi386/biosdisk.c ============================================================================== --- head/stand/i386/libi386/biosdisk.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/libi386/biosdisk.c Fri Jul 13 17:50:25 2018 (r336252) @@ -51,31 +51,7 @@ __FBSDID("$FreeBSD$"); #include "libi386.h" #ifdef LOADER_GELI_SUPPORT -#include "cons.h" -#include "drv.h" -#include "gpt.h" -#include "part.h" -#include -struct pentry { - struct ptable_entry part; - uint64_t flags; - union { - uint8_t bsd; - uint8_t mbr; - uuid_t gpt; - uint16_t vtoc8; - } type; - STAILQ_ENTRY(pentry) entry; -}; -struct ptable { - enum ptable_type type; - uint16_t sectorsize; - uint64_t sectors; - - STAILQ_HEAD(, pentry) entries; -}; - -#include "geliboot.c" +#include "geliboot.h" #endif /* LOADER_GELI_SUPPORT */ #define BIOS_NUMDRIVES 0x475 @@ -138,17 +114,6 @@ static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static int bd_print(int verbose); -#ifdef LOADER_GELI_SUPPORT -enum isgeli { - ISGELI_UNKNOWN, - ISGELI_NO, - ISGELI_YES -}; -static enum isgeli geli_status[MAXBDDEV][MAXTBLENTS]; - -int bios_read(void *, void *, off_t off, void *buf, size_t bytes); -#endif /* LOADER_GELI_SUPPORT */ - struct devsw biosdisk = { "disk", DEVT_DISK, @@ -195,9 +160,6 @@ bd_init(void) { int base, unit, nfd = 0; -#ifdef LOADER_GELI_SUPPORT - geli_init(); -#endif /* sequence 0, 0x80 */ for (base = 0; base <= 0x80; base += 0x80) { for (unit = base; (nbdinfo < MAXBDDEV); unit++) { @@ -379,7 +341,7 @@ bd_print(int verbose) static int bd_open(struct open_file *f, ...) { - struct disk_devdesc *dev; + struct disk_devdesc *dev, rdev; struct disk_devdesc disk; int err, g_err; va_list ap; @@ -421,81 +383,6 @@ bd_open(struct open_file *f, ...) err = disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, BD(dev).bd_sectorsize); -#ifdef LOADER_GELI_SUPPORT - static char gelipw[GELI_PW_MAXLEN]; - char *passphrase; - - if (err) - return (err); - - /* if we already know there is no GELI, skip the rest */ - if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_UNKNOWN) - return (err); - - struct dsk dskp; - struct ptable *table = NULL; - struct ptable_entry part; - struct pentry *entry; - int geli_part = 0; - - dskp.drive = bd_unit2bios(dev->dd.d_unit); - dskp.type = dev->dd.d_dev->dv_type; - dskp.unit = dev->dd.d_unit; - dskp.slice = dev->d_slice; - dskp.part = dev->d_partition; - dskp.start = dev->d_offset; - - /* We need the LBA of the end of the partition */ - table = ptable_open(&disk, BD(dev).bd_sectors, - BD(dev).bd_sectorsize, ptblread); - if (table == NULL) { - DEBUG("Can't read partition table"); - /* soft failure, return the exit status of disk_open */ - return (err); - } - - if (table->type == PTABLE_GPT) - dskp.part = 255; - - STAILQ_FOREACH(entry, &table->entries, entry) { - dskp.slice = entry->part.index; - dskp.start = entry->part.start; - if (is_geli(&dskp) == 0) { - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - return (0); - } - if (geli_taste(bios_read, &dskp, - entry->part.end - entry->part.start) == 0) { - if (geli_havekey(&dskp) == 0) { - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - geli_part++; - continue; - } - if ((passphrase = getenv("kern.geom.eli.passphrase")) - != NULL) { - /* Use the cached passphrase */ - bcopy(passphrase, &gelipw, GELI_PW_MAXLEN); - } - if (geli_passphrase(gelipw, dskp.unit, 'p', - (dskp.slice > 0 ? dskp.slice : dskp.part), - &dskp) == 0) { - setenv("kern.geom.eli.passphrase", gelipw, 1); - bzero(gelipw, sizeof(gelipw)); - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES; - geli_part++; - continue; - } - } else - geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_NO; - } - - /* none of the partitions on this disk have GELI */ - if (geli_part == 0) { - /* found no GELI */ - geli_status[dev->dd.d_unit][dev->d_slice] = ISGELI_NO; - } -#endif /* LOADER_GELI_SUPPORT */ - return (err); } @@ -841,80 +728,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest) { -#ifdef LOADER_GELI_SUPPORT - struct dsk dskp; - off_t p_off, diff; - daddr_t alignlba; - int err, n, alignblks; - char *tmpbuf; - /* if we already know there is no GELI, skip the rest */ - if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_YES) - return (bd_io(dev, dblk, blks, dest, 0)); - - if (geli_status[dev->dd.d_unit][dev->d_slice] == ISGELI_YES) { - /* - * Align reads to DEV_GELIBOOT_BSIZE bytes because partial - * sectors cannot be decrypted. Round the requested LBA down to - * nearest multiple of DEV_GELIBOOT_BSIZE bytes. - */ - alignlba = rounddown2(dblk * BD(dev).bd_sectorsize, - DEV_GELIBOOT_BSIZE) / BD(dev).bd_sectorsize; - /* - * Round number of blocks to read up to nearest multiple of - * DEV_GELIBOOT_BSIZE - */ - diff = (dblk - alignlba) * BD(dev).bd_sectorsize; - alignblks = roundup2(blks * BD(dev).bd_sectorsize + diff, - DEV_GELIBOOT_BSIZE) / BD(dev).bd_sectorsize; - - /* - * If the read is rounded up to a larger size, use a temporary - * buffer here because the buffer provided by the caller may be - * too small. - */ - if (diff == 0) { - tmpbuf = dest; - } else { - tmpbuf = malloc(alignblks * BD(dev).bd_sectorsize); - if (tmpbuf == NULL) { - return (-1); - } - } - - if (alignlba + alignblks > BD(dev).bd_sectors) { - DEBUG("Shorted read at %llu from %d to %llu blocks", - alignlba, alignblks, BD(dev).bd_sectors - alignlba); - alignblks = BD(dev).bd_sectors - alignlba; - } - - err = bd_io(dev, alignlba, alignblks, tmpbuf, 0); - if (err) - return (err); - - dskp.drive = bd_unit2bios(dev->dd.d_unit); - dskp.type = dev->dd.d_dev->dv_type; - dskp.unit = dev->dd.d_unit; - dskp.slice = dev->d_slice; - dskp.part = dev->d_partition; - dskp.start = dev->d_offset; - - /* GELI needs the offset relative to the partition start */ - p_off = alignlba - dskp.start; - - err = geli_read(&dskp, p_off * BD(dev).bd_sectorsize, (u_char *)tmpbuf, - alignblks * BD(dev).bd_sectorsize); - if (err) - return (err); - - if (tmpbuf != dest) { - bcopy(tmpbuf + diff, dest, blks * BD(dev).bd_sectorsize); - free(tmpbuf); - } - return (0); - } -#endif /* LOADER_GELI_SUPPORT */ - return (bd_io(dev, dblk, blks, dest, 0)); } @@ -1009,25 +823,3 @@ bd_getdev(struct i386_devdesc *d) DEBUG("dev is 0x%x\n", rootdev); return(rootdev); } - -#ifdef LOADER_GELI_SUPPORT -int -bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes) -{ - struct disk_devdesc dev; - struct dsk *priv = xpriv; - - dev.dd.d_dev = &biosdisk; - dev.dd.d_unit = priv->unit; - dev.d_slice = priv->slice; - dev.d_partition = priv->part; - dev.d_offset = priv->start; - - off = off / BD(&dev).bd_sectorsize; - /* GELI gives us the offset relative to the partition start */ - off += dev.d_offset; - bytes = bytes / BD(&dev).bd_sectorsize; - - return (bd_io(&dev, off, bytes, buf, 0)); -} -#endif /* LOADER_GELI_SUPPORT */ Modified: head/stand/i386/libi386/bootinfo32.c ============================================================================== --- head/stand/i386/libi386/bootinfo32.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/libi386/bootinfo32.c Fri Jul 13 17:50:25 2018 (r336252) @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" - -static const size_t keybuf_size = sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent)); #endif static struct bootinfo bi; @@ -154,10 +151,6 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_o int bootdevnr, i, howto; char *kernelname; const char *kernelpath; -#ifdef LOADER_GELI_SUPPORT - char buf[keybuf_size]; - struct keybuf *keybuf = (struct keybuf *)buf; -#endif howto = bi_getboothowto(args); @@ -235,9 +228,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_o file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); bios_addsmapdata(kfp); #ifdef LOADER_GELI_SUPPORT - geli_fill_keybuf(keybuf); - file_addmetadata(kfp, MODINFOMD_KEYBUF, keybuf_size, buf); - bzero(buf, sizeof(buf)); + geli_export_key_metadata(kfp); #endif /* Figure out the size and location of the metadata */ Modified: head/stand/i386/libi386/bootinfo64.c ============================================================================== --- head/stand/i386/libi386/bootinfo64.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/libi386/bootinfo64.c Fri Jul 13 17:50:25 2018 (r336252) @@ -42,9 +42,6 @@ __FBSDID("$FreeBSD$"); #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" - -static const size_t keybuf_size = sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent)); #endif /* @@ -196,10 +193,6 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *m vm_offset_t size; char *rootdevname; int howto; -#ifdef LOADER_GELI_SUPPORT - char buf[keybuf_size]; - struct keybuf *keybuf = (struct keybuf *)buf; -#endif if (!bi_checkcpu()) { printf("CPU doesn't support long mode\n"); @@ -248,11 +241,8 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *m file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof module, &module); if (add_smap != 0) bios_addsmapdata(kfp); - #ifdef LOADER_GELI_SUPPORT - geli_fill_keybuf(keybuf); - file_addmetadata(kfp, MODINFOMD_KEYBUF, keybuf_size, buf); - bzero(buf, sizeof(buf)); + geli_export_key_metadata(kfp); #endif size = bi_copymodules64(0); Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/loader/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI= yes - LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/loader/main.c Fri Jul 13 17:50:25 2018 (r336252) @@ -175,7 +175,7 @@ main(void) if (zargs != NULL && zargs->size >= offsetof(struct zfs_boot_args, gelipw)) { if (zargs->size >= offsetof(struct zfs_boot_args, keybuf_sentinel) && zargs->keybuf_sentinel == KEYBUF_SENTINEL) { - geli_save_keybuf(zargs->keybuf); + geli_import_key_buffer(zargs->keybuf); } if (zargs->gelipw[0] != '\0') { setenv("kern.geom.eli.passphrase", zargs->gelipw, 1); @@ -190,7 +190,7 @@ main(void) gargs = (struct geli_boot_args *)(kargs + 1); if (gargs != NULL && gargs->size >= offsetof(struct geli_boot_args, gelipw)) { if (gargs->keybuf_sentinel == KEYBUF_SENTINEL) { - geli_save_keybuf(gargs->keybuf); + geli_import_key_buffer(gargs->keybuf); } if (gargs->gelipw[0] != '\0') { setenv("kern.geom.eli.passphrase", gargs->gelipw, 1); Modified: head/stand/i386/zfsboot/Makefile ============================================================================== --- head/stand/i386/zfsboot/Makefile Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/zfsboot/Makefile Fri Jul 13 17:50:25 2018 (r336252) @@ -1,7 +1,5 @@ # $FreeBSD$ -HAVE_GELI=yes - .include .PATH: ${BOOTSRC}/i386/boot2 ${BOOTSRC}/i386/common ${SASRC} Modified: head/stand/i386/zfsboot/zfsboot.c ============================================================================== --- head/stand/i386/zfsboot/zfsboot.c Fri Jul 13 17:42:48 2018 (r336251) +++ head/stand/i386/zfsboot/zfsboot.c Fri Jul 13 17:50:25 2018 (r336252) @@ -127,11 +127,18 @@ static void bios_getmem(void); int main(void); #ifdef LOADER_GELI_SUPPORT -#include "geliboot.c" +#include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; static struct keybuf *gelibuf; #endif +struct zfsdsk { + struct dsk dsk; +#ifdef LOADER_GELI_SUPPORT + struct geli_dev *gdev; +#endif +}; + #include "zfsimpl.c" /* @@ -174,14 +181,14 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu daddr_t lba, alignlba; off_t diff; unsigned int nb, alignnb; - struct dsk *dsk = (struct dsk *) priv; + struct zfsdsk *zdsk = (struct zfsdsk *) priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) return -1; p = buf; lba = off / DEV_BSIZE; - lba += dsk->start; + lba += zdsk->dsk.start; /* * Align reads to 4k else 4k sector GELIs will not decrypt. * Round LBA down to nearest multiple of DEV_GELIBOOT_BSIZE bytes. @@ -191,7 +198,7 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu * The read must be aligned to DEV_GELIBOOT_BSIZE bytes relative to the * start of the GELI partition, not the start of the actual disk. */ - alignlba += dsk->start; + alignlba += zdsk->dsk.start; diff = (lba - alignlba) * DEV_BSIZE; while (bytes > 0) { @@ -209,18 +216,20 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu alignnb = roundup2(nb * DEV_BSIZE + diff, DEV_GELIBOOT_BSIZE) / DEV_BSIZE; - if (dsk->size > 0 && alignlba + alignnb > dsk->size + dsk->start) { - printf("Shortening read at %lld from %d to %lld\n", alignlba, - alignnb, (dsk->size + dsk->start) - alignlba); - alignnb = (dsk->size + dsk->start) - alignlba; + if (zdsk->dsk.size > 0 && alignlba + alignnb > + zdsk->dsk.size + zdsk->dsk.start) { + printf("Shortening read at %lld from %d to %lld\n", + alignlba, alignnb, + (zdsk->dsk.size + zdsk->dsk.start) - alignlba); + alignnb = (zdsk->dsk.size + zdsk->dsk.start) - alignlba; } - if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb)) + if (drvread(&zdsk->dsk, dmadat->rdbuf, alignlba, alignnb)) return -1; #ifdef LOADER_GELI_SUPPORT /* decrypt */ - if (is_geli(dsk) == 0) { - if (geli_read(dsk, ((alignlba - dsk->start) * + if (zdsk->gdev != NULL) { + if (geli_read(zdsk->gdev, ((alignlba - zdsk->dsk.start) * DEV_BSIZE), dmadat->rdbuf, alignnb * DEV_BSIZE)) return (-1); } @@ -250,20 +259,20 @@ vdev_write(vdev_t *vdev, void *priv, off_t off, void * char *p; daddr_t lba; unsigned int nb; - struct dsk *dsk = (struct dsk *) priv; + struct zfsdsk *zdsk = (struct zfsdsk *) priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) return -1; p = buf; lba = off / DEV_BSIZE; - lba += dsk->start; + lba += zdsk->dsk.start; while (bytes > 0) { nb = bytes / DEV_BSIZE; if (nb > READ_BUF_SIZE / DEV_BSIZE) nb = READ_BUF_SIZE / DEV_BSIZE; memcpy(dmadat->rdbuf, p, nb * DEV_BSIZE); - if (drvwrite(dsk, dmadat->rdbuf, lba, nb)) + if (drvwrite(&zdsk->dsk, dmadat->rdbuf, lba, nb)) return -1; p += nb * DEV_BSIZE; lba += nb; @@ -441,13 +450,13 @@ int13probe(int drive) * We call this when we find a ZFS vdev - ZFS consumes the dsk * structure so we must make a new one. */ -static struct dsk * -copy_dsk(struct dsk *dsk) +static struct zfsdsk * +copy_dsk(struct zfsdsk *zdsk) { - struct dsk *newdsk; + struct zfsdsk *newdsk; - newdsk = malloc(sizeof(struct dsk)); - *newdsk = *dsk; + newdsk = malloc(sizeof(struct zfsdsk)); + *newdsk = *zdsk; return (newdsk); } @@ -459,11 +468,14 @@ copy_dsk(struct dsk *dsk) * with boot2 and we can not afford to grow that code. */ static uint64_t -drvsize_ext(struct dsk *dskp) +drvsize_ext(struct zfsdsk *zdsk) { + struct dsk *dskp; uint64_t size, tmp; int cyl, hds, sec; + dskp = &zdsk->dsk; + v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0x800; @@ -508,17 +520,17 @@ drvsize_ext(struct dsk *dskp) uint64_t ldi_get_size(void *priv) { - struct dsk *dskp = priv; - uint64_t size = dskp->size; + struct zfsdsk *zdsk = priv; + uint64_t size = zdsk->dsk.size; - if (dskp->start == 0) - size = drvsize_ext(dskp); + if (zdsk->dsk.start == 0) + size = drvsize_ext(zdsk); return (size * DEV_BSIZE); } static void -probe_drive(struct dsk *dsk) +probe_drive(struct zfsdsk *zdsk) { #ifdef GPT struct gpt_hdr hdr; @@ -537,7 +549,7 @@ probe_drive(struct dsk *dsk) /* * If we find a vdev on the whole disk, stop here. */ - if (vdev_probe(vdev_read2, dsk, NULL) == 0) + if (vdev_probe(vdev_read2, zdsk, NULL) == 0) return; #ifdef LOADER_GELI_SUPPORT @@ -547,14 +559,15 @@ probe_drive(struct dsk *dsk) * out the partition table and probe each slice/partition * in turn for a vdev or GELI encrypted vdev. */ - elba = drvsize_ext(dsk); + elba = drvsize_ext(zdsk); if (elba > 0) { elba--; } - if (geli_taste(vdev_read, dsk, elba) == 0) { - if (geli_havekey(dsk) == 0 || geli_passphrase(gelipw, dsk->unit, - ':', 0, dsk) == 0) { - if (vdev_probe(vdev_read2, dsk, NULL) == 0) { + zdsk->gdev = geli_taste(vdev_read, zdsk, elba, "disk%u:0:"); + if (zdsk->gdev != NULL) { + if (geli_havekey(zdsk->gdev) == 0 || + geli_passphrase(zdsk->gdev, gelipw) == 0) { + if (vdev_probe(vdev_read2, zdsk, NULL) == 0) { return; } } @@ -562,13 +575,13 @@ probe_drive(struct dsk *dsk) #endif /* LOADER_GELI_SUPPORT */ sec = dmadat->secbuf; - dsk->start = 0; + zdsk->dsk.start = 0; #ifdef GPT /* * First check for GPT. */ - if (drvread(dsk, sec, 1, 1)) { + if (drvread(&zdsk->dsk, sec, 1, 1)) { return; } memcpy(&hdr, sec, sizeof(hdr)); @@ -590,38 +603,39 @@ probe_drive(struct dsk *dsk) slba = hdr.hdr_lba_table; elba = slba + hdr.hdr_entries / entries_per_sec; while (slba < elba) { - dsk->start = 0; - if (drvread(dsk, sec, slba, 1)) + zdsk->dsk.start = 0; + if (drvread(&zdsk->dsk, sec, slba, 1)) return; for (part = 0; part < entries_per_sec; part++) { ent = (struct gpt_ent *)(sec + part * hdr.hdr_entsz); if (memcmp(&ent->ent_type, &freebsd_zfs_uuid, sizeof(uuid_t)) == 0) { - dsk->start = ent->ent_lba_start; - dsk->size = ent->ent_lba_end - ent->ent_lba_start + 1; - dsk->slice = part + 1; - dsk->part = 255; - if (vdev_probe(vdev_read2, dsk, NULL) == 0) { + zdsk->dsk.start = ent->ent_lba_start; + zdsk->dsk.size = ent->ent_lba_end - ent->ent_lba_start + 1; + zdsk->dsk.slice = part + 1; + zdsk->dsk.part = 255; + if (vdev_probe(vdev_read2, zdsk, NULL) == 0) { /* * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. */ - dsk = copy_dsk(dsk); + zdsk = copy_dsk(zdsk); } #ifdef LOADER_GELI_SUPPORT - else if (geli_taste(vdev_read, dsk, ent->ent_lba_end - - ent->ent_lba_start) == 0) { - if (geli_havekey(dsk) == 0 || geli_passphrase(gelipw, - dsk->unit, 'p', dsk->slice, dsk) == 0) { + else if ((zdsk->gdev = geli_taste(vdev_read, zdsk, + ent->ent_lba_end - ent->ent_lba_start, "disk%up%u:", + zdsk->dsk.unit, zdsk->dsk.slice)) != NULL) { + if (geli_havekey(zdsk->gdev) == 0 || + geli_passphrase(zdsk->gdev, gelipw) == 0) { /* * This slice has GELI, check it for ZFS. */ - if (vdev_probe(vdev_read2, dsk, NULL) == 0) { + if (vdev_probe(vdev_read2, zdsk, NULL) == 0) { /* * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. */ - dsk = copy_dsk(dsk); + zdsk = copy_dsk(zdsk); } break; } @@ -635,33 +649,33 @@ probe_drive(struct dsk *dsk) trymbr: #endif /* GPT */ - if (drvread(dsk, sec, DOSBBSECTOR, 1)) + if (drvread(&zdsk->dsk, sec, DOSBBSECTOR, 1)) return; dp = (void *)(sec + DOSPARTOFF); for (i = 0; i < NDOSPART; i++) { if (!dp[i].dp_typ) continue; - dsk->start = dp[i].dp_start; - dsk->size = dp[i].dp_size; - dsk->slice = i + 1; - if (vdev_probe(vdev_read2, dsk, NULL) == 0) { - dsk = copy_dsk(dsk); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jul 13 18:00:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50A1F104655D; Fri, 13 Jul 2018 18:00:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 038F0715FA; Fri, 13 Jul 2018 18:00:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8F0E13896; Fri, 13 Jul 2018 18:00:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DI0D5P029758; Fri, 13 Jul 2018 18:00:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DI0DoH029757; Fri, 13 Jul 2018 18:00:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131800.w6DI0DoH029757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 18:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336253 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 336253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 18:00:14 -0000 Author: imp Date: Fri Jul 13 18:00:13 2018 New Revision: 336253 URL: https://svnweb.freebsd.org/changeset/base/336253 Log: Add missing include of sys/boot.h Modified: head/sys/dev/ofw/ofw_subr.c Modified: head/sys/dev/ofw/ofw_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_subr.c Fri Jul 13 17:50:25 2018 (r336252) +++ head/sys/dev/ofw/ofw_subr.c Fri Jul 13 18:00:13 2018 (r336253) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include From owner-svn-src-head@freebsd.org Fri Jul 13 18:19:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23C51047027; Fri, 13 Jul 2018 18:19:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 549427214D; Fri, 13 Jul 2018 18:19:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 360CF13BD3; Fri, 13 Jul 2018 18:19:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DIJXYY039827; Fri, 13 Jul 2018 18:19:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DIJXRq039826; Fri, 13 Jul 2018 18:19:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131819.w6DIJXRq039826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 18:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336254 - head/stand/libsa/geli X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa/geli X-SVN-Commit-Revision: 336254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 18:19:34 -0000 Author: imp Date: Fri Jul 13 18:19:33 2018 New Revision: 336254 URL: https://svnweb.freebsd.org/changeset/base/336254 Log: Use if rather than case for a simple boolean. gcc thinks blks is undefined sometimes with the case, but enc is always 0 or 1, so and if / else is better anyway. Modified: head/stand/libsa/geli/geliboot_crypto.c Modified: head/stand/libsa/geli/geliboot_crypto.c ============================================================================== --- head/stand/libsa/geli/geliboot_crypto.c Fri Jul 13 18:00:13 2018 (r336253) +++ head/stand/libsa/geli/geliboot_crypto.c Fri Jul 13 18:19:33 2018 (r336254) @@ -59,15 +59,14 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size return (err); } - switch (enc) { - case 0: /* decrypt */ + if (enc == 0) { + /* decrypt */ blks = rijndael_blockDecrypt(&cipher, &aeskey, data, datasize * 8, data); - break; - case 1: /* encrypt */ + } else { + /* encrypt */ blks = rijndael_blockEncrypt(&cipher, &aeskey, data, datasize * 8, data); - break; } if (datasize != (blks / 8)) { printf("Failed to decrypt the entire input: " From owner-svn-src-head@freebsd.org Fri Jul 13 18:21:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C70F10471D2; Fri, 13 Jul 2018 18:21:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1204B7251A; Fri, 13 Jul 2018 18:21:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E866213C29; Fri, 13 Jul 2018 18:21:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DILcXU043898; Fri, 13 Jul 2018 18:21:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DILccE043897; Fri, 13 Jul 2018 18:21:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807131821.w6DILccE043897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 18:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336255 - head/sys/geom/eli X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom/eli X-SVN-Commit-Revision: 336255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 18:21:39 -0000 Author: imp Date: Fri Jul 13 18:21:38 2018 New Revision: 336255 URL: https://svnweb.freebsd.org/changeset/base/336255 Log: g_eli_key_cmp is used only in the kernel, so only define it in the kernel. Modified: head/sys/geom/eli/g_eli_key_cache.c Modified: head/sys/geom/eli/g_eli_key_cache.c ============================================================================== --- head/sys/geom/eli/g_eli_key_cache.c Fri Jul 13 18:19:33 2018 (r336254) +++ head/sys/geom/eli/g_eli_key_cache.c Fri Jul 13 18:21:38 2018 (r336255) @@ -61,8 +61,6 @@ static uint64_t g_eli_key_cache_misses; SYSCTL_UQUAD(_kern_geom_eli, OID_AUTO, key_cache_misses, CTLFLAG_RW, &g_eli_key_cache_misses, 0, "Key cache misses"); -#endif /* _KERNEL */ - static int g_eli_key_cmp(const struct g_eli_key *a, const struct g_eli_key *b) { @@ -73,6 +71,7 @@ g_eli_key_cmp(const struct g_eli_key *a, const struct return (-1); return (0); } +#endif /* _KERNEL */ void g_eli_key_fill(struct g_eli_softc *sc, struct g_eli_key *key, uint64_t keyno) From owner-svn-src-head@freebsd.org Fri Jul 13 18:31:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 484B41047A01 for ; Fri, 13 Jul 2018 18:31:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-20.consmr.mail.gq1.yahoo.com (sonic306-20.consmr.mail.gq1.yahoo.com [98.137.68.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF16772B61 for ; Fri, 13 Jul 2018 18:31:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: OM7CAsIVM1ke_CJdmh9MZK80MHB5nr9264kdCYBMWDGFz9GmttkkYmsBZNKGtIV 2tHYQPWCtpooxgDsrLbKp4c1XKkUQAjsnjlwkzn5zEa1q1xgeDJ_6hGmIZvauSw3t2uJSp.oVC5P EU1wJaySTq5_4NenHOsi18srx0GmZ00v6P53Q5YZZxFyZZpXGX9RXXliPIn8TatvtQNKbf_rpDMF jTDkSs6jdMxvW4_KVpTk.XqHX3NA1KKrWlj0rc7ErQuzixhXut_m5nzArFehznqP1PuuIcnirptu KxeS_UR2E0vyO_l3vnknM6d0j5VafiIl3uzj7KwF1Y7MXBp80Tqh4S7D_bQgyeIVArZyWnx.JK3X qHZof9XJTIyAd463CqxnUlXF6NRTlF8qF2cJtu3Z3_sPe6bK6bPvkoeXq3HzpzF3H3Y4TMvWFWvO w_0kFkc_iEFBrOPhIH3rpeAiXSmhHbjRWsErGYiIyU4PrVEWiD1KyqaGP2.uwMZ9VENKlaCreBL9 og9ufaKs44Shr4DfvK7yJLwxVo3otYrQ4LD89HcjJCDDFjBkzGznuxxy_eypJbvn3yoa1kPmVb3Z 9DSuohnMUpwQLvg6T6OrBjmlEdsLM3qbvy.V_6eYRvePkwUvxST1HN.GBmgVcpg50XgeS.GCCFMg IKZdTami3OoTV6L2pY46lwFYz9zw630dZ4DtZE.F5BMirGtIErROzhnU2x8LdDM1NSjFhfOGoFUE Wv.nZOorYe5Ze5CMCUaEP3sulUyVX2MIiYtj9.5A6pR6VcCXgv1t9LtVO4ciZ_o52Qci1Zgq1CW2 c5ZOVhp8PXBc.mf3_7vGVp4V6y2O4C.U.XkX0HA1ALUwz24Z8g9CbzAl5jhRotXeGMwJz7.zK7pz 5t947Ab5Uoqb9EIcAhKCmCZa8xFeO.eN5jENlwq4RgOa27x35Wv.WZhkZs6YOXiNNBrJ7bcKfuKk q6hzjJ9dCZ3Fh.uPnBD1pkMyP67mBGxWPYoNjojd8ym.X2opwufovXC3Q3C6cMg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.gq1.yahoo.com with HTTP; Fri, 13 Jul 2018 18:31:20 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 26e94217122c3788126bbd55fe7e289b; Fri, 13 Jul 2018 18:21:11 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r336252 - in head: [ broke the ci.freebsd.org's FreeBSD-head-{mips,mips64,powerpc,powerpc64,sparc64,???}-build ] Message-Id: Date: Fri, 13 Jul 2018 11:21:10 -0700 To: ian@FreeBSD.org, svn-src-head@freebsd.org, FreeBSD Current X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 18:31:28 -0000 [Note: mips64 built for -r336251 but failed for -r336252 and -r336253 .] An example (mips64): --- all_subdir_stand --- cc1: warnings being treated as errors /usr/src/stand/libsa/geli/geliboot_crypto.c: In function = 'geliboot_crypt': /usr/src/stand/libsa/geli/geliboot_crypto.c:45: warning: 'blks' may be = used uninitialized in this function *** [geliboot_crypto.o] Error code 1 (A bunch of architectures are still building their first build after -r336251 .) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jul 13 18:58:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AB2C10488EB; Fri, 13 Jul 2018 18:58:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0DD173AE3; Fri, 13 Jul 2018 18:58:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF22C14236; Fri, 13 Jul 2018 18:58:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DIwbVd060058; Fri, 13 Jul 2018 18:58:37 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DIwbVJ060057; Fri, 13 Jul 2018 18:58:37 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807131858.w6DIwbVJ060057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 13 Jul 2018 18:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336256 - head/stand/i386/gptboot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/stand/i386/gptboot X-SVN-Commit-Revision: 336256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 18:58:38 -0000 Author: ian Date: Fri Jul 13 18:58:37 2018 New Revision: 336256 URL: https://svnweb.freebsd.org/changeset/base/336256 Log: Fix glitched indentation (and rewrap as needed due to deeper indent). No functional changes. Reported by: rpokala@ Modified: head/stand/i386/gptboot/gptboot.c Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Fri Jul 13 18:21:38 2018 (r336255) +++ head/stand/i386/gptboot/gptboot.c Fri Jul 13 18:58:37 2018 (r336256) @@ -400,9 +400,10 @@ load(void) if (!(ino = lookup(kname))) { if (!ls) { printf("%s: No %s on %u:%s(%up%u)\n", BOOTPROG, - kname, gdsk.dsk.drive & DRV_MASK, dev_nm[gdsk.dsk.type], - gdsk.dsk.unit, gdsk.dsk.part); - } + kname, gdsk.dsk.drive & DRV_MASK, + dev_nm[gdsk.dsk.type], gdsk.dsk.unit, + gdsk.dsk.part); + } return; } if (xfsread(ino, &hdr, sizeof(hdr))) From owner-svn-src-head@freebsd.org Fri Jul 13 19:43:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DA29104A08B; Fri, 13 Jul 2018 19:43:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD9067548C; Fri, 13 Jul 2018 19:42:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA97F14A2F; Fri, 13 Jul 2018 19:42:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DJgxsI085316; Fri, 13 Jul 2018 19:42:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DJgxN1085315; Fri, 13 Jul 2018 19:42:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807131942.w6DJgxN1085315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 13 Jul 2018 19:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336257 - head/sys/x86/include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/x86/include X-SVN-Commit-Revision: 336257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 19:43:00 -0000 Author: markj Date: Fri Jul 13 19:42:59 2018 New Revision: 336257 URL: https://svnweb.freebsd.org/changeset/base/336257 Log: Define the MSR used to fetch the current microcode patch level on AMD. It is defined in the AMD family 17h register reference. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Fri Jul 13 18:58:37 2018 (r336256) +++ head/sys/x86/include/specialreg.h Fri Jul 13 19:42:59 2018 (r336257) @@ -973,6 +973,7 @@ #define AMD_WT_ALLOC_FRE 0x10000 /* fixed (A0000-FFFFF) range enable */ /* AMD64 MSR's */ +#define MSR_PATCH_LEVEL 0x0000008b /* microcode revision number */ #define MSR_EFER 0xc0000080 /* extended features */ #define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target/cs/ss */ #define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target rip */ From owner-svn-src-head@freebsd.org Fri Jul 13 19:45:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 198C4104A354; Fri, 13 Jul 2018 19:45:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0585756DC; Fri, 13 Jul 2018 19:45:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F04114A30; Fri, 13 Jul 2018 19:45:12 +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 w6DJjCfC085480; Fri, 13 Jul 2018 19:45:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DJjCQ9085479; Fri, 13 Jul 2018 19:45:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807131945.w6DJjCQ9085479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 13 Jul 2018 19:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336258 - head/usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/cpucontrol X-SVN-Commit-Revision: 336258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 19:45:13 -0000 Author: markj Date: Fri Jul 13 19:45:12 2018 New Revision: 336258 URL: https://svnweb.freebsd.org/changeset/base/336258 Log: Use the name added in r336257. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/cpucontrol/amd10h.c Modified: head/usr.sbin/cpucontrol/amd10h.c ============================================================================== --- head/usr.sbin/cpucontrol/amd10h.c Fri Jul 13 19:42:59 2018 (r336257) +++ head/usr.sbin/cpucontrol/amd10h.c Fri Jul 13 19:45:12 2018 (r336258) @@ -129,7 +129,7 @@ amd10h_update(const char *dev, const char *path) } signature = idargs.data[0]; - msrargs.msr = 0x0000008b; + msrargs.msr = MSR_PATCH_LEVEL; error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); if (error < 0) { WARN(0, "ioctl(%s)", dev); @@ -295,7 +295,7 @@ amd10h_update(const char *dev, const char *path) fprintf(stderr, "done.\n"); } - msrargs.msr = 0x0000008b; + msrargs.msr = MSR_PATCH_LEVEL; error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); if (error < 0) { WARN(0, "ioctl(%s)", dev); From owner-svn-src-head@freebsd.org Fri Jul 13 19:54:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365FD104A93C; Fri, 13 Jul 2018 19:54:24 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE8E075CCB; Fri, 13 Jul 2018 19:54:23 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8BA714BBC; Fri, 13 Jul 2018 19:54:23 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DJsN99090282; Fri, 13 Jul 2018 19:54:23 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DJsM8q090278; Fri, 13 Jul 2018 19:54:22 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201807131954.w6DJsM8q090278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Fri, 13 Jul 2018 19:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336259 - in head/sys: arm/xilinx arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: arm/xilinx arm64/conf conf X-SVN-Commit-Revision: 336259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 19:54:24 -0000 Author: mw Date: Fri Jul 13 19:54:22 2018 New Revision: 336259 URL: https://svnweb.freebsd.org/changeset/base/336259 Log: Enable UART support for Xilinx Ultrascale+ SoCs Xilinx Ultrascale+ are based on Cortex-A53 and use existing UART driver (uart_dev_cdnc). Enable it in arm64 GENERIC config. Submitted by: Michal Stanek Obtained from: Semihalf Modified: head/sys/arm/xilinx/uart_dev_cdnc.c head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 head/sys/conf/options.arm64 Modified: head/sys/arm/xilinx/uart_dev_cdnc.c ============================================================================== --- head/sys/arm/xilinx/uart_dev_cdnc.c Fri Jul 13 19:45:12 2018 (r336258) +++ head/sys/arm/xilinx/uart_dev_cdnc.c Fri Jul 13 19:54:22 2018 (r336259) @@ -711,6 +711,8 @@ static struct uart_class uart_cdnc_class = { static struct ofw_compat_data compat_data[] = { {"cadence,uart", (uintptr_t)&uart_cdnc_class}, + {"cdns,uart-r1p12", (uintptr_t)&uart_cdnc_class}, + {"xlnx,xuartps", (uintptr_t)&uart_cdnc_class}, {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data); Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Jul 13 19:45:12 2018 (r336258) +++ head/sys/arm64/conf/GENERIC Fri Jul 13 19:54:22 2018 (r336259) @@ -106,6 +106,7 @@ options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 options SOC_BRCM_BCM2837 options SOC_ROCKCHIP_RK3328 +options SOC_XILINX_ZYNQ # Annapurna Alpine drivers device al_ccu # Alpine Cache Coherency Unit Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Jul 13 19:45:12 2018 (r336258) +++ head/sys/conf/files.arm64 Fri Jul 13 19:54:22 2018 (r336259) @@ -87,6 +87,7 @@ arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt +arm/xilinx/uart_dev_cdnc.c optional uart soc_xilinx_zynq arm64/acpica/acpi_machdep.c optional acpi arm64/acpica/OsdEnvironment.c optional acpi arm64/acpica/acpi_wakeup.c optional acpi Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Fri Jul 13 19:45:12 2018 (r336258) +++ head/sys/conf/options.arm64 Fri Jul 13 19:54:22 2018 (r336259) @@ -20,3 +20,4 @@ SOC_BRCM_BCM2837 opt_soc.h SOC_CAVM_THUNDERX opt_soc.h SOC_HISI_HI6220 opt_soc.h SOC_ROCKCHIP_RK3328 opt_soc.h +SOC_XILINX_ZYNQ opt_soc.h From owner-svn-src-head@freebsd.org Fri Jul 13 20:03:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54F1C104AD06; Fri, 13 Jul 2018 20:03:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04B5B76167; Fri, 13 Jul 2018 20:03:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEBBE14D4A; Fri, 13 Jul 2018 20:03:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DK35NQ095551; Fri, 13 Jul 2018 20:03:05 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DK35MK095550; Fri, 13 Jul 2018 20:03:05 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807132003.w6DK35MK095550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 13 Jul 2018 20:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336260 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 336260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:03:06 -0000 Author: rmacklem Date: Fri Jul 13 20:03:05 2018 New Revision: 336260 URL: https://svnweb.freebsd.org/changeset/base/336260 Log: Close down the TCP connection to a pNFS DS when it is disabled. So long as the TCP connection to a pNFS DS isn't shared with other DSs, it can be closed down when the DS is being disabled in the pNFS client. This causes any RPCs in progress to fail. This patch only affects the NFSv4.1 pNFS client when errors occur while doing I/O on a DS. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Fri Jul 13 19:54:22 2018 (r336259) +++ head/sys/fs/nfsclient/nfs_clstate.c Fri Jul 13 20:03:05 2018 (r336260) @@ -125,6 +125,7 @@ static struct nfscldeleg *nfscl_finddeleg(struct nfscl static void nfscl_retoncloselayout(vnode_t, struct nfsclclient *, uint8_t *, int, struct nfsclrecalllayout **); static void nfscl_reldevinfo_locked(struct nfscldevinfo *); +static void nfscl_cancelreqs(struct nfsclds *); static struct nfscllayout *nfscl_findlayout(struct nfsclclient *, u_int8_t *, int); static struct nfscldevinfo *nfscl_finddevinfo(struct nfsclclient *, uint8_t *); @@ -4971,14 +4972,16 @@ nfscl_retoncloselayout(vnode_t vp, struct nfsclclient /* * Mark the layout to be recalled and with an error. + * Also, disable the dsp from further use. */ void nfscl_dserr(uint32_t op, uint32_t stat, struct nfscldevinfo *dp, - struct nfscllayout *lyp, __unused struct nfsclds *dsp) + struct nfscllayout *lyp, struct nfsclds *dsp) { struct nfsclrecalllayout *recallp; uint32_t iomode; + printf("DS being disabled, error=%d\n", stat); /* Set up the return of the layout. */ recallp = malloc(sizeof(*recallp), M_NFSLAYRECALL, M_WAITOK); iomode = 0; @@ -4997,6 +5000,39 @@ nfscl_dserr(uint32_t op, uint32_t stat, struct nfsclde NFSUNLOCKCLSTATE(); free(recallp, M_NFSLAYRECALL); } + + /* If the connection isn't used for other DSs, we can shut it down. */ + if ((dsp->nfsclds_flags & NFSCLDS_SAMECONN) == 0) + nfscl_cancelreqs(dsp); +} + +/* + * Cancel all RPCs for this "dsp" by closing the connection. + * Also, mark the session as defunct. + */ +static void +nfscl_cancelreqs(struct nfsclds *dsp) +{ + struct __rpc_client *cl; + static int non_event; + + NFSLOCKDS(dsp); + if ((dsp->nfsclds_flags & (NFSCLDS_CLOSED | NFSCLDS_SAMECONN)) == 0 && + dsp->nfsclds_sockp != NULL && + dsp->nfsclds_sockp->nr_client != NULL) { + dsp->nfsclds_flags |= NFSCLDS_CLOSED; + cl = dsp->nfsclds_sockp->nr_client; + dsp->nfsclds_sess.nfsess_defunct = 1; + NFSUNLOCKDS(dsp); + CLNT_CLOSE(cl); + /* + * This 1sec sleep is done to reduce the number of reconnect + * attempts made on the DS while it has failed. + */ + tsleep(&non_event, PVFS, "ndscls", hz); + return; + } + NFSUNLOCKDS(dsp); } /* From owner-svn-src-head@freebsd.org Fri Jul 13 20:08:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E30AE104AED7; Fri, 13 Jul 2018 20:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86AFD76352; Fri, 13 Jul 2018 20:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 639ED14D51; Fri, 13 Jul 2018 20:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DK8Jvw095815; Fri, 13 Jul 2018 20:08:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DK8JIL095814; Fri, 13 Jul 2018 20:08:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807132008.w6DK8JIL095814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 20:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336261 - head/stand/i386/kgzldr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/i386/kgzldr X-SVN-Commit-Revision: 336261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:08:20 -0000 Author: imp Date: Fri Jul 13 20:08:18 2018 New Revision: 336261 URL: https://svnweb.freebsd.org/changeset/base/336261 Log: Catch up to the inflate renaming. Modified: head/stand/i386/kgzldr/Makefile Modified: head/stand/i386/kgzldr/Makefile ============================================================================== --- head/stand/i386/kgzldr/Makefile Fri Jul 13 20:03:05 2018 (r336260) +++ head/stand/i386/kgzldr/Makefile Fri Jul 13 20:08:18 2018 (r336261) @@ -7,7 +7,7 @@ STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} -SRCS= start.s boot.c inflate.c lib.c crt.s sio.s +SRCS= start.s boot.c subr_inflate.c lib.c crt.s sio.s CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= From owner-svn-src-head@freebsd.org Fri Jul 13 20:33:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FC6E104BA58; Fri, 13 Jul 2018 20:33:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F61577202; Fri, 13 Jul 2018 20:33:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F3A71521B; Fri, 13 Jul 2018 20:33:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DKXAGM010905; Fri, 13 Jul 2018 20:33:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DKXAiu010904; Fri, 13 Jul 2018 20:33:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807132033.w6DKXAiu010904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 20:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336262 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 336262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:33:11 -0000 Author: imp Date: Fri Jul 13 20:33:10 2018 New Revision: 336262 URL: https://svnweb.freebsd.org/changeset/base/336262 Log: Fix machdep_boot.c A last minute change made this no longer compile. Pass the right arg and eliminate now-unused variables from the code. Modified: head/sys/arm/arm/machdep_boot.c Modified: head/sys/arm/arm/machdep_boot.c ============================================================================== --- head/sys/arm/arm/machdep_boot.c Fri Jul 13 20:08:18 2018 (r336261) +++ head/sys/arm/arm/machdep_boot.c Fri Jul 13 20:33:10 2018 (r336262) @@ -148,13 +148,11 @@ arm_print_kenv(void) static void cmdline_set_env(char *cmdline, const char *guard) { - char *cmdline_next; - size_t size, guard_len; + size_t guard_len; - size = strlen(cmdline); /* Skip leading spaces. */ - for (; isspace(*cmdline) && (size > 0); cmdline++) - size--; + while (isspace(*cmdline)) + cmdline++; /* Test and remove guard. */ if (guard != NULL && guard[0] != '\0') { @@ -162,10 +160,9 @@ cmdline_set_env(char *cmdline, const char *guard) if (strncasecmp(cmdline, guard, guard_len) != 0) return; cmdline += guard_len; - size -= guard_len; } - boothowto |= boot_parse_cmdline(); + boothowto |= boot_parse_cmdline(cmdline); } /* From owner-svn-src-head@freebsd.org Fri Jul 13 20:39:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A28E104BD0B; Fri, 13 Jul 2018 20:39:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B6E0775B3; Fri, 13 Jul 2018 20:39:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w6DKcsN4075686 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 13 Jul 2018 23:38:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w6DKcsN4075686 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w6DKcsEX075685; Fri, 13 Jul 2018 23:38:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Jul 2018 23:38:54 +0300 From: Konstantin Belousov To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336257 - head/sys/x86/include Message-ID: <20180713203854.GP5562@kib.kiev.ua> References: <201807131942.w6DJgxN1085315@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807131942.w6DJgxN1085315@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:39:02 -0000 On Fri, Jul 13, 2018 at 07:42:59PM +0000, Mark Johnston wrote: > Author: markj > Date: Fri Jul 13 19:42:59 2018 > New Revision: 336257 > URL: https://svnweb.freebsd.org/changeset/base/336257 > > Log: > Define the MSR used to fetch the current microcode patch level on AMD. > > It is defined in the AMD family 17h register reference. > > MFC after: 3 days > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/x86/include/specialreg.h > > Modified: head/sys/x86/include/specialreg.h > ============================================================================== > --- head/sys/x86/include/specialreg.h Fri Jul 13 18:58:37 2018 (r336256) > +++ head/sys/x86/include/specialreg.h Fri Jul 13 19:42:59 2018 (r336257) > @@ -973,6 +973,7 @@ > #define AMD_WT_ALLOC_FRE 0x10000 /* fixed (A0000-FFFFF) range enable */ > > /* AMD64 MSR's */ > +#define MSR_PATCH_LEVEL 0x0000008b /* microcode revision number */ This register is called MSR_BIOS_SIGN. It is defined for Intel as well. > #define MSR_EFER 0xc0000080 /* extended features */ > #define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target/cs/ss */ > #define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target rip */ From owner-svn-src-head@freebsd.org Fri Jul 13 20:56:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19ADB104C8FB; Fri, 13 Jul 2018 20:56:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B84C27824C; Fri, 13 Jul 2018 20:56:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B4071555C; Fri, 13 Jul 2018 20:56:20 +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 w6DKuKeI021897; Fri, 13 Jul 2018 20:56:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DKuKZu021895; Fri, 13 Jul 2018 20:56:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807132056.w6DKuKZu021895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 13 Jul 2018 20:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336263 - in head: sys/x86/include usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: sys/x86/include usr.sbin/cpucontrol X-SVN-Commit-Revision: 336263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:56:21 -0000 Author: markj Date: Fri Jul 13 20:56:20 2018 New Revision: 336263 URL: https://svnweb.freebsd.org/changeset/base/336263 Log: Use the existing MSR_BIOS_SIGN on AMD. Reported by: kib Sponsored by: The FreeBSD Foundation Modified: head/sys/x86/include/specialreg.h head/usr.sbin/cpucontrol/amd10h.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Fri Jul 13 20:33:10 2018 (r336262) +++ head/sys/x86/include/specialreg.h Fri Jul 13 20:56:20 2018 (r336263) @@ -973,7 +973,6 @@ #define AMD_WT_ALLOC_FRE 0x10000 /* fixed (A0000-FFFFF) range enable */ /* AMD64 MSR's */ -#define MSR_PATCH_LEVEL 0x0000008b /* microcode revision number */ #define MSR_EFER 0xc0000080 /* extended features */ #define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target/cs/ss */ #define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target rip */ Modified: head/usr.sbin/cpucontrol/amd10h.c ============================================================================== --- head/usr.sbin/cpucontrol/amd10h.c Fri Jul 13 20:33:10 2018 (r336262) +++ head/usr.sbin/cpucontrol/amd10h.c Fri Jul 13 20:56:20 2018 (r336263) @@ -129,7 +129,7 @@ amd10h_update(const char *dev, const char *path) } signature = idargs.data[0]; - msrargs.msr = MSR_PATCH_LEVEL; + msrargs.msr = MSR_BIOS_SIGN; error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); if (error < 0) { WARN(0, "ioctl(%s)", dev); @@ -295,7 +295,7 @@ amd10h_update(const char *dev, const char *path) fprintf(stderr, "done.\n"); } - msrargs.msr = MSR_PATCH_LEVEL; + msrargs.msr = MSR_BIOS_SIGN; error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); if (error < 0) { WARN(0, "ioctl(%s)", dev); From owner-svn-src-head@freebsd.org Fri Jul 13 20:56:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D7E8104C983; Fri, 13 Jul 2018 20:56:51 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (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 BEAED7838E; Fri, 13 Jul 2018 20:56:50 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf0-x230.google.com with SMTP id l123-v6so23256662pfl.13; Fri, 13 Jul 2018 13:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0fxRTyMs69Ces8WjSf55FcVjcGgSlDlH3X7rE83g8WU=; b=WjuwMN/nkb8YgIe7HvNPRqk7c6X+8EsGiaqqrnvpCoBAW6fB/cOnsPgH6g28Xa2fze 9f1eqzKezNsAQPd/BCGXb7otf1kz/u5EU7abZ2GKkjU/F0Drqot8EUvTn0TyZo+e09L4 +EsLopC/jPiAmPofbFt29kOo+0exh6ojokCbrNCmfzqaHGATzTDsPsPlhHcTYYYAxNl8 MRQ7OmcT5qf5lSazMrwGInzVcb9Lo9vofMS7TvGfYsQ9iP5khvkkkNJEaky4zCdq281y wABg/hwv4ioHLQRT3D/o/rz0PaO1mpwjpRt0wsbes3y6eqS7IaWvvj6ujcXpzE3Pv2d8 jjFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0fxRTyMs69Ces8WjSf55FcVjcGgSlDlH3X7rE83g8WU=; b=I6UdxTJEVPxcft68xrMIhPZJYIE38Hc1pj6a/sabKGkY0vKWtznSZDNdVbk/roUnFr MN8kryvqYwRwF29B6ja8UUUjaqpUk9FACuMsJIvWkv62hXCs9V4fz5b22RbpJUAp+5PA qknFn8ZzDnJm3F+PzRFQhQq9zqzMW9E/KfJOYa+Vxl5yKNZrEScbblvWDsI3aEkSt9+F ENC+UztTMTFFcfxj4HNes8gVQL6nUMKLttTtbWKSMpZisEnPAaNK0llRie+AYqHl+sgX dGqm4+BBDgDGmebw7K9SkYofFobGCfxzIVn5Q3l4EOd7SpoHDDisZo59miJASfMuAaj1 z+uQ== X-Gm-Message-State: AOUpUlGC8uZhY6TLnWtG2x7cYH1zcSJ3ZRM1geJhAi9Sxk0c7DMwHkOT BL9/1vmQkrjw722uwukal+I= X-Google-Smtp-Source: AAOMgpfoEPDMsNgz2BxZvk9mxAqZ5I356ZOLHCVpvrLLnYEuqX5dLZEvcuX1BhDBMCxuCqkZ3bGgNw== X-Received: by 2002:a63:1844:: with SMTP id 4-v6mr7616603pgy.313.1531515409795; Fri, 13 Jul 2018 13:56:49 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-107.dsl.bell.ca. [70.52.224.107]) by smtp.gmail.com with ESMTPSA id m6-v6sm37461555pfh.153.2018.07.13.13.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 13:56:48 -0700 (PDT) Sender: Mark Johnston Date: Fri, 13 Jul 2018 16:56:46 -0400 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336257 - head/sys/x86/include Message-ID: <20180713205646.GH26064@raichu> References: <201807131942.w6DJgxN1085315@repo.freebsd.org> <20180713203854.GP5562@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180713203854.GP5562@kib.kiev.ua> User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 20:56:51 -0000 On Fri, Jul 13, 2018 at 11:38:54PM +0300, Konstantin Belousov wrote: > On Fri, Jul 13, 2018 at 07:42:59PM +0000, Mark Johnston wrote: > > Author: markj > > Date: Fri Jul 13 19:42:59 2018 > > New Revision: 336257 > > URL: https://svnweb.freebsd.org/changeset/base/336257 > > > > Log: > > Define the MSR used to fetch the current microcode patch level on AMD. > > > > It is defined in the AMD family 17h register reference. > > > > MFC after: 3 days > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/sys/x86/include/specialreg.h > > > > Modified: head/sys/x86/include/specialreg.h > > ============================================================================== > > --- head/sys/x86/include/specialreg.h Fri Jul 13 18:58:37 2018 (r336256) > > +++ head/sys/x86/include/specialreg.h Fri Jul 13 19:42:59 2018 (r336257) > > @@ -973,6 +973,7 @@ > > #define AMD_WT_ALLOC_FRE 0x10000 /* fixed (A0000-FFFFF) range enable */ > > > > /* AMD64 MSR's */ > > +#define MSR_PATCH_LEVEL 0x0000008b /* microcode revision number */ > This register is called MSR_BIOS_SIGN. It is defined for Intel as well. Oops, thanks. I knew about BIOS_SIGN but somehow convinced myself it had a different value. From owner-svn-src-head@freebsd.org Fri Jul 13 21:03:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39456104CEE1; Fri, 13 Jul 2018 21:03:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAB5978DD3; Fri, 13 Jul 2018 21:03:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD58F156EF; Fri, 13 Jul 2018 21:03:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DL3Wu2026649; Fri, 13 Jul 2018 21:03:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DL3WsV026648; Fri, 13 Jul 2018 21:03:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807132103.w6DL3WsV026648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Jul 2018 21:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336264 - head/stand/efi/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/include X-SVN-Commit-Revision: 336264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 21:03:33 -0000 Author: imp Date: Fri Jul 13 21:03:32 2018 New Revision: 336264 URL: https://svnweb.freebsd.org/changeset/base/336264 Log: Define ADR subtype of ACPI type for a device path. Modified: head/stand/efi/include/efidevp.h Modified: head/stand/efi/include/efidevp.h ============================================================================== --- head/stand/efi/include/efidevp.h Fri Jul 13 20:56:20 2018 (r336263) +++ head/stand/efi/include/efidevp.h Fri Jul 13 21:03:32 2018 (r336264) @@ -141,6 +141,9 @@ typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { UINT32 CID; } ACPI_EXTENDED_HID_DEVICE_PATH; +#define ACPI_ADR_DP 0x03 +/* ACPI_ADR_DEVICE_PATH not defined */ + // // EISA ID Macro // EISA ID Definition 32-bits From owner-svn-src-head@freebsd.org Fri Jul 13 22:40:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2FC91028A71; Fri, 13 Jul 2018 22:40:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A60F47BD54; Fri, 13 Jul 2018 22:40:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83C6816541; Fri, 13 Jul 2018 22:40:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DMeEeA073098; Fri, 13 Jul 2018 22:40:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DMeEA7073097; Fri, 13 Jul 2018 22:40:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201807132240.w6DMeEA7073097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 13 Jul 2018 22:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336267 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 336267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 22:40:15 -0000 Author: mjg Date: Fri Jul 13 22:40:14 2018 New Revision: 336267 URL: https://svnweb.freebsd.org/changeset/base/336267 Log: lockmgr: tidy up slock/sunlock similar to other locks Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Fri Jul 13 21:30:18 2018 (r336266) +++ head/sys/kern/kern_lock.c Fri Jul 13 22:40:14 2018 (r336267) @@ -112,11 +112,21 @@ CTASSERT(LK_UNLOCKED == (LK_UNLOCKED & } \ } while (0) -#define LK_CAN_SHARE(x, flags) \ - (((x) & LK_SHARE) && \ - (((x) & (LK_EXCLUSIVE_WAITERS | LK_EXCLUSIVE_SPINNERS)) == 0 || \ - (curthread->td_lk_slocks != 0 && !(flags & LK_NODDLKTREAT)) || \ - (curthread->td_pflags & TDP_DEADLKTREAT))) +static bool __always_inline +LK_CAN_SHARE(uintptr_t x, int flags, bool fp) +{ + + if ((x & (LK_SHARE | LK_EXCLUSIVE_WAITERS | LK_EXCLUSIVE_SPINNERS)) == + LK_SHARE) + return (true); + if (fp || (!(x & LK_SHARE))) + return (false); + if ((curthread->td_lk_slocks != 0 && !(flags & LK_NODDLKTREAT)) || + (curthread->td_pflags & TDP_DEADLKTREAT)) + return (true); + return (false); +} + #define LK_TRYOP(x) \ ((x) & LK_NOWAIT) @@ -169,7 +179,7 @@ struct lockmgr_wait { }; static bool __always_inline lockmgr_slock_try(struct lock *lk, uintptr_t *xp, - int flags); + int flags, bool fp); static bool __always_inline lockmgr_sunlock_try(struct lock *lk, uintptr_t *xp); static void @@ -498,7 +508,7 @@ lockdestroy(struct lock *lk) } static bool __always_inline -lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int flags) +lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int flags, bool fp) { /* @@ -509,7 +519,7 @@ lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int * loop back and retry. */ *xp = lk->lk_lock; - while (LK_CAN_SHARE(*xp, flags)) { + while (LK_CAN_SHARE(*xp, flags, fp)) { if (atomic_fcmpset_acq_ptr(&lk->lk_lock, xp, *xp + LK_ONE_SHARER)) { return (true); @@ -523,29 +533,12 @@ lockmgr_sunlock_try(struct lock *lk, uintptr_t *xp) { for (;;) { - /* - * If there is more than one shared lock held, just drop one - * and return. - */ - if (LK_SHARERS(*xp) > 1) { + if (LK_SHARERS(*xp) > 1 || !(*xp & LK_ALL_WAITERS)) { if (atomic_fcmpset_rel_ptr(&lk->lk_lock, xp, *xp - LK_ONE_SHARER)) return (true); continue; } - - /* - * If there are not waiters on the exclusive queue, drop the - * lock quickly. - */ - if ((*xp & LK_ALL_WAITERS) == 0) { - MPASS((*xp & ~LK_EXCLUSIVE_SPINNERS) == - LK_SHARERS_LOCK(1)); - if (atomic_fcmpset_rel_ptr(&lk->lk_lock, xp, - LK_UNLOCKED)) - return (true); - continue; - } break; } return (false); @@ -574,7 +567,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER, file, line, flags & LK_INTERLOCK ? ilk : NULL); for (;;) { - if (lockmgr_slock_try(lk, &x, flags)) + if (lockmgr_slock_try(lk, &x, flags, false)) break; #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); @@ -617,7 +610,7 @@ retry_sleepq: * if the lock can be acquired in shared mode, try * again. */ - if (LK_CAN_SHARE(x, flags)) { + if (LK_CAN_SHARE(x, flags, false)) { sleepq_release(&lk->lock_object); continue; } @@ -932,7 +925,7 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, s file, line, flags & LK_INTERLOCK ? ilk : NULL); if (__predict_false(lk->lock_object.lo_flags & LK_NOSHARE)) break; - if (lockmgr_slock_try(lk, &x, flags)) { + if (lockmgr_slock_try(lk, &x, flags, true)) { lockmgr_note_shared_acquire(lk, 0, 0, file, line, flags); locked = true; From owner-svn-src-head@freebsd.org Fri Jul 13 22:49:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 284FB1029007; Fri, 13 Jul 2018 22:49:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE7A77C210; Fri, 13 Jul 2018 22:49:49 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2366166E9; Fri, 13 Jul 2018 22:49:49 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DMnnG2078023; Fri, 13 Jul 2018 22:49:49 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DMnmKO078019; Fri, 13 Jul 2018 22:49:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807132249.w6DMnmKO078019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 13 Jul 2018 22:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336268 - head/sys/dev/smartpqi X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/smartpqi X-SVN-Commit-Revision: 336268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 22:49:50 -0000 Author: cem Date: Fri Jul 13 22:49:48 2018 New Revision: 336268 URL: https://svnweb.freebsd.org/changeset/base/336268 Log: Re-unbreak smartpqi(4) GCC build Like r333085, remove redundant declarations. Redundant declarations were re-introduced in r336201. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/smartpqi/smartpqi_cam.c head/sys/dev/smartpqi/smartpqi_ioctl.c head/sys/dev/smartpqi/smartpqi_main.c head/sys/dev/smartpqi/smartpqi_prototypes.h Modified: head/sys/dev/smartpqi/smartpqi_cam.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_cam.c Fri Jul 13 22:40:14 2018 (r336267) +++ head/sys/dev/smartpqi/smartpqi_cam.c Fri Jul 13 22:49:48 2018 (r336268) @@ -1198,7 +1198,3 @@ void deregister_sim(struct pqisrc_softstate *softs) DBG_FUNC("OUT\n"); } - -static void smartpqi_cam_action(struct cam_sim *, union ccb *); -static void smartpqi_poll(struct cam_sim *); - Modified: head/sys/dev/smartpqi/smartpqi_ioctl.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_ioctl.c Fri Jul 13 22:40:14 2018 (r336267) +++ head/sys/dev/smartpqi/smartpqi_ioctl.c Fri Jul 13 22:49:48 2018 (r336268) @@ -166,10 +166,6 @@ static int smartpqi_ioctl(struct cdev *cdev, u_long cm return error; } -static d_open_t smartpqi_open; -static d_ioctl_t smartpqi_ioctl; -static d_close_t smartpqi_close; - static struct cdevsw smartpqi_cdevsw = { .d_version = D_VERSION, Modified: head/sys/dev/smartpqi/smartpqi_main.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_main.c Fri Jul 13 22:40:14 2018 (r336267) +++ head/sys/dev/smartpqi/smartpqi_main.c Fri Jul 13 22:49:48 2018 (r336268) @@ -482,12 +482,6 @@ smartpqi_shutdown(void *arg) return rval; } -static int smartpqi_probe(device_t dev); -static int smartpqi_attach(device_t dev); -static int smartpqi_detach(device_t dev); -static int smartpqi_suspend(device_t dev); -static int smartpqi_resume(device_t dev); - /* * PCI bus interface. */ Modified: head/sys/dev/smartpqi/smartpqi_prototypes.h ============================================================================== --- head/sys/dev/smartpqi/smartpqi_prototypes.h Fri Jul 13 22:40:14 2018 (r336267) +++ head/sys/dev/smartpqi/smartpqi_prototypes.h Fri Jul 13 22:49:48 2018 (r336268) @@ -238,21 +238,17 @@ void os_stop_heartbeat_timer(pqisrc_softstate_t *); void os_start_heartbeat_timer(void *); /* FreeBSD_cam.c */ -int pqisrc_scsi_setup(struct pqisrc_softstate *); -void pqisrc_scsi_cleanup(struct pqisrc_softstate *); uint8_t os_get_task_attr(rcb_t *); void os_wellness_periodic(void *); void smartpqi_target_rescan(struct pqisrc_softstate *); /* FreeBSD_intr.c FreeBSD_main.c */ -void pqisrc_event_worker(void *, int); void os_add_device(pqisrc_softstate_t *, pqi_scsi_dev_t *); void os_remove_device(pqisrc_softstate_t *, pqi_scsi_dev_t *); void os_io_response_success(rcb_t *); void os_aio_response_error(rcb_t *, aio_path_error_info_elem_t *); void smartpqi_adjust_queue_depth(struct cam_path *, uint32_t ); void os_raid_response_error(rcb_t *, raid_path_error_info_elem_t *); -void os_wellness_periodic(void *); void os_reset_rcb( rcb_t *); int register_sim(struct pqisrc_softstate *, int); void deregister_sim(struct pqisrc_softstate *); From owner-svn-src-head@freebsd.org Fri Jul 13 23:46:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B309102B268; Fri, 13 Jul 2018 23:46:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1BE7DCC9; Fri, 13 Jul 2018 23:46:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10D671704A; Fri, 13 Jul 2018 23:46:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6DNk945008195; Fri, 13 Jul 2018 23:46:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6DNk7CL008183; Fri, 13 Jul 2018 23:46:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807132346.w6DNk7CL008183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 13 Jul 2018 23:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336269 - in head/sys: netipsec opencrypto X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: netipsec opencrypto X-SVN-Commit-Revision: 336269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 23:46:10 -0000 Author: cem Date: Fri Jul 13 23:46:07 2018 New Revision: 336269 URL: https://svnweb.freebsd.org/changeset/base/336269 Log: OCF: Add a typedef for session identifiers No functional change. This should ease the transition from an integer session identifier model to an opaque pointer model. Added: head/sys/opencrypto/_cryptodev.h (contents, props changed) Modified: head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/keydb.h head/sys/netipsec/xform.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptodev_if.m Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/ipsec.c Fri Jul 13 23:46:07 2018 (r336269) @@ -1322,9 +1322,10 @@ ok: } int -ipsec_updateid(struct secasvar *sav, uint64_t *new, uint64_t *old) +ipsec_updateid(struct secasvar *sav, crypto_session_t *new, + crypto_session_t *old) { - uint64_t tmp; + crypto_session_t tmp; /* * tdb_cryptoid is initialized by xform_init(). Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/ipsec.h Fri Jul 13 23:46:07 2018 (r336269) @@ -332,7 +332,7 @@ int udp_ipsec_pcbctl(struct inpcb *, struct sockopt *) int ipsec_chkreplay(uint32_t, struct secasvar *); int ipsec_updatereplay(uint32_t, struct secasvar *); -int ipsec_updateid(struct secasvar *, uint64_t *, uint64_t *); +int ipsec_updateid(struct secasvar *, crypto_session_t *, crypto_session_t *); int ipsec_initialized(void); void ipsec_setspidx_inpcb(struct inpcb *, struct secpolicyindex *, u_int); Modified: head/sys/netipsec/keydb.h ============================================================================== --- head/sys/netipsec/keydb.h Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/keydb.h Fri Jul 13 23:46:07 2018 (r336269) @@ -41,6 +41,7 @@ #include #include +#include #ifndef _SOCKADDR_UNION_DEFINED #define _SOCKADDR_UNION_DEFINED @@ -162,7 +163,7 @@ struct secasvar { const struct enc_xform *tdb_encalgxform;/* encoding algorithm */ const struct auth_hash *tdb_authalgxform;/* authentication algorithm */ const struct comp_algo *tdb_compalgxform;/* compression algorithm */ - uint64_t tdb_cryptoid; /* crypto session id */ + crypto_session_t tdb_cryptoid; /* crypto session */ uint8_t alg_auth; /* Authentication Algorithm Identifier*/ uint8_t alg_enc; /* Cipher Algorithm Identifier */ Modified: head/sys/netipsec/xform.h ============================================================================== --- head/sys/netipsec/xform.h Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/xform.h Fri Jul 13 23:46:07 2018 (r336269) @@ -71,7 +71,7 @@ struct xform_history { struct xform_data { struct secpolicy *sp; /* security policy */ struct secasvar *sav; /* related SA */ - uint64_t cryptoid; /* used crypto session id */ + crypto_session_t cryptoid; /* used crypto session */ u_int idx; /* IPsec request index */ int protoff; /* current protocol offset */ int skip; /* data offset */ Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/xform_ah.c Fri Jul 13 23:46:07 2018 (r336269) @@ -544,7 +544,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski struct cryptop *crp; struct xform_data *xd; struct newah *ah; - uint64_t cryptoid; + crypto_session_t cryptoid; int hl, rplen, authsize, ahsize, error; IPSEC_ASSERT(sav != NULL, ("null SA")); @@ -699,7 +699,7 @@ ah_input_cb(struct cryptop *crp) struct secasvar *sav; struct secasindex *saidx; caddr_t ptr; - uint64_t cryptoid; + crypto_session_t cryptoid; int authsize, rplen, ahsize, error, skip, protoff; uint8_t nxt; @@ -849,7 +849,7 @@ ah_output(struct mbuf *m, struct secpolicy *sp, struct struct mbuf *mi; struct cryptop *crp; struct newah *ah; - uint64_t cryptoid; + crypto_session_t cryptoid; uint16_t iplen; int error, rplen, authsize, ahsize, maxpacketsize, roff; uint8_t prot; @@ -1082,7 +1082,7 @@ ah_output_cb(struct cryptop *crp) struct secpolicy *sp; struct secasvar *sav; struct mbuf *m; - uint64_t cryptoid; + crypto_session_t cryptoid; caddr_t ptr; u_int idx; int skip, error; Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/xform_esp.c Fri Jul 13 23:46:07 2018 (r336269) @@ -271,7 +271,7 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk struct cryptop *crp; struct newesp *esp; uint8_t *ivp; - uint64_t cryptoid; + crypto_session_t cryptoid; int alen, error, hlen, plen; IPSEC_ASSERT(sav != NULL, ("null SA")); @@ -448,7 +448,7 @@ esp_input_cb(struct cryptop *crp) struct secasvar *sav; struct secasindex *saidx; caddr_t ptr; - uint64_t cryptoid; + crypto_session_t cryptoid; int hlen, skip, protoff, error, alen; crd = crp->crp_desc; @@ -637,7 +637,8 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc struct secasindex *saidx; unsigned char *pad; uint8_t *ivp; - uint64_t cntr, cryptoid; + uint64_t cntr; + crypto_session_t cryptoid; int hlen, rlen, padding, blks, alen, i, roff; int error, maxpacketsize; uint8_t prot; @@ -883,7 +884,7 @@ esp_output_cb(struct cryptop *crp) struct secpolicy *sp; struct secasvar *sav; struct mbuf *m; - uint64_t cryptoid; + crypto_session_t cryptoid; u_int idx; int error; Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/netipsec/xform_ipcomp.c Fri Jul 13 23:46:07 2018 (r336269) @@ -280,7 +280,7 @@ ipcomp_input_cb(struct cryptop *crp) struct secasvar *sav; struct secasindex *saidx; caddr_t addr; - uint64_t cryptoid; + crypto_session_t cryptoid; int hlen = IPCOMP_HLENGTH, error, clen; int skip, protoff; uint8_t nproto; @@ -531,7 +531,7 @@ ipcomp_output_cb(struct cryptop *crp) struct secpolicy *sp; struct secasvar *sav; struct mbuf *m; - uint64_t cryptoid; + crypto_session_t cryptoid; u_int idx; int error, skip, protoff; Added: head/sys/opencrypto/_cryptodev.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/opencrypto/_cryptodev.h Fri Jul 13 23:46:07 2018 (r336269) @@ -0,0 +1,8 @@ +/* + * This trivial work is released to the public domain, or licensed under the + * terms of the CC0, at your option. + * $FreeBSD$ + */ +#pragma once + +typedef __uint64_t crypto_session_t; Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/opencrypto/crypto.c Fri Jul 13 23:46:07 2018 (r336269) @@ -488,7 +488,7 @@ again: * must be capable of the requested crypto algorithms. */ int -crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int crid) +crypto_newsession(crypto_session_t *sid, struct cryptoini *cri, int crid) { struct cryptocap *cap; u_int32_t hid, lid; @@ -548,7 +548,7 @@ crypto_remove(struct cryptocap *cap) * driver). */ int -crypto_freesession(u_int64_t sid) +crypto_freesession(crypto_session_t sid) { struct cryptocap *cap; u_int32_t hid; @@ -1162,7 +1162,7 @@ crypto_invoke(struct cryptocap *cap, struct cryptop *c #endif if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { struct cryptodesc *crd; - u_int64_t nid; + crypto_session_t nid; /* * Driver has unregistered; migrate the session and return Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/opencrypto/cryptodev.c Fri Jul 13 23:46:07 2018 (r336269) @@ -265,7 +265,7 @@ crypt_kop_to_32(const struct crypt_kop *from, struct c struct csession { TAILQ_ENTRY(csession) next; - u_int64_t sid; + crypto_session_t sid; u_int32_t ses; struct mtx lock; /* for op submission */ @@ -320,7 +320,7 @@ static struct fileops cryptofops = { static struct csession *csefind(struct fcrypt *, u_int); static int csedelete(struct fcrypt *, struct csession *); static struct csession *cseadd(struct fcrypt *, struct csession *); -static struct csession *csecreate(struct fcrypt *, u_int64_t, caddr_t, +static struct csession *csecreate(struct fcrypt *, crypto_session_t, caddr_t, u_int64_t, caddr_t, u_int64_t, u_int32_t, u_int32_t, struct enc_xform *, struct auth_hash *); static int csefree(struct csession *); @@ -378,7 +378,7 @@ cryptof_ioctl( struct enc_xform *txform = NULL; struct auth_hash *thash = NULL; struct crypt_kop *kop; - u_int64_t sid; + crypto_session_t sid; u_int32_t ses; int error = 0, crid; #ifdef COMPAT_FREEBSD32 @@ -1350,7 +1350,7 @@ cseadd(struct fcrypt *fcr, struct csession *cse) } struct csession * -csecreate(struct fcrypt *fcr, u_int64_t sid, caddr_t key, u_int64_t keylen, +csecreate(struct fcrypt *fcr, crypto_session_t sid, caddr_t key, u_int64_t keylen, caddr_t mackey, u_int64_t mackeylen, u_int32_t cipher, u_int32_t mac, struct enc_xform *txform, struct auth_hash *thash) { Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/opencrypto/cryptodev.h Fri Jul 13 23:46:07 2018 (r336269) @@ -65,6 +65,10 @@ #include #include +#ifdef _KERNEL +#include +#endif + /* Some initial values */ #define CRYPTO_DRIVERS_INITIAL 4 #define CRYPTO_SW_SESSIONS 32 @@ -408,7 +412,7 @@ struct cryptop { struct task crp_task; - u_int64_t crp_sid; /* Session ID */ + crypto_session_t crp_sid; /* Session ID */ int crp_ilen; /* Input data total length */ int crp_olen; /* Result total length */ @@ -502,8 +506,8 @@ struct cryptkop { MALLOC_DECLARE(M_CRYPTO_DATA); -extern int crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard); -extern int crypto_freesession(u_int64_t sid); +extern int crypto_newsession(crypto_session_t *sid, struct cryptoini *cri, int hard); +extern int crypto_freesession(crypto_session_t sid); #define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE #define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE #define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */ Modified: head/sys/opencrypto/cryptodev_if.m ============================================================================== --- head/sys/opencrypto/cryptodev_if.m Fri Jul 13 22:49:48 2018 (r336268) +++ head/sys/opencrypto/cryptodev_if.m Fri Jul 13 23:46:07 2018 (r336269) @@ -39,7 +39,7 @@ METHOD int newsession { METHOD int freesession { device_t dev; - uint64_t sid; + crypto_session_t sid; }; METHOD int process { From owner-svn-src-head@freebsd.org Sat Jul 14 00:40:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12C44102D326; Sat, 14 Jul 2018 00:40:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B745A7FA28; Sat, 14 Jul 2018 00:40:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9869517866; Sat, 14 Jul 2018 00:40:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6E0edAK033639; Sat, 14 Jul 2018 00:40:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6E0eddV033638; Sat, 14 Jul 2018 00:40:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807140040.w6E0eddV033638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 14 Jul 2018 00:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336270 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 336270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 00:40:40 -0000 Author: imp Date: Sat Jul 14 00:40:38 2018 New Revision: 336270 URL: https://svnweb.freebsd.org/changeset/base/336270 Log: uefi stand: Guess the console better For server machines, ComOut is set to the set of devices that the efi console suppots. Parse it to see if we have serial, video or both. Make that take precidence over the command line args. boot1.efi parses them, but loader.efi doesn't. It's not clear where to read boot.conf from, so we don't do that. The command line args can still be set via efibootmgr, which is more inline with the UEFI boot manager to replace that. These args are typically used only to set serial vs video and the com speed line. We can infer that from ComOut, so do so. Remember the com speed and hw.uart.console to match. RelNotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15917 Modified: head/stand/efi/loader/bootinfo.c head/stand/efi/loader/main.c Modified: head/stand/efi/loader/bootinfo.c ============================================================================== --- head/stand/efi/loader/bootinfo.c Fri Jul 13 23:46:07 2018 (r336269) +++ head/stand/efi/loader/bootinfo.c Sat Jul 14 00:40:38 2018 (r336270) @@ -67,10 +67,11 @@ extern EFI_SYSTEM_TABLE *ST; static int bi_getboothowto(char *kargs) { - const char *sw; + const char *sw, *tmp; char *opts; char *console; - int howto; + int howto, speed, port; + char buf[50]; howto = boot_parse_cmdline(kargs); howto |= boot_env_to_howto(); @@ -81,6 +82,35 @@ bi_getboothowto(char *kargs) howto |= RB_SERIAL; if (strcmp(console, "nullconsole") == 0) howto |= RB_MUTE; + if (strcmp(console, "efi") == 0) { + /* + * If we found a com port and com speed, we need to tell + * the kernel where the serial port is, and how + * fast. Ideally, we'd get the port from ACPI, but that + * isn't running in the loader. Do the next best thing + * by allowing it to be set by a loader.conf variable, + * either a EFI specific one, or the compatible + * comconsole_port if not. PCI support is needed, but + * for that we'd ideally refactor the + * libi386/comconsole.c code to have identical behavior. + */ + tmp = getenv("efi_com_speed"); + if (tmp != NULL) { + speed = strtol(tmp, NULL, 0); + tmp = getenv("efi_com_port"); + if (tmp == NULL) + tmp = getenv("comconsole_port"); + /* XXX fallback to EFI variable set in rc.d? */ + if (tmp != NULL) + port = strtol(tmp, NULL, 0); + else + port = 0x3f8; + snprintf(buf, sizeof(buf), "io:%d,br:%d", port, + speed); + env_setenv("hw.uart.console", EV_VOLATILE, buf, + NULL, NULL); + } + } } return (howto); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Fri Jul 13 23:46:07 2018 (r336269) +++ head/stand/efi/loader/main.c Sat Jul 14 00:40:38 2018 (r336270) @@ -400,8 +400,8 @@ interactive_interrupt(const char *msg) return (false); } -int -parse_args(int argc, CHAR16 *argv[], bool has_kbd) +static int +parse_args(int argc, CHAR16 *argv[]) { int i, j, howto; bool vargood; @@ -429,12 +429,98 @@ parse_args(int argc, CHAR16 *argv[], bool has_kbd) return (howto); } +/* + * Parse ConOut (the list of consoles active) and see if we can find a + * serial port and/or a video port. It would be nice to also walk the + * ACPI name space to map the UID for the serial port to a port. The + * latter is especially hard. + */ +static int +parse_uefi_con_out(void) +{ + int how, rv; + int vid_seen = 0, com_seen = 0, seen = 0; + size_t sz; + char buf[4096], *ep; + EFI_DEVICE_PATH *node; + ACPI_HID_DEVICE_PATH *acpi; + UART_DEVICE_PATH *uart; + bool pci_pending; + how = 0; + sz = sizeof(buf); + rv = efi_global_getenv("ConOut", buf, &sz); + if (rv != EFI_SUCCESS) + goto out; + ep = buf + sz; + node = (EFI_DEVICE_PATH *)buf; + while ((char *)node < ep && !IsDevicePathEndType(node)) { + pci_pending = false; + if (DevicePathType(node) == ACPI_DEVICE_PATH && + DevicePathSubType(node) == ACPI_DP) { + /* Check for Serial node */ + acpi = (void *)node; + if (EISA_ID_TO_NUM(acpi->HID) == 0x501) + com_seen = ++seen; + } else if (DevicePathType(node) == MESSAGING_DEVICE_PATH && + DevicePathSubType(node) == MSG_UART_DP) { + char bd[16]; + + uart = (void *)node; + snprintf(bd, sizeof(bd), "%d", uart->BaudRate); + setenv("efi_com_speed", bd, 1); + printf("Console speed is %d\n", uart->BaudRate); + } else if (DevicePathType(node) == ACPI_DEVICE_PATH && + DevicePathSubType(node) == ACPI_ADR_DP) { + /* Check for AcpiAdr() Node for video */ + vid_seen = ++seen; + } else if (DevicePathType(node) == HARDWARE_DEVICE_PATH && + DevicePathSubType(node) == HW_PCI_DP) { + /* + * Note, vmware fusion has a funky console device + * PciRoot(0x0)/Pci(0xf,0x0) + * which we can only detect at the end since we also + * have to cope with: + * PciRoot(0x0)/Pci(0x1f,0x0)/Serial(0x1) + * so only match it if it's last. + */ + pci_pending = true; + } + node = NextDevicePathNode(node); /* Skip the end node */ + } + if (pci_pending && vid_seen == 0) + vid_seen = ++seen; + + /* + * Truth table for RB_MULTIPLE | RB_SERIAL + * Value Result + * 0 Use only video console + * RB_SERIAL Use only serial console + * RB_MULTIPLE Use both video and serial console + * (but video is primary so gets rc messages) + * both Use both video and serial console + * (but serial is primary so gets rc messages) + * + * Try to honor this as best we can. If only one of serial / video + * found, then use that. Otherwise, use the first one we found. + * This also implies if we found nothing, default to video. + */ + how = 0; + if (vid_seen && com_seen) { + how |= RB_MULTIPLE; + if (com_seen < vid_seen) + how |= RB_SERIAL; + } else if (com_seen) + how |= RB_SERIAL; +out: + return (how); +} + EFI_STATUS main(int argc, CHAR16 *argv[]) { EFI_GUID *guid; - int howto, i; + int howto, i, uhowto; UINTN k; bool has_kbd; char *s; @@ -481,23 +567,61 @@ main(int argc, CHAR16 *argv[]) */ bcache_init(32768, 512); - howto = parse_args(argc, argv, has_kbd); + howto = parse_args(argc, argv); + if (!has_kbd && (howto & RB_PROBE)) + howto |= RB_SERIAL | RB_MULTIPLE; + howto &= ~RB_PROBE; - boot_howto_to_env(howto); + uhowto = parse_uefi_con_out(); /* - * XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables + * We now have two notions of console. howto should be viewed as + * overrides. */ - if (howto & RB_MULTIPLE) { - if (howto & RB_SERIAL) - setenv("console", "comconsole efi" , 1); - else - setenv("console", "efi comconsole" , 1); - } else if (howto & RB_SERIAL) { - setenv("console", "comconsole" , 1); - } else - setenv("console", "efi", 1); +#define VIDEO_ONLY 0 +#define SERIAL_ONLY RB_SERIAL +#define VID_SER_BOTH RB_MULTIPLE +#define SER_VID_BOTH (RB_SERIAL | RB_MULTIPLE) +#define CON_MASK (RB_SERIAL | RB_MULTIPLE) + if ((howto & CON_MASK) == 0) { + /* No override, uhowto is controlling and efi cons is perfect */ + howto = howto | (uhowto & CON_MASK); + setenv("console", "efi", 1); + } else if ((howto & CON_MASK) == (uhowto & CON_MASK)) { + /* override matches what UEFI told us, efi console is perfect */ + setenv("console", "efi", 1); + } else if ((uhowto & (CON_MASK)) != 0) { + /* + * We detected a serial console on ConOut. All possible + * overrides include serial. We can't really override what efi + * gives us, so we use it knowing it's the best choice. + */ + setenv("console", "efi", 1); + } else { + /* + * We detected some kind of serial in the override, but ConOut + * has no serial, so we have to sort out which case it really is. + */ + switch (howto & CON_MASK) { + case SERIAL_ONLY: + setenv("console", "comconsole", 1); + break; + case VID_SER_BOTH: + setenv("console", "efi comconsole", 1); + break; + case SER_VID_BOTH: + setenv("console", "comconsole efi", 1); + break; + /* case VIDEO_ONLY can't happen -- it's the first if above */ + } + } + /* + * howto is set now how we want to export the flags to the kernel, so + * set the env based on it. + */ + boot_howto_to_env(howto); + if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); From owner-svn-src-head@freebsd.org Sat Jul 14 01:46:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39CAD1030C53; Sat, 14 Jul 2018 01:46:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA1FF8203D; Sat, 14 Jul 2018 01:46:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4E00184B0; Sat, 14 Jul 2018 01:46:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6E1kJZp069000; Sat, 14 Jul 2018 01:46:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6E1kJVS068999; Sat, 14 Jul 2018 01:46:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807140146.w6E1kJVS068999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 14 Jul 2018 01:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336271 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 336271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 01:46:20 -0000 Author: imp Date: Sat Jul 14 01:46:19 2018 New Revision: 336271 URL: https://svnweb.freebsd.org/changeset/base/336271 Log: Add reporting of whether or not a keyboard is detected. In addition, note that r336270's commit message was slightly incorrect. It changed the default setting of the console to honor the ConOut variable. Overrides via the command line are still possible, and we use the devices in ConOut to set the proper console. If, for example, serial cosnole is specified, we'll set console to "efi" if ConOut has a serial port list and to either "efi comconsole" or "comconsole efi" if not depending on whether -D or -D -h was specified. RelNotes: Yes Sponsored by: Netflix Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Sat Jul 14 00:40:38 2018 (r336270) +++ head/stand/efi/loader/main.c Sat Jul 14 01:46:19 2018 (r336271) @@ -622,6 +622,8 @@ main(int argc, CHAR16 *argv[]) */ boot_howto_to_env(howto); + printf(" Keyboard: %s", has_kbd ? "yes" : "no"); + if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); From owner-svn-src-head@freebsd.org Sat Jul 14 02:13:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EB3F10328C9 for ; Sat, 14 Jul 2018 02:13:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F30F83467 for ; Sat, 14 Jul 2018 02:13:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id l16-v6so14011990ita.0 for ; Fri, 13 Jul 2018 19:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=cUcTtxEiTL88q/oJUd4jf1OVUnj6pECy3MPn3XeZvE4=; b=jEziYybzujWTHsCaF/HW9AVNSNYzZ6bY32dM8mMxqLwLtDS/1S+39LFSEeW2lz0Ei9 Vm7suYbyl1wjygcnAN6uhow9tTwGgL2Bz2FqdTNqODM40YSXsNxskMFH8R4qhtxIoXq6 x50WA96jVJv1pDYhAKk/nwYtvQDV5LBd/PTRnHX7B3uY0k/qsqCXYuWtzbS2N+tU4aWH WBxc9YUNHx31awstN2eAoV7jrYH4sg4JSABeA0Bw8jNDdLgrt3Jdiqkdb4yIyMp/6lQJ YtNNAs/JxEOmVyxKTPrl5Xingrt3+GSo17YE00Kgpsq4Hs3OB2ZRlIkJlHPLitPTsDnK YUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=cUcTtxEiTL88q/oJUd4jf1OVUnj6pECy3MPn3XeZvE4=; b=ELNEL8+w8b8J3Obq1YP4FI04RYOZywwpDnQmRPPNe+p767j7wIcWYiN5T8Gr29r21U N4+cMJQY0JmAACtxlpqhAmrY1XRE9ruKrrT6Mf9WLZUMgBcG2F36KurRfpdpqD3pklUR K1sFJG3qMqYW6wGvBV9Ok3mc74OBoIBzkmP45c6axtD95dlM8qCu3kn9zBNqhQ2MsWVm MFrc+EemsIvo+9gshQ/PrdapBs8OT2KiJJP6mEFitfQDLNS36QDGuxkBnxATFnRCjE02 Jdwkje9qFtoBGexAoP0z/O3oFrqRCPCwkJ3UYwOrqQg3fD4sYIh/aTPvkedRg/kOMj1J B4fA== X-Gm-Message-State: AOUpUlGBPvXc6LWfdx5DQF69SNcU0G2DYsVfR2OOAlfwBqhui2rhYcI7 ckNRSH6ey+MC5BSF8Wg5KEC4TSwBX7IAF0vo8sOjMA== X-Google-Smtp-Source: AAOMgpf0IIBt1XBRBbCHWrPEXFN9FdRusOpCYkvyBOEjTkHdNZXbMuWkgcl0hZgMAGeQDKDqcW6JHp98qeBJ2fh9BTc= X-Received: by 2002:a02:3344:: with SMTP id k4-v6mr7605302jak.45.1531534381253; Fri, 13 Jul 2018 19:13:01 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:1183:0:0:0:0:0 with HTTP; Fri, 13 Jul 2018 19:13:00 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201807140040.w6E0eddV033638@repo.freebsd.org> References: <201807140040.w6E0eddV033638@repo.freebsd.org> From: Warner Losh Date: Fri, 13 Jul 2018 20:13:00 -0600 X-Google-Sender-Auth: c4LNEd8LQcE3bsLG9RSGX4SqMNc Message-ID: Subject: Re: svn commit: r336270 - head/stand/efi/loader To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 02:13:02 -0000 Uggg. This commit message is slightly wrong. Added a printf I wanted to add anyway to a new version and made a note about what's wrong with it. I changed the behavior based on review feedback, but didn't change the commit message before the commit. Warner On Fri, Jul 13, 2018 at 6:40 PM, Warner Losh wrote: > Author: imp > Date: Sat Jul 14 00:40:38 2018 > New Revision: 336270 > URL: https://svnweb.freebsd.org/changeset/base/336270 > > Log: > uefi stand: Guess the console better > > For server machines, ComOut is set to the set of devices that the efi > console suppots. Parse it to see if we have serial, video or both. > Make that take precidence over the command line args. boot1.efi parses > them, but loader.efi doesn't. It's not clear where to read boot.conf > from, so we don't do that. The command line args can still be set via > efibootmgr, which is more inline with the UEFI boot manager to replace > that. These args are typically used only to set serial vs video and > the com speed line. We can infer that from ComOut, so do so. > Remember the com speed and hw.uart.console to match. > > RelNotes: yes > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D15917 > > Modified: > head/stand/efi/loader/bootinfo.c > head/stand/efi/loader/main.c > > Modified: head/stand/efi/loader/bootinfo.c > ============================================================ > ================== > --- head/stand/efi/loader/bootinfo.c Fri Jul 13 23:46:07 2018 > (r336269) > +++ head/stand/efi/loader/bootinfo.c Sat Jul 14 00:40:38 2018 > (r336270) > @@ -67,10 +67,11 @@ extern EFI_SYSTEM_TABLE *ST; > static int > bi_getboothowto(char *kargs) > { > - const char *sw; > + const char *sw, *tmp; > char *opts; > char *console; > - int howto; > + int howto, speed, port; > + char buf[50]; > > howto = boot_parse_cmdline(kargs); > howto |= boot_env_to_howto(); > @@ -81,6 +82,35 @@ bi_getboothowto(char *kargs) > howto |= RB_SERIAL; > if (strcmp(console, "nullconsole") == 0) > howto |= RB_MUTE; > + if (strcmp(console, "efi") == 0) { > + /* > + * If we found a com port and com speed, we need > to tell > + * the kernel where the serial port is, and how > + * fast. Ideally, we'd get the port from ACPI, but > that > + * isn't running in the loader. Do the next best > thing > + * by allowing it to be set by a loader.conf > variable, > + * either a EFI specific one, or the compatible > + * comconsole_port if not. PCI support is needed, > but > + * for that we'd ideally refactor the > + * libi386/comconsole.c code to have identical > behavior. > + */ > + tmp = getenv("efi_com_speed"); > + if (tmp != NULL) { > + speed = strtol(tmp, NULL, 0); > + tmp = getenv("efi_com_port"); > + if (tmp == NULL) > + tmp = getenv("comconsole_port"); > + /* XXX fallback to EFI variable set in > rc.d? */ > + if (tmp != NULL) > + port = strtol(tmp, NULL, 0); > + else > + port = 0x3f8; > + snprintf(buf, sizeof(buf), "io:%d,br:%d", > port, > + speed); > + env_setenv("hw.uart.console", EV_VOLATILE, > buf, > + NULL, NULL); > + } > + } > } > > return (howto); > > Modified: head/stand/efi/loader/main.c > ============================================================ > ================== > --- head/stand/efi/loader/main.c Fri Jul 13 23:46:07 2018 > (r336269) > +++ head/stand/efi/loader/main.c Sat Jul 14 00:40:38 2018 > (r336270) > @@ -400,8 +400,8 @@ interactive_interrupt(const char *msg) > return (false); > } > > -int > -parse_args(int argc, CHAR16 *argv[], bool has_kbd) > +static int > +parse_args(int argc, CHAR16 *argv[]) > { > int i, j, howto; > bool vargood; > @@ -429,12 +429,98 @@ parse_args(int argc, CHAR16 *argv[], bool has_kbd) > return (howto); > } > > +/* > + * Parse ConOut (the list of consoles active) and see if we can find a > + * serial port and/or a video port. It would be nice to also walk the > + * ACPI name space to map the UID for the serial port to a port. The > + * latter is especially hard. > + */ > +static int > +parse_uefi_con_out(void) > +{ > + int how, rv; > + int vid_seen = 0, com_seen = 0, seen = 0; > + size_t sz; > + char buf[4096], *ep; > + EFI_DEVICE_PATH *node; > + ACPI_HID_DEVICE_PATH *acpi; > + UART_DEVICE_PATH *uart; > + bool pci_pending; > > + how = 0; > + sz = sizeof(buf); > + rv = efi_global_getenv("ConOut", buf, &sz); > + if (rv != EFI_SUCCESS) > + goto out; > + ep = buf + sz; > + node = (EFI_DEVICE_PATH *)buf; > + while ((char *)node < ep && !IsDevicePathEndType(node)) { > + pci_pending = false; > + if (DevicePathType(node) == ACPI_DEVICE_PATH && > + DevicePathSubType(node) == ACPI_DP) { > + /* Check for Serial node */ > + acpi = (void *)node; > + if (EISA_ID_TO_NUM(acpi->HID) == 0x501) > + com_seen = ++seen; > + } else if (DevicePathType(node) == MESSAGING_DEVICE_PATH && > + DevicePathSubType(node) == MSG_UART_DP) { > + char bd[16]; > + > + uart = (void *)node; > + snprintf(bd, sizeof(bd), "%d", uart->BaudRate); > + setenv("efi_com_speed", bd, 1); > + printf("Console speed is %d\n", uart->BaudRate); > + } else if (DevicePathType(node) == ACPI_DEVICE_PATH && > + DevicePathSubType(node) == ACPI_ADR_DP) { > + /* Check for AcpiAdr() Node for video */ > + vid_seen = ++seen; > + } else if (DevicePathType(node) == HARDWARE_DEVICE_PATH && > + DevicePathSubType(node) == HW_PCI_DP) { > + /* > + * Note, vmware fusion has a funky console device > + * PciRoot(0x0)/Pci(0xf,0x0) > + * which we can only detect at the end since we > also > + * have to cope with: > + * PciRoot(0x0)/Pci(0x1f,0x0)/Serial(0x1) > + * so only match it if it's last. > + */ > + pci_pending = true; > + } > + node = NextDevicePathNode(node); /* Skip the end node */ > + } > + if (pci_pending && vid_seen == 0) > + vid_seen = ++seen; > + > + /* > + * Truth table for RB_MULTIPLE | RB_SERIAL > + * Value Result > + * 0 Use only video console > + * RB_SERIAL Use only serial console > + * RB_MULTIPLE Use both video and serial console > + * (but video is primary so gets rc messages) > + * both Use both video and serial console > + * (but serial is primary so gets rc messages) > + * > + * Try to honor this as best we can. If only one of serial / video > + * found, then use that. Otherwise, use the first one we found. > + * This also implies if we found nothing, default to video. > + */ > + how = 0; > + if (vid_seen && com_seen) { > + how |= RB_MULTIPLE; > + if (com_seen < vid_seen) > + how |= RB_SERIAL; > + } else if (com_seen) > + how |= RB_SERIAL; > +out: > + return (how); > +} > + > EFI_STATUS > main(int argc, CHAR16 *argv[]) > { > EFI_GUID *guid; > - int howto, i; > + int howto, i, uhowto; > UINTN k; > bool has_kbd; > char *s; > @@ -481,23 +567,61 @@ main(int argc, CHAR16 *argv[]) > */ > bcache_init(32768, 512); > > - howto = parse_args(argc, argv, has_kbd); > + howto = parse_args(argc, argv); > + if (!has_kbd && (howto & RB_PROBE)) > + howto |= RB_SERIAL | RB_MULTIPLE; > + howto &= ~RB_PROBE; > > - boot_howto_to_env(howto); > + uhowto = parse_uefi_con_out(); > > /* > - * XXX we need fallback to this stuff after looking at the ConIn, > ConOut and ConErr variables > + * We now have two notions of console. howto should be viewed as > + * overrides. > */ > - if (howto & RB_MULTIPLE) { > - if (howto & RB_SERIAL) > - setenv("console", "comconsole efi" , 1); > - else > - setenv("console", "efi comconsole" , 1); > - } else if (howto & RB_SERIAL) { > - setenv("console", "comconsole" , 1); > - } else > - setenv("console", "efi", 1); > +#define VIDEO_ONLY 0 > +#define SERIAL_ONLY RB_SERIAL > +#define VID_SER_BOTH RB_MULTIPLE > +#define SER_VID_BOTH (RB_SERIAL | RB_MULTIPLE) > +#define CON_MASK (RB_SERIAL | RB_MULTIPLE) > > + if ((howto & CON_MASK) == 0) { > + /* No override, uhowto is controlling and efi cons is > perfect */ > + howto = howto | (uhowto & CON_MASK); > + setenv("console", "efi", 1); > + } else if ((howto & CON_MASK) == (uhowto & CON_MASK)) { > + /* override matches what UEFI told us, efi console is > perfect */ > + setenv("console", "efi", 1); > + } else if ((uhowto & (CON_MASK)) != 0) { > + /* > + * We detected a serial console on ConOut. All possible > + * overrides include serial. We can't really override what > efi > + * gives us, so we use it knowing it's the best choice. > + */ > + setenv("console", "efi", 1); > + } else { > + /* > + * We detected some kind of serial in the override, but > ConOut > + * has no serial, so we have to sort out which case it > really is. > + */ > + switch (howto & CON_MASK) { > + case SERIAL_ONLY: > + setenv("console", "comconsole", 1); > + break; > + case VID_SER_BOTH: > + setenv("console", "efi comconsole", 1); > + break; > + case SER_VID_BOTH: > + setenv("console", "comconsole efi", 1); > + break; > + /* case VIDEO_ONLY can't happen -- it's the first if above > */ > + } > + } > + /* > + * howto is set now how we want to export the flags to the kernel, > so > + * set the env based on it. > + */ > + boot_howto_to_env(howto); > + > if (efi_copy_init()) { > printf("failed to allocate staging area\n"); > return (EFI_BUFFER_TOO_SMALL); > > From owner-svn-src-head@freebsd.org Sat Jul 14 06:43:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD08104146D; Sat, 14 Jul 2018 06:43:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAEE38CA51; Sat, 14 Jul 2018 06:43:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7A6C1B828; Sat, 14 Jul 2018 06:43:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6E6hboY024265; Sat, 14 Jul 2018 06:43:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6E6hbgG024264; Sat, 14 Jul 2018 06:43:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807140643.w6E6hbgG024264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 14 Jul 2018 06:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336272 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 336272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 06:43:38 -0000 Author: imp Date: Sat Jul 14 06:43:37 2018 New Revision: 336272 URL: https://svnweb.freebsd.org/changeset/base/336272 Log: Minor adjustments: o Fix the parsing of the device path. a last minute change terminated it too soon. o Kill setting LINES. We don't need to do it, and even if we did hard coding it to 24 is wrong. o Now that the console is working again for the loader, adjust the printfs to be more in line with other platforms. Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Sat Jul 14 01:46:19 2018 (r336271) +++ head/stand/efi/loader/main.c Sat Jul 14 06:43:37 2018 (r336272) @@ -316,11 +316,6 @@ find_currdev(EFI_LOADED_IMAGE *img) if (dp->pd_parent != NULL) { dp = dp->pd_parent; STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { - text = efi_devpath_name(pp->pd_devpath); - if (text != NULL) { - printf("And now the part: %S\n", text); - efi_free_devpath_name(text); - } /* * Roll up the ZFS special case * for those partitions that have @@ -454,7 +449,7 @@ parse_uefi_con_out(void) goto out; ep = buf + sz; node = (EFI_DEVICE_PATH *)buf; - while ((char *)node < ep && !IsDevicePathEndType(node)) { + while ((char *)node < ep) { pci_pending = false; if (DevicePathType(node) == ACPI_DEVICE_PATH && DevicePathSubType(node) == ACPI_DP) { @@ -469,7 +464,6 @@ parse_uefi_con_out(void) uart = (void *)node; snprintf(bd, sizeof(bd), "%d", uart->BaudRate); setenv("efi_com_speed", bd, 1); - printf("Console speed is %d\n", uart->BaudRate); } else if (DevicePathType(node) == ACPI_DEVICE_PATH && DevicePathSubType(node) == ACPI_ADR_DP) { /* Check for AcpiAdr() Node for video */ @@ -560,6 +554,7 @@ main(int argc, CHAR16 *argv[]) * eg. the boot device, which we can't do yet. We can use * printf() etc. once this is done. */ + setenv("console", "efi", 1); cons_probe(); /* @@ -622,8 +617,6 @@ main(int argc, CHAR16 *argv[]) */ boot_howto_to_env(howto); - printf(" Keyboard: %s", has_kbd ? "yes" : "no"); - if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); @@ -643,18 +636,17 @@ main(int argc, CHAR16 *argv[]) } else printf("efipart_inithandles failed %d, expect failures", i); - printf("Command line arguments:"); + printf("%s\n", bootprog_info); + printf(" Command line arguments:"); for (i = 0; i < argc; i++) printf(" %S", argv[i]); printf("\n"); - printf("Image base: 0x%lx\n", (u_long)img->ImageBase); - printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, + printf(" EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); - printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, + printf(" EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); - printf("\n%s", bootprog_info); /* Determine the devpath of our image so we can prefer it. */ text = efi_devpath_name(img->FilePath); @@ -710,7 +702,6 @@ main(int argc, CHAR16 *argv[]) return (EFI_NOT_FOUND); efi_init_environment(); - setenv("LINES", "24", 1); /* optional */ #if !defined(__arm__) for (k = 0; k < ST->NumberOfTableEntries; k++) { From owner-svn-src-head@freebsd.org Sat Jul 14 09:11:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C7D21047C6B; Sat, 14 Jul 2018 09:11:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5204471BE2; Sat, 14 Jul 2018 09:11:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 331191CFA1; Sat, 14 Jul 2018 09:11:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6E9BXRm097690; Sat, 14 Jul 2018 09:11:33 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6E9BXnJ097689; Sat, 14 Jul 2018 09:11:33 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807140911.w6E9BXnJ097689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 14 Jul 2018 09:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336273 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 336273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 09:11:33 -0000 Author: kp Date: Sat Jul 14 09:11:32 2018 New Revision: 336273 URL: https://svnweb.freebsd.org/changeset/base/336273 Log: pf: Fix panic on vnet jail shutdown with synproxy When shutting down a vnet jail pf_shutdown() clears the remaining states, which through pf_clear_states() calls pf_unlink_state(). For synproxy states pf_unlink_state() will send a TCP RST, which eventually tries to schedule the pf swi in pf_send(). This means we can't remove the software interrupt until after pf_shutdown(). MFC after: 1 week Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Sat Jul 14 06:43:37 2018 (r336272) +++ head/sys/netpfil/pf/pf_ioctl.c Sat Jul 14 09:11:32 2018 (r336273) @@ -3951,7 +3951,6 @@ pf_unload_vnet(void) V_pf_vnet_active = 0; V_pf_status.running = 0; - swi_remove(V_pf_swi_cookie); error = dehook_pf(); if (error) { /* @@ -3966,6 +3965,8 @@ pf_unload_vnet(void) PF_RULES_WLOCK(); shutdown_pf(); PF_RULES_WUNLOCK(); + + swi_remove(V_pf_swi_cookie); pf_unload_vnet_purge(); From owner-svn-src-head@freebsd.org Sat Jul 14 09:29:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96CBF1048631; Sat, 14 Jul 2018 09:29:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 413AB72682; Sat, 14 Jul 2018 09:29:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21AD91D2B1; Sat, 14 Jul 2018 09:29:46 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6E9TkwU007567; Sat, 14 Jul 2018 09:29:46 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6E9TkEb007566; Sat, 14 Jul 2018 09:29:46 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201807140929.w6E9TkEb007566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 14 Jul 2018 09:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336274 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 336274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 09:29:46 -0000 Author: tsoome Date: Sat Jul 14 09:29:45 2018 New Revision: 336274 URL: https://svnweb.freebsd.org/changeset/base/336274 Log: regex/engine.c: error: variable 'dp' set but not used The issue found with gcc6 build (originally on illumos, confirmed on FreeBSD). Mark it __unused. Differential Revision: https://reviews.freebsd.org/D13109 Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Jul 14 09:11:32 2018 (r336273) +++ head/lib/libc/regex/engine.c Sat Jul 14 09:29:45 2018 (r336274) @@ -385,7 +385,7 @@ dissect(struct match *m, const char *ssp; /* start of string matched by subsubRE */ const char *sep; /* end of string matched by subsubRE */ const char *oldssp; /* previous ssp */ - const char *dp; + const char *dp __unused; AT("diss", start, stop, startst, stopst); sp = start; From owner-svn-src-head@freebsd.org Sat Jul 14 10:15:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AD401049E7A; Sat, 14 Jul 2018 10:15:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC87673ED6; Sat, 14 Jul 2018 10:14:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7F8C1DAA0; Sat, 14 Jul 2018 10:14:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EAExru033288; Sat, 14 Jul 2018 10:14:59 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EAExfp033287; Sat, 14 Jul 2018 10:14:59 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807141014.w6EAExfp033287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 14 Jul 2018 10:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336275 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 336275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 10:15:00 -0000 Author: kp Date: Sat Jul 14 10:14:59 2018 New Revision: 336275 URL: https://svnweb.freebsd.org/changeset/base/336275 Log: pf: Fix synproxy Synproxy was accidentally broken by r335569. The 'return (action)' must be executed for every non-PF_PASS result, but the error packet (TCP RST or ICMP error) should only be sent if the packet was dropped (i.e. PF_DROP) and the return flag is set. PR: 229477 Submitted by: Andre Albsmeier MFC after: 1 week Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Sat Jul 14 09:29:45 2018 (r336274) +++ head/sys/netpfil/pf/pf.c Sat Jul 14 10:14:59 2018 (r336275) @@ -3558,9 +3558,11 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm action = pf_create_state(r, nr, a, pd, nsn, nk, sk, m, off, sport, dport, &rewrite, kif, sm, tag, bproto_sum, bip_sum, hdrlen); - if (action != PF_PASS && r->rule_flag & PFRULE_RETURN) { - pf_return(r, nr, pd, sk, off, m, th, kif, - bproto_sum, bip_sum, hdrlen, &reason); + if (action != PF_PASS) { + if (action == PF_DROP && + (r->rule_flag & PFRULE_RETURN)) + pf_return(r, nr, pd, sk, off, m, th, kif, + bproto_sum, bip_sum, hdrlen, &reason); return (action); } } else { From owner-svn-src-head@freebsd.org Sat Jul 14 15:45:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 104EF102FAB5; Sat, 14 Jul 2018 15:45:12 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A85827DEC7; Sat, 14 Jul 2018 15:45:11 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83EA320FC1; Sat, 14 Jul 2018 15:45:11 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EFjBmp000955; Sat, 14 Jul 2018 15:45:11 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EFjBT0000954; Sat, 14 Jul 2018 15:45:11 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201807141545.w6EFjBT0000954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 14 Jul 2018 15:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336280 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 336280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 15:45:12 -0000 Author: cem Date: Sat Jul 14 15:45:11 2018 New Revision: 336280 URL: https://svnweb.freebsd.org/changeset/base/336280 Log: ffs_syncvnode: Remove unhelpful print It can occur during ordinary use of softupdates, or perhaps if writes to the underlying media fail (causing bufs to be redirtied). Either way, it is not particularly actionable. Reviewed by: imp, kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16258 Modified: head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Jul 14 15:32:36 2018 (r336279) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Jul 14 15:45:11 2018 (r336280) @@ -377,10 +377,6 @@ next: wait = !wait; if (wait || ++passes < UFS_NIADDR + 2) goto loop; -#ifdef INVARIANTS - if (!vn_isdisk(vp, NULL)) - vn_printf(vp, "ffs_fsync: dirty "); -#endif } } BO_UNLOCK(bo); From owner-svn-src-head@freebsd.org Sat Jul 14 16:06:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5696D1031246; Sat, 14 Jul 2018 16:06:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 058C27F2A0; Sat, 14 Jul 2018 16:06:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D20FE212E3; Sat, 14 Jul 2018 16:06:53 +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 w6EG6ruX011261; Sat, 14 Jul 2018 16:06:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EG6rCC011260; Sat, 14 Jul 2018 16:06:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201807141606.w6EG6rCC011260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 14 Jul 2018 16:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336281 - head/sys/dev/vnic X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/vnic X-SVN-Commit-Revision: 336281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:06:54 -0000 Author: markj Date: Sat Jul 14 16:06:53 2018 New Revision: 336281 URL: https://svnweb.freebsd.org/changeset/base/336281 Log: Fix vnic fallback PHY name matching after r334880. In some cases it seems that the PHY mode can only be identified by matching against the corresponding device node name in the FDT. r334880 broke this for the case where the node name contains a unit address. Fix the problem by allowing a match in that case. Reviewed by: andrew, sbruno Tested by: sbruno Differential Revision: https://reviews.freebsd.org/D16259 Modified: head/sys/dev/vnic/thunder_bgx_fdt.c Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Sat Jul 14 15:45:11 2018 (r336280) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Sat Jul 14 16:06:53 2018 (r336281) @@ -193,7 +193,8 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name if (sz > size) return (FALSE); - if (strncmp(phy_name, type, sz) == 0) + if (strncmp(phy_name, type, sz - 1) == 0 && + (phy_name[sz - 1] == '\0' || phy_name[sz - 1] == '@')) return (TRUE); return (FALSE); From owner-svn-src-head@freebsd.org Sat Jul 14 16:19:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CFCC1031921; Sat, 14 Jul 2018 16:19:47 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3777B7F7DF; Sat, 14 Jul 2018 16:19:47 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15012214A1; Sat, 14 Jul 2018 16:19:47 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EGJk8G016470; Sat, 14 Jul 2018 16:19:46 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EGJk2Y016469; Sat, 14 Jul 2018 16:19:46 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201807141619.w6EGJk2Y016469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sat, 14 Jul 2018 16:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336282 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 336282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:19:47 -0000 Author: sbruno Date: Sat Jul 14 16:19:46 2018 New Revision: 336282 URL: https://svnweb.freebsd.org/changeset/base/336282 Log: Fixup memory management for fetching options in ip_ctloutput() Submitted by: Jason Eggleston Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14621 Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sat Jul 14 16:06:53 2018 (r336281) +++ head/sys/netinet/ip_output.c Sat Jul 14 16:19:46 2018 (r336282) @@ -1256,12 +1256,18 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) switch (sopt->sopt_name) { case IP_OPTIONS: case IP_RETOPTS: - if (inp->inp_options) + if (inp->inp_options) { + unsigned long len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); + struct mbuf *options = malloc(len, M_TEMP, M_WAITOK); + INP_RLOCK(inp); + bcopy(inp->inp_options, options, len); + INP_RUNLOCK(inp); error = sooptcopyout(sopt, - mtod(inp->inp_options, + mtod(options, char *), - inp->inp_options->m_len); - else + len); + free(options, M_TEMP); + } else sopt->sopt_valsize = 0; break; From owner-svn-src-head@freebsd.org Sat Jul 14 16:33:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF655103218B; Sat, 14 Jul 2018 16:33:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 845AA80089; Sat, 14 Jul 2018 16:33:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FF7121819; Sat, 14 Jul 2018 16:33:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EGXCvC026220; Sat, 14 Jul 2018 16:33:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EGXCt7026219; Sat, 14 Jul 2018 16:33:12 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807141633.w6EGXCt7026219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 14 Jul 2018 16:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336283 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 336283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:33:13 -0000 Author: ian Date: Sat Jul 14 16:33:11 2018 New Revision: 336283 URL: https://svnweb.freebsd.org/changeset/base/336283 Log: Eliminate an unused var warning-error; the var is used only when parsing linux-style boot args, so wrap it in the appropriate ifdef. Modified: head/sys/arm/arm/machdep_boot.c Modified: head/sys/arm/arm/machdep_boot.c ============================================================================== --- head/sys/arm/arm/machdep_boot.c Sat Jul 14 16:19:46 2018 (r336282) +++ head/sys/arm/arm/machdep_boot.c Sat Jul 14 16:33:11 2018 (r336283) @@ -68,7 +68,9 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +#ifdef LINUX_BOOT_ABI static char static_kenv[4096]; +#endif extern int *end; From owner-svn-src-head@freebsd.org Sat Jul 14 16:37:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B8F1032336; Sat, 14 Jul 2018 16:37:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3262E80264; Sat, 14 Jul 2018 16:37:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (unknown [73.93.142.101]) by mail.baldwin.cx (Postfix) with ESMTPSA id 3BC1A10AFCD; Sat, 14 Jul 2018 12:37:02 -0400 (EDT) Subject: Re: svn commit: r336282 - head/sys/netinet To: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807141619.w6EGJk2Y016469@repo.freebsd.org> From: John Baldwin Message-ID: <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> Date: Sat, 14 Jul 2018 09:37:09 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <201807141619.w6EGJk2Y016469@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Sat, 14 Jul 2018 12:37:02 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:37:10 -0000 On 7/14/18 9:19 AM, Sean Bruno wrote: > Author: sbruno > Date: Sat Jul 14 16:19:46 2018 > New Revision: 336282 > URL: https://svnweb.freebsd.org/changeset/base/336282 > > Log: > Fixup memory management for fetching options in ip_ctloutput() > > Submitted by: Jason Eggleston > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D14621 > > Modified: > head/sys/netinet/ip_output.c > > Modified: head/sys/netinet/ip_output.c > ============================================================================== > --- head/sys/netinet/ip_output.c Sat Jul 14 16:06:53 2018 (r336281) > +++ head/sys/netinet/ip_output.c Sat Jul 14 16:19:46 2018 (r336282) > @@ -1256,12 +1256,18 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) > switch (sopt->sopt_name) { > case IP_OPTIONS: > case IP_RETOPTS: > - if (inp->inp_options) > + if (inp->inp_options) { > + unsigned long len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); > + struct mbuf *options = malloc(len, M_TEMP, M_WAITOK); > + INP_RLOCK(inp); > + bcopy(inp->inp_options, options, len); > + INP_RUNLOCK(inp); > error = sooptcopyout(sopt, > - mtod(inp->inp_options, > + mtod(options, > char *), > - inp->inp_options->m_len); > - else > + len); > + free(options, M_TEMP); > + } else > sopt->sopt_valsize = 0; > break; You can't malloc an mbuf, and you don't really want an mbuf here anyway. Also, style(9) doesn't normally assign values when a variable is created. I would perhaps have done something like this: if (inp->inp_options) { void *options; u_long len; INP_RLOCK(inp); len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); INP_RUNLOCK(inp); options = malloc(len, M_TEMP, M_WAITOK); INP_RLOCK(inp); len = ulmin(inp->inp_options->m_len, len); m_copydata(inp->inp_options, 0, len, options); INP_RUNLOCK(inp); error = sooptcopyout(sopt, options, len); free(options, M_TEMP); } The current code isn't doing what you think it is doing since the bcopy() copies the m_data pointer from 'inp_options' into 'options' so that 'options->m_data' points at the m_data buffer in the 'inp_options' mbuf. Thus, the mtod() returns a pointer into 'inp_options' just like the old code, so this commit doesn't change anything in terms of the previous race (it is still just as broken). Also, while INP_RLOCK isn't helpful in my version above for reading the 'm_len' member (it's racy to read and then malloc no matter what), you still need the lock to ensure the inp_options pointer itself is valid when you dereference it. Without the lock another thread might have freed inp_options out from under you and the unlocked dereference could panic (though it probably just reads garbage on most of our architectures rather than panicking since we don't tend to invalidate KVA if you lose that race). -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jul 14 16:57:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAD521032D89; Sat, 14 Jul 2018 16:57:34 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AA7180AAF; Sat, 14 Jul 2018 16:57:34 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-234-146.albq.qwest.net [67.0.234.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id CE6421AF636; Sat, 14 Jul 2018 09:12:03 +0000 (UTC) Subject: Re: svn commit: r336282 - head/sys/netinet To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807141619.w6EGJk2Y016469@repo.freebsd.org> <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: Date: Sat, 14 Jul 2018 10:57:32 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3Gncr6iJ5BhrSfBA5oFx32w6nrm7oAy7g" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:57:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3Gncr6iJ5BhrSfBA5oFx32w6nrm7oAy7g Content-Type: multipart/mixed; boundary="mQotTGm8t5PiUhpisxN0wwEcLVIFPAJdw"; protected-headers="v1" From: Sean Bruno To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r336282 - head/sys/netinet References: <201807141619.w6EGJk2Y016469@repo.freebsd.org> <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> In-Reply-To: <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> --mQotTGm8t5PiUhpisxN0wwEcLVIFPAJdw Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 07/14/18 10:37, John Baldwin wrote: > On 7/14/18 9:19 AM, Sean Bruno wrote: >> Author: sbruno >> Date: Sat Jul 14 16:19:46 2018 >> New Revision: 336282 >> URL: https://svnweb.freebsd.org/changeset/base/336282 >> >> Log: >> Fixup memory management for fetching options in ip_ctloutput() >> =20 >> Submitted by: Jason Eggleston >> Sponsored by: Limelight Networks >> Differential Revision: https://reviews.freebsd.org/D14621 >> >> Modified: >> head/sys/netinet/ip_output.c >> >> Modified: head/sys/netinet/ip_output.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/netinet/ip_output.c Sat Jul 14 16:06:53 2018 (r336281) >> +++ head/sys/netinet/ip_output.c Sat Jul 14 16:19:46 2018 (r336282) >> @@ -1256,12 +1256,18 @@ ip_ctloutput(struct socket *so, struct sockopt= *sopt) >> switch (sopt->sopt_name) { >> case IP_OPTIONS: >> case IP_RETOPTS: >> - if (inp->inp_options) >> + if (inp->inp_options) { >> + unsigned long len =3D ulmin(inp->inp_options->m_len, sopt->sopt_v= alsize); >> + struct mbuf *options =3D malloc(len, M_TEMP, M_WAITOK); >> + INP_RLOCK(inp); >> + bcopy(inp->inp_options, options, len); >> + INP_RUNLOCK(inp); >> error =3D sooptcopyout(sopt, >> - mtod(inp->inp_options, >> + mtod(options, >> char *), >> - inp->inp_options->m_len); >> - else >> + len); >> + free(options, M_TEMP); >> + } else >> sopt->sopt_valsize =3D 0; >> break; >=20 > You can't malloc an mbuf, and you don't really want an mbuf here anyway= =2E > Also, style(9) doesn't normally assign values when a variable is create= d. > I would perhaps have done something like this: >=20 > if (inp->inp_options) { > void *options; > u_long len; >=20 > INP_RLOCK(inp); > len =3D ulmin(inp->inp_options->m_len, sopt->sopt_valsize); > INP_RUNLOCK(inp); > options =3D malloc(len, M_TEMP, M_WAITOK); > INP_RLOCK(inp); > len =3D ulmin(inp->inp_options->m_len, len); > m_copydata(inp->inp_options, 0, len, options); > INP_RUNLOCK(inp); > error =3D sooptcopyout(sopt, options, len); > free(options, M_TEMP); > } >=20 > The current code isn't doing what you think it is doing since the bcopy= () > copies the m_data pointer from 'inp_options' into 'options' so that > 'options->m_data' points at the m_data buffer in the 'inp_options' mbuf= =2E > Thus, the mtod() returns a pointer into 'inp_options' just like the old= > code, so this commit doesn't change anything in terms of the previous > race (it is still just as broken). >=20 > Also, while INP_RLOCK isn't helpful in my version above for reading the= > 'm_len' member (it's racy to read and then malloc no matter what), you > still need the lock to ensure the inp_options pointer itself is valid > when you dereference it. Without the lock another thread might have > freed inp_options out from under you and the unlocked dereference could= > panic (though it probably just reads garbage on most of our architectur= es > rather than panicking since we don't tend to invalidate KVA if you lose= > that race). >=20 Shall I revert and rethink? sean --mQotTGm8t5PiUhpisxN0wwEcLVIFPAJdw-- --3Gncr6iJ5BhrSfBA5oFx32w6nrm7oAy7g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAltKK3xfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LYJgQgAn+hdOLTO4jdx7idzur4MvqgLBRd5kM0OkQUX571d0eIWkOLohsAu8E8e XwKegzBFGZvITzQV0ZWXLjzWB2RvGwcgtNdQWD2NBeoRYENH4cFjHf1T0cuTqO5t h9JbRNjQFJiNTG8eQh+au/BtInNZ8lLtBWQlIbVkrHQmwo7Yxn52qkHDeZ4mMVOx 72+uD6uxuI5G2pSEeQwrev/wxx+B7Y72J/HC97eAZYwH86t16DFbyH8OTlCAwXKh t4y4AKQZUoeWWrbeGErdyb3OsHP76ivJPWtLsZqWPaWBREk5uNh/8PjC0C2mgoAM eKOGzb2v5XSCtq5IZNXUAiLKfJ03kA== =+yx6 -----END PGP SIGNATURE----- --3Gncr6iJ5BhrSfBA5oFx32w6nrm7oAy7g-- From owner-svn-src-head@freebsd.org Sat Jul 14 16:59:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C8F21032EF8; Sat, 14 Jul 2018 16:59:18 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2F9080C4D; Sat, 14 Jul 2018 16:59:17 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE8DD21B6F; Sat, 14 Jul 2018 16:59:17 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EGxHwR036559; Sat, 14 Jul 2018 16:59:17 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EGxHtD036558; Sat, 14 Jul 2018 16:59:17 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201807141659.w6EGxHtD036558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Sat, 14 Jul 2018 16:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336284 - in head/sys: modules/mac_veriexec_rmd160 security/mac_veriexec X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: in head/sys: modules/mac_veriexec_rmd160 security/mac_veriexec X-SVN-Commit-Revision: 336284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 16:59:18 -0000 Author: stevek Date: Sat Jul 14 16:59:17 2018 New Revision: 336284 URL: https://svnweb.freebsd.org/changeset/base/336284 Log: Remove RIPEMD-160 fingerprint modules for veriexec, since it has very little practical use and would not be recommended for anyone to use in a production environment. Reviewed by: sjg Deleted: head/sys/modules/mac_veriexec_rmd160/ head/sys/security/mac_veriexec/mac_veriexec_rmd160.c From owner-svn-src-head@freebsd.org Sat Jul 14 17:12:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3837610337F1; Sat, 14 Jul 2018 17:12:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1FC381271; Sat, 14 Jul 2018 17:12:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C434521E6A; Sat, 14 Jul 2018 17:12:04 +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 w6EHC4K7046312; Sat, 14 Jul 2018 17:12:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EHC4aX046311; Sat, 14 Jul 2018 17:12:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807141712.w6EHC4aX046311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 14 Jul 2018 17:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336285 - head/cddl/lib/libdtrace X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/cddl/lib/libdtrace X-SVN-Commit-Revision: 336285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:12:05 -0000 Author: tuexen Date: Sat Jul 14 17:12:04 2018 New Revision: 336285 URL: https://svnweb.freebsd.org/changeset/base/336285 Log: Add support for TCP state names used by Solaris. For compatibility, add the TCP state names used by Solaris and given in the Dtrace Guide available at https://docs.oracle.com/cd/E37838_01/html/E61035/glhgu.html#OSDTGglhmv Reviewed by: markj@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16269 Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Sat Jul 14 16:59:17 2018 (r336284) +++ head/cddl/lib/libdtrace/tcp.d Sat Jul 14 17:12:04 2018 (r336285) @@ -55,6 +55,32 @@ inline int TCPS_FIN_WAIT_2 = 9; #pragma D binding "1.6.3" TCPS_TIME_WAIT inline int TCPS_TIME_WAIT = 10; +/* + * For compatibility also provide the names used by Solaris. + */ +#pragma D binding "1.13" TCP_STATE_CLOSED +inline int TCP_STATE_CLOSED = TCPS_CLOSED; +#pragma D binding "1.13" TCP_STATE_LISTEN +inline int TCP_STATE_LISTEN = TCPS_LISTEN; +#pragma D binding "1.13" TCP_STATE_SYN_SENT +inline int TCP_STATE_SYN_SENT = TCPS_SYN_SENT; +#pragma D binding "1.13" TCP_STATE_SYN_RECEIVED +inline int TCP_STATE_SYN_RECEIVED = TCPS_SYN_RECEIVED; +#pragma D binding "1.13" TCP_STATE_ESTABLISHED +inline int TCP_STATE_ESTABLISHED = TCPS_ESTABLISHED; +#pragma D binding "1.13" TCP_STATE_CLOSE_WAIT +inline int TCP_STATE_CLOSE_WAIT = TCPS_CLOSE_WAIT; +#pragma D binding "1.13" TCP_STATE_FIN_WAIT_1 +inline int TCP_STATE_FIN_WAIT_1 = TCPS_FIN_WAIT_1; +#pragma D binding "1.13" TCP_STATE_CLOSING +inline int TCP_STATE_CLOSING = TCPS_CLOSING; +#pragma D binding "1.13" TCP_STATE_LAST_ACK +inline int TCP_STATE_LAST_ACK = TCPS_LAST_ACK; +#pragma D binding "1.13" TCP_STATE_FIN_WAIT_2 +inline int TCP_STATE_FIN_WAIT_2 = TCPS_FIN_WAIT_2; +#pragma D binding "1.13" TCP_STATE_TIME_WAIT +inline int TCP_STATE_TIME_WAIT = TCPS_TIME_WAIT; + /* TCP segment flags. */ #pragma D binding "1.6.3" TH_FIN inline uint8_t TH_FIN = 0x01; From owner-svn-src-head@freebsd.org Sat Jul 14 17:15:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C8AE1033957; Sat, 14 Jul 2018 17:15:29 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D041581579; Sat, 14 Jul 2018 17:15:28 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0DD521E9F; Sat, 14 Jul 2018 17:15:28 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EHFSTU046527; Sat, 14 Jul 2018 17:15:28 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EHFSFA046525; Sat, 14 Jul 2018 17:15:28 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201807141715.w6EHFSFA046525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Sat, 14 Jul 2018 17:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336286 - head/sys/security/mac_veriexec X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: head/sys/security/mac_veriexec X-SVN-Commit-Revision: 336286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:15:29 -0000 Author: stevek Date: Sat Jul 14 17:15:28 2018 New Revision: 336286 URL: https://svnweb.freebsd.org/changeset/base/336286 Log: Fix a typo which could cause a build breakage when building with MAC/veriexec enabled in the kernel config. Remove unused mac_veriexec_print_db prototype in internal header file. Modified: head/sys/security/mac_veriexec/mac_veriexec.c head/sys/security/mac_veriexec/mac_veriexec_internal.h Modified: head/sys/security/mac_veriexec/mac_veriexec.c ============================================================================== --- head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:12:04 2018 (r336285) +++ head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:15:28 2018 (r336286) @@ -113,7 +113,7 @@ sysctl_mac_veriexec_db(SYSCTL_HANDLER_ARGS) return (error); sbuf_new_for_sysctl(&sb, NULL, 1024, req); - mac_veriexec_print_db(&sb); + mac_veriexec_metadata_print_db(&sb); error = sbuf_finish(&sb); sbuf_delete(&sb); Modified: head/sys/security/mac_veriexec/mac_veriexec_internal.h ============================================================================== --- head/sys/security/mac_veriexec/mac_veriexec_internal.h Sat Jul 14 17:12:04 2018 (r336285) +++ head/sys/security/mac_veriexec/mac_veriexec_internal.h Sat Jul 14 17:15:28 2018 (r336286) @@ -95,7 +95,6 @@ fingerprint_status_t mac_veriexec_get_fingerprint_status(struct vnode *vp); int mac_veriexec_get_state(void); int mac_veriexec_in_state(int state); -void mac_veriexec_print_db(struct sbuf *); void mac_veriexec_set_fingerprint_status(struct vnode *vp, fingerprint_status_t fp_status); void mac_veriexec_set_state(int state); From owner-svn-src-head@freebsd.org Sat Jul 14 17:18:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E7C11033A6C; Sat, 14 Jul 2018 17:18:19 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A87BF816F2; Sat, 14 Jul 2018 17:18:18 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B72721EA0; Sat, 14 Jul 2018 17:18:18 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EHIIBi046702; Sat, 14 Jul 2018 17:18:18 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EHIIF8046701; Sat, 14 Jul 2018 17:18:18 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201807141718.w6EHIIF8046701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Sat, 14 Jul 2018 17:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336287 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 336287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:18:19 -0000 Author: stevek Date: Sat Jul 14 17:18:17 2018 New Revision: 336287 URL: https://svnweb.freebsd.org/changeset/base/336287 Log: Add config(8) options that can be used to enable building MAC/veriexec and its fingerprint modules into a kernel. Reviewed by: sjg Modified: head/sys/conf/options Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Jul 14 17:15:28 2018 (r336286) +++ head/sys/conf/options Sat Jul 14 17:18:17 2018 (r336287) @@ -164,6 +164,11 @@ MAC_SEEOTHERUIDS opt_dontuse.h MAC_STATIC opt_mac.h MAC_STUB opt_dontuse.h MAC_TEST opt_dontuse.h +MAC_VERIEXEC opt_dontuse.h +MAC_VERIEXEC_SHA1 opt_dontuse.h +MAC_VERIEXEC_SHA256 opt_dontuse.h +MAC_VERIEXEC_SHA384 opt_dontuse.h +MAC_VERIEXEC_SHA512 opt_dontuse.h MD_ROOT opt_md.h MD_ROOT_FSTYPE opt_md.h MD_ROOT_READONLY opt_md.h From owner-svn-src-head@freebsd.org Sat Jul 14 17:20:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9121A1033BA1; Sat, 14 Jul 2018 17:20:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40A0F8187A; Sat, 14 Jul 2018 17:20:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02DE021EA4; Sat, 14 Jul 2018 17:20:28 +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 w6EHKRZh046865; Sat, 14 Jul 2018 17:20:27 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EHKRvt046862; Sat, 14 Jul 2018 17:20:27 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807141720.w6EHKRvt046862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 14 Jul 2018 17:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336288 - in head/sys: i386/i386 i386/include vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: i386/i386 i386/include vm X-SVN-Commit-Revision: 336288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:20:28 -0000 Author: alc Date: Sat Jul 14 17:20:27 2018 New Revision: 336288 URL: https://svnweb.freebsd.org/changeset/base/336288 Log: Add support for pmap_enter(..., psind=1) to the i386 pmap. In other words, add support for explicitly requesting that pmap_enter() create a 2 or 4 MB page mapping. (Essentially, this feature allows the machine-independent layer to create superpage mappings preemptively, and not wait for automatic promotion to occur.) Export pmap_ps_enabled() to the machine-independent layer. Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or reclaim a PV entry when one is not available. Refactor pmap_enter_pde() into two functions, one by the same name, that is a general-purpose function for creating PDE PG_PS mappings, and another, pmap_enter_4mpage(), that is used to prefault 2 or 4 MB read- and/or execute-only mappings for execve(2), mmap(2), and shmat(2). Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D16246 Modified: head/sys/i386/i386/pmap.c head/sys/i386/include/pmap.h head/sys/vm/vm_fault.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Jul 14 17:18:17 2018 (r336287) +++ head/sys/i386/i386/pmap.c Sat Jul 14 17:20:27 2018 (r336288) @@ -285,11 +285,18 @@ static struct mtx PMAP2mutex; int pti; +/* + * Internal flags for pmap_enter()'s helper functions. + */ +#define PMAP_ENTER_NORECLAIM 0x1000000 /* Don't reclaim PV entries. */ +#define PMAP_ENTER_NOREPLACE 0x2000000 /* Don't replace mappings. */ + static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); -static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); +static bool pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde, + u_int flags); #if VM_NRESERVLEVEL > 0 static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); #endif @@ -299,8 +306,10 @@ static pv_entry_t pmap_pvh_remove(struct md_page *pvh, static int pmap_pvh_wired_mappings(struct md_page *pvh, int count); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); -static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot); +static bool pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot); +static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, + u_int flags, vm_page_t m); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static void pmap_flush_page(vm_page_t m); @@ -326,6 +335,8 @@ static int pmap_remove_pte(pmap_t pmap, pt_entry_t *pt static vm_page_t pmap_remove_pt_page(pmap_t pmap, vm_offset_t va); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va, struct spglist *free); +static bool pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + struct spglist *free); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); @@ -1068,6 +1079,13 @@ pmap_cache_bits(int mode, boolean_t is_pde) return (cache_bits); } +bool +pmap_ps_enabled(pmap_t pmap) +{ + + return (pg_ps_enabled); +} + /* * The caller is responsible for maintaining TLB consistency. */ @@ -2702,21 +2720,22 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, /* * Create the pv entries for each of the pages within a superpage. */ -static boolean_t -pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa) +static bool +pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde, u_int flags) { struct md_page *pvh; pv_entry_t pv; + bool noreclaim; rw_assert(&pvh_global_lock, RA_WLOCKED); - if (pv_entry_count < pv_entry_high_water && - (pv = get_pv_entry(pmap, TRUE)) != NULL) { - pv->pv_va = va; - pvh = pa_to_pvh(pa); - TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); - return (TRUE); - } else - return (FALSE); + noreclaim = (flags & PMAP_ENTER_NORECLAIM) != 0; + if ((noreclaim && pv_entry_count >= pv_entry_high_water) || + (pv = get_pv_entry(pmap, noreclaim)) == NULL) + return (false); + pv->pv_va = va; + pvh = pa_to_pvh(pde & PG_PS_FRAME); + TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); + return (true); } /* @@ -3026,6 +3045,38 @@ pmap_remove_page(pmap_t pmap, vm_offset_t va, struct s } /* + * Removes the specified range of addresses from the page table page. + */ +static bool +pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + struct spglist *free) +{ + pt_entry_t *pte; + bool anyvalid; + + rw_assert(&pvh_global_lock, RA_WLOCKED); + KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + anyvalid = false; + for (pte = pmap_pte_quick(pmap, sva); sva != eva; pte++, + sva += PAGE_SIZE) { + if (*pte == 0) + continue; + + /* + * The TLB entry for a PG_G mapping is invalidated by + * pmap_remove_pte(). + */ + if ((*pte & PG_G) == 0) + anyvalid = true; + + if (pmap_remove_pte(pmap, pte, sva, free)) + break; + } + return (anyvalid); +} + +/* * Remove the given range of addresses from the specified map. * * It is assumed that the start and end are properly @@ -3036,7 +3087,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t { vm_offset_t pdnxt; pd_entry_t ptpaddr; - pt_entry_t *pte; struct spglist free; int anyvalid; @@ -3119,20 +3169,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t if (pdnxt > eva) pdnxt = eva; - for (pte = pmap_pte_quick(pmap, sva); sva != pdnxt; pte++, - sva += PAGE_SIZE) { - if (*pte == 0) - continue; - - /* - * The TLB entry for a PG_G mapping is invalidated - * by pmap_remove_pte(). - */ - if ((*pte & PG_G) == 0) - anyvalid = 1; - if (pmap_remove_pte(pmap, pte, sva, &free)) - break; - } + if (pmap_remove_ptes(pmap, sva, pdnxt, &free)) + anyvalid = 1; } out: sched_unpin(); @@ -3614,6 +3652,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); sched_pin(); + if (psind == 1) { + /* Assert the required virtual and physical alignment. */ + KASSERT((va & PDRMASK) == 0, ("pmap_enter: va unaligned")); + KASSERT(m->psind > 0, ("pmap_enter: m->psind < psind")); + rv = pmap_enter_pde(pmap, va, newpte | PG_PS, flags, m); + goto out; + } pde = pmap_pde(pmap, va); if (pmap != kernel_pmap) { @@ -3812,48 +3857,111 @@ out: } /* - * Tries to create a 2- or 4MB page mapping. Returns TRUE if successful and - * FALSE otherwise. Fails if (1) a page table page cannot be allocated without - * blocking, (2) a mapping already exists at the specified virtual address, or - * (3) a pv entry cannot be allocated without reclaiming another pv entry. + * Tries to create a read- and/or execute-only 2 or 4 MB page mapping. Returns + * true if successful. Returns false if (1) a mapping already exists at the + * specified virtual address or (2) a PV entry cannot be allocated without + * reclaiming another PV entry. */ -static boolean_t -pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) +static bool +pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { - pd_entry_t *pde, newpde; + pd_entry_t newpde; - rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - pde = pmap_pde(pmap, va); - if (*pde != 0) { - CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" - " in pmap %p", va, pmap); - return (FALSE); - } newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) | PG_PS | PG_V; - if ((m->oflags & VPO_UNMANAGED) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) newpde |= PG_MANAGED; +#if defined(PAE) || defined(PAE_TABLES) + if ((prot & VM_PROT_EXECUTE) == 0) + newpde |= pg_nx; +#endif + if (pmap != kernel_pmap) + newpde |= PG_U; + return (pmap_enter_pde(pmap, va, newpde, PMAP_ENTER_NOSLEEP | + PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL) == + KERN_SUCCESS); +} +/* + * Tries to create the specified 2 or 4 MB page mapping. Returns KERN_SUCCESS + * if the mapping was created, and either KERN_FAILURE or + * KERN_RESOURCE_SHORTAGE otherwise. Returns KERN_FAILURE if + * PMAP_ENTER_NOREPLACE was specified and a mapping already exists at the + * specified virtual address. Returns KERN_RESOURCE_SHORTAGE if + * PMAP_ENTER_NORECLAIM was specified and a PV entry allocation failed. + * + * The parameter "m" is only used when creating a managed, writeable mapping. + */ +static int +pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, + vm_page_t m) +{ + struct spglist free; + pd_entry_t oldpde, *pde; + vm_page_t mt; + + rw_assert(&pvh_global_lock, RA_WLOCKED); + KASSERT((newpde & (PG_M | PG_RW)) != PG_RW, + ("pmap_enter_pde: newpde is missing PG_M")); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pde = pmap_pde(pmap, va); + oldpde = *pde; + if ((oldpde & PG_V) != 0) { + if ((flags & PMAP_ENTER_NOREPLACE) != 0) { + CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" + " in pmap %p", va, pmap); + return (KERN_FAILURE); + } + /* Break the existing mapping(s). */ + SLIST_INIT(&free); + if ((oldpde & PG_PS) != 0) { + /* + * If the PDE resulted from a promotion, then a + * reserved PT page could be freed. + */ + (void)pmap_remove_pde(pmap, pde, va, &free); + if ((oldpde & PG_G) == 0) + pmap_invalidate_pde_page(pmap, va, oldpde); + } else { + if (pmap_remove_ptes(pmap, va, va + NBPDR, &free)) + pmap_invalidate_all(pmap); + } + vm_page_free_pages_toq(&free, true); + if (pmap == kernel_pmap) { + mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); + if (pmap_insert_pt_page(pmap, mt)) { + /* + * XXX Currently, this can't happen because + * we do not perform pmap_enter(psind == 1) + * on the kernel pmap. + */ + panic("pmap_enter_pde: trie insert failed"); + } + } else + KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", + pde)); + } + if ((newpde & PG_MANAGED) != 0) { /* * Abort this mapping if its PV entry could not be created. */ - if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m))) { + if (!pmap_pv_insert_pde(pmap, va, newpde, flags)) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); - return (FALSE); + return (KERN_RESOURCE_SHORTAGE); } + if ((newpde & PG_RW) != 0) { + for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) + vm_page_aflag_set(mt, PGA_WRITEABLE); + } } -#if defined(PAE) || defined(PAE_TABLES) - if ((prot & VM_PROT_EXECUTE) == 0) - newpde |= pg_nx; -#endif - if (va < VM_MAXUSER_ADDRESS) - newpde |= PG_U; /* * Increment counters. */ + if ((newpde & PG_W) != 0) + pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE; /* @@ -3865,7 +3973,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t pmap_pde_mappings++; CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" " in pmap %p", va, pmap); - return (TRUE); + return (KERN_SUCCESS); } /* @@ -3899,7 +4007,7 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_o va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && m->psind == 1 && pg_ps_enabled && - pmap_enter_pde(pmap, va, m, prot)) + pmap_enter_4mpage(pmap, va, m, prot)) m = &m[NBPDR / PAGE_SIZE - 1]; else mpte = pmap_enter_quick_locked(pmap, va, m, prot, @@ -4273,8 +4381,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_ continue; if (dst_pmap->pm_pdir[ptepindex] == 0 && ((srcptepaddr & PG_MANAGED) == 0 || - pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & - PG_PS_FRAME))) { + pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, + PMAP_ENTER_NORECLAIM))) { dst_pmap->pm_pdir[ptepindex] = srcptepaddr & ~PG_W; dst_pmap->pm_stats.resident_count += Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Sat Jul 14 17:18:17 2018 (r336287) +++ head/sys/i386/include/pmap.h Sat Jul 14 17:20:27 2018 (r336288) @@ -387,6 +387,7 @@ void *pmap_mapdev(vm_paddr_t, vm_size_t); void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); +bool pmap_ps_enabled(pmap_t pmap); void pmap_unmapdev(vm_offset_t, vm_size_t); pt_entry_t *pmap_pte(pmap_t, vm_offset_t) __pure2; void pmap_invalidate_page(pmap_t, vm_offset_t); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Jul 14 17:18:17 2018 (r336287) +++ head/sys/vm/vm_fault.c Sat Jul 14 17:20:27 2018 (r336288) @@ -270,7 +270,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t int fault_type, int fault_flags, boolean_t wired, vm_page_t *m_hold) { vm_page_t m, m_map; -#if defined(__amd64__) && VM_NRESERVLEVEL > 0 +#if (defined(__amd64__) || defined(__i386__)) && VM_NRESERVLEVEL > 0 vm_page_t m_super; int flags; #endif @@ -284,7 +284,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t return (KERN_FAILURE); m_map = m; psind = 0; -#if defined(__amd64__) && VM_NRESERVLEVEL > 0 +#if (defined(__amd64__) || defined(__i386__)) && VM_NRESERVLEVEL > 0 if ((m->flags & PG_FICTITIOUS) == 0 && (m_super = vm_reserv_to_superpage(m)) != NULL && rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start && @@ -460,7 +460,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro pidx <= pager_last; pidx += npages, m = vm_page_next(&m[npages - 1])) { vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset; -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) psind = m->psind; if (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last || From owner-svn-src-head@freebsd.org Sat Jul 14 17:21:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E69E61033D89; Sat, 14 Jul 2018 17:21:17 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97EC881A65; Sat, 14 Jul 2018 17:21:17 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F64221EDF; Sat, 14 Jul 2018 17:21:17 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EHLH1Q047726; Sat, 14 Jul 2018 17:21:17 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EHLHIU047725; Sat, 14 Jul 2018 17:21:17 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201807141721.w6EHLHIU047725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Sat, 14 Jul 2018 17:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336289 - head/sys/security/mac_veriexec X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: head/sys/security/mac_veriexec X-SVN-Commit-Revision: 336289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:21:18 -0000 Author: stevek Date: Sat Jul 14 17:21:16 2018 New Revision: 336289 URL: https://svnweb.freebsd.org/changeset/base/336289 Log: Add mpo_vnode_check_setmode MAC method to MAC/veriexec. In the method, disallow changing SUID/SGID on verified files. Obtained from: Juniper Networks, Inc. Modified: head/sys/security/mac_veriexec/mac_veriexec.c Modified: head/sys/security/mac_veriexec/mac_veriexec.c ============================================================================== --- head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:20:27 2018 (r336288) +++ head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:21:16 2018 (r336289) @@ -550,6 +550,38 @@ mac_veriexec_vnode_check_open(struct ucred *cred, stru } /** + * @brief Check mode changes on file to ensure they should be allowed. + * + * We cannot allow chmod of SUID or SGID on verified files. + * + * @param cred credentials to use + * @param vp vnode of the file to open + * @param label vnode label assigned to the vnode + * @param mode mode flags to set + * + * @return 0 if the mode change should be allowed, EAUTH otherwise. + */ +static int +mac_veriexec_vnode_check_setmode(struct ucred *cred, struct vnode *vp, + struct label *label __unused, mode_t mode) +{ + int error; + + if ((mac_veriexec_state & VERIEXEC_STATE_ENFORCE) == 0) + return (0); + + /* + * Do not allow chmod (set-[gu]id) of verified file + */ + error = mac_veriexec_check_vp(cred, vp, VVERIFY); + if (error == EAUTH) /* it isn't verified */ + return (0); + if (error == 0 && (mode & (S_ISUID|S_ISGID)) != 0) + return (EAUTH); + return (0); +} + +/** * @internal * @brief Initialize the mac_veriexec MAC policy * @@ -673,6 +705,7 @@ static struct mac_policy_ops mac_veriexec_ops = .mpo_proc_check_debug = mac_veriexec_proc_check_debug, .mpo_vnode_check_exec = mac_veriexec_vnode_check_exec, .mpo_vnode_check_open = mac_veriexec_vnode_check_open, + .mpo_vnode_check_setmode = mac_veriexec_vnode_check_setmode, .mpo_vnode_copy_label = mac_veriexec_copy_label, .mpo_vnode_destroy_label = mac_veriexec_vnode_destroy_label, .mpo_vnode_init_label = mac_veriexec_vnode_init_label, From owner-svn-src-head@freebsd.org Sat Jul 14 17:25:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEDBC1033FC4 for ; Sat, 14 Jul 2018 17:25:46 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 5371881E27 for ; Sat, 14 Jul 2018 17:25:46 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-ed1-x531.google.com with SMTP id w14-v6so26907600eds.6 for ; Sat, 14 Jul 2018 10:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VHL6otcmwI/geiTOLaxUyUcuBrB6c9ebXHMrp/a6kiw=; b=QHCL72AnL2QDOP+zh/pIJjhGgEsKP6trAkdbnl/N8FvCPNVetyt1rjkKXTr6hw/m0C 7l7pgVn1I4JJvqOVXBg7PO2crJiWY7LSV/PLHohLxiUXvIcNRoXwRWr9wgg5DYnsPiSg e1i6QYVCOSOdxhfmSe8z9CR/mNnbWtU0wRibI3cJGF045MhvleXOn+rWhYD/2XyUohvg 0IDtqPZNPSbFQD7WQjx4HBFllfmKPWHu9Vm3QHkqX8TPc759LJES10yDW9JZabI+dzi9 zIgUIZUC/hTo+89RNczMUk6vugl03r+GywTmZOE/MewJPHedq1jNjr4Yb3AIkupNKSG7 f5UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VHL6otcmwI/geiTOLaxUyUcuBrB6c9ebXHMrp/a6kiw=; b=W38YyzzvkSCzXBegsix6Y+YLDtGmv/5sRd7A8dg3Slh5vpvFnuezmfMLi56jcqCRil c8SUbeLiqLWLCyaMEY0wXEKpIRZp17bsyoLb0687r7bE/F6dUQeK2wpdgBpGMS829S8T chS6bMNxB74PpMcZ7qwXeFVGJ9Z9ynvDzOk6+lQEIXIuhUwEvSC5tQ7ka+Nul6DzAEJY aeYxd3SrWshXVz/fTLcW6utaWOS9kWoQfzdnqWF5H2cGb6uAzT/w6YlFxf1vsfy7I0Ob hrnjTJg16BzMVTx7H7lQMKa8LEWAJKUNrEsW7TGDi7ej9CLOg28jSuJZVmX49ywhG/d9 KeGw== X-Gm-Message-State: AOUpUlEBQuPTbH23HODWodNEFXkKC0++oDX9VmBsOSsDtecvqpz3QsJ7 S57+whT38SZBJy2adL3lCkMs9Q== X-Google-Smtp-Source: AAOMgpfe50nzAq1MnNXmaJkyXsDHk8afAKXJGbJ6y73Y95PjJVo5S7hzYrDHbS67eYXUC5/DxBmYXQ== X-Received: by 2002:a50:8fe6:: with SMTP id y93-v6mr11552490edy.290.1531589144485; Sat, 14 Jul 2018 10:25:44 -0700 (PDT) Received: from mutt-hbsd ([141.255.162.35]) by smtp.gmail.com with ESMTPSA id y32-v6sm13395250eda.38.2018.07.14.10.25.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jul 2018 10:25:43 -0700 (PDT) Date: Sat, 14 Jul 2018 13:25:04 -0400 From: Shawn Webb To: "Stephen J. Kiernan" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336289 - head/sys/security/mac_veriexec Message-ID: <20180714172504.p4zntlfveopmui2o@mutt-hbsd> References: <201807141721.w6EHLHIU047725@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="alujffhh45ntpwos" Content-Disposition: inline In-Reply-To: <201807141721.w6EHLHIU047725@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-CURRENT FreeBSD 12.0-CURRENT X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20180622 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:25:47 -0000 --alujffhh45ntpwos Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Stephen, On Sat, Jul 14, 2018 at 05:21:17PM +0000, Stephen J. Kiernan wrote: > Author: stevek > Date: Sat Jul 14 17:21:16 2018 > New Revision: 336289 > URL: https://svnweb.freebsd.org/changeset/base/336289 >=20 > Log: > Add mpo_vnode_check_setmode MAC method to MAC/veriexec. > In the method, disallow changing SUID/SGID on verified files. > =20 > Obtained from: Juniper Networks, Inc. >=20 > Modified: > head/sys/security/mac_veriexec/mac_veriexec.c >=20 > Modified: head/sys/security/mac_veriexec/mac_veriexec.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:20:27 201= 8 (r336288) > +++ head/sys/security/mac_veriexec/mac_veriexec.c Sat Jul 14 17:21:16 201= 8 (r336289) > @@ -550,6 +550,38 @@ mac_veriexec_vnode_check_open(struct ucred *cred, st= ru > } > =20 > /** > + * @brief Check mode changes on file to ensure they should be allowed. > + * > + * We cannot allow chmod of SUID or SGID on verified files. > + * > + * @param cred credentials to use > + * @param vp vnode of the file to open > + * @param label vnode label assigned to the vnode > + * @param mode mode flags to set > + * > + * @return 0 if the mode change should be allowed, EAUTH otherwise. > + */ > +static int > +mac_veriexec_vnode_check_setmode(struct ucred *cred, struct vnode *vp, > + struct label *label __unused, mode_t mode) > +{ > + int error; > + > + if ((mac_veriexec_state & VERIEXEC_STATE_ENFORCE) =3D=3D 0) > + return (0); > + > + /* > + * Do not allow chmod (set-[gu]id) of verified file > + */ > + error =3D mac_veriexec_check_vp(cred, vp, VVERIFY); > + if (error =3D=3D EAUTH) /* it isn't verified */ Is EAUTH the right error to return? errno(2) shows that EAUTH signifies: "Authentication error. Attempted to use an invalid authentication ticket to mount a NFS file system." Perhaps EPERM would be better suited? > + return (0); > + if (error =3D=3D 0 && (mode & (S_ISUID|S_ISGID)) !=3D 0) > + return (EAUTH); > + return (0); > +} > + > +/** > * @internal > * @brief Initialize the mac_veriexec MAC policy > * > @@ -673,6 +705,7 @@ static struct mac_policy_ops mac_veriexec_ops =3D > .mpo_proc_check_debug =3D mac_veriexec_proc_check_debug, > .mpo_vnode_check_exec =3D mac_veriexec_vnode_check_exec, > .mpo_vnode_check_open =3D mac_veriexec_vnode_check_open, > + .mpo_vnode_check_setmode =3D mac_veriexec_vnode_check_setmode, > .mpo_vnode_copy_label =3D mac_veriexec_copy_label, > .mpo_vnode_destroy_label =3D mac_veriexec_vnode_destroy_label, > .mpo_vnode_init_label =3D mac_veriexec_vnode_init_label, Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --alujffhh45ntpwos Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAltKMesACgkQaoRlj1JF bu7NBQ/+JwUPh3ESPWahhkW3TCE1KWHAfNKWTad53w6LYf9025nlgwMx4Yy6coNn S5U0GsaLI7KT31b+o3WjCV838OiIkK1iLbtN+1usX16/muwbzRYDKIlSjysOZ++W MiZVDC5rFaCqnl/po3jD5Ndp3k4RtCTYlAiDH7oFruRTpBEI1hcVHvyZuiBljLP0 hDXuUumfRBEs7fxX2/hXuAusozkKj1k/OG+tDH/ULf5BO7AkeXl2fweT8HTRwI6r NUiOGGWF2Z0GXdOCzj9Of6/SjVx2Z6uSsKjBodU0a0IX9V4FXSJ1Xn7NGgnskvWb 6Lr1DD130rYIrELbPWiWfituxlmtTjMOGUEIa/oEx2Zwdar28r7LyBfwp3YaSA1D E5/02b015Em8GqJMXPr2gNWwRuHlgNh7OfNAq5w0+d+omT7PfudUN1yL27WXBYTk rWxcIujUKnELsyx7EvJipq2T/09ifMSGosl4O7UnphfuO1h6jRv6azOT48FSwRbB /ZmS9a4cJPUGCkLupai6VbzobBaacGaUKt+RumLjMdo5UMco3qI4nHAp+6uR3mV7 59fldHe8TkPmUXuytYJNplJ32QTYvDOYZxGoxob9tCAe/XH3q0LHbkZbmJPlVxJu xoUB+S1ofH0Wtp3O0SWBaGyQeusvL31PpkiCB0h5b/TNT5mTKw0= =BfuE -----END PGP SIGNATURE----- --alujffhh45ntpwos-- From owner-svn-src-head@freebsd.org Sat Jul 14 17:25:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29A111033FFB; Sat, 14 Jul 2018 17:25:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 712EA81F13; Sat, 14 Jul 2018 17:25:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (unknown [73.93.142.209]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8D5F610A87D; Sat, 14 Jul 2018 13:25:53 -0400 (EDT) Subject: Re: svn commit: r336282 - head/sys/netinet To: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201807141619.w6EGJk2Y016469@repo.freebsd.org> <7bbbb553-fca5-9801-49aa-caf6df929c2f@FreeBSD.org> From: John Baldwin Message-ID: <8f1bc11e-5653-b737-42d0-140aa9b8ad84@FreeBSD.org> Date: Sat, 14 Jul 2018 10:26:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Sat, 14 Jul 2018 13:25:54 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:25:56 -0000 On 7/14/18 9:57 AM, Sean Bruno wrote: > > > On 07/14/18 10:37, John Baldwin wrote: >> On 7/14/18 9:19 AM, Sean Bruno wrote: >>> Author: sbruno >>> Date: Sat Jul 14 16:19:46 2018 >>> New Revision: 336282 >>> URL: https://svnweb.freebsd.org/changeset/base/336282 >>> >>> Log: >>> Fixup memory management for fetching options in ip_ctloutput() >>> >>> Submitted by: Jason Eggleston >>> Sponsored by: Limelight Networks >>> Differential Revision: https://reviews.freebsd.org/D14621 >>> >>> Modified: >>> head/sys/netinet/ip_output.c >>> >>> Modified: head/sys/netinet/ip_output.c >>> ============================================================================== >>> --- head/sys/netinet/ip_output.c Sat Jul 14 16:06:53 2018 (r336281) >>> +++ head/sys/netinet/ip_output.c Sat Jul 14 16:19:46 2018 (r336282) >>> @@ -1256,12 +1256,18 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) >>> switch (sopt->sopt_name) { >>> case IP_OPTIONS: >>> case IP_RETOPTS: >>> - if (inp->inp_options) >>> + if (inp->inp_options) { >>> + unsigned long len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); >>> + struct mbuf *options = malloc(len, M_TEMP, M_WAITOK); >>> + INP_RLOCK(inp); >>> + bcopy(inp->inp_options, options, len); >>> + INP_RUNLOCK(inp); >>> error = sooptcopyout(sopt, >>> - mtod(inp->inp_options, >>> + mtod(options, >>> char *), >>> - inp->inp_options->m_len); >>> - else >>> + len); >>> + free(options, M_TEMP); >>> + } else >>> sopt->sopt_valsize = 0; >>> break; >> >> You can't malloc an mbuf, and you don't really want an mbuf here anyway. >> Also, style(9) doesn't normally assign values when a variable is created. >> I would perhaps have done something like this: >> >> if (inp->inp_options) { >> void *options; >> u_long len; >> >> INP_RLOCK(inp); >> len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); >> INP_RUNLOCK(inp); >> options = malloc(len, M_TEMP, M_WAITOK); >> INP_RLOCK(inp); >> len = ulmin(inp->inp_options->m_len, len); >> m_copydata(inp->inp_options, 0, len, options); >> INP_RUNLOCK(inp); >> error = sooptcopyout(sopt, options, len); >> free(options, M_TEMP); >> } >> >> The current code isn't doing what you think it is doing since the bcopy() >> copies the m_data pointer from 'inp_options' into 'options' so that >> 'options->m_data' points at the m_data buffer in the 'inp_options' mbuf. >> Thus, the mtod() returns a pointer into 'inp_options' just like the old >> code, so this commit doesn't change anything in terms of the previous >> race (it is still just as broken). >> >> Also, while INP_RLOCK isn't helpful in my version above for reading the >> 'm_len' member (it's racy to read and then malloc no matter what), you >> still need the lock to ensure the inp_options pointer itself is valid >> when you dereference it. Without the lock another thread might have >> freed inp_options out from under you and the unlocked dereference could >> panic (though it probably just reads garbage on most of our architectures >> rather than panicking since we don't tend to invalidate KVA if you lose >> that race). >> > > > Shall I revert and rethink? Well, we can fix it, but even my fix above is wrong. You can't do the ulmin without breaking getsockopt(). The output length is an in-out parameter to getsockopt() so that you can determine the size of variable-sized variables (such as this one) with this type of pattern: socklen_t len; void *buf; len = 0; getsockopt(s, IPPROTO_IP, IP_OPTIONS, NULL, &len); buf = malloc(len); getsockopt(s, IPPROTO_IP, IP_OPTIONS, buf, &len); (In theory you'd really need to use a loop with realloc until you obtain a consistent snapshot.) However, for this to work, the kernel code that calls sooptcopyout has to always pass the full size. sooptcopyout ensures it doesn't overflow the user's supplied buffer, but depends on the length it is passed to determine the output value of 'len'. The ulmin breaks this since it will return a len of 0 for the first call always. I think the right way to fix this is to use m_dup() with M_NOWAIT while holding the INP lock and fail with ENOMEM if m_dup() fails: INP_RLOCK(inp); if (inp->inp_options) { struct mbuf *options; options = m_dup(inp->inp_options, M_NOWAIT); INP_RUNLOCK(inp); if (options != NULL) { error = sooptcopyout(sopt, mtod(options, char *), options->m_len); m_free(options); } else error = ENOEM; } else { INP_RUNLOCK(inp); sopt->optvalsize = 0; } (Someone else may prefer m_freem() to m_free() in case inp_options can be an arbitrary chain.) I chose to always acquire INP_RLOCK because I would have had to test it again under the lock anyway before calling m_dup() to determine ENOMEM vs no valid options, and getsockopt(IP_OPTIONS) isn't a critical path such that it warrants doing an unlocked check before doing a check under the lock. I would also probably have expanded a bit on the commit message. "Fixup memory management" is a bit vague as opposed to something like "Fix a potential use after free in access to inp_options." I would maybe ask jtl@ to review the above and/or offer an alternative. -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jul 14 17:47:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A24331034C7A; Sat, 14 Jul 2018 17:47:40 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 377CB82B67; Sat, 14 Jul 2018 17:47:40 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id l16-v6so15645522ita.0; Sat, 14 Jul 2018 10:47:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=Tv5hA1KgjYL6UzUnMkGMnUd3Z98MbxCL5xJhLeP4akg=; b=tmfpqdKO4U9lUttL+1/YXSZvUSs1y9uZgsds5f6v9V6mkRvxb1dxAHH31Z7CK/8DS9 EbTIcQcjRnjkmQLPRn8atw6qflv6znYZniOv7+aNedpIXq+m1Bi/eZtukdo3BH/nb15B KpQ54DOhrc4/lf64ZnVRe5y50XaMX/erBGypJmICQJ3HhG2ahwbPn+NMyp6O1HIN2LNS 2cqPlb+642FPkpMzPEABBz3MZKi8zINO/J2Gm3LcCrb0U13sh7Z4F3/OSUKQaSQhrmwc ImP4tqaa6IJ1HoAtlM5r4oE4qKL6JBl9DOozAa6wO/Qcb9eUadxvkZVN2Nt0s4pBbPiA 6iLQ== X-Gm-Message-State: AOUpUlFbh6Mbz6uvmsi5HYUupzsIKtq3Tl8AKdZhxGES1h5rA1aNDRYN vQMR2rSIXga0LdlZsEda8yWQ+39a X-Google-Smtp-Source: AAOMgpfkvePIwRPwtW7/+p+Tz32Ka/50mkgarDaWf+h9gEimdEhqFqWjWl6yf40jeUBgJDYbyUYX+Q== X-Received: by 2002:a02:8c75:: with SMTP id j50-v6mr9347372jal.76.1531588931555; Sat, 14 Jul 2018 10:22:11 -0700 (PDT) Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id r23-v6sm14238294ior.17.2018.07.14.10.22.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jul 2018 10:22:11 -0700 (PDT) Received: by mail-it0-f48.google.com with SMTP id s7-v6so15453064itb.4; Sat, 14 Jul 2018 10:22:11 -0700 (PDT) X-Received: by 2002:a02:10c6:: with SMTP id 189-v6mr9394803jay.54.1531588931195; Sat, 14 Jul 2018 10:22:11 -0700 (PDT) MIME-Version: 1.0 References: <201807141659.w6EGxHtD036558@repo.freebsd.org> In-Reply-To: <201807141659.w6EGxHtD036558@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 14 Jul 2018 10:22:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r336284 - in head/sys: modules/mac_veriexec_rmd160 security/mac_veriexec To: "Stephen J. Kiernan" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 17:47:40 -0000 Thanks! On Sat, Jul 14, 2018 at 9:59 AM Stephen J. Kiernan wrote: > Author: stevek > Date: Sat Jul 14 16:59:17 2018 > New Revision: 336284 > URL: https://svnweb.freebsd.org/changeset/base/336284 > > Log: > Remove RIPEMD-160 fingerprint modules for veriexec, since it has very > little practical use and would not be recommended for anyone to use in > a production environment. > > Reviewed by: sjg > > Deleted: > head/sys/modules/mac_veriexec_rmd160/ > head/sys/security/mac_veriexec/mac_veriexec_rmd160.c > > From owner-svn-src-head@freebsd.org Sat Jul 14 19:35:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0F53103B3F3; Sat, 14 Jul 2018 19:35:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CBFB860AB; Sat, 14 Jul 2018 19:35:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F8A72354F; Sat, 14 Jul 2018 19:35:42 +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 w6EJZgtI018294; Sat, 14 Jul 2018 19:35:42 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EJZgc0018293; Sat, 14 Jul 2018 19:35:42 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807141935.w6EJZgc0018293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 14 Jul 2018 19:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336290 - head/sys/i386/include X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/include X-SVN-Commit-Revision: 336290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 19:35:43 -0000 Author: alc Date: Sat Jul 14 19:35:41 2018 New Revision: 336290 URL: https://svnweb.freebsd.org/changeset/base/336290 Log: Correct some typos. Reviewed by: kib Modified: head/sys/i386/include/vmparam.h Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Jul 14 17:21:16 2018 (r336289) +++ head/sys/i386/include/vmparam.h Sat Jul 14 19:35:41 2018 (r336290) @@ -175,12 +175,12 @@ * * 0x00000000 - 0x003fffff Transient identity map of low memory (0-4M), * normally disabled to catch NULL derefs. - * 0x00400000 - 0x007fffff Fixed mapping of the low memory (0-4M). + * 0x00400000 - 0x007fffff Fixed mapping of the low memory (4-8M). * 0x00800000 - 0xffbfffff KERNBASE (VA) == KERNLOAD (PA), kernel * text + data and all kernel maps. Managed * by MI VM. * 0xffc00000 - 0xffdfffff Recursive kernel page table mapping, pointed - * to by PTmap. PTD[] recusively points + * to by PTmap. PTD[] recursively points * into PTmap. * 0xffe00000 - 0xffffffff Kernel/User mode shared PDE, contains GDT, * IDT, TSS, LDT, trampoline code and stacks. From owner-svn-src-head@freebsd.org Sat Jul 14 19:49:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78FC6103B980; Sat, 14 Jul 2018 19:49:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 260C286630; Sat, 14 Jul 2018 19:49:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEEF523700; Sat, 14 Jul 2018 19:49:16 +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 w6EJnGRo023664; Sat, 14 Jul 2018 19:49:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EJnFUW023656; Sat, 14 Jul 2018 19:49:15 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807141949.w6EJnFUW023656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 14 Jul 2018 19:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336291 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Commit-Revision: 336291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 19:49:17 -0000 Author: tuexen Date: Sat Jul 14 19:49:14 2018 New Revision: 336291 URL: https://svnweb.freebsd.org/changeset/base/336291 Log: Fix shebangs and execute bit of test scripts. Since we don't have /usr/bin/ksh, use a generic way of specifying ksh. Some of the tests only run with ksh93, so use this shell for these tests. Two of the tests don't have the execute bit set, so fix this, too. Reviewed by: markj@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16270 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh (contents, props changed) head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh (contents, props changed) Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh93 # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh93 # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh93 # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh # # CDDL HEADER START # Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh Sat Jul 14 19:35:41 2018 (r336290) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh Sat Jul 14 19:49:14 2018 (r336291) @@ -1,4 +1,4 @@ -#!/usr/bin/ksh +#!/usr/bin/env ksh93 # # CDDL HEADER START # From owner-svn-src-head@freebsd.org Sat Jul 14 19:51:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1184103BBE4; Sat, 14 Jul 2018 19:51:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73BD78687A; Sat, 14 Jul 2018 19:51:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54ADE2384F; Sat, 14 Jul 2018 19:51:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EJpjlm026735; Sat, 14 Jul 2018 19:51:45 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EJpicC026731; Sat, 14 Jul 2018 19:51:44 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201807141951.w6EJpicC026731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 14 Jul 2018 19:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336292 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 336292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 19:51:46 -0000 Author: rmacklem Date: Sat Jul 14 19:51:44 2018 New Revision: 336292 URL: https://svnweb.freebsd.org/changeset/base/336292 Log: Fix the pNFS client when mirrors aren't on the same machine. Without this patch, the client side NFSv4.1 pNFS code erroneously did writes and commits to both DS mirrors using the TCP connection of the first one. For my test setup this worked, since I have both DSs running on the same machine, but it would have failed when the DSs are on separate machines. This patch fixes the code to use the correct TCP connection for each DS. This patch should only affect the NFSv4.1 client when using "pnfs" mounts to mirrored DSs. MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Sat Jul 14 19:49:14 2018 (r336291) +++ head/sys/fs/nfs/nfs_var.h Sat Jul 14 19:51:44 2018 (r336292) @@ -607,7 +607,7 @@ void nfscl_rellayout(struct nfscllayout *, int); struct nfscldevinfo *nfscl_getdevinfo(struct nfsclclient *, uint8_t *, struct nfscldevinfo *); void nfscl_reldevinfo(struct nfscldevinfo *); -int nfscl_adddevinfo(struct nfsmount *, struct nfscldevinfo *, +int nfscl_adddevinfo(struct nfsmount *, struct nfscldevinfo *, int, struct nfsclflayout *); void nfscl_freelayout(struct nfscllayout *); void nfscl_freeflayout(struct nfsclflayout *); Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Sat Jul 14 19:49:14 2018 (r336291) +++ head/sys/fs/nfs/nfsclstate.h Sat Jul 14 19:51:44 2018 (r336292) @@ -269,6 +269,7 @@ struct nfscllayout { */ struct nfsffm { nfsv4stateid_t st; + struct nfscldevinfo *devp; char dev[NFSX_V4DEVICEID]; uint32_t eff; uid_t user; @@ -290,7 +291,6 @@ struct nfsclflayout { uint64_t nfsfl_off; uint64_t nfsfl_end; uint32_t nfsfl_iomode; - struct nfscldevinfo *nfsfl_devp; uint16_t nfsfl_flags; union { struct { @@ -299,6 +299,7 @@ struct nfsclflayout { uint32_t stripe1; uint8_t dev[NFSX_V4DEVICEID]; uint16_t fhcnt; + struct nfscldevinfo *devp; } fl; struct { uint64_t stripeunit; @@ -317,6 +318,7 @@ struct nfsclflayout { #define nfsfl_stripe1 nfsfl_un.fl.stripe1 #define nfsfl_dev nfsfl_un.fl.dev #define nfsfl_fhcnt nfsfl_un.fl.fhcnt +#define nfsfl_devp nfsfl_un.fl.devp #define nfsfl_stripeunit nfsfl_un.ff.stripeunit #define nfsfl_fflags nfsfl_un.ff.fflags #define nfsfl_statshint nfsfl_un.ff.statshint Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 14 19:49:14 2018 (r336291) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jul 14 19:51:44 2018 (r336292) @@ -5722,12 +5722,15 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode } } for (i = firstmirror; i < mirrorcnt && error == 0; i++){ - if ((layp->nfsly_flags & NFSLY_FLEXFILE) != 0) + if ((layp->nfsly_flags & NFSLY_FLEXFILE) != 0) { dev = rflp->nfsfl_ffm[i].dev; - else + dip = nfscl_getdevinfo(nmp->nm_clp, dev, + rflp->nfsfl_ffm[i].devp); + } else { dev = rflp->nfsfl_dev; - dip = nfscl_getdevinfo(nmp->nm_clp, dev, - rflp->nfsfl_devp); + dip = nfscl_getdevinfo(nmp->nm_clp, dev, + rflp->nfsfl_devp); + } if (dip != NULL) { if ((rflp->nfsfl_flags & NFSFL_FLEXFILE) != 0) @@ -6828,7 +6831,8 @@ nfsrv_parselayoutget(struct nfsrv_descript *nd, nfsv4s sizeof(struct nfsffm), M_NFSFLAYOUT, M_WAITOK); flp->nfsfl_flags = NFSFL_FLEXFILE; flp->nfsfl_mirrorcnt = mirrorcnt; - flp->nfsfl_devp = NULL; + for (j = 0; j < mirrorcnt; j++) + flp->nfsfl_ffm[j].devp = NULL; flp->nfsfl_off = off; if (flp->nfsfl_off + retlen < flp->nfsfl_off) flp->nfsfl_end = UINT64_MAX - flp->nfsfl_off; @@ -7588,6 +7592,7 @@ nfsrpc_layoutgetres(struct nfsmount *nmp, vnode_t vp, struct nfsclflayout *tflp; struct nfscldevinfo *dip; uint8_t *dev; + int i, mirrorcnt; if (laystat == NFSERR_UNKNLAYOUTTYPE) { NFSLOCKMNT(nmp); @@ -7604,25 +7609,35 @@ nfsrpc_layoutgetres(struct nfsmount *nmp, vnode_t vp, if (laystat == 0) { NFSCL_DEBUG(4, "nfsrpc_layoutgetres at FOREACH\n"); LIST_FOREACH(tflp, flhp, nfsfl_list) { - laystat = nfscl_adddevinfo(nmp, NULL, tflp); - NFSCL_DEBUG(4, "aft adddev=%d\n", laystat); - if (laystat != 0) { - if (layouttype == NFSLAYOUT_FLEXFILE) - dev = tflp->nfsfl_ffm[0].dev; - else - dev = tflp->nfsfl_dev; - laystat = nfsrpc_getdeviceinfo(nmp, dev, - layouttype, notifybit, &dip, cred, p); - NFSCL_DEBUG(4, "aft nfsrpc_gdi=%d\n", - laystat); - if (laystat != 0) - break; - laystat = nfscl_adddevinfo(nmp, dip, tflp); - if (laystat != 0) - printf("getlayout: cannot add\n"); + if (layouttype == NFSLAYOUT_FLEXFILE) + mirrorcnt = tflp->nfsfl_mirrorcnt; + else + mirrorcnt = 1; + for (i = 0; i < mirrorcnt; i++) { + laystat = nfscl_adddevinfo(nmp, NULL, i, tflp); + NFSCL_DEBUG(4, "aft adddev=%d\n", laystat); + if (laystat != 0) { + if (layouttype == NFSLAYOUT_FLEXFILE) + dev = tflp->nfsfl_ffm[i].dev; + else + dev = tflp->nfsfl_dev; + laystat = nfsrpc_getdeviceinfo(nmp, dev, + layouttype, notifybit, &dip, cred, + p); + NFSCL_DEBUG(4, "aft nfsrpc_gdi=%d\n", + laystat); + if (laystat != 0) + goto out; + laystat = nfscl_adddevinfo(nmp, dip, i, + tflp); + if (laystat != 0) + printf("nfsrpc_layoutgetresout" + ": cannot add\n"); + } } } } +out: if (laystat == 0) { /* * nfscl_layout() always returns with the nfsly_lock Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Sat Jul 14 19:49:14 2018 (r336291) +++ head/sys/fs/nfsclient/nfs_clstate.c Sat Jul 14 19:51:44 2018 (r336292) @@ -5152,7 +5152,7 @@ nfscl_mergeflayouts(struct nfsclflayouthead *fhlp, * This function consumes the structure pointed at by dip, if not NULL. */ APPLESTATIC int -nfscl_adddevinfo(struct nfsmount *nmp, struct nfscldevinfo *dip, +nfscl_adddevinfo(struct nfsmount *nmp, struct nfscldevinfo *dip, int ind, struct nfsclflayout *flp) { struct nfsclclient *clp; @@ -5170,11 +5170,14 @@ nfscl_adddevinfo(struct nfsmount *nmp, struct nfscldev if ((flp->nfsfl_flags & NFSFL_FILE) != 0) dev = flp->nfsfl_dev; else - dev = flp->nfsfl_ffm[0].dev; + dev = flp->nfsfl_ffm[ind].dev; tdip = nfscl_finddevinfo(clp, dev); if (tdip != NULL) { tdip->nfsdi_layoutrefs++; - flp->nfsfl_devp = tdip; + if ((flp->nfsfl_flags & NFSFL_FILE) != 0) + flp->nfsfl_devp = tdip; + else + flp->nfsfl_ffm[ind].devp = tdip; nfscl_reldevinfo_locked(tdip); NFSUNLOCKCLSTATE(); if (dip != NULL) @@ -5184,7 +5187,10 @@ nfscl_adddevinfo(struct nfsmount *nmp, struct nfscldev if (dip != NULL) { LIST_INSERT_HEAD(&clp->nfsc_devinfo, dip, nfsdi_list); dip->nfsdi_layoutrefs = 1; - flp->nfsfl_devp = dip; + if ((flp->nfsfl_flags & NFSFL_FILE) != 0) + flp->nfsfl_devp = dip; + else + flp->nfsfl_ffm[ind].devp = dip; } NFSUNLOCKCLSTATE(); if (dip == NULL) @@ -5225,15 +5231,19 @@ nfscl_freeflayout(struct nfsclflayout *flp) { int i, j; - if ((flp->nfsfl_flags & NFSFL_FILE) != 0) + if ((flp->nfsfl_flags & NFSFL_FILE) != 0) { for (i = 0; i < flp->nfsfl_fhcnt; i++) free(flp->nfsfl_fh[i], M_NFSFH); + if (flp->nfsfl_devp != NULL) + flp->nfsfl_devp->nfsdi_layoutrefs--; + } if ((flp->nfsfl_flags & NFSFL_FLEXFILE) != 0) - for (i = 0; i < flp->nfsfl_mirrorcnt; i++) + for (i = 0; i < flp->nfsfl_mirrorcnt; i++) { for (j = 0; j < flp->nfsfl_ffm[i].fhcnt; j++) free(flp->nfsfl_ffm[i].fh[j], M_NFSFH); - if (flp->nfsfl_devp != NULL) - flp->nfsfl_devp->nfsdi_layoutrefs--; + if (flp->nfsfl_ffm[i].devp != NULL) + flp->nfsfl_ffm[i].devp->nfsdi_layoutrefs--; + } free(flp, M_NFSFLAYOUT); } From owner-svn-src-head@freebsd.org Sat Jul 14 19:53:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7242103BD17; Sat, 14 Jul 2018 19:53:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6854A86B90; Sat, 14 Jul 2018 19:53:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43DDC23891; Sat, 14 Jul 2018 19:53:42 +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 w6EJrgvL028600; Sat, 14 Jul 2018 19:53:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EJrgFE028599; Sat, 14 Jul 2018 19:53:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201807141953.w6EJrgFE028599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 14 Jul 2018 19:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336293 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip X-SVN-Commit-Revision: 336293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 19:53:43 -0000 Author: tuexen Date: Sat Jul 14 19:53:41 2018 New Revision: 336293 URL: https://svnweb.freebsd.org/changeset/base/336293 Log: Return the intended return code. This bug was spotted by markj@ in D16268 because I copied this code part and used it there. So fix it. Sponsored by: Netflix, Inc. Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Sat Jul 14 19:51:44 2018 (r336292) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh Sat Jul 14 19:53:41 2018 (r336293) @@ -126,4 +126,4 @@ status=$? cd / /bin/rm -rf $DIR -exit $? +exit $status From owner-svn-src-head@freebsd.org Sat Jul 14 20:14:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E813103C685; Sat, 14 Jul 2018 20:14:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4B60873CE; Sat, 14 Jul 2018 20:14:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5C8223BC4; Sat, 14 Jul 2018 20:14:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6EKE0wl038681; Sat, 14 Jul 2018 20:14:00 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6EKE0Ld038680; Sat, 14 Jul 2018 20:14:00 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201807142014.w6EKE0Ld038680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 14 Jul 2018 20:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336294 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 336294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 20:14:01 -0000 Author: alc Date: Sat Jul 14 20:14:00 2018 New Revision: 336294 URL: https://svnweb.freebsd.org/changeset/base/336294 Log: Invalidate the mapping before updating its physical address. Doing so ensures that all threads sharing the pmap have a consistent view of the mapping. This fixes the problem described in the commit log message for r329254 without the overhead of an extra page fault in the common case. (Now that all pmap_enter() implementations are similarly modified, the workaround added in r329254 can be removed, reducing the overhead of COW faults.) With this change we can reuse the PV entry from the old mapping, potentially avoiding a call to reclaim_pv_chunk(). Otherwise, there is nothing preventing the old PV entry from being reclaimed. In rare cases this could result in the PTE's page table page being freed, leading to a use-after-free of the page when the updated PTE is written following the allocation of the PV entry for the new mapping. Reviewed by: br, markj MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D16261 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Sat Jul 14 19:53:41 2018 (r336293) +++ head/sys/riscv/riscv/pmap.c Sat Jul 14 20:14:00 2018 (r336294) @@ -2040,6 +2040,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v new_l3 |= (pn << PTE_PPN0_S); if ((flags & PMAP_ENTER_WIRED) != 0) new_l3 |= PTE_SW_WIRED; + if ((m->oflags & VPO_UNMANAGED) == 0) + new_l3 |= PTE_SW_MANAGED; CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); @@ -2109,9 +2111,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pmap_invalidate_page(pmap, va); } - om = NULL; orig_l3 = pmap_load(l3); opa = PTE_TO_PHYS(orig_l3); + pv = NULL; /* * Is the specified virtual address already mapped? @@ -2148,7 +2150,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v * No, might be a protection or wiring change. */ if ((orig_l3 & PTE_SW_MANAGED) != 0) { - new_l3 |= PTE_SW_MANAGED; if (pmap_is_write(new_l3)) vm_page_aflag_set(m, PGA_WRITEABLE); } @@ -2158,6 +2159,42 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v /* Flush the cache, there might be uncommitted data in it */ if (pmap_is_current(pmap) && pmap_l3_valid_cacheable(orig_l3)) cpu_dcache_wb_range(va, L3_SIZE); + + /* + * The physical page has changed. Temporarily invalidate + * the mapping. This ensures that all threads sharing the + * pmap keep a consistent view of the mapping, which is + * necessary for the correct handling of COW faults. It + * also permits reuse of the old mapping's PV entry, + * avoiding an allocation. + * + * For consistency, handle unmanaged mappings the same way. + */ + orig_l3 = pmap_load_clear(l3); + KASSERT(PTE_TO_PHYS(orig_l3) == opa, + ("pmap_enter: unexpected pa update for %#lx", va)); + if ((orig_l3 & PTE_SW_MANAGED) != 0) { + om = PHYS_TO_VM_PAGE(opa); + + /* + * The pmap lock is sufficient to synchronize with + * concurrent calls to pmap_page_test_mappings() and + * pmap_ts_referenced(). + */ + if (pmap_page_dirty(orig_l3)) + vm_page_dirty(om); + if ((orig_l3 & PTE_A) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); + CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); + pv = pmap_pvh_remove(&om->md, pmap, va); + if ((new_l3 & PTE_SW_MANAGED) == 0) + free_pv_entry(pmap, pv); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_aflag_clear(om, PGA_WRITEABLE); + } + pmap_invalidate_page(pmap, va); + orig_l3 = 0; } else { /* * Increment the counters. @@ -2169,10 +2206,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v /* * Enter on the PV list if part of our managed memory. */ - if ((m->oflags & VPO_UNMANAGED) == 0) { - new_l3 |= PTE_SW_MANAGED; - pv = get_pv_entry(pmap, &lock); - pv->pv_va = va; + if ((new_l3 & PTE_SW_MANAGED) != 0) { + if (pv == NULL) { + pv = get_pv_entry(pmap, &lock); + pv->pv_va = va; + } CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; @@ -2187,22 +2225,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v validate: orig_l3 = pmap_load_store(l3, new_l3); PTE_SYNC(l3); - opa = PTE_TO_PHYS(orig_l3); - - if (opa != pa) { - if ((orig_l3 & PTE_SW_MANAGED) != 0) { - om = PHYS_TO_VM_PAGE(opa); - if (pmap_page_dirty(orig_l3)) - vm_page_dirty(om); - if ((orig_l3 & PTE_A) != 0) - vm_page_aflag_set(om, PGA_REFERENCED); - CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); - pmap_pvh_free(&om->md, pmap, va); - } - } else if (pmap_page_dirty(orig_l3)) { - if ((orig_l3 & PTE_SW_MANAGED) != 0) - vm_page_dirty(m); - } + KASSERT(PTE_TO_PHYS(orig_l3) == pa, + ("pmap_enter: invalid update")); + if (pmap_page_dirty(orig_l3) && + (orig_l3 & PTE_SW_MANAGED) != 0) + vm_page_dirty(m); } else { pmap_load_store(l3, new_l3); PTE_SYNC(l3); From owner-svn-src-head@freebsd.org Sat Jul 14 21:32:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BA09103F03C; Sat, 14 Jul 2018 21:32:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40C108A554; Sat, 14 Jul 2018 21:32:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21FA724894; Sat, 14 Jul 2018 21:32:33 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ELWXJK079230; Sat, 14 Jul 2018 21:32:33 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ELWWmX079227; Sat, 14 Jul 2018 21:32:32 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201807142132.w6ELWWmX079227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 14 Jul 2018 21:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336297 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 336297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 21:32:33 -0000 Author: kp Date: Sat Jul 14 21:32:32 2018 New Revision: 336297 URL: https://svnweb.freebsd.org/changeset/base/336297 Log: pf tests: Basic synproxy test A very basic syncproxy test: set up a connection via a synproxy rule. This triggeres the panic fixed in r336273. Added: head/tests/sys/netpfil/pf/echo_inetd.conf (contents, props changed) head/tests/sys/netpfil/pf/synproxy.sh (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile Modified: head/tests/sys/netpfil/pf/Makefile ============================================================================== --- head/tests/sys/netpfil/pf/Makefile Sat Jul 14 20:44:25 2018 (r336296) +++ head/tests/sys/netpfil/pf/Makefile Sat Jul 14 21:32:32 2018 (r336297) @@ -9,9 +9,11 @@ ATF_TESTS_SH+= pass_block \ forward \ fragmentation \ set_tos \ - route_to + route_to \ + synproxy ${PACKAGE}FILES+= utils.subr \ + echo_inetd.conf \ pft_ping.py ${PACKAGE}FILESMODE_pft_ping.py= 0555 Added: head/tests/sys/netpfil/pf/echo_inetd.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/echo_inetd.conf Sat Jul 14 21:32:32 2018 (r336297) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +echo stream tcp nowait root internal +echo stream tcp6 nowait root internal +echo dgram udp wait root internal +echo dgram udp6 wait root internal Added: head/tests/sys/netpfil/pf/synproxy.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/synproxy.sh Sat Jul 14 21:32:32 2018 (r336297) @@ -0,0 +1,59 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "synproxy" "cleanup" +synproxy_head() +{ + atf_set descr 'Basic synproxy test' + atf_set require.user root +} + +synproxy_body() +{ + pft_init + + epair=$(pft_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + route add -net 198.51.100.0/24 192.0.2.2 + + link=$(pft_mkepair) + + pft_mkjail alcatraz ${epair}b ${link}a + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${link}a 198.51.100.1/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + + pft_mkjail singsing ${link}b + jexec singsing ifconfig ${link}b 198.51.100.2/24 up + jexec singsing route add default 198.51.100.1 + + jexec singsing /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "set fail-policy return" \ + "scrub in all fragment reassemble" \ + "pass out quick on ${epair}b all no state allow-opts" \ + "pass in quick on ${epair}b proto tcp from any to any port 7 synproxy state" \ + "pass in quick on ${epair}b all no state" + + # Sanity check, can we ping singing + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + # Check that we can talk to the singsing jail, after synproxying + reply=$(echo ping | nc -N 198.51.100.2 7) + if [ "${reply}" != "ping" ]; + then + atf_fail "echo failed" + fi +} + +synproxy_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "synproxy" +} From owner-svn-src-head@freebsd.org Sat Jul 14 23:53:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46F6C10435FE; Sat, 14 Jul 2018 23:53:52 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E06C08E21E; Sat, 14 Jul 2018 23:53:51 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC05D25F1F; Sat, 14 Jul 2018 23:53:51 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6ENrp0H050131; Sat, 14 Jul 2018 23:53:51 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6ENrpIK050130; Sat, 14 Jul 2018 23:53:51 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201807142353.w6ENrpIK050130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Sat, 14 Jul 2018 23:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336298 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 336298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2018 23:53:52 -0000 Author: sbruno Date: Sat Jul 14 23:53:51 2018 New Revision: 336298 URL: https://svnweb.freebsd.org/changeset/base/336298 Log: There was quite a bit of feedback on r336282 that has led to the submitter to want to revert it. Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sat Jul 14 21:32:32 2018 (r336297) +++ head/sys/netinet/ip_output.c Sat Jul 14 23:53:51 2018 (r336298) @@ -1256,18 +1256,12 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) switch (sopt->sopt_name) { case IP_OPTIONS: case IP_RETOPTS: - if (inp->inp_options) { - unsigned long len = ulmin(inp->inp_options->m_len, sopt->sopt_valsize); - struct mbuf *options = malloc(len, M_TEMP, M_WAITOK); - INP_RLOCK(inp); - bcopy(inp->inp_options, options, len); - INP_RUNLOCK(inp); + if (inp->inp_options) error = sooptcopyout(sopt, - mtod(options, + mtod(inp->inp_options, char *), - len); - free(options, M_TEMP); - } else + inp->inp_options->m_len); + else sopt->sopt_valsize = 0; break;